/** * 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. * * @param desiredDataSize - amount of data we need * @param adjustLen - whether to adjust the remaining lengths * * @exception DRDProtocolException */ private void ensureBLayerDataInBuffer (int desiredDataSize, boolean adjustLen) throws DRDAProtocolException { ensureALayerDataInBuffer (desiredDataSize); if (dssIsContinued) { if (desiredDataSize > dssLength) { int continueDssHeaderCount = (((desiredDataSize - dssLength) / DssConstants.MAX_DSS_LENGTH) + 1); compressBLayerData (continueDssHeaderCount); } } if (adjustLen) adjustLengths(desiredDataSize); }
/** * Refresh the current buffer from the DDMReader * @exception IOException if there is a IOException when * refreshing the buffer from DDMReader * @return the next byte of data, or <code>-1</code> if the end of the * stream is reached and layer B streaming was finished. */ private int refreshCurrentBuffer() throws IOException { if( ! reader.doingLayerBStreaming() ) return -1; currentBuffer = reader.readLOBContinuationStream(); return currentBuffer.read(); }
/** * Read byte value * @return value * * @exception DRDProtocolException */ protected byte readByte () throws DRDAProtocolException { ensureBLayerDataInBuffer (1, ADJUST_LENGTHS); return buffer[pos++]; }
private boolean isEXTDTANull () throws DRDAProtocolException { // make sure that the null byte is in the buffer ensureALayerDataInBuffer (1); adjustLengths (1); // examine the null byte byte nullByte = buffer[pos++]; if (nullByte == (byte)0x00) return false; return true; }
int svrcod = 0; copyToRequired(ACCRDB_REQUIRED); reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) int sqlam = reader.readNetworkShort(); if (this.trace) trace("RDBACCCL = " + sqlam); database.crrtkn = reader.readBytes(); if (this.trace) trace("crrtkn " + convertToHexString(database.crrtkn)); long time = SignedBinary.getLong(database.crrtkn, l-8, SignedBinary.BIG_ENDIAN); // as "long" as unique session.drdaID = reader.convertBytes(part1) + time + leftBrace + session.connNum + rightBrace; if (this.trace) appRequester.setClientVersion(reader.readString()); if (this.trace) trace("prdId " + appRequester.prdid); int allowUpd = reader.readByte() & 0xff; database.resetFlags(); byte txnFailoverCtxWritten = reader.readByte(); if (txnFailoverCtxWritten == ClientSharedData.CLIENT_FAILOVER_CONTEXT_WRITTEN) {
throws DRDAProtocolException ensureBLayerDataInBuffer (4, NO_ADJUST_LENGTHS); ddmScalarLen = readCodePoint(); int codePoint = readCodePoint(); trace("length = "+ ddmScalarLen + " codepoint = " + java.lang.Integer.toHexString(codePoint)); DssConstants.CONTINUATION_BIT) - 4; int adjustSize = 0; ensureBLayerDataInBuffer (numberOfExtendedLenBytes, NO_ADJUST_LENGTHS); switch (numberOfExtendedLenBytes) { case 8: codePoint == CodePoint.QRYDTA ) ){ startLayerBStreaming(); adjustSize = 4; agent.throwSyntaxrm(CodePoint.SYNERRCD_OBJ_LEN_LESS_THAN_4, DRDAProtocolException.NO_CODPNT_ARG); adjustLengths (4); trace("actual length = "+ ddmScalarLen + " codepoint = " + java.lang.Integer.toHexString(codePoint));
readDSSContinuationHeader(); ensureALayerDataInBuffer (copySize); adjustLengths (copySize); finishLayerBStreaming();
if (isEXTDTANull()) return null; ensureALayerDataInBuffer (copySize); adjustLengths (copySize); baos.write (buffer, pos, copySize); pos += copySize; readDSSContinuationHeader ();
ensureBLayerDataInBuffer (length, ADJUST_LENGTHS); int value = packedNybblesToInt(buffer, pos, 0, length*2-1); long value = packedNybblesToLong(buffer, pos, 0, length*2-1); int lo = packedNybblesToInt(buffer, pos, (length-5)*2, 9); int me = packedNybblesToInt(buffer, pos, (length-10)*2+1, 9); int hi = packedNybblesToInt(buffer, pos, 0, (length-10)*2+1); int[] value = computeMagnitude(new int[] {hi, me, lo}); if (start == 0 && remaining != 0) { v = packedNybblesToInt(buffer, pos, 0, remaining); start = remaining; v = packedNybblesToInt(buffer, pos, start, 9); start += 9; magnitude = computeMagnitude(magnitude);
ensureALayerDataInBuffer (6); trace("dssLength = " + dssLength + " correlationID = " + dssCorrelationID);
byte [] rdbName = reader.readBytes(); if (rdbName.length == 0) name = reader.convertBytes(rdbName);
/** * Initialize class */ private void initialize() { // set input and output sockets // this needs to be done before creating reader sockis = session.sessionInput; sockos = session.sessionOutput; reader = new DDMReader(this, session.dssTrace); writer = new DDMWriter(ccsidManager, this, session.dssTrace); }
/** * Check for the command protocol * * @return true if this is a command; false otherwise * * @exception DRDProtocolException */ protected boolean isCmd() throws DRDAProtocolException, java.io.UnsupportedEncodingException { ensureALayerDataInBuffer(4); String val = new String(buffer, 0, 4, NetworkServerControlImpl.DEFAULT_ENCODING); return NetworkServerControlImpl.isCmd(val); }
/** * Send unpexpected error to the client * @param e Exception to be sent */ private void sendUnexpectedException(Exception e) { DRDAProtocolException unExpDe; String dbname = null; try { if (database != null) dbname = database.dbName; println2Log(dbname,session.drdaID, e.getMessage()); server.consoleExceptionPrintTrace(e); unExpDe = DRDAProtocolException.newAgentError(this, CodePoint.SVRCOD_PRMDMG, dbname, e.getMessage()); reader.clearBuffer(); unExpDe.write(writer); finalizeChain(); } catch (DRDAProtocolException nde) { // we can't tell the client, but we tried. } }
ensureSpaceInBufferForFill (minimumBytesNeeded);
int svrcod = 0; copyToRequired(ACCRDB_REQUIRED); reader.markCollection(); codePoint = reader.getCodePoint(); while (codePoint != -1) int sqlam = reader.readNetworkShort(); if (this.trace) trace("RDBACCCL = " + sqlam); database.crrtkn = reader.readBytes(); if (this.trace) trace("crrtkn " + convertToHexString(database.crrtkn)); long time = SignedBinary.getLong(database.crrtkn, l-8, SignedBinary.BIG_ENDIAN); // as "long" as unique session.drdaID = reader.convertBytes(part1) + time + leftBrace + session.connNum + rightBrace; if (this.trace) appRequester.setClientVersion(reader.readString()); if (this.trace) trace("prdId " + appRequester.prdid); int allowUpd = reader.readByte() & 0xff; database.resetFlags(); byte txnFailoverCtxWritten = reader.readByte(); if (txnFailoverCtxWritten == ClientSharedData.CLIENT_FAILOVER_CONTEXT_WRITTEN) {
throws DRDAProtocolException ensureBLayerDataInBuffer (4, NO_ADJUST_LENGTHS); ddmScalarLen = readCodePoint(); int codePoint = readCodePoint(); trace("length = "+ ddmScalarLen + " codepoint = " + java.lang.Integer.toHexString(codePoint)); DssConstants.CONTINUATION_BIT) - 4; int adjustSize = 0; ensureBLayerDataInBuffer (numberOfExtendedLenBytes, NO_ADJUST_LENGTHS); switch (numberOfExtendedLenBytes) { case 8: codePoint == CodePoint.QRYDTA ) ){ startLayerBStreaming(); adjustSize = 4; agent.throwSyntaxrm(CodePoint.SYNERRCD_OBJ_LEN_LESS_THAN_4, DRDAProtocolException.NO_CODPNT_ARG); adjustLengths (4); trace("actual length = "+ ddmScalarLen + " codepoint = " + java.lang.Integer.toHexString(codePoint));
readDSSContinuationHeader(); ensureALayerDataInBuffer (copySize); adjustLengths (copySize); finishLayerBStreaming();
if (isEXTDTANull()) return null; ensureALayerDataInBuffer (copySize); adjustLengths (copySize); baos.write (buffer, pos, copySize); pos += copySize; readDSSContinuationHeader ();
ensureBLayerDataInBuffer (length, ADJUST_LENGTHS); int value = packedNybblesToInt(buffer, pos, 0, length*2-1); long value = packedNybblesToLong(buffer, pos, 0, length*2-1); int lo = packedNybblesToInt(buffer, pos, (length-5)*2, 9); int me = packedNybblesToInt(buffer, pos, (length-10)*2+1, 9); int hi = packedNybblesToInt(buffer, pos, 0, (length-10)*2+1); int[] value = computeMagnitude(new int[] {hi, me, lo}); if (start == 0 && remaining != 0) { v = packedNybblesToInt(buffer, pos, 0, remaining); start = remaining; v = packedNybblesToInt(buffer, pos, start, 9); start += 9; magnitude = computeMagnitude(magnitude);