protected void writeBody(NetworkDataRepresentation ndr) { NdrBuffer dst = ndr.getBuffer(); dst.enc_ndr_long(getAllocationHint()); dst.enc_ndr_short(getContextId()); dst.enc_ndr_short(getOpnum()); if (getFlag(PFC_OBJECT_UUID)) { try { getObject().encode(ndr, ndr.getBuffer()); } catch (NdrException ne) { }; } }
byte[] stub = pdu.getStub(); if (stub == null) stub = new byte[0]; while (fragments.hasNext()) { RequestCoPdu fragment = (RequestCoPdu) fragments.next(); byte[] fragmentStub = fragment.getStub(); if (fragmentStub != null && fragmentStub.length > 0) { byte[] tmp = new byte[stub.length + fragmentStub.length]; pdu.setStub(stub); pdu.setAllocationHint(length); } else { 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(); RequestCoPdu fragment = (RequestCoPdu) RequestCoPdu.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); fragment.setCallId(callId);
protected void readPdu(NetworkDataRepresentation ndr) { readHeader(ndr); readBody(ndr); readStub(ndr); }
if ( request instanceof RequestCoPdu ) buffer = new NdrBuffer ( ( (RequestCoPdu)request ).getStub (), 0 ); if ( buffer.buf != null ) ndr.setFormat ( ( (RequestCoPdu)request ).getFormat () ); workerObject.setOpnum ( ( (RequestCoPdu)request ).getOpnum () ); workerObject.setCurrentObjectID ( ( (RequestCoPdu)request ).getObject () ); 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; response.setCallId ( ( (RequestCoPdu)request ).getCallId () ); ( (FaultCoPdu)response ).setStatus ( e.getHResult () );
public void call(int semantics, UUID object, int opnum, NdrObject ndrobj) throws IOException { bind(); RequestCoPdu request = new RequestCoPdu(); request.setContextId(contextIdToUse); request.setStub(stub); request.setAllocationHint(buffer.getLength()); request.setOpnum(opnum); request.setObject(object); if ((semantics & MAYBE) != 0) { request.setFlag(ConnectionOrientedPdu.PFC_MAYBE, true); if (request.getFlag(ConnectionOrientedPdu.PFC_MAYBE)) return; ConnectionOrientedPdu reply = receive(); if (reply instanceof ResponseCoPdu) {
if (request instanceof RequestCoPdu) buffer = new NdrBuffer(((RequestCoPdu) request).getStub(), 0); if(buffer.buf != null) workerObject.setOpnum(((RequestCoPdu) request).getOpnum()); workerObject.setCurrentObjectID(((RequestCoPdu) request).getObject()); responseCoPdu.setContextId(((RequestCoPdu) request).getContextId()); responseCoPdu.setFormat(((RequestCoPdu) request).getFormat()); responseCoPdu.setCallId(((RequestCoPdu) request).getCallId());
protected void readBody(NetworkDataRepresentation ndr) { UUID object = null; NdrBuffer src = ndr.getBuffer(); setAllocationHint(src.dec_ndr_long()); setContextId(src.dec_ndr_short()); setOpnum(src.dec_ndr_short()); if (getFlag(PFC_OBJECT_UUID)) { object = new UUID(); try { object.decode(ndr, src); } catch (NdrException ne) { } } setObject(object); }
public void call(int semantics, UUID object, int opnum, NdrObject ndrobj) throws IOException { bind(); RequestCoPdu request = new RequestCoPdu(); request.setContextId(contextIdToUse); request.setStub(stub); request.setAllocationHint(buffer.getLength()); request.setOpnum(opnum); request.setObject(object); if ((semantics & MAYBE) != 0) { request.setFlag(ConnectionOrientedPdu.PFC_MAYBE, true);
byte[] stub = pdu.getStub(); if (stub == null) stub = new byte[0]; while (fragments.hasNext()) { RequestCoPdu fragment = (RequestCoPdu) fragments.next(); byte[] fragmentStub = fragment.getStub(); if (fragmentStub != null && fragmentStub.length > 0) { byte[] tmp = new byte[stub.length + fragmentStub.length]; pdu.setStub(stub); pdu.setAllocationHint(length); } else { pdu.setStub(null); pdu.setAllocationHint(0);
public Iterator fragment(int size) { byte[] stub = getStub(); if (stub == null) { return Arrays.asList(new RequestCoPdu[] { this }).iterator(); } //subtracting 8 bytes for authentication header and 16 for the authentication verifier size, someone forgot the //poor guys.. int stubSize = size - (getFlag(PFC_OBJECT_UUID) ? 40 : 24) - 8 - 16 ; if (stub.length <= stubSize) { return Arrays.asList(new RequestCoPdu[] { this }).iterator(); } if (logger.isLoggable(Level.FINEST)) { logger.finest("In fragment of RequestCoPdu, this packet will be fragmented while sending...\n"); } return new FragmentIterator(stubSize); }
public Iterator fragment(int size) { byte[] stub = getStub(); if (stub == null) { return Arrays.asList(new RequestCoPdu[] { this }).iterator(); } //subtracting 8 bytes for authentication header and 16 for the authentication verifier size, someone forgot the //poor guys.. int stubSize = size - (getFlag(PFC_OBJECT_UUID) ? 40 : 24) - 8 - 16 ; if (stub.length <= stubSize) { return Arrays.asList(new RequestCoPdu[] { this }).iterator(); } if (logger.isLoggable(Level.FINEST)) { logger.finest("In fragment of RequestCoPdu, this packet will be fragmented while sending...\n"); } return new FragmentIterator(stubSize); }
public Object next() { if (index >= stub.length) throw new NoSuchElementException(); RequestCoPdu fragment = (RequestCoPdu) RequestCoPdu.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;
break; case RequestCoPdu.REQUEST_TYPE: pdu = new RequestCoPdu (); break; case ResponseCoPdu.RESPONSE_TYPE:
if (request instanceof RequestCoPdu) buffer = new NdrBuffer(((RequestCoPdu) request).getStub(), 0); if(buffer.buf != null) ndr.setFormat(((RequestCoPdu) request).getFormat()); workerObject.setOpnum(((RequestCoPdu) request).getOpnum()); workerObject.setCurrentObjectID(((RequestCoPdu) request).getObject()); 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; response.setCallId(((RequestCoPdu) request).getCallId()); ((FaultCoPdu)response).setStatus(e.getHResult());
public void call ( int semantics, UUID object, int opnum, NdrObject ndrobj ) throws IOException RequestCoPdu request = new RequestCoPdu (); request.setContextId ( contextIdToUse ); request.setStub ( stub ); request.setAllocationHint ( buffer.getLength () ); request.setOpnum ( opnum ); request.setObject ( object ); if ( ( semantics & MAYBE ) != 0 ) request.setFlag ( ConnectionOrientedPdu.PFC_MAYBE, true ); if ( request.getFlag ( ConnectionOrientedPdu.PFC_MAYBE ) ) return; ConnectionOrientedPdu reply = receive ();
protected void readBody ( NetworkDataRepresentation ndr ) { UUID object = null; NdrBuffer src = ndr.getBuffer (); setAllocationHint ( src.dec_ndr_long () ); setContextId ( src.dec_ndr_short () ); setOpnum ( src.dec_ndr_short () ); if ( getFlag ( PFC_OBJECT_UUID ) ) { object = new UUID (); try { object.decode ( ndr, src ); } catch ( NdrException ne ) { } } setObject ( object ); }
protected void writeStub ( NetworkDataRepresentation ndr ) { NdrBuffer dst = ndr.getBuffer (); dst.align ( 8, (byte)0 ); byte[] stub = getStub (); if ( stub != null ) ndr.writeOctetArray ( stub, 0, stub.length ); }
protected void readPdu ( NetworkDataRepresentation ndr ) { readHeader ( ndr ); readBody ( ndr ); readStub ( ndr ); }