本文整理汇总了C#中DataSegment类的典型用法代码示例。如果您正苦于以下问题:C# DataSegment类的具体用法?C# DataSegment怎么用?C# DataSegment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSegment类属于命名空间,在下文中一共展示了DataSegment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length < MinIdentifierLength || data.Length > MaxIdentifierLength)
return null;
return new IpV6MobilityOptionServiceSelection(data);
}
示例2: CreateInstance
internal override IpV6Option CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6OptionTunnelEncapsulationLimit(data[0]);
}
示例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);
}
示例4: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6MobilityOptionBindingRefreshAdvice(data.ReadUShort(0, Endianity.Big));
}
示例5: CreateInstance
internal override IpV6Option CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6OptionJumboPayload(data.ReadUInt(0, Endianity.Big));
}
示例6: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6MobilityOptionRedirectCapability();
}
示例7: CreateInstance
internal override IpV6MobilityOption CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
return null;
return new IpV6MobilityOptionAlternateIpV4CareOfAddress(data.ReadIpV4Address(0, Endianity.Big));
}
示例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;
}
}
示例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;
}
示例10: IpV6ExtensionHeaderEncapsulatingSecurityPayload
public IpV6ExtensionHeaderEncapsulatingSecurityPayload(uint securityParametersIndex, uint sequenceNumber, DataSegment encryptedDataAndAuthenticationData)
: base(null)
{
SecurityParametersIndex = securityParametersIndex;
SequenceNumber = sequenceNumber;
EncryptedDataAndAuthenticationData = encryptedDataAndAuthenticationData;
}
示例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;
}
示例12: IpV6ExtensionHeaderAuthentication
public IpV6ExtensionHeaderAuthentication(IpV4Protocol nextHeader, uint securityParametersIndex, uint sequenceNumber, DataSegment authenticationData)
: base(nextHeader)
{
SecurityParametersIndex = securityParametersIndex;
SequenceNumber = sequenceNumber;
AuthenticationData = authenticationData;
}
示例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);
}
示例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;
}
示例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);
}
}