本文整理汇总了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();
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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) };
}
示例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);
}
}