public DefaultConnection(int transmitLength, int receiveLength) { ndr = new NetworkDataRepresentation(); transmitBuffer = new NdrBuffer(new byte[transmitLength], 0); receiveBuffer = new NdrBuffer(new byte[receiveLength], 0); }
public void writeFormat ( boolean connectionless ) { int index = buf.getIndex (); buf.index += connectionless ? 3 : 4; format.writeFormat ( buf.buf, index, connectionless ); }
public int align(int boundary) { int m = boundary - 1; int i = index - start; int n = ((i + m) & ~m) - i; advance(n); return n; } public void enc_ndr_small(int s) {
static void writeOctetArrayLE(NetworkDataRepresentation ndr, byte[] b) { for (int i = 0;i < b.length; i++) { ndr.writeUnsignedSmall(b[b.length - i - 1]); } }
protected void writeBody ( NetworkDataRepresentation ndr ) { ndr.writeUnsignedLong ( 0 ); } }
@Override public void write ( final NetworkDataRepresentation ndr ) { ndr.setBuffer ( this.buffer ); //this buffer is prepared via read. }
static byte[] readOctetArrayLE(NetworkDataRepresentation ndr, int length) { byte[] bytes = new byte[8]; ndr.readOctetArray(bytes,0,8); for (int i = 0;i < 4; i++) { byte t = bytes[i]; bytes[i] = bytes[7-i]; bytes[7-i] = t; } return bytes; }
public void decode(NetworkDataRepresentation ndr, NdrBuffer src) throws NdrException { ndr.buf = src; read(ndr); } public void write(NetworkDataRepresentation ndr) { }
public void writeFormat(Format format) { format.writeFormat(buf.buf, buf.index, false); buf.index += 4; } public void writeFormat(boolean connectionless) {
public void readOctetArray ( byte[] b, int i, int l ) { buf.readOctetArray ( b, i, l ); } }
public void encode(NetworkDataRepresentation ndr, NdrBuffer dst) throws NdrException { ndr.buf = dst; write(ndr); /* just for compatibility with jarapac < 0.2 */ } public void decode(NetworkDataRepresentation ndr, NdrBuffer src) throws NdrException {
public void decode(NetworkDataRepresentation ndr, NdrBuffer src) throws NdrException { majorVersion = src.dec_ndr_small(); minorVersion = src.dec_ndr_small(); } }
public void writeFormat(byte[] dest, int index, boolean connectionless) { int val = getDataRepresentation(); dest[index++] = (byte) ((val >> 24) & 0xff); dest[index++] = (byte) ((val >> 16) & 0xff); dest[index] = (byte) 0x00; if (!connectionless) dest[++index] = (byte) 0x00; }
public Format readFormat(boolean connectionless) { Format format = Format.readFormat(buf.buf, buf.index, connectionless); buf.index += 4; return format; } public void writeFormat(Format format) {
public DefaultConnection ( int transmitLength, int receiveLength ) { ndr = new NetworkDataRepresentation (); transmitBuffer = new NdrBuffer ( new byte[transmitLength], 0 ); receiveBuffer = new NdrBuffer ( new byte[receiveLength], 0 ); }
public void writeFormat(boolean connectionless) { int index = buf.getIndex(); buf.index += connectionless ? 3 : 4; format.writeFormat(buf.buf, index, connectionless); }
public int dec_ndr_small() { int val = buf[index] & 0xFF; advance(1); return val; } public void enc_ndr_short(int s) {
public void decode(NetworkDataRepresentation ndr, NdrBuffer src) throws NdrException { ndr.buf = src; read(ndr); } public void write(NetworkDataRepresentation ndr) { }
public DefaultConnection(int transmitLength, int receiveLength) { ndr = new NetworkDataRepresentation(); transmitBuffer = new NdrBuffer(new byte[transmitLength], 0); receiveBuffer = new NdrBuffer(new byte[receiveLength], 0); }
public void writeFormat(boolean connectionless) { int index = buf.getIndex(); buf.index += connectionless ? 3 : 4; format.writeFormat(buf.buf, index, connectionless); }