List of usage examples for io.netty.buffer ByteBuf order
@Deprecated public abstract ByteBuf order(ByteOrder endianness);
From source file:eu.xworlds.util.raknet.protocol.ConnectionRequest.java
License:Open Source License
@Override public ByteBuf encode() { int size = 1 + SIZE_GUID + SIZE_TIME + 1; if (this.doSecurity) { size += 32 + 1;//from w w w.j av a 2 s . co m if (this.doIdentity) { size += EASYHANDSHAKE_IDENTITY_BYTES; } } final ByteBuf buf = Unpooled.buffer(size); buf.order(ByteOrder.BIG_ENDIAN); buf.writeByte(ID); writeGuid(buf, this.clientGuid); writeTime(buf, this.time); buf.writeBoolean(this.doSecurity); if (this.doSecurity) { buf.writeBytes(this.proof); buf.writeBoolean(this.doIdentity); if (this.doIdentity) { buf.writeBytes(this.identity); } } return buf; }
From source file:eu.xworlds.util.raknet.protocol.DetectLostConnections.java
License:Open Source License
@Override public ByteBuf encode() { final ByteBuf buf = Unpooled.buffer(1); buf.order(ByteOrder.BIG_ENDIAN); buf.writeByte(ID);//from w w w . j a v a 2 s .c o m return buf; }
From source file:eu.xworlds.util.raknet.protocol.OpenConnectionReply1.java
License:Open Source License
@Override public ByteBuf encode() { int size = 1 + this.magic.length + SIZE_GUID + 1 + 2; if (this.hasSecurity) { size += 4 + this.publicKey.length; }//from w w w . j a v a 2s . c o m final ByteBuf result = Unpooled.buffer(size); result.order(ByteOrder.BIG_ENDIAN); result.writeByte(ID); result.writeBytes(this.magic); writeGuid(result, this.serverGuid); result.writeBoolean(this.hasSecurity); if (this.hasSecurity) { result.writeInt(this.securityCookie); result.writeBytes(this.publicKey); } writeUnsignedShort(result, this.mtuSize); return result; }
From source file:eu.xworlds.util.raknet.protocol.OpenConnectionReply2.java
License:Open Source License
@Override public ByteBuf encode() { int size = 1 + this.magic.length + SIZE_GUID + 2 + 2 + 1; if (this.doSecurity) { size += this.securityAnswer.length; }//w w w .j av a 2 s . c om final ByteBuf buf = Unpooled.buffer(size); buf.order(ByteOrder.BIG_ENDIAN); buf.writeByte(ID); buf.writeBytes(this.magic); writeGuid(buf, this.serverGuid); writeUnsignedShort(buf, this.port); writeUnsignedShort(buf, this.mtuSize); buf.writeBoolean(this.doSecurity); if (this.doSecurity) { buf.writeBytes(this.securityAnswer); } return buf; }
From source file:eu.xworlds.util.raknet.protocol.OpenConnectionRequest1.java
License:Open Source License
@Override public ByteBuf encode() { final ByteBuf result = Unpooled.buffer(1 + 16 + this.magic.length + 1 + this.mtuPayload.length); result.order(ByteOrder.BIG_ENDIAN); result.writeByte(ID);/*w w w.j a va 2s . c o m*/ result.writeBytes(this.magic); result.writeByte(this.procotolVersion); result.writeBytes(this.mtuPayload); return result; }
From source file:eu.xworlds.util.raknet.protocol.OpenConnectionRequest2.java
License:Open Source License
@Override public ByteBuf encode() { int size = 1 + this.magic.length + SIZE_IPV4_ADDRESS + 2 + SIZE_GUID; if (this.useSecurity) { size += 4 + 1;//from w ww . j av a 2 s. co m if (this.clientWroteChallenge) { size += this.clientChallenge.length; } } final ByteBuf buf = Unpooled.buffer(size); buf.order(ByteOrder.BIG_ENDIAN); buf.writeByte(ID); buf.writeBytes(this.magic); if (this.useSecurity) { buf.writeInt(this.cookie); buf.writeBoolean(this.clientWroteChallenge); if (this.clientWroteChallenge) { buf.writeBytes(this.clientChallenge); } } writeIpv4Address(buf, this.bindingAddress); writeUnsignedShort(buf, this.mtuSize); writeGuid(buf, this.guid); return buf; }
From source file:eu.xworlds.util.raknet.protocol.OutOfBandInternal.java
License:Open Source License
@Override public ByteBuf encode() { int size = 1 + SIZE_GUID + this.magic.length; if (this.oobData != null) { size += this.oobData.length; }//from w ww . j a v a 2 s . c o m final ByteBuf buf = Unpooled.buffer(size); buf.order(ByteOrder.BIG_ENDIAN); buf.writeByte(ID); writeGuid(buf, this.guid); buf.writeBytes(this.magic); if (this.oobData != null) { buf.writeBytes(this.oobData); } return buf; }
From source file:eu.xworlds.util.raknet.protocol.RemoteSystemRequiresPublicKey.java
License:Open Source License
@Override public ByteBuf encode() { final ByteBuf buf = Unpooled.buffer(1 + 1); buf.order(ByteOrder.BIG_ENDIAN); buf.writeByte(ID);/* ww w.j a va 2 s . c o m*/ buf.writeByte(this.error.ordinal()); return buf; }
From source file:eu.xworlds.util.raknet.protocol.SndReceiptAcked.java
License:Open Source License
@Override public ByteBuf encode() { final ByteBuf buf = Unpooled.buffer(1 + 4); buf.order(ByteOrder.BIG_ENDIAN); buf.writeByte(ID);// ww w .j ava 2s .c om writeUnsignedInt(buf, this.serial); return buf; }
From source file:eu.xworlds.util.raknet.protocol.UnconnectedPing.java
License:Open Source License
@Override public ByteBuf encode() { final ByteBuf result = Unpooled.buffer(1 + SIZE_TIME + this.magic.length); result.order(ByteOrder.BIG_ENDIAN); result.writeByte(ID);//from ww w . j a v a 2 s . c o m writeTime(result, this.time); result.writeBytes(this.magic); return result; }