コード例 #1
0
    @Override
    public OFMeterFeaturesStatsReply readFrom(ByteBuf bb) throws OFParseError {
      int start = bb.readerIndex();
      // fixed value property version == 5
      byte version = bb.readByte();
      if (version != (byte) 0x5)
        throw new OFParseError("Wrong version: Expected=OFVersion.OF_14(5), got=" + version);
      // fixed value property type == 19
      byte type = bb.readByte();
      if (type != (byte) 0x13)
        throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(19), got=" + type);
      int length = U16.f(bb.readShort());
      if (length != 32) throw new OFParseError("Wrong length: Expected=32(32), 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 == 11
      short statsType = bb.readShort();
      if (statsType != (short) 0xb)
        throw new OFParseError(
            "Wrong statsType: Expected=OFStatsType.METER_FEATURES(11), got=" + statsType);
      Set<OFStatsReplyFlags> flags = OFStatsReplyFlagsSerializerVer14.readFrom(bb);
      // pad: 4 bytes
      bb.skipBytes(4);
      OFMeterFeatures features = OFMeterFeaturesVer14.READER.readFrom(bb);

      OFMeterFeaturesStatsReplyVer14 meterFeaturesStatsReplyVer14 =
          new OFMeterFeaturesStatsReplyVer14(xid, flags, features);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", meterFeaturesStatsReplyVer14);
      return meterFeaturesStatsReplyVer14;
    }
コード例 #2
0
 @Override
 public void funnel(OFMeterStatsReplyVer14 message, PrimitiveSink sink) {
   // fixed value property version = 5
   sink.putByte((byte) 0x5);
   // fixed value property type = 19
   sink.putByte((byte) 0x13);
   // FIXME: skip funnel of length
   sink.putLong(message.xid);
   // fixed value property statsType = 9
   sink.putShort((short) 0x9);
   OFStatsReplyFlagsSerializerVer14.putTo(message.flags, sink);
   // skip pad (4 bytes)
   FunnelUtils.putList(message.entries, sink);
 }
コード例 #3
0
 @Override
 public void funnel(OFMeterFeaturesStatsReplyVer14 message, PrimitiveSink sink) {
   // fixed value property version = 5
   sink.putByte((byte) 0x5);
   // fixed value property type = 19
   sink.putByte((byte) 0x13);
   // fixed value property length = 32
   sink.putShort((short) 0x20);
   sink.putLong(message.xid);
   // fixed value property statsType = 11
   sink.putShort((short) 0xb);
   OFStatsReplyFlagsSerializerVer14.putTo(message.flags, sink);
   // skip pad (4 bytes)
   message.features.putTo(sink);
 }
コード例 #4
0
 @Override
 public void write(ByteBuf bb, OFMeterFeaturesStatsReplyVer14 message) {
   // fixed value property version = 5
   bb.writeByte((byte) 0x5);
   // fixed value property type = 19
   bb.writeByte((byte) 0x13);
   // fixed value property length = 32
   bb.writeShort((short) 0x20);
   bb.writeInt(U32.t(message.xid));
   // fixed value property statsType = 11
   bb.writeShort((short) 0xb);
   OFStatsReplyFlagsSerializerVer14.writeTo(bb, message.flags);
   // pad: 4 bytes
   bb.writeZero(4);
   message.features.writeTo(bb);
 }
コード例 #5
0
    @Override
    public OFBsnImageDescStatsReply readFrom(ChannelBuffer bb) throws OFParseError {
      int start = bb.readerIndex();
      // fixed value property version == 5
      byte version = bb.readByte();
      if (version != (byte) 0x5)
        throw new OFParseError("Wrong version: Expected=OFVersion.OF_14(5), got=" + version);
      // fixed value property type == 19
      byte type = bb.readByte();
      if (type != (byte) 0x13)
        throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(19), got=" + type);
      int length = U16.f(bb.readShort());
      if (length != 536) throw new OFParseError("Wrong length: Expected=536(536), 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<OFStatsReplyFlags> flags = OFStatsReplyFlagsSerializerVer14.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 == 0xeL
      int subtype = bb.readInt();
      if (subtype != 0xe)
        throw new OFParseError("Wrong subtype: Expected=0xeL(0xeL), got=" + subtype);
      String imageChecksum = ChannelUtils.readFixedLengthString(bb, 256);
      String startupConfigChecksum = ChannelUtils.readFixedLengthString(bb, 256);

      OFBsnImageDescStatsReplyVer14 bsnImageDescStatsReplyVer14 =
          new OFBsnImageDescStatsReplyVer14(xid, flags, imageChecksum, startupConfigChecksum);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", bsnImageDescStatsReplyVer14);
      return bsnImageDescStatsReplyVer14;
    }
コード例 #6
0
 @Override
 public void funnel(OFBsnImageDescStatsReplyVer14 message, PrimitiveSink sink) {
   // fixed value property version = 5
   sink.putByte((byte) 0x5);
   // fixed value property type = 19
   sink.putByte((byte) 0x13);
   // fixed value property length = 536
   sink.putShort((short) 0x218);
   sink.putLong(message.xid);
   // fixed value property statsType = 65535
   sink.putShort((short) 0xffff);
   OFStatsReplyFlagsSerializerVer14.putTo(message.flags, sink);
   // skip pad (4 bytes)
   // fixed value property experimenter = 0x5c16c7L
   sink.putInt(0x5c16c7);
   // fixed value property subtype = 0xeL
   sink.putInt(0xe);
   sink.putUnencodedChars(message.imageChecksum);
   sink.putUnencodedChars(message.startupConfigChecksum);
 }
コード例 #7
0
 @Override
 public void write(ChannelBuffer bb, OFBsnImageDescStatsReplyVer14 message) {
   // fixed value property version = 5
   bb.writeByte((byte) 0x5);
   // fixed value property type = 19
   bb.writeByte((byte) 0x13);
   // fixed value property length = 536
   bb.writeShort((short) 0x218);
   bb.writeInt(U32.t(message.xid));
   // fixed value property statsType = 65535
   bb.writeShort((short) 0xffff);
   OFStatsReplyFlagsSerializerVer14.writeTo(bb, message.flags);
   // pad: 4 bytes
   bb.writeZero(4);
   // fixed value property experimenter = 0x5c16c7L
   bb.writeInt(0x5c16c7);
   // fixed value property subtype = 0xeL
   bb.writeInt(0xe);
   ChannelUtils.writeFixedLengthString(bb, message.imageChecksum, 256);
   ChannelUtils.writeFixedLengthString(bb, message.startupConfigChecksum, 256);
 }
コード例 #8
0
    @Override
    public void write(ByteBuf bb, OFMeterStatsReplyVer14 message) {
      int startIndex = bb.writerIndex();
      // fixed value property version = 5
      bb.writeByte((byte) 0x5);
      // fixed value property type = 19
      bb.writeByte((byte) 0x13);
      // length is length of variable message, will be updated at the end
      int lengthIndex = bb.writerIndex();
      bb.writeShort(U16.t(0));

      bb.writeInt(U32.t(message.xid));
      // fixed value property statsType = 9
      bb.writeShort((short) 0x9);
      OFStatsReplyFlagsSerializerVer14.writeTo(bb, message.flags);
      // pad: 4 bytes
      bb.writeZero(4);
      ChannelUtils.writeList(bb, message.entries);

      // update length field
      int length = bb.writerIndex() - startIndex;
      bb.setShort(lengthIndex, length);
    }
コード例 #9
0
    @Override
    public OFMeterStatsReply readFrom(ByteBuf bb) throws OFParseError {
      int start = bb.readerIndex();
      // fixed value property version == 5
      byte version = bb.readByte();
      if (version != (byte) 0x5)
        throw new OFParseError("Wrong version: Expected=OFVersion.OF_14(5), got=" + version);
      // fixed value property type == 19
      byte type = bb.readByte();
      if (type != (byte) 0x13)
        throw new OFParseError("Wrong type: Expected=OFType.STATS_REPLY(19), got=" + type);
      int length = U16.f(bb.readShort());
      if (length < MINIMUM_LENGTH)
        throw new OFParseError(
            "Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + 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 == 9
      short statsType = bb.readShort();
      if (statsType != (short) 0x9)
        throw new OFParseError("Wrong statsType: Expected=OFStatsType.METER(9), got=" + statsType);
      Set<OFStatsReplyFlags> flags = OFStatsReplyFlagsSerializerVer14.readFrom(bb);
      // pad: 4 bytes
      bb.skipBytes(4);
      List<OFMeterStats> entries =
          ChannelUtils.readList(bb, length - (bb.readerIndex() - start), OFMeterStatsVer14.READER);

      OFMeterStatsReplyVer14 meterStatsReplyVer14 = new OFMeterStatsReplyVer14(xid, flags, entries);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", meterStatsReplyVer14);
      return meterStatsReplyVer14;
    }