本文整理汇总了C#中DataSegment类的典型用法代码示例。如果您正苦于以下问题:C# DataSegment类的具体用法?C# DataSegment怎么用?C# DataSegment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSegment类属于命名空间,在下文中一共展示了DataSegment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length < MinIdentifierLength || data.Length > MaxIdentifierLength)
return null;
return new IpV6MobilityOptionServiceSelection(data);
}
开发者ID:amitla,项目名称:Pcap.Net,代码行数:7,代码来源:IpV6MobilityOptionServiceSelection.cs
示例2: CreateInstance
internal override IpV6Option CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6OptionTunnelEncapsulationLimit(data[0]);
}
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:IpV6OptionTunnelEncapsulationLimit.cs
示例3: CreateInstance
internal override IpV6Option CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
IpV6Address homeAddress = data.ReadIpV6Address(0, Endianity.Big);
return new IpV6OptionHomeAddress(homeAddress);
}
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:IpV6OptionHomeAddress.cs
示例4: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6MobilityOptionBindingRefreshAdvice(data.ReadUShort(0, Endianity.Big));
}
开发者ID:amitla,项目名称:Pcap.Net,代码行数:7,代码来源:IpV6MobilityOptionBindingRefreshAdvice.cs
示例5: CreateInstance
internal override IpV6Option CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6OptionJumboPayload(data.ReadUInt(0, Endianity.Big));
}
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:IpV6OptionJumboPayload.cs
示例6: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6MobilityOptionRedirectCapability();
}
开发者ID:JackWangCUMT,项目名称:WiFiSpy,代码行数:7,代码来源:IpV6MobilityOptionRedirectCapability.cs
示例7: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6MobilityOptionAlternateIpV4CareOfAddress(data.ReadIpV4Address(0, Endianity.Big));
}
开发者ID:amitla,项目名称:Pcap.Net,代码行数:7,代码来源:IpV6MobilityOptionAlternateIpV4CareOfAddress.cs
示例8: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length < OptionDataMinimumLength)
return null;
IpV6LocalMobilityAnchorAddressCode code = (IpV6LocalMobilityAnchorAddressCode)data[Offset.Code];
switch (code)
{
case IpV6LocalMobilityAnchorAddressCode.IpV6:
{
if (data.Length != Offset.LocalMobilityAnchorAddress + IpV6Address.SizeOf)
return null;
IpV6Address localMobilityAnchorAddress = data.ReadIpV6Address(Offset.LocalMobilityAnchorAddress, Endianity.Big);
return new IpV6MobilityOptionLocalMobilityAnchorAddress(localMobilityAnchorAddress);
}
case IpV6LocalMobilityAnchorAddressCode.IpV4:
{
if (data.Length != Offset.LocalMobilityAnchorAddress + IpV4Address.SizeOf)
return null;
IpV4Address localMobilityAnchorAddress = data.ReadIpV4Address(Offset.LocalMobilityAnchorAddress, Endianity.Big);
return new IpV6MobilityOptionLocalMobilityAnchorAddress(localMobilityAnchorAddress);
}
default:
return null;
}
}
开发者ID:amitla,项目名称:Pcap.Net,代码行数:28,代码来源:IpV6MobilityOptionLocalMobilityAnchorAddress.cs
示例9: IpV6MobilityOptionDnsUpdate
/// <summary>
/// Creates an instance from status, remove and mobile node identity.
/// </summary>
/// <param name="status">
/// Indicating the result of the dynamic DNS update procedure.
/// This field must be set to 0 and ignored by the receiver when the DNS Update mobility option is included in a Binding Update message.
/// When the DNS Update mobility option is included in the Binding Acknowledgement message,
/// values of the Status field less than 128 indicate that the dynamic DNS update was performed successfully by the Home Agent.
/// Values greater than or equal to 128 indicate that the dynamic DNS update was not completed by the HA.
/// </param>
/// <param name="remove">
/// Whether the Mobile Node is requesting the HA to remove the DNS entry identified by the FQDN specified in this option and the HoA of the Mobile Node.
/// If false, the Mobile Node is requesting the HA to create or update a DNS entry with its HoA and the FQDN specified in the option.
/// </param>
/// <param name="mobileNodeIdentity">
/// The identity of the Mobile Node in FQDN format to be used by the Home Agent to send a Dynamic DNS update.
/// </param>
public IpV6MobilityOptionDnsUpdate(IpV6DnsUpdateStatus status, bool remove, DataSegment mobileNodeIdentity)
: base(IpV6MobilityOptionType.DnsUpdate)
{
Status = status;
Remove = remove;
MobileNodeIdentity = mobileNodeIdentity;
}
开发者ID:JackWangCUMT,项目名称:WiFiSpy,代码行数:24,代码来源:IpV6MobilityOptionDnsUpdate.cs
示例10: IpV6ExtensionHeaderEncapsulatingSecurityPayload
public IpV6ExtensionHeaderEncapsulatingSecurityPayload(uint securityParametersIndex, uint sequenceNumber, DataSegment encryptedDataAndAuthenticationData)
: base(null)
{
SecurityParametersIndex = securityParametersIndex;
SequenceNumber = sequenceNumber;
EncryptedDataAndAuthenticationData = encryptedDataAndAuthenticationData;
}
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:7,代码来源:IpV6ExtensionHeaderEncapsulatingSecurityPayload.cs
示例11: IpV6MobilityOptionVendorSpecific
/// <summary>
/// Creates an instance from vendor id, subtype and data.
/// </summary>
/// <param name="vendorId">
/// The SMI Network Management Private Enterprise Code of the IANA- maintained Private Enterprise Numbers registry.
/// See http://www.iana.org/assignments/enterprise-numbers/enterprise-numbers
/// </param>
/// <param name="subtype">
/// Indicating the type of vendor-specific information carried in the option.
/// The administration of the Sub-type is done by the Vendor.
/// </param>
/// <param name="data">Vendor-specific data that is carried in this message.</param>
public IpV6MobilityOptionVendorSpecific(uint vendorId, byte subtype, DataSegment data)
: base(IpV6MobilityOptionType.VendorSpecific)
{
VendorId = vendorId;
Subtype = subtype;
Data = data;
}
开发者ID:amitla,项目名称:Pcap.Net,代码行数:19,代码来源:IpV6MobilityOptionVendorSpecific.cs
示例12: IpV6ExtensionHeaderAuthentication
public IpV6ExtensionHeaderAuthentication(IpV4Protocol nextHeader, uint securityParametersIndex, uint sequenceNumber, DataSegment authenticationData)
: base(nextHeader)
{
SecurityParametersIndex = securityParametersIndex;
SequenceNumber = sequenceNumber;
AuthenticationData = authenticationData;
}
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:7,代码来源:IpV6ExtensionHeaderAuthentication.cs
示例13: IpV6OptionSmfDpdSequenceHashAssistValue
public IpV6OptionSmfDpdSequenceHashAssistValue(DataSegment data)
{
byte[] hashAssistValueBuffer = new byte[data.Length - Offset.HashAssistValue];
data.Buffer.BlockCopy(data.StartOffset + Offset.HashAssistValue, hashAssistValueBuffer, 0, hashAssistValueBuffer.Length);
hashAssistValueBuffer[0] &= 0x7F;
HashAssistValue = new DataSegment(hashAssistValueBuffer);
}
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:7,代码来源:IpV6OptionSmfDpdSequenceHashAssistValue.cs
示例14: IpV6MobilityOptionAuthentication
/// <summary>
/// Creates an instance from subtype, mobility security parameter index and authentication data.
/// </summary>
/// <param name="subtype">A number assigned to identify the entity and/or mechanism to be used to authenticate the message.</param>
/// <param name="mobilitySecurityParameterIndex">
/// A number in the range [0-4294967296] used to index into the shared-key-based mobility security associations.
/// </param>
/// <param name="authenticationData">
/// Has the information to authenticate the relevant mobility entity.
/// This protects the message beginning at the Mobility Header up to and including the mobility SPI field.
/// </param>
public IpV6MobilityOptionAuthentication(IpV6AuthenticationSubtype subtype, uint mobilitySecurityParameterIndex, DataSegment authenticationData)
: base(IpV6MobilityOptionType.Authentication)
{
Subtype = subtype;
MobilitySecurityParameterIndex = mobilitySecurityParameterIndex;
AuthenticationData = authenticationData;
}
开发者ID:amitla,项目名称:Pcap.Net,代码行数:18,代码来源:IpV6MobilityOptionAuthentication.cs
示例15: CreateStandardInstance
private static IpV6ExtensionHeader CreateStandardInstance(IpV4Protocol nextHeader, DataSegment extensionHeaderData, out int numBytesRead)
{
numBytesRead = 0;
if (extensionHeaderData.Length < MinimumLength)
return null;
IpV4Protocol nextNextHeader = (IpV4Protocol)extensionHeaderData[Offset.NextHeader];
int length = (extensionHeaderData[Offset.HeaderExtensionLength] + 1) * 8;
if (extensionHeaderData.Length < length)
return null;
DataSegment data = extensionHeaderData.Subsegment(Offset.Data, length - Offset.Data);
numBytesRead = data.Length;
switch (nextHeader)
{
case IpV4Protocol.IpV6HopByHopOption: // 0
return IpV6ExtensionHeaderHopByHopOptions.ParseData(nextNextHeader, data);
case IpV4Protocol.IpV6Route: // 43
return IpV6ExtensionHeaderRouting.ParseData(nextNextHeader, data);
case IpV4Protocol.FragmentHeaderForIpV6: // 44
return IpV6ExtensionHeaderFragmentData.ParseData(nextNextHeader, data);
case IpV4Protocol.IpV6Opts: // 60
return IpV6ExtensionHeaderDestinationOptions.ParseData(nextNextHeader, data);
case IpV4Protocol.MobilityHeader: // 135
return IpV6ExtensionHeaderMobility.ParseData(nextNextHeader, data);
default:
throw new InvalidOperationException("Invalid nextHeader value" + nextHeader);
}
}
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:34,代码来源:IpV6ExtensionHeader.cs
示例16: CreateInstance
internal override IpV6Option CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6OptionRouterAlert((IpV6RouterAlertType)data.ReadUShort(0, Endianity.Big));
}
开发者ID:OsirisTerje,项目名称:sonarlint-vs,代码行数:7,代码来源:IpV6OptionRouterAlert.cs
示例17: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length < OptionDataMinimumLength)
return null;
bool isIpV4 = data.ReadBool(Offset.IsIpV4, Mask.IsIpV4);
bool isIpV6 = data.ReadBool(Offset.IsIpV6, Mask.IsIpV6);
if (isIpV4 && !isIpV6)
{
if (data.Length != OptionDataMinimumLength + IpV4Address.SizeOf)
return null;
IpV4Address localMobilityAddress = data.ReadIpV4Address(Offset.LocalMobilityAddress, Endianity.Big);
return new IpV6MobilityOptionRedirect(localMobilityAddress);
}
if (isIpV6 && !isIpV4)
{
if (data.Length != OptionDataMinimumLength + IpV6Address.SizeOf)
return null;
IpV6Address localMobilityAddress = data.ReadIpV6Address(Offset.LocalMobilityAddress, Endianity.Big);
return new IpV6MobilityOptionRedirect(localMobilityAddress);
}
return null;
}
开发者ID:amitla,项目名称:Pcap.Net,代码行数:25,代码来源:IpV6MobilityOptionRedirect.cs
示例18: ReadData
public static void ReadData(DataSegment data, out IpV4OptionQuickStartFunction function, out byte rate, out byte ttl, out uint nonce)
{
function = (IpV4OptionQuickStartFunction)(data[Offset.Function] & Mask.Function);
rate = (byte)(data[Offset.Rate] & Mask.Rate);
ttl = data[Offset.Ttl];
nonce = data.ReadUInt(Offset.Nonce, Endianity.Big);
}
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:IpOptionQuickStartCommon.cs
示例19: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6MobilityOptionCryptographicallyGeneratedAddressParametersRequest();
}
开发者ID:amitla,项目名称:Pcap.Net,代码行数:7,代码来源:IpV6MobilityOptionCryptographicallyGeneratedAddressParametersRequest.cs
示例20: ParseData
internal static IpV6ExtensionHeaderRouting ParseData(IpV4Protocol nextHeader, DataSegment data)
{
if (data.Length < DataMinimumLength)
return null;
IpV6RoutingType routingType = (IpV6RoutingType)data[DataOffset.RoutingType];
byte segmentsLeft = data[DataOffset.SegmentsLeft];
DataSegment routingData = data.Subsegment(DataOffset.TypeSpecificData, data.Length - DataOffset.TypeSpecificData);
switch (routingType)
{
case IpV6RoutingType.SourceRoute:
return IpV6ExtensionHeaderRoutingSourceRoute.ParseRoutingData(nextHeader, segmentsLeft, routingData);
case IpV6RoutingType.Nimrod:
// Unused.
return null;
case IpV6RoutingType.Type2RoutingHeader:
return IpV6ExtensionHeaderRoutingHomeAddress.ParseRoutingData(nextHeader, segmentsLeft, routingData);
case IpV6RoutingType.RoutingProtocolLowPowerAndLossyNetworksSourceRouteHeader:
return IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks.ParseRoutingData(nextHeader, segmentsLeft, routingData);
default:
return null;
}
}
开发者ID:amitla,项目名称:Pcap.Net,代码行数:26,代码来源:IpV6ExtensionHeaderRouting.cs
注:本文中的DataSegment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论