public void decode(NdrBuffer buf) throws NdrException { decode_header(buf); if (ptype != 12 && ptype != 2 && ptype != 3 && ptype != 13) throw new NdrException("Unexpected ptype: " + ptype); if (ptype == 2 || ptype == 3) { /* Response or Fault */ alloc_hint = buf.dec_ndr_long(); buf.dec_ndr_short(); /* context id */ buf.dec_ndr_short(); /* cancel count */ } if (ptype == 3 || ptype == 13) { /* Fault */ result = buf.dec_ndr_long(); } else { /* Bind_ack or Response */ decode_out(buf); } }
/** * @param msg * @param out * @return * @throws NdrException * @throws DcerpcException */ private NdrBuffer encodeMessage ( DcerpcMessage msg, byte[] out ) throws NdrException, DcerpcException { NdrBuffer buf = new NdrBuffer(out, 0); msg.flags = DCERPC_FIRST_FRAG | DCERPC_LAST_FRAG; msg.call_id = call_id.incrementAndGet(); msg.encode(buf); if ( this.securityProvider != null ) { buf.setIndex(0); this.securityProvider.wrap(buf); } return buf; }
byte[] fragBytes = new byte[this.max_recv]; NdrBuffer fragBuf = new NdrBuffer(fragBytes, 0); while ( !msg.isFlagSet(DCERPC_LAST_FRAG) ) { doReceiveFragment(fragBytes); setupReceivedFragment(fragBuf); fragBuf.reset(); msg.decode_header(fragBuf); int stub_frag_len = msg.length - 24; if ( ( off + stub_frag_len ) > in.length ) {
msg.call_id = call_id++; msg.encode(buf); buf.start = off; buf.reset(); msg.encode_header(buf); buf.enc_ndr_long(msg.alloc_hint); buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(msg.getOpnum()); msg.decode_header(buf); if (msg.ptype == 2 && msg.isFlagSet(DCERPC_LAST_FRAG) == false) off = msg.length; while (msg.isFlagSet(DCERPC_LAST_FRAG) == false) { int stub_frag_len; msg.decode_header(fbuf); stub_frag_len = msg.length - 24; msg.decode(buf); } finally { jcifs.smb.BufferCache.releaseBuffer(stub); if ((de = msg.getResult()) != null) throw de;
msg.call_id = call_id; msg.encode(buf); msg.decode_header(buf); if (msg.ptype == 2 && msg.isFlagSet(DCERPC_LAST_FRAG) == false) off = msg.length; while (msg.isFlagSet(DCERPC_LAST_FRAG) == false) { int stub_frag_len; msg.decode_header(fbuf); stub_frag_len = msg.length - 24; msg.decode(buf); } finally { jcifs.smb.BufferCache.releaseBuffer(stub); if ((de = msg.getResult()) != null) throw de;
public void encode(NdrBuffer buf) throws NdrException { int start = buf.getIndex(); int alloc_hint_index = 0; buf.advance(16); /* momentarily skip header */ if (ptype == 0) { /* Request */ alloc_hint_index = buf.getIndex(); buf.enc_ndr_long(0); /* momentarily skip alloc hint */ buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(getOpnum()); } encode_in(buf); length = buf.getIndex() - start; if (ptype == 0) { buf.setIndex(alloc_hint_index); alloc_hint = length - alloc_hint_index; buf.enc_ndr_long(alloc_hint); } buf.setIndex(start); encode_header(buf); buf.setIndex(start + length); } public void decode(NdrBuffer buf) throws NdrException {
buf.start = off; buf.reset(); msg.encode_header(buf); buf.enc_ndr_long(msg.alloc_hint); buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(msg.getOpnum());
msg.call_id = call_id++; msg.encode(buf); buf.start = off; buf.reset(); msg.encode_header(buf); buf.enc_ndr_long(msg.alloc_hint); buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(msg.getOpnum()); msg.decode_header(buf); if (msg.ptype == 2 && msg.isFlagSet(DCERPC_LAST_FRAG) == false) off = msg.length; while (msg.isFlagSet(DCERPC_LAST_FRAG) == false) { int stub_frag_len; msg.decode_header(fbuf); stub_frag_len = msg.length - 24; msg.decode(buf); } finally { jcifs.smb.BufferCache.releaseBuffer(stub); if ((de = msg.getResult()) != null) throw de;
setupReceivedFragment(buf); buf.setIndex(0); msg.decode_header(buf); if ( have == 0 || !msg.isFlagSet(DCERPC_LAST_FRAG) ) { msgBuf = new NdrBuffer(receiveMoreFragments(msg, inB), 0); msgBuf = new NdrBuffer(inB, 0); msg.decode(msgBuf); if ( ( de = msg.getResult() ) != null ) { throw de;
@Override public void encode ( NdrBuffer buf ) throws NdrException { int start = buf.getIndex(); int alloc_hint_index = 0; buf.advance(16); /* momentarily skip header */ if ( this.ptype == 0 ) { /* Request */ alloc_hint_index = buf.getIndex(); buf.enc_ndr_long(0); /* momentarily skip alloc hint */ buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(getOpnum()); } encode_in(buf); this.length = buf.getIndex() - start; if ( this.ptype == 0 ) { buf.setIndex(alloc_hint_index); this.alloc_hint = this.length - alloc_hint_index; buf.enc_ndr_long(this.alloc_hint); } buf.setIndex(start); encode_header(buf); buf.setIndex(start + this.length); }
buf.start = off; buf.reset(); msg.encode_header(buf); buf.enc_ndr_long(msg.alloc_hint); buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(msg.getOpnum());
msg.call_id = call_id++; msg.encode(buf); buf.start = off; buf.reset(); msg.encode_header(buf); buf.enc_ndr_long(msg.alloc_hint); buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(msg.getOpnum()); msg.decode_header(buf); if (msg.ptype == 2 && msg.isFlagSet(DCERPC_LAST_FRAG) == false) off = msg.length; while (msg.isFlagSet(DCERPC_LAST_FRAG) == false) { int stub_frag_len; msg.decode_header(fbuf); stub_frag_len = msg.length - 24; msg.decode(buf); } finally { jcifs.smb.BufferCache.releaseBuffer(stub); if ((de = msg.getResult()) != null) throw de;
setupReceivedFragment(buf); buf.setIndex(0); msg.decode_header(buf); if ( have == 0 || !msg.isFlagSet(DCERPC_LAST_FRAG) ) { msgBuf = new NdrBuffer(receiveMoreFragments(msg, inB), 0); msgBuf = new NdrBuffer(inB, 0); msg.decode(msgBuf); if ( ( de = msg.getResult() ) != null ) { throw de;
public void encode(NdrBuffer buf) throws NdrException { int start = buf.getIndex(); int alloc_hint_index = 0; buf.advance(16); /* momentarily skip header */ if (ptype == 0) { /* Request */ alloc_hint_index = buf.getIndex(); buf.enc_ndr_long(0); /* momentarily skip alloc hint */ buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(getOpnum()); } encode_in(buf); length = buf.getIndex() - start; if (ptype == 0) { buf.setIndex(alloc_hint_index); alloc_hint = length - alloc_hint_index; buf.enc_ndr_long(alloc_hint); } buf.setIndex(start); encode_header(buf); buf.setIndex(start + length); } public void decode(NdrBuffer buf) throws NdrException {
@Override public void decode ( NdrBuffer buf ) throws NdrException { decode_header(buf); if ( this.ptype != 12 && this.ptype != 2 && this.ptype != 3 && this.ptype != 13 ) throw new NdrException("Unexpected ptype: " + this.ptype); if ( this.ptype == 2 || this.ptype == 3 ) { /* Response or Fault */ this.alloc_hint = buf.dec_ndr_long(); buf.dec_ndr_short(); /* context id */ buf.dec_ndr_short(); /* cancel count */ } if ( this.ptype == 3 || this.ptype == 13 ) { /* Fault */ this.result = buf.dec_ndr_long(); } else { /* Bind_ack or Response */ decode_out(buf); } }
byte[] fragBytes = new byte[this.max_recv]; NdrBuffer fragBuf = new NdrBuffer(fragBytes, 0); while ( !msg.isFlagSet(DCERPC_LAST_FRAG) ) { doReceiveFragment(fragBytes); setupReceivedFragment(fragBuf); fragBuf.reset(); msg.decode_header(fragBuf); int stub_frag_len = msg.length - 24; if ( ( off + stub_frag_len ) > in.length ) {
/** * @param msg * @param out * @return * @throws NdrException * @throws DcerpcException */ private NdrBuffer encodeMessage ( DcerpcMessage msg, byte[] out ) throws NdrException, DcerpcException { NdrBuffer buf = new NdrBuffer(out, 0); msg.flags = DCERPC_FIRST_FRAG | DCERPC_LAST_FRAG; msg.call_id = call_id.incrementAndGet(); msg.encode(buf); if ( this.securityProvider != null ) { buf.setIndex(0); this.securityProvider.wrap(buf); } return buf; }
public void encode(NdrBuffer buf) throws NdrException { int start = buf.getIndex(); int alloc_hint_index = 0; buf.advance(16); /* momentarily skip header */ if (ptype == 0) { /* Request */ alloc_hint_index = buf.getIndex(); buf.enc_ndr_long(0); /* momentarily skip alloc hint */ buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(getOpnum()); } encode_in(buf); length = buf.getIndex() - start; if (ptype == 0) { buf.setIndex(alloc_hint_index); alloc_hint = length - alloc_hint_index; buf.enc_ndr_long(alloc_hint); } buf.setIndex(start); encode_header(buf); buf.setIndex(start + length); } public void decode(NdrBuffer buf) throws NdrException {
public void decode(NdrBuffer buf) throws NdrException { decode_header(buf); if (ptype != 12 && ptype != 2 && ptype != 3 && ptype != 13) throw new NdrException("Unexpected ptype: " + ptype); if (ptype == 2 || ptype == 3) { /* Response or Fault */ alloc_hint = buf.dec_ndr_long(); buf.dec_ndr_short(); /* context id */ buf.dec_ndr_short(); /* cancel count */ } if (ptype == 3 || ptype == 13) { /* Fault */ result = buf.dec_ndr_long(); } else { /* Bind_ack or Response */ decode_out(buf); } }
public void encode(NdrBuffer buf) throws NdrException { int start = buf.getIndex(); int alloc_hint_index = 0; buf.advance(16); /* momentarily skip header */ if (ptype == 0) { /* Request */ alloc_hint_index = buf.getIndex(); buf.enc_ndr_long(0); /* momentarily skip alloc hint */ buf.enc_ndr_short(0); /* context id */ buf.enc_ndr_short(getOpnum()); } encode_in(buf); length = buf.getIndex() - start; if (ptype == 0) { buf.setIndex(alloc_hint_index); alloc_hint = length - alloc_hint_index; buf.enc_ndr_long(alloc_hint); } buf.setIndex(start); encode_header(buf); buf.setIndex(start + length); } public void decode(NdrBuffer buf) throws NdrException {