public bool sameAs(ReConfigChunk other) { // we ignore other var types for now.... bool ret = false; // assume the negative. if (other != null) { // if there are 2 params and both match if ((this.hasIncomingReset() && other.hasIncomingReset()) && (this.hasOutgoingReset() && other.hasOutgoingReset())) { ret = this.getIncomingReset().sameAs(other.getIncomingReset()) && this.getOutgoingReset().sameAs(other.getOutgoingReset()); } else { // there is only one (of these) params // that has to match too if (this.hasIncomingReset() && other.hasIncomingReset()) { ret = this.getIncomingReset().sameAs(other.getIncomingReset()); } if (this.hasOutgoingReset() && other.hasOutgoingReset()) { ret = this.getOutgoingReset().sameAs(other.getOutgoingReset()); } } } return(ret); }
/* * Chunk Length: 16 bits (unsigned integer) * * This value represents the size of the chunk in bytes, including * the Chunk Type, Chunk Flags, Chunk Length, and Chunk Value fields. * Therefore, if the Chunk Value field is zero-length, the Length * field will be set to 4. The Chunk Length field does not count any * chunk padding. */ public static Chunk mkChunk(ByteBuffer pkt) { Chunk ret = null; if (pkt.remaining() >= 4) { CType type = (CType)pkt.GetByte(); byte flags = pkt.GetByte(); int length = pkt.GetUShort(); switch (type) { case CType.DATA: ret = new DataChunk(type, flags, length, pkt); break; case CType.INIT: ret = new InitChunk(type, flags, length, pkt); break; case CType.SACK: ret = new SackChunk(type, flags, length, pkt); break; case CType.INITACK: ret = new InitAckChunk(type, flags, length, pkt); break; case CType.COOKIE_ECHO: ret = new CookieEchoChunk(type, flags, length, pkt); break; case CType.COOKIE_ACK: ret = new CookieAckChunk(type, flags, length, pkt); break; case CType.ABORT: ret = new AbortChunk(type, flags, length, pkt); break; case CType.HEARTBEAT: ret = new HeartBeatChunk(type, flags, length, pkt); break; case CType.RE_CONFIG: ret = new ReConfigChunk(type, flags, length, pkt); break; default: Logger.Warn("Default chunk type " + type + " read in "); ret = new FailChunk(type, flags, length, pkt); break; } if (ret != null) { if (pkt.hasRemaining()) { int mod = ret.getLength() % 4; if (mod != 0) { for (int pad = mod; pad < 4; pad++) { pkt.GetByte(); } } } } } return(ret); }