Пример #1
0
        public override bool Decode(PduMarshaler marshaler)
        {
            HeaderBits = new Header(marshaler.ReadByte());

            Cmd_Values c = HeaderBits.Cmd;

            // TODO: Check this logic
            // Check in the special case that the Cmd bit field just
            // equals to Cmd_Values.Unknown
            if (c == Cmd_Values.Unknown)
            {
                return false;
            }

            try
            {
                if (c == Cmd)
                {
                    DoUnmarshal(marshaler);
                    SetRawData(false, marshaler);
                    return true;
                }
            }
            catch (OverflowException)
            {
                marshaler.Reset();
            }

            return false;
        }
Пример #2
0
 public DynamicVCPDU()
 {
     // Unknown PDU doesn't support header.
     if (Cmd != Cmd_Values.Unknown)
     {
         HeaderBits = new Header(Cmd, 0, 0);
     }
 }
Пример #3
0
        public CreateReqDvcPdu(int priority, uint channelId, string channelName)
        {
            HeaderBits = new Header(Cmd, priority, cbChId_Values.Invalid);

            this.ChannelId = channelId;
            this.ChannelName = channelName;

            UpdateCbChannelId();
        }
Пример #4
0
        public CreateRespDvcPdu(uint channelId, int creationStatus)
        {
            HeaderBits = new Header(Cmd, 0, cbChId_Values.Invalid);

            this.ChannelId = channelId;
            this.CreationStatus = creationStatus;

            UpdateCbChannelId();
        }
Пример #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        public SoftSyncReqDvcPDU(SoftSyncReqFlags_Value flags, ushort numberOfTunnels, SoftSyncChannelList[] softSyncChannelLists)
        {
            HeaderBits = new Header(Cmd_Values.SoftSyncReq, 0, 0);
            this.Pad = 0;
            this.Flags = flags;
            this.NumberOfTunnels = numberOfTunnels;
            this.SoftSyncChannelLists = softSyncChannelLists;
            // Section 2.2.5.1, Length (4 bytes): A 32-bit, unsigned integer indicating the total size, in bytes, of SoftSyncChannelLists field.
            // TDI: this length should also including the length of Length(4 bytes), Flags(2 bytes) and NumberOfTunnels(2 bytes) in DYNVC_SOFT_SYNC_REQUEST PDU.
            // this length value is Length(4) + Flags(2) + NumberOfTunnels(2) = 8.
            this.Length = 8;

            if(flags.HasFlag(SoftSyncReqFlags_Value.SOFT_SYNC_CHANNEL_LIST_PRESENT))
            {
                if (softSyncChannelLists == null)
                {
                    DynamicVCException.Throw("Should have one or more Soft-Sync Channel Lists.");
                }

                foreach (var channel in softSyncChannelLists)
                {
                    this.Length += (uint)channel.GetSize();
                }
            }
        }