Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add listening address configuration in XML fileConfig #45

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
80e759c
Markdown head format
tongdaotech Jul 26, 2022
a09e192
Markdown head format for GitHub
tongdaotech Jul 26, 2022
3e15257
Fix redundant one block capacity
ActiveVolcano Jul 29, 2022
617fd3a
Add Unit Serial Number page into INQUIRY command to avoid error log w…
ActiveVolcano Jul 29, 2022
ff76938
Support PB level storage by adding READ (16), READ (12), WRITE (16), …
ActiveVolcano Jul 29, 2022
7acaa6f
Ignore javadoc plugin errors
ActiveVolcano Jul 29, 2022
a637f23
How to build
ActiveVolcano Jul 29, 2022
087fe37
Merge pull request #1 from ActiveVolcano/large-size
ActiveVolcano Jul 30, 2022
e00c5de
Merge branch 'large-size' into 'master'
tongdaotech Jul 30, 2022
36be0c8
Fix RESIDUAL flag bit mask to prevent Microsoft Windows 10 bundled iS…
ActiveVolcano Aug 5, 2022
0c1f7b3
Fix not to remove shared target info
ActiveVolcano Aug 5, 2022
18de931
Linux CentOS 7 bundled iSCSI target support Block Limits and Logical …
ActiveVolcano Aug 5, 2022
4f1e6e3
Enrich trace messages
ActiveVolcano Aug 5, 2022
a4a6150
Determine whether supported by requested operation code
ActiveVolcano Aug 5, 2022
85a3158
Add SYNCHRONIZE CACHE (10), (16) SCSI commands
ActiveVolcano Aug 5, 2022
45ec5bf
Merge branch 'windows10' of https://github.com/ActiveVolcano/jSCSI in…
ActiveVolcano Aug 5, 2022
cc69317
Merge pull request #2 from ActiveVolcano/windows10
ActiveVolcano Aug 5, 2022
d5c3833
Merge branch 'windows10' into 'master'
tongdaotech Aug 5, 2022
1385426
Fix compilation warnings
ActiveVolcano Aug 5, 2022
23699fc
Add listening address configuration in XML file
ActiveVolcano Aug 5, 2022
df5bbec
Merge branch 'config' of https://github.com/ActiveVolcano/jSCSI into …
ActiveVolcano Aug 5, 2022
d7caacf
Adds VENDOR, PRODUCT settings in configuration XML, returned returned…
ActiveVolcano Aug 8, 2022
6cec3fc
Skip user input target address step if configuration file parameter p…
ActiveVolcano Aug 29, 2022
a9deb1f
How to run the target as standalone executable jar
ActiveVolcano Aug 29, 2022
47d076e
Add extended storage class configuration in XML file
ActiveVolcano Aug 30, 2022
f7e39a0
Enrich listening address configuration comments
ActiveVolcano Aug 30, 2022
48e5e3e
Fix Maven warnings
ActiveVolcano Aug 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#jSCSI - A Java iSCSI Framework
# jSCSI - A Java iSCSI Framework

jSCSI is a feature-complete iSCSI implementation in Java only.
Platform-independent and fast, jSCSI represents a premium example how low-level protocols can be pushed to higher levels.
jSCSI contains a server (target), a client (initiator) and common classes to work with the protocol.

[![Build Status](https://secure.travis-ci.org/sebastiangraf/jSCSI.png)](http://travis-ci.org/sebastiangraf/jSCSI)

##Using jSCSI
## Using jSCSI

* Get the latest jar over Github or Maven

Expand Down Expand Up @@ -34,29 +34,58 @@ The schema and an example config are accessible as download as well and included

For further documentation and as an example, please refer to the examples in the initiator- and target-module.

##Content
* Run the target as standalone executable jar

1. Put the target configuration XML file in a sub-folder named ```config```.
See also ```bundles/target/src/main/resources/jscsi-target.xml```
2. Put the log configuration XML file in the ```config``` sub-folder.
See also ```bundles/target/src/main/resources/logback.xml```
3. Put commons-{version}.jar, target-{version}.jar and their dependencies jar in a sub-folder named ```lib```.
4. Run
```bash
java \
--class-path "lib/*" \
-Dlogback.configurationFile=config/logback.xml \
org.jscsi.target.TargetServer \
config/jscsi-target.xml \
> log/console.log \
2>&1 \
&
```

## Content

* README: this readme file
* LICENSE: license file
* bundles: bundles containing the projects
* pom.xml: Simple pom (yes we use Maven)

##License
## Build
* jar only:
```bash
mvn -Dmaven.test.skip=true -Dmaven.source.skip=true -Dmaven.javadoc.skip=true clean package
```
* jar, javadoc and sources:
```bash
mvn -Dmaven.test.skip=true -Pdoclint-java8-disable clean package
```

## License

This work is released in the public domain under the BSD 3-clause license

##Further information
## Further information

The project is currently under refactoring, the documentation is accessible under http://jscsi.org (pointing to http://disy.github.com/jscsi/) and a mailinglist has been set up:
https://mailman.uni-konstanz.de/mailman/listinfo/jscsi

##Publications
## Publications

* A TechReport describes the second iteration of the framework: [PDF](http://nbn-resolving.de/urn:nbn:de:bsz:352-opus-84511)
* The framework was presented at the Jazoon '07 as work in progress: [PDF](http://nbn-resolving.de/urn:nbn:de:bsz:352-opus-84424)
* jSCSI acted as backend for a block visualization presented at the InfoVis 2006: [PDF](http://nbn-resolving.de/urn:nbn:de:bsz:352-opus-69096)

##Concluded Thesis
## Concluded Thesis

* Target 1.0 (english): TO FOLLOW
* Initiator 2.0 (german only): [PDF](http://nbn-resolving.de/urn:nbn:de:bsz:352-opus-130096)
Expand All @@ -65,7 +94,7 @@ https://mailman.uni-konstanz.de/mailman/listinfo/jscsi

Any questions, just contact sebastian.graf AT uni-konstanz.de

##Involved People
## Involved People

jSCSI is maintained by:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Copyright (c) 2012, University of Konstanz, Distributed Systems Group All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or other materials provided with the
* distribution. * Neither the name of the University of Konstanz nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
Expand All @@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.Iterator;

import com.google.common.io.BaseEncoding;
import org.jscsi.exception.InternetSCSIException;
import org.jscsi.parser.datasegment.AbstractDataSegment;
import org.jscsi.parser.datasegment.IDataSegmentIterator.IDataSegmentChunk;
Expand All @@ -39,7 +40,7 @@
* <h1>ProtocolDataUnit</h1>
* <p>
* This class encapsulates a Protocol Data Unit (PDU), which is defined in the iSCSI Standard (RFC 3720).
*
*
* @author Volker Wildi
*/
public final class ProtocolDataUnit {
Expand Down Expand Up @@ -95,7 +96,7 @@ public final class ProtocolDataUnit {

/**
* Default constructor, creates a new, empty ProtcolDataUnit object.
*
*
* @param initHeaderDigest The instance of the digest to use for the Basic Header Segment protection.
* @param initDataDigest The instance of the digest to use for the Data Segment protection.
*/
Expand All @@ -115,7 +116,7 @@ public ProtocolDataUnit (final IDigest initHeaderDigest, final IDigest initDataD

/**
* Serialize all informations of this PDU object to its byte representation.
*
*
* @return The byte representation of this PDU.
* @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
* @throws IOException if an I/O error occurs.
Expand All @@ -134,7 +135,7 @@ public final ByteBuffer serialize () throws InternetSCSIException , IOException
}

offset += serializeAdditionalHeaderSegments(pdu, offset);

// write header digest
// TODO: Move CRC calculation in BasicHeaderSegment.serialize?
if (basicHeaderSegment.getParser().canHaveDigests()) {
Expand All @@ -150,12 +151,12 @@ public final ByteBuffer serialize () throws InternetSCSIException , IOException
offset += serializeDigest(pdu, dataDigest);
}

return (ByteBuffer) pdu.rewind();
return pdu.rewind();
}

/**
* Deserializes (parses) a given byte representation of a PDU to an PDU object.
*
*
* @param pdu The byte representation of an PDU to parse.
* @return The number of bytes, which are serialized.
* @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
Expand All @@ -178,7 +179,7 @@ public final int deserialize (final ByteBuffer pdu) throws InternetSCSIException
/**
* Deserializes a given array starting from offset <code>0</code> and store the informations in the
* BasicHeaderSegment object..
*
*
* @param bhs The array to read from.
* @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
* @throws DigestException There is a mismatch of the digest.
Expand All @@ -202,7 +203,7 @@ private final int deserializeBasicHeaderSegment (final ByteBuffer bhs) throws In
/**
* Deserializes a array (starting from offset <code>0</code>) and store the informations to the
* <code>AdditionalHeaderSegment</code> object.
*
*
* @param pdu The array to read from.
* @return The length of the read bytes.
* @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
Expand All @@ -215,7 +216,7 @@ private final int deserializeAdditionalHeaderSegments (final ByteBuffer pdu) thr
/**
* Deserializes a array (starting from the given offset) and store the informations to the
* <code>AdditionalHeaderSegment</code> object.
*
*
* @param pdu The <code>ByteBuffer</code> to read from.
* @param offset The offset to start from.
* @return The length of the written bytes.
Expand All @@ -241,7 +242,7 @@ private final int deserializeAdditionalHeaderSegments (final ByteBuffer pdu, fin

/**
* Serialize all the contained additional header segments to the destination array starting from the given offset.
*
*
* @param dst The destination array to write in.
* @param offset The offset to start to write in <code>dst</code>.
* @return The written length.
Expand All @@ -259,7 +260,7 @@ private final int serializeAdditionalHeaderSegments (final ByteBuffer dst, final

/**
* Serializes the data segment (binary or key-value pairs) to a destination array, staring from offset to write.
*
*
* @param dst The array to write in.
* @param offset The start offset to start from in <code>dst</code>.
* @return The written length.
Expand All @@ -276,7 +277,7 @@ public final int serializeDataSegment (final ByteBuffer dst, final int offset) t

/**
* Deserializes a array (starting from the given offset) and store the informations to the Data Segment.
*
*
* @param pdu The array to read from.
* @param offset The offset to start from.
* @return The length of the written bytes.
Expand Down Expand Up @@ -312,7 +313,7 @@ private final int deserializeDataSegment (final ByteBuffer pdu, final int offset

/**
* Writes this <code>ProtocolDataUnit</code> object to the given <code>SocketChannel</code>.
*
*
* @param sChannel <code>SocketChannel</code> to write to.
* @return The number of bytes written, possibly zero.
* @throws InternetSCSIException if any violation of the iSCSI-Standard emerge.
Expand All @@ -337,7 +338,7 @@ public final int write (final SocketChannel sChannel) throws InternetSCSIExcepti

/**
* Reads from the given <code>SocketChannel</code> all the neccassary bytes to fill this PDU.
*
*
* @param sChannel <code>SocketChannel</code> to read from.
* @return The number of bytes, possibly zero,or <code>-1</code> if the channel has reached end-of-stream
* @throws IOException if an I/O error occurs.
Expand Down Expand Up @@ -420,7 +421,7 @@ public final void clear () {

/**
* Returns an iterator to all contained Additional Header Segment in this PDU.
*
*
* @return The iterator to the contained Additional Header Segment.
* @see AdditionalHeaderSegment
*/
Expand All @@ -431,7 +432,7 @@ public final Iterator<AdditionalHeaderSegment> getAdditionalHeaderSegments () {

/**
* Returns the Basic Header Segment contained in this PDU.
*
*
* @return The Basic Header Segment.
* @see BasicHeaderSegment
*/
Expand All @@ -442,7 +443,7 @@ public final BasicHeaderSegment getBasicHeaderSegment () {

/**
* Gets the data segment in this PDU.
*
*
* @return The data segment of this <code>ProtocolDataUnit</code> object.
*/
public final ByteBuffer getDataSegment () {
Expand All @@ -458,7 +459,7 @@ public final void setDataSegment (final ByteBuffer dataSegment) {

/**
* Sets a new data segment in this PDU.
*
*
* @param chunk The new data segment of this <code>ProtocolDataUnit</code> object.
*/
public final void setDataSegment (final IDataSegmentChunk chunk) {
Expand All @@ -472,7 +473,7 @@ public final void setDataSegment (final IDataSegmentChunk chunk) {

/**
* Returns the instance of the used digest algorithm for the header.
*
*
* @return The instance of the header digest.
*/
public final IDigest getHeaderDigest () {
Expand All @@ -482,7 +483,7 @@ public final IDigest getHeaderDigest () {

/**
* Sets the digest of the header to use for data integrity.
*
*
* @param newHeaderDigest An instance of the new header digest.
*/
public final void setHeaderDigest (final IDigest newHeaderDigest) {
Expand All @@ -492,7 +493,7 @@ public final void setHeaderDigest (final IDigest newHeaderDigest) {

/**
* Returns the instance of the used digest algorithm for the data segment.
*
*
* @return The instance of the data digest.
*/
public final IDigest getDataDigest () {
Expand All @@ -502,7 +503,7 @@ public final IDigest getDataDigest () {

/**
* Sets the digest of the data segment to use for data integrity.
*
*
* @param newDataDigest An instance of the new data segment digest.
*/
public final void setDataDigest (final IDigest newDataDigest) {
Expand All @@ -516,15 +517,34 @@ public final void setDataDigest (final IDigest newDataDigest) {
/** {@inheritDoc} */
@Override
public final String toString () {

final StringBuilder sb = new StringBuilder(Constants.LOG_INITIAL_SIZE);
BaseEncoding base16 = BaseEncoding.base16 ().withSeparator (" ", 2).lowerCase ();

sb.append(basicHeaderSegment.toString());
try {
sb.append (" First 16 bytes: 0x");
byte[] pdu = new byte [calcSize()];
basicHeaderSegment.serialize (ByteBuffer.wrap (pdu), 0);
sb.append (base16.encode (pdu, 0, 16)).append ("\n");

} catch (InternetSCSIException e) {
sb.append ("Exception in serialize: " + e.getMessage ());
}

sb.append(basicHeaderSegment.toString());
for (AdditionalHeaderSegment ahs : additionalHeaderSegments) {
sb.append(ahs.toString());
}

if (dataSegment.limit () > 0) {
sb.append (" DataSegment (first 16 bytes): 0x");
byte[] preview = new byte [Math.min (dataSegment.limit (), 16)];
// NOT to use mark and reset because
// "If the mark is defined and larger than the new position then it is discarded."
int pos = dataSegment.position ();
dataSegment.position (0).get (preview).position (pos);
sb.append (base16.encode (preview));
}

return sb.toString();
}

Expand Down Expand Up @@ -567,7 +587,7 @@ public int hashCode() {

/**
* Calculates the needed size (in bytes) of serializing this object.
*
*
* @return The needed size to store this object.
*/
private final int calcSize () {
Expand Down
Loading