当前位置: 首页>>代码示例>>C#>>正文


C# ByteArraySegment.EncapsulatedBytes方法代码示例

本文整理汇总了C#中ByteArraySegment.EncapsulatedBytes方法的典型用法代码示例。如果您正苦于以下问题:C# ByteArraySegment.EncapsulatedBytes方法的具体用法?C# ByteArraySegment.EncapsulatedBytes怎么用?C# ByteArraySegment.EncapsulatedBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ByteArraySegment的用法示例。


在下文中一共展示了ByteArraySegment.EncapsulatedBytes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IGMPv2Packet

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="bas">
		/// A <see cref="ByteArraySegment"/>
		/// </param>
		public IGMPv2Packet(ByteArraySegment bas) {
			// set the header field, header field values are retrieved from this byte array
			header = new ByteArraySegment(bas);
			header.Length = UdpFields.HeaderLength;

			// store the payload bytes
			payloadPacketOrData = new PacketOrByteArraySegment();
			payloadPacketOrData.TheByteArraySegment = header.EncapsulatedBytes();
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:15,代码来源:IGMPv2Packet.cs

示例2: DataDataFrame

            /// <summary>
            /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.DataDataFrame"/> class.
            /// </summary>
            /// <param name='bas'>
            /// Bas.
            /// </param>
            public DataDataFrame (ByteArraySegment bas)
            {
                header = new ByteArraySegment (bas);

                FrameControl = new FrameControlField (FrameControlBytes);
                Duration = new DurationField (DurationBytes);
                SequenceControl = new SequenceControlField (SequenceControlBytes);
                ReadAddresses (); //must do this after reading FrameControl

                header.Length = FrameSize;
                var availablePayloadLength = GetAvailablePayloadLength();
                if (availablePayloadLength > SNAPFields.HeaderLength)
                {
                    payloadPacketOrData.ThePacket = new SNAPPacket(header.EncapsulatedBytes(availablePayloadLength));
                }
                else
                {
                    payloadPacketOrData.TheByteArraySegment = header.EncapsulatedBytes(availablePayloadLength);
                }
            }
开发者ID:joerango,项目名称:packetnet,代码行数:26,代码来源:DataDataFrame.cs

示例3: ParseEncapsulatedBytes

 /// <summary>
 /// Used by the Ieee80211PpiPacket constructor. 
 /// </summary>
 /// <param name="header">
 /// A <see cref="ByteArraySegment"/>
 /// </param>
 /// <param name="commonField">
 /// The <see cref="PpiCommon"/> object in the PPI packet or null if not available
 /// </param>
 /// <returns>
 /// A <see cref="PacketOrByteArraySegment"/>
 /// </returns>
 internal static PacketOrByteArraySegment ParseEncapsulatedBytes (ByteArraySegment header, PpiCommon commonField)
 {
     // slice off the payload
     var payload = header.EncapsulatedBytes ();
     var payloadPacketOrData = new PacketOrByteArraySegment ();
     MacFrame frame = null;
     
     if (commonField != null)
     {
         bool fcsPresent = ((commonField.Flags & PpiCommon.CommonFlags.FcsIncludedInFrame) == PpiCommon.CommonFlags.FcsIncludedInFrame);
         
         if (fcsPresent)
         {
             frame = MacFrame.ParsePacketWithFcs (payload);
         }
         else
         {
             frame = MacFrame.ParsePacket (payload);
         }
     }
     else
     {
         frame = MacFrame.ParsePacket (payload);
     }
     
     if (frame == null)
     {
         payloadPacketOrData.TheByteArraySegment = payload;
     }
     else
     {
         payloadPacketOrData.ThePacket = frame;
     }
     
     return payloadPacketOrData;
 }
开发者ID:alanrushforth,项目名称:Add-802.11-to-Packt.Net,代码行数:48,代码来源:PpiPacket.cs

示例4: ParseEncapsulatedBytes

 internal static PacketOrByteArraySegment ParseEncapsulatedBytes(ByteArraySegment Header, EthernetPacketType Type, PosixTimeval Timeval)
 {
     ByteArraySegment segment = Header.EncapsulatedBytes();
     PacketOrByteArraySegment segment2 = new PacketOrByteArraySegment();
     EthernetPacketType type = Type;
     if (type != EthernetPacketType.IpV4)
     {
         if (type == EthernetPacketType.Arp)
         {
             segment2.ThePacket = new ARPPacket(segment.Bytes, segment.Offset, Timeval);
             return segment2;
         }
         if (type == EthernetPacketType.IpV6)
         {
             segment2.ThePacket = new IPv6Packet(segment.Bytes, segment.Offset, Timeval);
             return segment2;
         }
         if (type == EthernetPacketType.PointToPointProtocolOverEthernetSessionStage)
         {
             segment2.ThePacket = new PPPoEPacket(segment.Bytes, segment.Offset, Timeval);
             return segment2;
         }
         if (type == EthernetPacketType.LLDP)
         {
             segment2.ThePacket = new LLDPPacket(segment.Bytes, segment.Offset, Timeval);
             return segment2;
         }
         segment2.TheByteArraySegment = segment;
         return segment2;
     }
     segment2.ThePacket = new IPv4Packet(segment.Bytes, segment.Offset, Timeval);
     return segment2;
 }
开发者ID:BGCX261,项目名称:znqq-svn-to-git,代码行数:33,代码来源:EthernetPacket.cs

示例5: ActionFrame

            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public ActionFrame (ByteArraySegment bas)
            {
                header = new ByteArraySegment (bas);

                FrameControl = new FrameControlField (FrameControlBytes);
                Duration = new DurationField (DurationBytes);
                DestinationAddress = GetAddress (0);
                SourceAddress = GetAddress (1);
                BssId = GetAddress (2);
                SequenceControl = new SequenceControlField (SequenceControlBytes);

                header.Length = FrameSize; 
                var availablePayloadLength = GetAvailablePayloadLength();
				if(availablePayloadLength > 0)
				{
					payloadPacketOrData.TheByteArraySegment = header.EncapsulatedBytes (availablePayloadLength);
				}
            }
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:24,代码来源:ActionFrame.cs

示例6: ParseEncapsulatedBytes

 internal static PacketOrByteArraySegment ParseEncapsulatedBytes(ByteArraySegment Header, PosixTimeval Timeval)
 {
     ByteArraySegment segment = Header.EncapsulatedBytes();
     return new PacketOrByteArraySegment { ThePacket = new PPPPacket(segment.Bytes, segment.Offset, Timeval) };
 }
开发者ID:BGCX261,项目名称:znqq-svn-to-git,代码行数:5,代码来源:PPPoEPacket.cs

示例7: QosDataFrame

            /// <summary>
            /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.QosDataFrame"/> class.
            /// </summary>
            /// <param name='bas'>
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public QosDataFrame (ByteArraySegment bas)
            {
                header = new ByteArraySegment (bas);

                FrameControl = new FrameControlField (FrameControlBytes);
                Duration = new DurationField (DurationBytes);
                SequenceControl = new SequenceControlField (SequenceControlBytes);
                QosControl = QosControlBytes;
                ReadAddresses ();
                
                header.Length = FrameSize;
                var availablePayloadLength = GetAvailablePayloadLength();
                if(availablePayloadLength > 0)
				{
					payloadPacketOrData.TheByteArraySegment = header.EncapsulatedBytes (availablePayloadLength);
				}
            }
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:23,代码来源:QosDataFrame.cs


注:本文中的ByteArraySegment.EncapsulatedBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。