internal override IpV6MobilityOption CreateInstance(DataSegment data) { if (data.Length < OptionDataMinimumLength) { return(null); } ushort bindingId = data.ReadUShort(Offset.BindingId, Endianity.Big); IpV6BindingAcknowledgementStatus status = (IpV6BindingAcknowledgementStatus)data[Offset.Status]; bool simultaneousHomeAndForeignBinding = data.ReadBool(Offset.SimultaneousHomeAndForeignBinding, Mask.SimultaneousHomeAndForeignBinding); byte priority = (byte)(data[Offset.Priority] & Mask.Priority); if (data.Length == OptionDataMinimumLength) { return(new IpV6MobilityOptionBindingIdentifier(bindingId, status, simultaneousHomeAndForeignBinding, priority)); } if (data.Length == OptionDataMinimumLength + IpV4Address.SizeOf) { IpV4Address careOfAddress = data.ReadIpV4Address(Offset.CareOfAddress, Endianity.Big); return(new IpV6MobilityOptionBindingIdentifier(bindingId, status, simultaneousHomeAndForeignBinding, priority, careOfAddress)); } if (data.Length == OptionDataMinimumLength + IpV6Address.SizeOf) { IpV6Address careOfAddress = data.ReadIpV6Address(Offset.CareOfAddress, Endianity.Big); return(new IpV6MobilityOptionBindingIdentifier(bindingId, status, simultaneousHomeAndForeignBinding, priority, careOfAddress)); } return(null); }
/// <summary> /// Creates an instance from next header, checksum, status, key management mobility capability, mobile router, proxy registration, TLV header format, /// sequence number, lifetime and options. /// </summary> /// <param name="nextHeader">Identifies the type of header immediately following this extension header.</param> /// <param name="checksum"> /// Contains the checksum of the Mobility Header. /// The checksum is calculated from the octet string consisting of a "pseudo-header" /// followed by the entire Mobility Header starting with the Payload Proto field. /// The checksum is the 16-bit one's complement of the one's complement sum of this string. /// </param> /// <param name="status"> /// Indicating the disposition of the Binding Update. /// Values of the Status field less than 128 indicate that the Binding Update was accepted by the receiving node. /// Values greater than or equal to 128 indicate that the Binding Update was rejected by the receiving node. /// </param> /// <param name="keyManagementMobilityCapability"> /// If this is cleared, the protocol used by the home agent for establishing the IPsec security associations between the mobile node and the home agent /// does not survive movements. /// It may then have to be rerun. /// (Note that the IPsec security associations themselves are expected to survive movements.) /// </param> /// <param name="mobileRouter"> /// Indicates that the Home Agent that processed the Binding Update supports Mobile Routers. /// True only if the corresponding Binding Update had the Mobile Router set to true. /// </param> /// <param name="proxyRegistration"> /// Indicates that the local mobility anchor that processed the corresponding Proxy Binding Update message supports proxy registrations. /// True only if the corresponding Proxy Binding Update had the Proxy Registration set to true. /// </param> /// <param name="typeLengthValueHeaderFormat"> /// Indicates that the sender of the Proxy Binding Acknowledgement, the LMA, supports tunneling IPv6-or-IPv4 in IPv4 using TLV-header format. /// </param> /// <param name="sequenceNumber"> /// Copied from the Sequence Number field in the Binding Update. /// It is used by the mobile node in matching this Binding Acknowledgement with an outstanding Binding Update. /// </param> /// <param name="lifetime"> /// The granted lifetime, in time units of 4 seconds for Binding Acknowledgement and 1 second for Fast Binding Acknowledgement, /// for which this node should retain the entry for this mobile node in its Binding Cache. /// </param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityBindingAcknowledgement(IpV4Protocol? nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status, bool keyManagementMobilityCapability, bool mobileRouter, bool proxyRegistration, bool typeLengthValueHeaderFormat, ushort sequenceNumber, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, status, keyManagementMobilityCapability, sequenceNumber, lifetime, options) { MobileRouter = mobileRouter; ProxyRegistration = proxyRegistration; TypeLengthValueHeaderFormat = typeLengthValueHeaderFormat; }
internal IpV6ExtensionHeaderMobilityBindingAcknowledgementBase(IpV4Protocol?nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status, bool keyManagementMobilityCapability, ushort sequenceNumber, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { Status = status; KeyManagementMobilityCapability = keyManagementMobilityCapability; SequenceNumber = sequenceNumber; Lifetime = lifetime; }
internal IpV6ExtensionHeaderMobilityBindingAcknowledgementBase(IpV4Protocol? nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status, bool keyManagementMobilityCapability, ushort sequenceNumber, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { Status = status; KeyManagementMobilityCapability = keyManagementMobilityCapability; SequenceNumber = sequenceNumber; Lifetime = lifetime; }
private IpV6MobilityOptionBindingIdentifier(ushort bindingId, IpV6BindingAcknowledgementStatus status, bool simultaneousHomeAndForeignBinding, byte priority, IpV4Address?ipV4CareOfAddress, IpV6Address?ipV6CareOfAddress) : base(IpV6MobilityOptionType.BindingIdentifier) { if (priority > MaxPriority) { throw new ArgumentOutOfRangeException("priority", priority, string.Format(CultureInfo.InvariantCulture, "Must not exceed {0}", MaxPriority)); } BindingId = bindingId; Status = status; SimultaneousHomeAndForeignBinding = simultaneousHomeAndForeignBinding; Priority = priority; IpV4CareOfAddress = ipV4CareOfAddress; IpV6CareOfAddress = ipV6CareOfAddress; }
internal static bool ParseMessageDataFields(DataSegment messageData, out IpV6BindingAcknowledgementStatus status, out bool keyManagementMobilityCapability, out ushort sequenceNumber, out ushort lifetime, out IpV6MobilityOptions options) { if (messageData.Length < MinimumMessageDataLength) { status = IpV6BindingAcknowledgementStatus.BindingUpdateAccepted; keyManagementMobilityCapability = false; sequenceNumber = 0; lifetime = 0; options = null; return(false); } status = (IpV6BindingAcknowledgementStatus)messageData[MessageDataOffset.Status]; keyManagementMobilityCapability = messageData.ReadBool(MessageDataOffset.KeyManagementMobilityCapability, MessageDataMask.KeyManagementMobilityCapability); sequenceNumber = messageData.ReadUShort(MessageDataOffset.SequenceNumber, Endianity.Big); lifetime = messageData.ReadUShort(MessageDataOffset.Lifetime, Endianity.Big); options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return(true); }
/// <summary> /// Creates an instance from binding id, status, simulatneous home and foreign binding, priority and IPv4 care of address. /// </summary> /// <param name="bindingId"> /// The BID that is assigned to the binding indicated by the care-of address in the Binding Update or the Binding Identifier mobility option. /// The value of zero is reserved and should not be used. /// </param> /// <param name="status"> /// When the Binding Identifier mobility option is included in a Binding Acknowledgement, /// this field overwrites the Status field in the Binding Acknowledgement only for this BID. /// If this field is set to zero, the receiver ignores this field and uses the registration status stored in the Binding Acknowledgement message. /// The receiver must ignore this field if the Binding Identifier mobility option is not carried within either the Binding Acknowledgement /// or the Care-of Test messages. /// The possible status codes are the same as the status codes of the Binding Acknowledgement. /// This Status field is also used to carry error information related to the care-of address test in the Care-of Test message. /// </param> /// <param name="simultaneousHomeAndForeignBinding"> /// Indicates that the mobile node registers multiple bindings to the home agent while it is attached to the home link. /// This flag is valid only for a Binding Update sent to the home agent. /// </param> /// <param name="priority"> /// Places each BID to a relative priority (PRI) with other registered BIDs. /// Value '0' is reserved and must not be used. /// A lower number in this field indicates a higher priority, while BIDs with the same BID-PRI value have equal priority meaning that, /// the BID used is an implementation issue. /// This is consistent with current practice in packet classifiers. /// </param> /// <param name="careOfAddress"> /// The IPv4 care-of address for the corresponding BID. /// </param> public IpV6MobilityOptionBindingIdentifier(ushort bindingId, IpV6BindingAcknowledgementStatus status, bool simultaneousHomeAndForeignBinding, byte priority, IpV4Address careOfAddress) : this(bindingId, status, simultaneousHomeAndForeignBinding, priority, careOfAddress, null) { }
/// <summary> /// Creates an instance from next header, checksum, status, key management mobility capability, sequence number, lifetime and options. /// </summary> /// <param name="nextHeader"> /// Identifies the type of header immediately following this extension header. /// </param> /// <param name="checksum"> /// Contains the checksum of the Mobility Header. /// The checksum is calculated from the octet string consisting of a "pseudo-header" /// followed by the entire Mobility Header starting with the Payload Proto field. /// The checksum is the 16-bit one's complement of the one's complement sum of this string. /// </param> /// <param name="status"> /// Indicating the disposition of the Binding Update. /// Values of the Status field less than 128 indicate that the Binding Update was accepted by the receiving node. /// Values greater than or equal to 128 indicate that the Binding Update was rejected by the receiving node. /// </param> /// <param name="keyManagementMobilityCapability"> /// If this is cleared, the protocol used by the home agent for establishing the IPsec security associations between the mobile node and the home agent /// does not survive movements. /// It may then have to be rerun. /// (Note that the IPsec security associations themselves are expected to survive movements.) /// </param> /// <param name="sequenceNumber"> /// Copied from the Sequence Number field in the Binding Update. /// It is used by the mobile node in matching this Binding Acknowledgement with an outstanding Binding Update. /// </param> /// <param name="lifetime"> /// The granted lifetime, in time units of 4 seconds for Binding Acknowledgement and 1 second for Fast Binding Acknowledgement, /// for which this node should retain the entry for this mobile node in its Binding Cache. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityFastBindingAcknowledgement(IpV4Protocol? nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status, bool keyManagementMobilityCapability, ushort sequenceNumber, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, status, keyManagementMobilityCapability, sequenceNumber, lifetime, options) { }
/// <summary> /// Creates an instance from next header, checksum, status, key management mobility capability, mobile router, proxy registration, TLV header format, /// sequence number, lifetime and options. /// </summary> /// <param name="nextHeader">Identifies the type of header immediately following this extension header.</param> /// <param name="checksum"> /// Contains the checksum of the Mobility Header. /// The checksum is calculated from the octet string consisting of a "pseudo-header" /// followed by the entire Mobility Header starting with the Payload Proto field. /// The checksum is the 16-bit one's complement of the one's complement sum of this string. /// </param> /// <param name="status"> /// Indicating the disposition of the Binding Update. /// Values of the Status field less than 128 indicate that the Binding Update was accepted by the receiving node. /// Values greater than or equal to 128 indicate that the Binding Update was rejected by the receiving node. /// </param> /// <param name="keyManagementMobilityCapability"> /// If this is cleared, the protocol used by the home agent for establishing the IPsec security associations between the mobile node and the home agent /// does not survive movements. /// It may then have to be rerun. /// (Note that the IPsec security associations themselves are expected to survive movements.) /// </param> /// <param name="mobileRouter"> /// Indicates that the Home Agent that processed the Binding Update supports Mobile Routers. /// True only if the corresponding Binding Update had the Mobile Router set to true. /// </param> /// <param name="proxyRegistration"> /// Indicates that the local mobility anchor that processed the corresponding Proxy Binding Update message supports proxy registrations. /// True only if the corresponding Proxy Binding Update had the Proxy Registration set to true. /// </param> /// <param name="typeLengthValueHeaderFormat"> /// Indicates that the sender of the Proxy Binding Acknowledgement, the LMA, supports tunneling IPv6-or-IPv4 in IPv4 using TLV-header format. /// </param> /// <param name="sequenceNumber"> /// Copied from the Sequence Number field in the Binding Update. /// It is used by the mobile node in matching this Binding Acknowledgement with an outstanding Binding Update. /// </param> /// <param name="lifetime"> /// The granted lifetime, in time units of 4 seconds for Binding Acknowledgement and 1 second for Fast Binding Acknowledgement, /// for which this node should retain the entry for this mobile node in its Binding Cache. /// </param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityBindingAcknowledgement(IpV4Protocol?nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status, bool keyManagementMobilityCapability, bool mobileRouter, bool proxyRegistration, bool typeLengthValueHeaderFormat, ushort sequenceNumber, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, status, keyManagementMobilityCapability, sequenceNumber, lifetime, options) { MobileRouter = mobileRouter; ProxyRegistration = proxyRegistration; TypeLengthValueHeaderFormat = typeLengthValueHeaderFormat; }
internal static bool ParseMessageDataFields(DataSegment messageData, out IpV6BindingAcknowledgementStatus status, out bool keyManagementMobilityCapability, out ushort sequenceNumber, out ushort lifetime, out IpV6MobilityOptions options) { if (messageData.Length < MinimumMessageDataLength) { status = IpV6BindingAcknowledgementStatus.BindingUpdateAccepted; keyManagementMobilityCapability = false; sequenceNumber = 0; lifetime = 0; options = null; return false; } status = (IpV6BindingAcknowledgementStatus)messageData[MessageDataOffset.Status]; keyManagementMobilityCapability = messageData.ReadBool(MessageDataOffset.KeyManagementMobilityCapability, MessageDataMask.KeyManagementMobilityCapability); sequenceNumber = messageData.ReadUShort(MessageDataOffset.SequenceNumber, Endianity.Big); lifetime = messageData.ReadUShort(MessageDataOffset.Lifetime, Endianity.Big); options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return true; }
public static IpV6MobilityOption NextIpV6MobilityOption(this Random random) { IpV6MobilityOptionType optionType = random.NextEnum <IpV6MobilityOptionType>(); switch (optionType) { case IpV6MobilityOptionType.Pad1: return(new IpV6MobilityOptionPad1()); case IpV6MobilityOptionType.PadN: return(new IpV6MobilityOptionPadN(random.NextInt(0, 10))); case IpV6MobilityOptionType.BindingRefreshAdvice: return(new IpV6MobilityOptionBindingRefreshAdvice(random.NextUShort())); case IpV6MobilityOptionType.AlternateCareOfAddress: return(new IpV6MobilityOptionAlternateCareOfAddress(random.NextIpV6Address())); case IpV6MobilityOptionType.NonceIndexes: return(new IpV6MobilityOptionNonceIndexes(random.NextUShort(), random.NextUShort())); case IpV6MobilityOptionType.BindingAuthorizationData: return(new IpV6MobilityOptionBindingAuthorizationData(random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.MobileNetworkPrefix: return(new IpV6MobilityOptionMobileNetworkPrefix(random.NextByte(), random.NextIpV6Address())); case IpV6MobilityOptionType.LinkLayerAddress: return(new IpV6MobilityOptionLinkLayerAddress(random.NextEnum <IpV6MobilityLinkLayerAddressCode>(), random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.MobileNodeIdentifier: IpV6MobileNodeIdentifierSubtype mobileNodeIdentifierSubtype = random.NextEnum <IpV6MobileNodeIdentifierSubtype>(); return(new IpV6MobilityOptionMobileNodeIdentifier( mobileNodeIdentifierSubtype, random.NextDataSegment(random.NextInt(mobileNodeIdentifierSubtype == IpV6MobileNodeIdentifierSubtype.NetworkAccessIdentifier ? 1 : 0, 100)))); case IpV6MobilityOptionType.Authentication: return(new IpV6MobilityOptionAuthentication(random.NextEnum <IpV6AuthenticationSubtype>(), random.NextUInt(), random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.ReplayProtection: return(new IpV6MobilityOptionReplayProtection(random.NextULong())); case IpV6MobilityOptionType.CryptographicallyGeneratedAddressParametersRequest: return(new IpV6MobilityOptionCryptographicallyGeneratedAddressParametersRequest()); case IpV6MobilityOptionType.CryptographicallyGeneratedAddressParameters: return(new IpV6MobilityOptionCryptographicallyGeneratedAddressParameters(random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.Signature: return(new IpV6MobilityOptionSignature(random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.PermanentHomeKeygenToken: return(new IpV6MobilityOptionPermanentHomeKeygenToken(random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.CareOfTestInit: return(new IpV6MobilityOptionCareOfTestInit()); case IpV6MobilityOptionType.CareOfTest: return(new IpV6MobilityOptionCareOfTest(random.NextULong())); case IpV6MobilityOptionType.DnsUpdate: return(new IpV6MobilityOptionDnsUpdate(random.NextEnum <IpV6DnsUpdateStatus>(), random.NextBool(), random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.Experimental: return(new IpV6MobilityOptionExperimental(random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.VendorSpecific: return(new IpV6MobilityOptionVendorSpecific(random.NextUInt(), random.NextByte(), random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.ServiceSelection: return(new IpV6MobilityOptionServiceSelection(random.NextDataSegment(random.NextInt(1, 100)))); case IpV6MobilityOptionType.BindingAuthorizationDataForFmIpV6: return(new IpV6MobilityOptionBindingAuthorizationDataForFmIpV6(random.NextUInt(), random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.HomeNetworkPrefix: return(new IpV6MobilityOptionHomeNetworkPrefix(random.NextByte(), random.NextIpV6Address())); case IpV6MobilityOptionType.HandoffIndicator: return(new IpV6MobilityOptionHandoffIndicator(random.NextEnum <IpV6HandoffIndicator>())); case IpV6MobilityOptionType.AccessTechnologyType: return(new IpV6MobilityOptionAccessTechnologyType(random.NextEnum <IpV6AccessTechnologyType>())); case IpV6MobilityOptionType.MobileNodeLinkLayerIdentifier: return(new IpV6MobilityOptionMobileNodeLinkLayerIdentifier(random.NextDataSegment(random.NextInt(0, 100)))); case IpV6MobilityOptionType.LinkLocalAddress: return(new IpV6MobilityOptionLinkLocalAddress(random.NextIpV6Address())); case IpV6MobilityOptionType.Timestamp: return(new IpV6MobilityOptionTimestamp(random.NextULong() % (500000000000L << 16))); case IpV6MobilityOptionType.RestartCounter: return(new IpV6MobilityOptionRestartCounter(random.NextUInt())); case IpV6MobilityOptionType.IpV4HomeAddress: return(new IpV6MobilityOptionIpV4HomeAddress(random.NextByte(IpV6MobilityOptionIpV4HomeAddress.MaxPrefixLength + 1), random.NextBool(), random.NextIpV4Address())); case IpV6MobilityOptionType.IpV4AddressAcknowledgement: return(new IpV6MobilityOptionIpV4AddressAcknowledgement(random.NextEnum <IpV6AddressAcknowledgementStatus>(), random.NextByte(IpV6MobilityOptionIpV4AddressAcknowledgement.MaxPrefixLength + 1), random.NextIpV4Address())); case IpV6MobilityOptionType.NatDetection: return(new IpV6MobilityOptionNatDetection(random.NextBool(), random.NextUInt())); case IpV6MobilityOptionType.IpV4CareOfAddress: return(new IpV6MobilityOptionIpV4CareOfAddress(random.NextIpV4Address())); case IpV6MobilityOptionType.GreKey: return(new IpV6MobilityOptionGreKey(random.NextUInt())); case IpV6MobilityOptionType.IpV6AddressPrefix: return(new IpV6MobilityOptionIpV6AddressPrefix(random.NextEnum <IpV6MobilityIpV6AddressPrefixCode>(), random.NextByte(IpV6MobilityOptionIpV6AddressPrefix.MaxPrefixLength + 1), random.NextIpV6Address())); case IpV6MobilityOptionType.BindingIdentifier: ushort bindingId = random.NextUShort(); IpV6BindingAcknowledgementStatus status = random.NextEnum <IpV6BindingAcknowledgementStatus>(); bool simultaneousHomeAndForeignBinding = random.NextBool(); byte priority = random.NextByte(IpV6MobilityOptionBindingIdentifier.MaxPriority + 1); if (random.NextBool(3)) { return(new IpV6MobilityOptionBindingIdentifier(bindingId, status, simultaneousHomeAndForeignBinding, priority)); } if (random.NextBool()) { return(new IpV6MobilityOptionBindingIdentifier(bindingId, status, simultaneousHomeAndForeignBinding, priority, random.NextIpV4Address())); } return(new IpV6MobilityOptionBindingIdentifier(bindingId, status, simultaneousHomeAndForeignBinding, priority, random.NextIpV6Address())); case IpV6MobilityOptionType.IpV4HomeAddressRequest: return(new IpV6MobilityOptionIpV4HomeAddressRequest(random.NextByte(IpV6MobilityOptionIpV4HomeAddressRequest.MaxPrefixLength + 1), random.NextIpV4Address())); case IpV6MobilityOptionType.IpV4HomeAddressReply: return(new IpV6MobilityOptionIpV4HomeAddressReply(random.NextEnum <IpV6IpV4HomeAddressReplyStatus>(), random.NextByte(IpV6MobilityOptionIpV4HomeAddressReply.MaxPrefixLength + 1), random.NextIpV4Address())); case IpV6MobilityOptionType.IpV4DefaultRouterAddress: return(new IpV6MobilityOptionIpV4DefaultRouterAddress(random.NextIpV4Address())); case IpV6MobilityOptionType.IpV4DhcpSupportMode: return(new IpV6MobilityOptionIpV4DhcpSupportMode(random.NextBool())); case IpV6MobilityOptionType.ContextRequest: return (new IpV6MobilityOptionContextRequest( ((Func <IpV6MobilityOptionContextRequestEntry>)(() => new IpV6MobilityOptionContextRequestEntry( random.NextByte(), random.NextDataSegment(random.NextInt(0, 25))))). GenerateArray(random.NextInt(0, 10)))); case IpV6MobilityOptionType.LocalMobilityAnchorAddress: if (random.NextBool()) { return(new IpV6MobilityOptionLocalMobilityAnchorAddress(random.NextIpV4Address())); } return(new IpV6MobilityOptionLocalMobilityAnchorAddress(random.NextIpV6Address())); case IpV6MobilityOptionType.MobileNodeLinkLocalAddressInterfaceIdentifier: return(new IpV6MobilityOptionMobileNodeLinkLocalAddressInterfaceIdentifier(random.NextULong())); case IpV6MobilityOptionType.TransientBinding: return(new IpV6MobilityOptionTransientBinding(random.NextBool(), random.NextByte())); case IpV6MobilityOptionType.FlowSummary: return(new IpV6MobilityOptionFlowSummary(((Func <ushort>)(random.NextUShort)).GenerateArray(random.NextInt(1, 10)))); case IpV6MobilityOptionType.FlowIdentification: return(new IpV6MobilityOptionFlowIdentification(random.NextUShort(), random.NextUShort(), random.NextEnum <IpV6FlowIdentificationStatus>(), random.NextIpV6FlowIdentificationSubOptions())); case IpV6MobilityOptionType.RedirectCapability: return(new IpV6MobilityOptionRedirectCapability()); case IpV6MobilityOptionType.Redirect: if (random.NextBool()) { return(new IpV6MobilityOptionRedirect(random.NextIpV4Address())); } return(new IpV6MobilityOptionRedirect(random.NextIpV6Address())); case IpV6MobilityOptionType.LoadInformation: return(new IpV6MobilityOptionLoadInformation(random.NextUShort(), random.NextUInt(), random.NextUInt(), random.NextUInt(), random.NextUInt())); case IpV6MobilityOptionType.AlternateIpV4CareOfAddress: return(new IpV6MobilityOptionAlternateIpV4CareOfAddress(random.NextIpV4Address())); case IpV6MobilityOptionType.MobileNodeGroupIdentifier: return(new IpV6MobilityOptionMobileNodeGroupIdentifier(random.NextEnum <IpV6MobileNodeGroupIdentifierSubtype>(), random.NextUInt())); case IpV6MobilityOptionType.MobileAccessGatewayIpV6Address: return(new IpV6MobilityOptionMobileAccessGatewayIpV6Address(random.NextIpV6Address())); case IpV6MobilityOptionType.AccessNetworkIdentifier: return(new IpV6MobilityOptionAccessNetworkIdentifier(random.NextIpV6AccessNetworkIdentifierSubOptions())); default: throw new InvalidOperationException(string.Format("Invalid optionType value {0}", optionType)); } }
private IpV6MobilityOptionBindingIdentifier(ushort bindingId, IpV6BindingAcknowledgementStatus status, bool simultaneousHomeAndForeignBinding, byte priority, IpV4Address? ipV4CareOfAddress, IpV6Address? ipV6CareOfAddress) : base(IpV6MobilityOptionType.BindingIdentifier) { if (priority > MaxPriority) throw new ArgumentOutOfRangeException("priority", priority, string.Format(CultureInfo.InvariantCulture, "Must not exceed {0}", MaxPriority)); BindingId = bindingId; Status = status; SimultaneousHomeAndForeignBinding = simultaneousHomeAndForeignBinding; Priority = priority; IpV4CareOfAddress = ipV4CareOfAddress; IpV6CareOfAddress = ipV6CareOfAddress; }
/// <summary> /// Creates an instance from next header, checksum, status, key management mobility capability, sequence number, lifetime and options. /// </summary> /// <param name="nextHeader"> /// Identifies the type of header immediately following this extension header. /// </param> /// <param name="checksum"> /// Contains the checksum of the Mobility Header. /// The checksum is calculated from the octet string consisting of a "pseudo-header" /// followed by the entire Mobility Header starting with the Payload Proto field. /// The checksum is the 16-bit one's complement of the one's complement sum of this string. /// </param> /// <param name="status"> /// Indicating the disposition of the Binding Update. /// Values of the Status field less than 128 indicate that the Binding Update was accepted by the receiving node. /// Values greater than or equal to 128 indicate that the Binding Update was rejected by the receiving node. /// </param> /// <param name="keyManagementMobilityCapability"> /// If this is cleared, the protocol used by the home agent for establishing the IPsec security associations between the mobile node and the home agent /// does not survive movements. /// It may then have to be rerun. /// (Note that the IPsec security associations themselves are expected to survive movements.) /// </param> /// <param name="sequenceNumber"> /// Copied from the Sequence Number field in the Binding Update. /// It is used by the mobile node in matching this Binding Acknowledgement with an outstanding Binding Update. /// </param> /// <param name="lifetime"> /// The granted lifetime, in time units of 4 seconds for Binding Acknowledgement and 1 second for Fast Binding Acknowledgement, /// for which this node should retain the entry for this mobile node in its Binding Cache. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityFastBindingAcknowledgement(IpV4Protocol?nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status, bool keyManagementMobilityCapability, ushort sequenceNumber, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, status, keyManagementMobilityCapability, sequenceNumber, lifetime, options) { }