コード例 #1
0
  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;

    result = prime * (int) (xid ^ (xid >>> 32));
    result = prime * result + ((code == null) ? 0 : code.hashCode());
    result = prime * result + ((data == null) ? 0 : data.hashCode());
    return result;
  }
コード例 #2
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    OFBadPropertyErrorMsgVer14 other = (OFBadPropertyErrorMsgVer14) obj;

    if (xid != other.xid) return false;
    if (code == null) {
      if (other.code != null) return false;
    } else if (!code.equals(other.code)) return false;
    if (data == null) {
      if (other.data != null) return false;
    } else if (!data.equals(other.data)) return false;
    return true;
  }
コード例 #3
0
    @Override
    public OFBadPropertyErrorMsg 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 == 1
      byte type = bb.readByte();
      if (type != (byte) 0x1)
        throw new OFParseError("Wrong type: Expected=OFType.ERROR(1), 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 errType == 14
      short errType = bb.readShort();
      if (errType != (short) 0xe)
        throw new OFParseError(
            "Wrong errType: Expected=OFErrorType.BAD_PROPERTY(14), got=" + errType);
      OFBadPropertyCode code = OFBadPropertyCodeSerializerVer14.readFrom(bb);
      OFErrorCauseData data =
          OFErrorCauseData.read(bb, length - (bb.readerIndex() - start), OFVersion.OF_14);

      OFBadPropertyErrorMsgVer14 badPropertyErrorMsgVer14 =
          new OFBadPropertyErrorMsgVer14(xid, code, data);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", badPropertyErrorMsgVer14);
      return badPropertyErrorMsgVer14;
    }
コード例 #4
0
    @Override
    public OFFlowModFailedErrorMsg readFrom(ByteBuf bb) throws OFParseError {
      int start = bb.readerIndex();
      // fixed value property version == 1
      byte version = bb.readByte();
      if (version != (byte) 0x1)
        throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), got=" + version);
      // fixed value property type == 1
      byte type = bb.readByte();
      if (type != (byte) 0x1)
        throw new OFParseError("Wrong type: Expected=OFType.ERROR(1), 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 errType == 3
      short errType = bb.readShort();
      if (errType != (short) 0x3)
        throw new OFParseError(
            "Wrong errType: Expected=OFErrorType.FLOW_MOD_FAILED(3), got=" + errType);
      OFFlowModFailedCode code = OFFlowModFailedCodeSerializerVer10.readFrom(bb);
      OFErrorCauseData data =
          OFErrorCauseData.read(bb, length - (bb.readerIndex() - start), OFVersion.OF_10);

      OFFlowModFailedErrorMsgVer10 flowModFailedErrorMsgVer10 =
          new OFFlowModFailedErrorMsgVer10(xid, code, data);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", flowModFailedErrorMsgVer10);
      return flowModFailedErrorMsgVer10;
    }