@Override public void funnel(OFPortStatsRequestVer13 message, PrimitiveSink sink) { // fixed value property version = 4 sink.putByte((byte) 0x4); // fixed value property type = 18 sink.putByte((byte) 0x12); // fixed value property length = 24 sink.putShort((short) 0x18); sink.putLong(message.xid); // fixed value property statsType = 4 sink.putShort((short) 0x4); OFStatsRequestFlagsSerializerVer13.putTo(message.flags, sink); // skip pad (4 bytes) message.portNo.putTo(sink); // skip pad (4 bytes) }
@Override public void funnel(OFBsnGentableDescStatsRequestVer13 message, PrimitiveSink sink) { // fixed value property version = 4 sink.putByte((byte) 0x4); // fixed value property type = 18 sink.putByte((byte) 0x12); // fixed value property length = 24 sink.putShort((short) 0x18); sink.putLong(message.xid); // fixed value property statsType = 65535 sink.putShort((short) 0xffff); OFStatsRequestFlagsSerializerVer13.putTo(message.flags, sink); // skip pad (4 bytes) // fixed value property experimenter = 0x5c16c7L sink.putInt(0x5c16c7); // fixed value property subtype = 0x4L sink.putInt(0x4); }
@Override public void write(ByteBuf bb, OFPortStatsRequestVer13 message) { // fixed value property version = 4 bb.writeByte((byte) 0x4); // fixed value property type = 18 bb.writeByte((byte) 0x12); // fixed value property length = 24 bb.writeShort((short) 0x18); bb.writeInt(U32.t(message.xid)); // fixed value property statsType = 4 bb.writeShort((short) 0x4); OFStatsRequestFlagsSerializerVer13.writeTo(bb, message.flags); // pad: 4 bytes bb.writeZero(4); message.portNo.write4Bytes(bb); // pad: 4 bytes bb.writeZero(4); }
@Override public OFBsnGentableDescStatsRequest readFrom(ChannelBuffer bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 4 byte version = bb.readByte(); if (version != (byte) 0x4) throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got=" + version); // fixed value property type == 18 byte type = bb.readByte(); if (type != (byte) 0x12) throw new OFParseError("Wrong type: Expected=OFType.STATS_REQUEST(18), got=" + type); int length = U16.f(bb.readShort()); if (length != 24) throw new OFParseError("Wrong length: Expected=24(24), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property statsType == 65535 short statsType = bb.readShort(); if (statsType != (short) 0xffff) throw new OFParseError( "Wrong statsType: Expected=OFStatsType.EXPERIMENTER(65535), got=" + statsType); Set<OFStatsRequestFlags> flags = OFStatsRequestFlagsSerializerVer13.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); // fixed value property experimenter == 0x5c16c7L int experimenter = bb.readInt(); if (experimenter != 0x5c16c7) throw new OFParseError( "Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got=" + experimenter); // fixed value property subtype == 0x4L int subtype = bb.readInt(); if (subtype != 0x4) throw new OFParseError("Wrong subtype: Expected=0x4L(0x4L), got=" + subtype); OFBsnGentableDescStatsRequestVer13 bsnGentableDescStatsRequestVer13 = new OFBsnGentableDescStatsRequestVer13(xid, flags); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnGentableDescStatsRequestVer13); return bsnGentableDescStatsRequestVer13; }
@Override public void write(ChannelBuffer bb, OFBsnGentableDescStatsRequestVer13 message) { // fixed value property version = 4 bb.writeByte((byte) 0x4); // fixed value property type = 18 bb.writeByte((byte) 0x12); // fixed value property length = 24 bb.writeShort((short) 0x18); bb.writeInt(U32.t(message.xid)); // fixed value property statsType = 65535 bb.writeShort((short) 0xffff); OFStatsRequestFlagsSerializerVer13.writeTo(bb, message.flags); // pad: 4 bytes bb.writeZero(4); // fixed value property experimenter = 0x5c16c7L bb.writeInt(0x5c16c7); // fixed value property subtype = 0x4L bb.writeInt(0x4); }
@Override public OFPortStatsRequest readFrom(ByteBuf bb) throws OFParseError { int start = bb.readerIndex(); // fixed value property version == 4 byte version = bb.readByte(); if (version != (byte) 0x4) throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got=" + version); // fixed value property type == 18 byte type = bb.readByte(); if (type != (byte) 0x12) throw new OFParseError("Wrong type: Expected=OFType.STATS_REQUEST(18), got=" + type); int length = U16.f(bb.readShort()); if (length != 24) throw new OFParseError("Wrong length: Expected=24(24), got=" + length); if (bb.readableBytes() + (bb.readerIndex() - start) < length) { // Buffer does not have all data yet bb.readerIndex(start); return null; } if (logger.isTraceEnabled()) logger.trace("readFrom - length={}", length); long xid = U32.f(bb.readInt()); // fixed value property statsType == 4 short statsType = bb.readShort(); if (statsType != (short) 0x4) throw new OFParseError("Wrong statsType: Expected=OFStatsType.PORT(4), got=" + statsType); Set<OFStatsRequestFlags> flags = OFStatsRequestFlagsSerializerVer13.readFrom(bb); // pad: 4 bytes bb.skipBytes(4); OFPort portNo = OFPort.read4Bytes(bb); // pad: 4 bytes bb.skipBytes(4); OFPortStatsRequestVer13 portStatsRequestVer13 = new OFPortStatsRequestVer13(xid, flags, portNo); if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", portStatsRequestVer13); return portStatsRequestVer13; }