コード例 #1
0
ファイル: InitAckChunk.cs プロジェクト: sgf/SCTP
        public InitAckChunk(CType type, byte flags, int length, ByteBuffer pkt)
            : base(type, flags, length, pkt)
        {
            if (_body.remaining() >= 16)
            {
                _initiateTag    = _body.GetInt();
                _adRecWinCredit = _body.GetUInt();;
                _numOutStreams  = _body.GetUShort();
                _numInStreams   = _body.GetUShort();
                _initialTSN     = _body.GetUInt();
                Logger.Trace("Init Ack" + this.ToString());
                while (_body.hasRemaining())
                {
                    VariableParam v = readVariable();
                    _varList.Add(v);
                }

                foreach (VariableParam v in _varList)
                {
                    // now look for variables we are expecting...
                    Logger.Trace("variable of type: " + v.getName() + " " + v.ToString());
                    if (typeof(StateCookie).IsAssignableFrom(v.GetType()))
                    {
                        _cookie = ((StateCookie)v).getData();
                    }
                    else
                    {
                        Logger.Trace("ignored variable of type: " + v.getName());
                    }
                }
            }
        }
コード例 #2
0
 public InitChunk(CType type, byte flags, int length, ByteBuffer pkt)
     : base(type, flags, length, pkt)
 {
     if (_body.remaining() >= 16)
     {
         _initiateTag    = _body.GetInt();
         _adRecWinCredit = _body.GetUInt();
         _numOutStreams  = _body.GetUShort();
         _numInStreams   = _body.GetUShort();
         _initialTSN     = _body.GetUInt();
         Logger.Trace("Init " + this.ToString());
         while (_body.hasRemaining())
         {
             VariableParam v = readVariable();
             _varList.Add(v);
         }
         foreach (VariableParam v in _varList)
         {
             // now look for variables we are expecting...
             Logger.Trace("variable of type: " + v.getName() + " " + v.ToString());
             if (typeof(SupportedExtensions).IsAssignableFrom(v.GetType()))
             {
                 _farSupportedExtensions = ((SupportedExtensions)v).getData();
             }
             else if (typeof(RandomParam).IsAssignableFrom(v.GetType()))
             {
                 _farRandom = ((RandomParam)v).getData();
             }
             else if (typeof(ForwardTSNsupported).IsAssignableFrom(v.GetType()))
             {
                 _farForwardTSNsupported = true;
             }
             else if (typeof(RequestedHMACAlgorithmParameter).IsAssignableFrom(v.GetType()))
             {
                 _farHmacs = ((RequestedHMACAlgorithmParameter)v).getData();
             }
             else if (typeof(ChunkListParam).IsAssignableFrom(v.GetType()))
             {
                 _farChunks = ((ChunkListParam)v).getData();
             }
             else
             {
                 Logger.Trace("unexpected variable of type: " + v.getName());
             }
         }
     }
 }