At layer A are request, reply and data correlation, structure chaining, continuation or termination of chains when errors are detected, interleaving and multi-leaving request, reply, and data DSSs for multitasking environments. For TCP/IP, the format of the DDM envelope is 2 bytes Length of the data 1 byte 'D0' - indicates DDM data 1 byte DDM format byte(DSSFMT) - type of DSS(RQSDSS,RPYDSS), whether it is chained, information about the next chained DSS 2 bytes request correlation identifier
The correlation identifier ties together a request, the request data and the reply. In a chained DSS, each request has a correlation identifier which is higher than the previous request (all correlation identifiers must be greater than 0).
At layer B are object mapping, object validation and command routing. Layer B objects with data 5 bytes less than 32K bytes consist of 2 bytes Length 2 bytes Type of the object (code point) Object data Object data is either SCALAR or COLLECTION data. Scalar data consists of a string of bytes formatted as the class description of the object required. Collections consist of a set of objects in which the entries in the collection are nested within the length/ code point of the collection.
Layer B objects with data >=32763 bytes long format is 2 bytes Length - length of class, length, and extended total length fields (high order bit set, indicating >=32763) 2 bytes Type of the object (code point) n bytes Extended total length - length of the object (n = Length - 4) Object data
At layer C are services each class of DDM object provides. |-------------------------------------------| Layer C | Specific | Specific | Specific | | Commands | Replies | Scalars and | | and their | and their | Collections | |-------------------------------------------|----------------| Layer B | Commands | Reply | Scalars and | Communications | | | Messages | Collections | | |-----------|---------------|---------------|----------------| Layer A | RQSDSS | RPYDSS | OBJDSS | CMNDSS | | | | | Mapped Data | |-----------|---------------|---------------|----------------| | DDM Data Stream Structures | |------------------------------------------------------------| DSS's may be chained so that more than one can be transmitted at a time to improve performance. For more details, see DRDA Volume 3 (Distributed Data Management(DDM) Architecture (DDS definition)
| Modifier and Type | Field and Description |
|---|---|
| private static final boolean | |
| private DRDAConnThread | |
| private byte[] | |
| private CcsidManager | |
| private int | |
| private long[] | |
| private long | |
| private static final int | |
| private boolean | |
| private int | |
| private boolean | |
| private boolean | |
| private boolean | |
| private int | |
| private DssTrace | |
| private EbcdicCcsidManager | |
| private static final int | |
| private InputStream | |
| private static final long | |
| private static final int | |
| private static final boolean | |
| private static final int | |
| private int | |
| private int | |
| private int | |
| private static final int[][] | |
| private boolean | |
| private int | |
| pack-priv volatile long | |
| private Utf8CcsidManager |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | DDMReader(InputStream inputStream)
This constructor is used for testing the protocol It is used by ProtocolTestAdapter to read the protocol returned by the server |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| protected void | |
| private void | compressBLayerData(int
- amount of data we need continueDssHeaderCount)Compress B Layer data if extended total length is used by removing the continuation headers |
| private int[] | Returns: array of int magnitudesvalue segments input)Compute the int array of magnitude from input value segments. |
| protected String | |
| pack-priv boolean | |
| private void | ensureALayerDataInBuffer(int
- amount of data we need desiredDataSize)Make sure a certain amount of Layer A data is in the buffer. |
| private void | ensureBLayerDataInBuffer(int
- amount of data we need desiredDataSize, boolean - whether to adjust the remaining lengths adjustLen)Make sure a certain amount of Layer B data is in the buffer. |
| private void | ensureSpaceInBufferForFill(int
- amount of data we need desiredSpace)This method makes sure there is enough room in the buffer for a certain number of bytes. |
| private void | fill(int
- minimum required bytes minimumBytesNeeded)This method will attempt to read a minimum number of bytes from the underlying stream. |
| private void | |
| protected int | Returns: NO_CODEPOINT if collection stack is empty or remaining length is 0; otherwise, read length and code pointGet the next CodePoint from a collection |
| protected int | Returns: codePoint- codePoint to check against codePointCheck)Get the next CodePoint from a collection and check that it matches the specified CodePoint |
| protected byte | |
| protected long | |
| pack-priv byte[] | |
| pack-priv EXTDTAReaderInputStream | Returns: EXTDTAReaderInputStream object which can be passed to prepared statement as a binary stream.used to check if the stream is null. If it is
null, this method returns null checkNullability)Creates an InputStream which can stream EXTDTA objects. |
| protected void | initialize(DRDAConnThread agent, DssTrace dssTrace)
Initialize values for this session, the reader is reused so we need to set null and 0 values |
| protected boolean | Returns: true if next DSS has a different correlator than current DSSNext DSS has different correlator than current DSS |
| protected boolean | Returns: true if next DSS has the same correlator as current DSSNext DSS has same correlator as current DSS |
| protected boolean | |
| private boolean | |
| protected void | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| private int | Returns: an int valuebuffer to read from buffer, int offset in the buffer offset, int start nybble startNybble, int number of nybbles numberOfNybbles)Convert a range of packed nybbles (up to 9 digits without overflow) to an int. |
| private long | Returns: an long valuebuffer to read from buffer, int offset in the buffer offset, int start nybble startNybble, int number of nybbles numberOfNybbles)Convert a range of packed nybbles (up to 18 digits without overflow) to a long. |
| protected BigDecimal | Returns: valueof the BigDecimal precision, int of the BigDecimal scale)Read a BigDecimal value |
| protected byte | |
| protected byte[] | |
| protected byte[] | |
| protected String | |
| protected String | |
| protected int | |
| protected double | |
| private void | |
| protected int | readDssHeader()
Read DSS header DSS Header format is 2 bytes - length 1 byte - 'D0' - indicates DDM data 1 byte - DSS format |---|---------|----------| | 0 | flags | type | |---|---------|----------| | 0 | 1 2 3 | 4 5 6 7 | |---|---------|----------| bit 0 - '0' bit 1 - '0' - unchained, '1' - chained bit 2 - '0' - do not continue on error, '1' - continue on error bit 3 - '0' - next DSS has different correlator, '1' - next DSS has same correlator type - 1 - Request DSS - 2 - Reply DSS - 3 - Object DSS - 4 - Communications DSS - 5 - Request DSS where no reply is expected 2 bytes - request correlation id |
| protected String | Returns: decrypted stringdecryption manager decryptM, int security mechanism securityMechanism, byte[] initialization vector for cipher initVector, byte[] public key (as in Deffie-Hellman algorithm)
from source (encryptor) sourcePublicKey)Read encrypted string |
| protected float | |
| protected int | |
| protected String | Returns: valueRead length delimited string value in DDM data with default encoding |
| protected int | Returns: - returns codepointtrue only when layer B streaming is possible isLayerBStreamingPossible)Read the DDM Length and CodePoint |
| private ByteArrayInputStream | readLOBChunk(final boolean
set to true if the dss continuation should be read readHeader, final long the desired length of chunk. This parameter is ignored when layerB Streaming is doing. desiredLength)This method is used by EXTDTAReaderInputStream to read the next chunk of data. |
| pack-priv ByteArrayInputStream | readLOBContinuationStream()
This method is used by EXTDTAReaderInputStream to read the next chunk of data. |
| pack-priv ByteArrayInputStream | readLOBContinuationStream(final long
the desired length of chunk. This parameter is ignored when layerB Streaming is doing. desiredLength)This method is used by EXTDTAReaderInputStream to read the next chunk of data. |
| pack-priv ByteArrayInputStream | |
| pack-priv ByteArrayInputStream | readLOBInitStream(final long
the desired length of chunk. This parameter is ignored when layerB Streaming is doing. desiredLength)This method is used by EXTDTAReaderInputStream to read the first chunk of data. |
| protected long | |
| protected int | |
| protected long | |
| protected int | |
| protected long | |
| protected void | |
| protected short | |
| protected int | |
| protected String | Returns: value- length of string to read length)Read string value Strings in DRDA protocol are encoded in EBCDIC by default so we need to convert to UCS2 |
| protected void | readString(DRDAString
destination for the read string dst, int size (in bytes) of string to read size, boolean if true, remove padding (trailing spaces) unpad)Read string value into a |
| protected String | Returns: value- length of string to read length, String encoding)Read encoded string value |
| protected String | |
| protected String | Returns: value- length of string to read length)Read specified length of string value in DDM data with default encoding |
| protected int | |
| protected void | |
| protected void | |
| private void | shiftBuffer(byte[]
- buffer to shift data to destinationBuffer)This is a helper method which shifts the buffered bytes from wherever they are in the current buffer to the beginning of different buffer (note these buffers could be the same). |
| protected void | |
| protected void | |
| protected void | |
| private void | |
| protected boolean | |
| private void |
| ADJUST_LENGTHS | back to summary |
|---|---|
| private static final boolean ADJUST_LENGTHS | |
| agent | back to summary |
|---|---|
| private DRDAConnThread agent | |
| buffer | back to summary |
|---|---|
| private byte[] buffer | |
| ccsidManager | back to summary |
|---|---|
| private CcsidManager ccsidManager | |
| count | back to summary |
|---|---|
| private int count | |
| ddmCollectionLenStack | back to summary |
|---|---|
| private long[] ddmCollectionLenStack | |
| ddmScalarLen | back to summary |
|---|---|
| private long ddmScalarLen | |
| DEFAULT_BUFFER_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_BUFFER_SIZE | |
| doingLayerBStreaming | back to summary |
|---|---|
| private boolean doingLayerBStreaming | |
| dssCorrelationID | back to summary |
|---|---|
| private int dssCorrelationID | |
| dssIsChainedWithDiffID | back to summary |
|---|---|
| private boolean dssIsChainedWithDiffID | |
| dssIsChainedWithSameID | back to summary |
|---|---|
| private boolean dssIsChainedWithSameID | |
| dssIsContinued | back to summary |
|---|---|
| private boolean dssIsContinued | |
| dssLength | back to summary |
|---|---|
| private int dssLength | |
| dssTrace | back to summary |
|---|---|
| private DssTrace dssTrace | |
| ebcdicCcsidManager | back to summary |
|---|---|
| private EbcdicCcsidManager ebcdicCcsidManager | |
| EMPTY_STACK | back to summary |
|---|---|
| private static final int EMPTY_STACK | |
| inputStream | back to summary |
|---|---|
| private InputStream inputStream | |
| MAX_EXTDTA_SIZE | back to summary |
|---|---|
| private static final long MAX_EXTDTA_SIZE | |
| MAX_MARKS_NESTING | back to summary |
|---|---|
| private static final int MAX_MARKS_NESTING | |
| NO_ADJUST_LENGTHS | back to summary |
|---|---|
| private static final boolean NO_ADJUST_LENGTHS | |
| NO_CODEPOINT | back to summary |
|---|---|
| private static final int NO_CODEPOINT | |
| pos | back to summary |
|---|---|
| private int pos | |
| prevCorrelationID | back to summary |
|---|---|
| private int prevCorrelationID | |
| svrcod | back to summary |
|---|---|
| private int svrcod | |
| tenRadixMagnitude | back to summary |
|---|---|
| private static final int[][] tenRadixMagnitude | |
| terminateChainOnErr | back to summary |
|---|---|
| private boolean terminateChainOnErr | |
| topDdmCollectionStack | back to summary |
|---|---|
| private int topDdmCollectionStack | |
| totalByteCount | back to summary |
|---|---|
| pack-priv volatile long totalByteCount | |
| utf8CcsidManager | back to summary |
|---|---|
| private Utf8CcsidManager utf8CcsidManager | |
| DDMReader | back to summary |
|---|---|
| pack-priv DDMReader(DRDAConnThread agent, DssTrace dssTrace) | |
| DDMReader | back to summary |
|---|---|
| pack-priv DDMReader(InputStream inputStream) This constructor is used for testing the protocol It is used by ProtocolTestAdapter to read the protocol returned by the server | |
| adjustLengths | back to summary |
|---|---|
| private void adjustLengths(int length) Adjust remaining length
| |
| clearBuffer | back to summary |
|---|---|
| protected void clearBuffer() throws DRDAProtocolException | |
| compressBLayerData | back to summary |
|---|---|
| private void compressBLayerData(int continueDssHeaderCount) throws DRDAProtocolException Compress B Layer data if extended total length is used by removing the continuation headers
| |
| computeMagnitude | back to summary |
|---|---|
| private int[] computeMagnitude(int[] input) Compute the int array of magnitude from input value segments.
| |
| convertBytes | back to summary |
|---|---|
| protected String convertBytes(byte[] buf) Convert EBCDIC byte array to unicode string
| |
| doingLayerBStreaming | back to summary |
|---|---|
| pack-priv boolean doingLayerBStreaming() | |
| ensureALayerDataInBuffer | back to summary |
|---|---|
| private void ensureALayerDataInBuffer(int desiredDataSize) throws DRDAProtocolException Make sure a certain amount of Layer A data is in the buffer. The data will be in the buffer after this method is called.
| |
| ensureBLayerDataInBuffer | back to summary |
|---|---|
| private void ensureBLayerDataInBuffer(int desiredDataSize, boolean adjustLen) throws DRDAProtocolException Make sure a certain amount of Layer B data is in the buffer. The data will be in the buffer after this method is called.
| |
| ensureSpaceInBufferForFill | back to summary |
|---|---|
| private void ensureSpaceInBufferForFill(int desiredSpace) This method makes sure there is enough room in the buffer for a certain number of bytes. This method will allocate a new buffer if needed and shift the bytes in the current buffer to make ensure space is available for a fill. Right now this method will shift bytes as needed to make sure there is as much room as possible in the buffer before trying to do the read. The idea is to try to have space to get as much data as possible if we need to do a read on the socket's stream.
| |
| fill | back to summary |
|---|---|
| private void fill(int minimumBytesNeeded) throws DRDAProtocolException This method will attempt to read a minimum number of bytes from the underlying stream. This method will keep trying to read bytes until it has obtained at least the minimum number.
| |
| finishLayerBStreaming | back to summary |
|---|---|
| private void finishLayerBStreaming() | |
| getCodePoint | back to summary |
|---|---|
| protected int getCodePoint() throws DRDAProtocolException Get the next CodePoint from a collection
| |
| getCodePoint | back to summary |
|---|---|
| protected int getCodePoint(int codePointCheck) throws DRDAProtocolException Get the next CodePoint from a collection and check that it matches the specified CodePoint
| |
| getCurrChainState | back to summary |
|---|---|
| protected byte getCurrChainState() Return chaining bit for current DSS. | |
| getDdmLength | back to summary |
|---|---|
| protected long getDdmLength() Length of current DDM object
| |
| getExtData | back to summary |
|---|---|
| pack-priv byte[] getExtData(long desiredLength, boolean checkNullability) throws DRDAProtocolException | |
| getEXTDTAReaderInputStream | back to summary |
|---|---|
| pack-priv EXTDTAReaderInputStream getEXTDTAReaderInputStream(final boolean checkNullability) throws DRDAProtocolException Creates an InputStream which can stream EXTDTA objects. The InputStream uses this DDMReader to read data from network. The DDMReader should not be used before all data in the stream has been read.
| |
| initialize | back to summary |
|---|---|
| protected void initialize(DRDAConnThread agent, DssTrace dssTrace) Initialize values for this session, the reader is reused so we need to set null and 0 values | |
| isChainedWithDiffID | back to summary |
|---|---|
| protected boolean isChainedWithDiffID() Next DSS has different correlator than current DSS
| |
| isChainedWithSameID | back to summary |
|---|---|
| protected boolean isChainedWithSameID() Next DSS has same correlator as current DSS
| |
| isCmd | back to summary |
|---|---|
| protected boolean isCmd() throws DRDAProtocolException, UnsupportedEncodingException Check for the command protocol
| |
| isEXTDTANull | back to summary |
|---|---|
| private boolean isEXTDTANull() throws DRDAProtocolException | |
| markCollection | back to summary |
|---|---|
| protected void markCollection() Push DDM Length on to collection stack | |
| moreData | back to summary |
|---|---|
| protected boolean moreData() Is there more data in the buffer
| |
| moreDdmData | back to summary |
|---|---|
| protected boolean moreDdmData() Is there more in this DDM object
| |
| moreDssData | back to summary |
|---|---|
| protected boolean moreDssData() Is there more in this DDS object
| |
| packedNybblesToInt | back to summary |
|---|---|
| private int packedNybblesToInt(byte[] buffer, int offset, int startNybble, int numberOfNybbles) Convert a range of packed nybbles (up to 9 digits without overflow) to an int. Note that for performance purpose, it does not do array-out-of-bound checking.
| |
| packedNybblesToLong | back to summary |
|---|---|
| private long packedNybblesToLong(byte[] buffer, int offset, int startNybble, int numberOfNybbles) Convert a range of packed nybbles (up to 18 digits without overflow) to a long. Note that for performance purpose, it does not do array-out-of-bound checking.
| |
| readBigDecimal | back to summary |
|---|---|
| protected BigDecimal readBigDecimal(int precision, int scale) throws DRDAProtocolException Read a BigDecimal value
| |
| readByte | back to summary |
|---|---|
| protected byte readByte() throws DRDAProtocolException Read byte value
| |
| readBytes | back to summary |
|---|---|
| protected byte[] readBytes(int length) throws DRDAProtocolException Read byte string value
| |
| readBytes | back to summary |
|---|---|
| protected byte[] readBytes() throws DRDAProtocolException Read byte string value
| |
| readCmdString | back to summary |
|---|---|
| protected String readCmdString(int length) throws DRDAProtocolException, UnsupportedEncodingException Read string value
| |
| readCmdString | back to summary |
|---|---|
| protected String readCmdString() throws DRDAProtocolException, UnsupportedEncodingException Read string value
| |
| readCodePoint | back to summary |
|---|---|
| protected int readCodePoint() Read the CodePoint
| |
| readDouble | back to summary |
|---|---|
| protected double readDouble(int byteOrder) throws DRDAProtocolException Read platform double value
| |
| readDSSContinuationHeader | back to summary |
|---|---|
| private void readDSSContinuationHeader() throws DRDAProtocolException | |
| readDssHeader | back to summary |
|---|---|
| protected int readDssHeader() throws DRDAProtocolException Read DSS header DSS Header format is 2 bytes - length 1 byte - 'D0' - indicates DDM data 1 byte - DSS format |---|---------|----------| | 0 | flags | type | |---|---------|----------| | 0 | 1 2 3 | 4 5 6 7 | |---|---------|----------| bit 0 - '0' bit 1 - '0' - unchained, '1' - chained bit 2 - '0' - do not continue on error, '1' - continue on error bit 3 - '0' - next DSS has different correlator, '1' - next DSS has same correlator type - 1 - Request DSS - 2 - Reply DSS - 3 - Object DSS - 4 - Communications DSS - 5 - Request DSS where no reply is expected 2 bytes - request correlation id
| |
| readEncryptedString | back to summary |
|---|---|
| protected String readEncryptedString(DecryptionManager decryptM, int securityMechanism, byte[] initVector, byte[] sourcePublicKey) throws DRDAProtocolException, SQLException Read encrypted string
| |
| readFloat | back to summary |
|---|---|
| protected float readFloat(int byteOrder) throws DRDAProtocolException Read platform float value
| |
| readInt | back to summary |
|---|---|
| protected int readInt(int byteOrder) throws DRDAProtocolException Read platform int value
| |
| readLDStringData | back to summary |
|---|---|
| protected String readLDStringData(String encoding) throws DRDAProtocolException Read length delimited string value in DDM data with default encoding
| |
| readLengthAndCodePoint | back to summary |
|---|---|
| protected int readLengthAndCodePoint(boolean isLayerBStreamingPossible) throws DRDAProtocolException Read the DDM Length and CodePoint
| |
| readLOBChunk | back to summary |
|---|---|
| private ByteArrayInputStream readLOBChunk(final boolean readHeader, final long desiredLength) throws DRDAProtocolException This method is used by EXTDTAReaderInputStream to read the next chunk of data. Furthermore, when Layer B streaming is carried out, calling this method may finish layer B streaming.
| |
| readLOBContinuationStream | back to summary |
|---|---|
| pack-priv ByteArrayInputStream readLOBContinuationStream() throws IOException This method is used by EXTDTAReaderInputStream to read the next chunk of data. Calling this method finishes layer B streaming if continuation of DSS segment was finished. This lengthless method must be called only when layer B streaming.
| |
| readLOBContinuationStream | back to summary |
|---|---|
| pack-priv ByteArrayInputStream readLOBContinuationStream(final long desiredLength) throws IOException This method is used by EXTDTAReaderInputStream to read the next chunk of data. Furthermore, when Layer B streaming is carried out, calling this method finishes layer B streaming if continuation of DSS segment was finished.
| |
| readLOBInitStream | back to summary |
|---|---|
| pack-priv ByteArrayInputStream readLOBInitStream() throws DRDAProtocolException This method is used by EXTDTAReaderInputStream to read the first chunk of data. This lengthless method must be called only when layer B streaming.
| |
| readLOBInitStream | back to summary |
|---|---|
| pack-priv ByteArrayInputStream readLOBInitStream(final long desiredLength) throws DRDAProtocolException This method is used by EXTDTAReaderInputStream to read the first chunk of data.
| |
| readLong | back to summary |
|---|---|
| protected long readLong(int byteOrder) throws DRDAProtocolException Read platform long value
| |
| readNetworkInt | back to summary |
|---|---|
| protected int readNetworkInt() throws DRDAProtocolException Read network int value
| |
| readNetworkLong | back to summary |
|---|---|
| protected long readNetworkLong() throws DRDAProtocolException Read network long value
| |
| readNetworkShort | back to summary |
|---|---|
| protected int readNetworkShort() throws DRDAProtocolException Read network short value
| |
| readNetworkSixByteLong | back to summary |
|---|---|
| protected long readNetworkSixByteLong() throws DRDAProtocolException Read network six byte value and put it in a long v
| |
| readReplyDss | back to summary |
|---|---|
| protected void readReplyDss() throws DRDAProtocolException Read Reply DSS This is used in testing the protocol. We shouldn't see a reply DSS when we are servicing DRDA commands
| |
| readShort | back to summary |
|---|---|
| protected short readShort(int byteOrder) throws DRDAProtocolException Read platform short value
| |
| readSignedNetworkShort | back to summary |
|---|---|
| protected int readSignedNetworkShort() throws DRDAProtocolException Read signed network short value
| |
| readString | back to summary |
|---|---|
| protected String readString(int length) throws DRDAProtocolException Read string value Strings in DRDA protocol are encoded in EBCDIC by default so we need to convert to UCS2
| |
| readString | back to summary |
|---|---|
| protected void readString(DRDAString dst, int size, boolean unpad) throws DRDAProtocolException Read string value into a
| |
| readString | back to summary |
|---|---|
| protected String readString(int length, String encoding) throws DRDAProtocolException Read encoded string value
| |
| readString | back to summary |
|---|---|
| protected String readString() throws DRDAProtocolException Read string value
| |
| readStringData | back to summary |
|---|---|
| protected String readStringData(int length) throws DRDAProtocolException Read specified length of string value in DDM data with default encoding
| |
| readUnsignedByte | back to summary |
|---|---|
| protected int readUnsignedByte() throws DRDAProtocolException Read byte value and mask out high order bytes before returning
| |
| setEbcdicCcsid | back to summary |
|---|---|
| protected void setEbcdicCcsid() | |
| setUtf8Ccsid | back to summary |
|---|---|
| protected void setUtf8Ccsid() | |
| shiftBuffer | back to summary |
|---|---|
| private void shiftBuffer(byte[] destinationBuffer) This is a helper method which shifts the buffered bytes from wherever they are in the current buffer to the beginning of different buffer (note these buffers could be the same). State information is updated as needed after the shift.
| |
| skipBytes | back to summary |
|---|---|
| protected void skipBytes(int length) throws DRDAProtocolException Skip byte string value
| |
| skipBytes | back to summary |
|---|---|
| protected void skipBytes() throws DRDAProtocolException Skip byte string value | |
| skipDss | back to summary |
|---|---|
| protected void skipDss() throws DRDAProtocolException Skip remaining DSS | |
| startLayerBStreaming | back to summary |
|---|---|
| private void startLayerBStreaming() | |
| terminateChainOnErr | back to summary |
|---|---|
| protected boolean terminateChainOnErr() | |
| trace | back to summary |
|---|---|
| private void trace(String msg) Print a internal trace message | |