public Object next() { if (index >= stub.length) throw new NoSuchElementException(); ResponseCoPdu fragment = (ResponseCoPdu) ResponseCoPdu.this.clone(); int allocation = stub.length - index; fragment.setAllocationHint(allocation); if (stubSize < allocation) allocation = stubSize; byte[] fragmentStub = new byte[allocation]; System.arraycopy(stub, index, fragmentStub, 0, allocation); fragment.setStub(fragmentStub); int flags = getFlags() & ~(PFC_FIRST_FRAG | PFC_LAST_FRAG); if (index == 0) flags |= PFC_FIRST_FRAG; index += allocation; if (index >= stub.length) flags |= PFC_LAST_FRAG; fragment.setFlags(flags); return fragment; }
protected void readBody(NetworkDataRepresentation ndr) { setAllocationHint(ndr.readUnsignedLong()); setContextId(ndr.readUnsignedShort()); setCancelCount(ndr.readUnsignedSmall()); }
protected void writeBody(NetworkDataRepresentation ndr) { ndr.writeUnsignedLong(getAllocationHint()); ndr.writeUnsignedShort(getContextId()); ndr.writeUnsignedSmall((short) getCancelCount()); }
protected void readPdu ( NetworkDataRepresentation ndr ) { readHeader ( ndr ); readBody ( ndr ); readStub ( ndr ); }
final ResponseCoPdu responseCoPdu = new ResponseCoPdu (); responseCoPdu.setContextId ( ( (RequestCoPdu)request ).getContextId () ); responseCoPdu.setFormat ( ( (RequestCoPdu)request ).getFormat () ); responseCoPdu.setCallId ( ( (RequestCoPdu)request ).getCallId () ); ( (NdrObject)workerObject ).encode ( ndr, null ); final int length = ndr.getBuffer ().length > ndr.getBuffer ().index ? ndr.getBuffer ().length : ndr.getBuffer ().index; responseCoPdu.setAllocationHint ( length + 4 ); final byte[] responsebytes = new byte[length + 4]; System.arraycopy ( ndr.getBuffer ().getBuffer (), 0, responsebytes, 0, responsebytes.length - 4 ); responseCoPdu.setStub ( responsebytes );
ResponseCoPdu responseCoPdu = new ResponseCoPdu(); responseCoPdu.setContextId(((RequestCoPdu) request).getContextId()); responseCoPdu.setFormat(((RequestCoPdu) request).getFormat()); responseCoPdu.setCallId(((RequestCoPdu) request).getCallId()); int length = ndr.getBuffer().length > ndr.getBuffer().index ? ndr.getBuffer().length : ndr.getBuffer().index; responseCoPdu.setAllocationHint(length + 4); byte[] responsebytes = new byte[length + 4]; System.arraycopy(ndr.getBuffer().getBuffer(), 0, responsebytes, 0, responsebytes.length - 4); responseCoPdu.setStub(responsebytes);
byte[] stub = pdu.getStub(); if (stub == null) stub = new byte[0]; int i = 0; byte[] fragmentStub = fragment.getStub(); if (fragmentStub != null && fragmentStub.length > 0) { if (logger.isLoggable(Level.FINEST)) pdu.setStub(stub); pdu.setAllocationHint(length); if (logger.isLoggable(Level.FINEST)) pdu.setStub(null); pdu.setAllocationHint(0); pdu.setFlag(PFC_FIRST_FRAG, true); pdu.setFlag(PFC_LAST_FRAG, true); return pdu; } catch (Exception ex) {
public Object next() { if (index >= stub.length) throw new NoSuchElementException(); ResponseCoPdu fragment = (ResponseCoPdu) ResponseCoPdu.this.clone(); int allocation = stub.length - index; fragment.setAllocationHint(allocation); if (stubSize < allocation) allocation = stubSize; byte[] fragmentStub = new byte[allocation]; System.arraycopy(stub, index, fragmentStub, 0, allocation); fragment.setStub(fragmentStub); int flags = getFlags() & ~(PFC_FIRST_FRAG | PFC_LAST_FRAG); if (index == 0) flags |= PFC_FIRST_FRAG; index += allocation; if (index >= stub.length) flags |= PFC_LAST_FRAG; fragment.setFlags(flags); return fragment; }
byte[] stub = pdu.getStub(); if (stub == null) stub = new byte[0]; int i = 0; byte[] fragmentStub = fragment.getStub(); if (fragmentStub != null && fragmentStub.length > 0) { if (logger.isLoggable(Level.FINEST)) pdu.setStub(stub); pdu.setAllocationHint(length); if (logger.isLoggable(Level.FINEST)) pdu.setStub(null); pdu.setAllocationHint(0);
protected void readStub(NetworkDataRepresentation ndr) { ndr.getBuffer().align(8); byte[] stub = null; int length = getFragmentLength() - ndr.getBuffer().getIndex(); if (length > 0) { stub = new byte[length]; ndr.readOctetArray(stub, 0, length); } setStub(stub); }
break; case ResponseCoPdu.RESPONSE_TYPE: pdu = new ResponseCoPdu (); break; case ShutdownPdu.SHUTDOWN_TYPE:
public Iterator fragment(int size) { byte[] stub = getStub(); if (stub == null) { return Arrays.asList(new ResponseCoPdu[] { this }).iterator(); } //subtracting 8 bytes for authentication header and 16 for the authentication verifier size, someone forgot the //poor guys.. int stubSize = size - 24 - 8 - 16; if (stub.length <= stubSize) { return Arrays.asList(new ResponseCoPdu[] { this }).iterator(); } return new FragmentIterator(stubSize); }
protected void readStub(NetworkDataRepresentation ndr) { ndr.getBuffer().align(8); byte[] stub = null; int length = getFragmentLength() - ndr.getBuffer().getIndex(); if (length > 0) { stub = new byte[length]; ndr.readOctetArray(stub, 0, length); } setStub(stub); }
ResponseCoPdu responseCoPdu = new ResponseCoPdu(); responseCoPdu.setContextId(((RequestCoPdu) request).getContextId()); responseCoPdu.setFormat(((RequestCoPdu) request).getFormat()); responseCoPdu.setCallId(((RequestCoPdu) request).getCallId()); ((NdrObject)workerObject).encode(ndr,null); int length = ndr.getBuffer().length > ndr.getBuffer().index ? ndr.getBuffer().length : ndr.getBuffer().index; responseCoPdu.setAllocationHint(length + 4); byte[] responsebytes = new byte[length + 4]; System.arraycopy(ndr.getBuffer().getBuffer(), 0, responsebytes, 0, responsebytes.length - 4); responseCoPdu.setStub(responsebytes);
byte[] stub = pdu.getStub (); if ( stub == null ) stub = new byte[0]; byte[] fragmentStub = fragment.getStub (); if ( fragmentStub != null && fragmentStub.length > 0 ) if ( length > 0 ) pdu.setStub ( stub ); pdu.setAllocationHint ( length ); if ( logger.isLoggable ( Level.FINEST ) ) pdu.setStub ( null ); pdu.setAllocationHint ( 0 ); pdu.setFlag ( PFC_FIRST_FRAG, true ); pdu.setFlag ( PFC_LAST_FRAG, true ); return pdu;
protected void readPdu(NetworkDataRepresentation ndr) { readHeader(ndr); readBody(ndr); readStub(ndr); }
protected void readStub ( NetworkDataRepresentation ndr ) { ndr.getBuffer ().align ( 8 ); byte[] stub = null; int length = getFragmentLength () - ndr.getBuffer ().getIndex (); if ( length > 0 ) { stub = new byte[length]; ndr.readOctetArray ( stub, 0, length ); } setStub ( stub ); }
break; case ResponseCoPdu.RESPONSE_TYPE: pdu = new ResponseCoPdu(); break; case ShutdownPdu.SHUTDOWN_TYPE:
public Iterator fragment(int size) { byte[] stub = getStub(); if (stub == null) { return Arrays.asList(new ResponseCoPdu[] { this }).iterator(); } //subtracting 8 bytes for authentication header and 16 for the authentication verifier size, someone forgot the //poor guys.. int stubSize = size - 24 - 8 - 16; if (stub.length <= stubSize) { return Arrays.asList(new ResponseCoPdu[] { this }).iterator(); } return new FragmentIterator(stubSize); }