コード例 #1
0
 @Override
 public void funnel(OFBsnTlvStatusVer13 message, PrimitiveSink sink) {
   // fixed value property type = 0x61
   sink.putShort((short) 0x61);
   // fixed value property length = 5
   sink.putShort((short) 0x5);
   OFBsnStatusSerializerVer13.putTo(message.value, sink);
 }
コード例 #2
0
 @Override
 public void write(ByteBuf bb, OFBsnTlvStatusVer13 message) {
   // fixed value property type = 0x61
   bb.writeShort((short) 0x61);
   // fixed value property length = 5
   bb.writeShort((short) 0x5);
   OFBsnStatusSerializerVer13.writeTo(bb, message.value);
 }
コード例 #3
0
    @Override
    public OFBsnTlvStatus readFrom(ByteBuf bb) throws OFParseError {
      int start = bb.readerIndex();
      // fixed value property type == 0x61
      short type = bb.readShort();
      if (type != (short) 0x61)
        throw new OFParseError("Wrong type: Expected=0x61(0x61), got=" + type);
      int length = U16.f(bb.readShort());
      if (length != 5) throw new OFParseError("Wrong length: Expected=5(5), 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);
      OFBsnStatus value = OFBsnStatusSerializerVer13.readFrom(bb);

      OFBsnTlvStatusVer13 bsnTlvStatusVer13 = new OFBsnTlvStatusVer13(value);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnTlvStatusVer13);
      return bsnTlvStatusVer13;
    }