internal static IpV6ExtensionHeaderMobilityBindingRevocationMessage ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) { return(null); } IpV6MobilityBindingRevocationType bindingRevocationType = (IpV6MobilityBindingRevocationType)messageData[MessageDataOffset.BindingRevocationType]; byte revocationTriggerOrStatus = messageData[MessageDataOffset.RevocationTriggerOrStatus]; ushort sequenceNumber = messageData.ReadUShort(MessageDataOffset.SequenceNumber, Endianity.Big); bool proxyBinding = messageData.ReadBool(MessageDataOffset.ProxyBinding, MessageDataMask.ProxyBinding); bool ipV4HomeAddressBindingOnly = messageData.ReadBool(MessageDataOffset.IpV4HomeAddressBindingOnly, MessageDataMask.IpV4HomeAddressBindingOnly); bool global = messageData.ReadBool(MessageDataOffset.Global, MessageDataMask.Global); IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); switch (bindingRevocationType) { case IpV6MobilityBindingRevocationType.BindingRevocationIndication: return(new IpV6ExtensionHeaderMobilityBindingRevocationIndicationMessage(nextHeader, checksum, (Ipv6MobilityBindingRevocationTrigger)revocationTriggerOrStatus, sequenceNumber, proxyBinding, ipV4HomeAddressBindingOnly, global, options)); case IpV6MobilityBindingRevocationType.BindingRevocationAcknowledgement: return(new IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage(nextHeader, checksum, (Ipv6MobilityBindingRevocationStatus)revocationTriggerOrStatus, sequenceNumber, proxyBinding, ipV4HomeAddressBindingOnly, global, options)); default: return(null); } }
/// <summary> /// Creates an instance from next header, checksum, status, home address 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 reason for this message.</param> /// <param name="homeAddress"> /// The home address that was contained in the Home Address destination option. /// The mobile node uses this information to determine which binding does not exist, in cases where the mobile node has several home addresses. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityBindingError(IpV4Protocol?nextHeader, ushort checksum, IpV6BindingErrorStatus status, IpV6Address homeAddress, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { Status = status; HomeAddress = homeAddress; }
internal static bool ParseMessageDataToFields(DataSegment messageData, out ushort sequenceNumber, out bool acknowledge, out bool homeRegistration, out bool linkLocalAddressCompatibility, out bool keyManagementMobilityCapability, out ushort lifetime, out IpV6MobilityOptions options) { if (messageData.Length < MinimumMessageDataLength) { sequenceNumber = 0; acknowledge = false; homeRegistration = false; linkLocalAddressCompatibility = false; keyManagementMobilityCapability = false; lifetime = 0; options = null; return(false); } sequenceNumber = messageData.ReadUShort(MessageDataOffset.SequenceNumber, Endianity.Big); acknowledge = messageData.ReadBool(MessageDataOffset.Acknowledge, MessageDataMask.Acknowledge); homeRegistration = messageData.ReadBool(MessageDataOffset.HomeRegistration, MessageDataMask.HomeRegistration); linkLocalAddressCompatibility = messageData.ReadBool(MessageDataOffset.LinkLocalAddressCompatibility, MessageDataMask.LinkLocalAddressCompatibility); keyManagementMobilityCapability = messageData.ReadBool(MessageDataOffset.KeyManagementMobilityCapability, MessageDataMask.KeyManagementMobilityCapability); lifetime = messageData.ReadUShort(MessageDataOffset.Lifetime, Endianity.Big); options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return(true); }
internal IpV6ExtensionHeaderMobilityLocalizedRouting(IpV4Protocol? nextHeader, ushort checksum, ushort sequenceNumber, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { SequenceNumber = sequenceNumber; Lifetime = lifetime; }
internal IpV6ExtensionHeaderMobilityLocalizedRouting(IpV4Protocol?nextHeader, ushort checksum, ushort sequenceNumber, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { SequenceNumber = sequenceNumber; Lifetime = lifetime; }
internal static IpV6ExtensionHeaderMobilityHomeAgentSwitchMessage ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) { return(null); } byte numberOfAddresses = messageData[MessageDataOffset.NumberOfAddresses]; int homeAgentAddressesSize = numberOfAddresses * IpV6Address.SizeOf; if (messageData.Length < MinimumMessageDataLength + homeAgentAddressesSize) { return(null); } IpV6Address[] homeAgentAddresses = new IpV6Address[numberOfAddresses]; for (int i = 0; i != numberOfAddresses; ++i) { homeAgentAddresses[i] = messageData.ReadIpV6Address(MessageDataOffset.HomeAgentAddresses + i * IpV6Address.SizeOf, Endianity.Big); } int optionsOffset = MessageDataOffset.HomeAgentAddresses + homeAgentAddressesSize; IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(optionsOffset, messageData.Length - optionsOffset)); return(new IpV6ExtensionHeaderMobilityHomeAgentSwitchMessage(nextHeader, checksum, homeAgentAddresses, options)); }
/// <summary> /// Creates an instance from next header, checksum, status, home address 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 reason for this message.</param> /// <param name="homeAddress"> /// The home address that was contained in the Home Address destination option. /// The mobile node uses this information to determine which binding does not exist, in cases where the mobile node has several home addresses. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityBindingError(IpV4Protocol? nextHeader, ushort checksum, IpV6BindingErrorStatus status, IpV6Address homeAddress, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { Status = status; HomeAddress = homeAddress; }
/// <summary> /// Creates an instance from next header, checksum, sequence number, code 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="sequenceNumber"> /// Copied from the corresponding field in the Handover Initiate message to which this message is a response, /// to enable the receiver to match this Handover Acknowledge message with an outstanding Handover Initiate message. /// </param> /// <param name="code">Describes whether the handover was accepted or not and more details.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHandoverAcknowledgeMessage(IpV4Protocol? nextHeader, ushort checksum, ushort sequenceNumber, IpV6MobilityHandoverAcknowledgeCode code, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { SequenceNumber = sequenceNumber; Code = code; }
/// <summary> /// Creates an instance from next header, checksum, status, sequence number, proxy binding, IPv4 home address binding only, global 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 result of processing the Binding Revocation Indication message by the responder. /// </param> /// <param name="sequenceNumber"> /// Copied from the Sequence Number field in the Binding Revocation Indication. /// It is used by the initiator, e.g., HA, LMA, MAG, in matching this Binding Revocation Acknowledgement /// with the outstanding Binding Revocation Indication. /// </param> /// <param name="proxyBinding"> /// Set if set in the corresponding Binding Revocation Indication message. /// </param> /// <param name="ipV4HomeAddressBindingOnly"> /// Set if the it is set in the corresponding Binding Revocation Indication message. /// </param> /// <param name="global"> /// Set if it is set in the corresponding Binding Revocation Indication message. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage(IpV4Protocol?nextHeader, ushort checksum, Ipv6MobilityBindingRevocationStatus status, ushort sequenceNumber, bool proxyBinding, bool ipV4HomeAddressBindingOnly, bool global, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, proxyBinding, ipV4HomeAddressBindingOnly, global, options) { Status = status; }
/// <summary> /// Creates an instance from next header, checksum, sequence number, unsolicited, status, 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="sequenceNumber">Copied from the sequence number field of the LRI message being responded to.</param> /// <param name="unsolicited"> /// When true, the LRA message is sent unsolicited. /// The Lifetime field indicates a new requested value. /// The MAG must wait for the regular LRI message to confirm that the request is acceptable to the LMA. /// </param> /// <param name="status">The acknowledgement status.</param> /// <param name="lifetime"> /// The time in seconds for which the local forwarding is supported. /// Typically copied from the corresponding field in the LRI message. /// </param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityLocalizedRoutingAcknowledgement(IpV4Protocol?nextHeader, ushort checksum, ushort sequenceNumber, bool unsolicited, IpV6MobilityLocalizedRoutingAcknowledgementStatus status, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, lifetime, options) { Status = status; Unsolicited = unsolicited; }
/// <summary> /// Creates an instance from next header, checksum, home nonce index, home init cookie, home keygen token 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="homeNonceIndex">Will be echoed back by the mobile node to the correspondent node in a subsequent Binding Update.</param> /// <param name="homeInitCookie">Contains the home init cookie.</param> /// <param name="homeKeygenToken">Contains the 64-bit home keygen token used in the return routability procedure.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHomeTest(IpV4Protocol?nextHeader, ushort checksum, ushort homeNonceIndex, ulong homeInitCookie, ulong homeKeygenToken, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { HomeNonceIndex = homeNonceIndex; HomeInitCookie = homeInitCookie; HomeKeygenToken = homeKeygenToken; }
internal static IpV6ExtensionHeaderMobilityFastNeighborAdvertisement ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) return null; IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return new IpV6ExtensionHeaderMobilityFastNeighborAdvertisement(nextHeader, checksum, options); }
/// <summary> /// Creates an instance from next header, checksum, sequence number, unsolicited, status, 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="sequenceNumber">Copied from the sequence number field of the LRI message being responded to.</param> /// <param name="unsolicited"> /// When true, the LRA message is sent unsolicited. /// The Lifetime field indicates a new requested value. /// The MAG must wait for the regular LRI message to confirm that the request is acceptable to the LMA. /// </param> /// <param name="status">The acknowledgement status.</param> /// <param name="lifetime"> /// The time in seconds for which the local forwarding is supported. /// Typically copied from the corresponding field in the LRI message. /// </param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityLocalizedRoutingAcknowledgement(IpV4Protocol? nextHeader, ushort checksum, ushort sequenceNumber, bool unsolicited, IpV6MobilityLocalizedRoutingAcknowledgementStatus status, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, lifetime, options) { Status = status; Unsolicited = unsolicited; }
/// <summary> /// Creates an instance from next header, checksum, status, sequence number, proxy binding, IPv4 home address binding only, global 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 result of processing the Binding Revocation Indication message by the responder. /// </param> /// <param name="sequenceNumber"> /// Copied from the Sequence Number field in the Binding Revocation Indication. /// It is used by the initiator, e.g., HA, LMA, MAG, in matching this Binding Revocation Acknowledgement /// with the outstanding Binding Revocation Indication. /// </param> /// <param name="proxyBinding"> /// Set if set in the corresponding Binding Revocation Indication message. /// </param> /// <param name="ipV4HomeAddressBindingOnly"> /// Set if the it is set in the corresponding Binding Revocation Indication message. /// </param> /// <param name="global"> /// Set if it is set in the corresponding Binding Revocation Indication message. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage(IpV4Protocol? nextHeader, ushort checksum, Ipv6MobilityBindingRevocationStatus status, ushort sequenceNumber, bool proxyBinding, bool ipV4HomeAddressBindingOnly, bool global, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, proxyBinding, ipV4HomeAddressBindingOnly, global, options) { Status = status; }
/// <summary> /// Creates an instance from next header, checksum, is unsolicited heartbeat response, is response, sequence number 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="isUnsolicitedHeartbeatResponse">Set to true in Unsolicited Heartbeat Response.</param> /// <param name="isResponse"> /// Indicates whether the message is a request or a response. /// When it's set to false, it indicates that the Heartbeat message is a request. /// When it's set to true, it indicates that the Heartbeat message is a response. /// </param> /// <param name="sequenceNumber">Sequence number used for matching the request to the reply.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHeartbeatMessage(IpV4Protocol?nextHeader, ushort checksum, bool isUnsolicitedHeartbeatResponse, bool isResponse, uint sequenceNumber, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.MobilityOptions) { IsUnsolicitedHeartbeatResponse = isUnsolicitedHeartbeatResponse; IsResponse = isResponse; SequenceNumber = sequenceNumber; }
/// <summary> /// Creates an instance from next header, checksum, home nonce index, home init cookie, home keygen token 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="homeNonceIndex">Will be echoed back by the mobile node to the correspondent node in a subsequent Binding Update.</param> /// <param name="homeInitCookie">Contains the home init cookie.</param> /// <param name="homeKeygenToken">Contains the 64-bit home keygen token used in the return routability procedure.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHomeTest(IpV4Protocol? nextHeader, ushort checksum, ushort homeNonceIndex, ulong homeInitCookie, ulong homeKeygenToken, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { HomeNonceIndex = homeNonceIndex; HomeInitCookie = homeInitCookie; HomeKeygenToken = homeKeygenToken; }
/// <summary> /// Creates an instance from next header, checksum, care of nonce index, care of init cookie, care of keygen token 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="careOfNonceIndex">Will be echoed back by the mobile node to the correspondent node in a subsequent Binding Update.</param> /// <param name="careOfInitCookie">Contains the care-of init cookie.</param> /// <param name="careOfKeygenToken">Contains the 64-bit care-of keygen token used in the return routability procedure.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityCareOfTest(IpV4Protocol?nextHeader, ushort checksum, ushort careOfNonceIndex, ulong careOfInitCookie, ulong careOfKeygenToken, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { CareOfNonceIndex = careOfNonceIndex; CareOfInitCookie = careOfInitCookie; CareOfKeygenToken = careOfKeygenToken; }
/// <summary> /// Creates an instance from next header, checksum, revocation trigger, sequence number, proxy binding, IPv4 home address binding only, global /// 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="revocationTrigger"> /// Indicating the event that triggered the initiator to send the BRI message. /// </param> /// <param name="sequenceNumber"> /// Used by the initiator to match a returned Binding Revocation Acknowledgement with this Binding Revocation Indication. /// This sequence number could be a random number. /// At any time, implementations must ensure there is no collision between the sequence numbers of all outstanding Binding Revocation Indication /// Messages. /// </param> /// <param name="proxyBinding"> /// Set by the initiator to indicate that the revoked binding(s) is a PMIPv6 binding. /// </param> /// <param name="ipV4HomeAddressBindingOnly"> /// Set by the initiator, home agent, or local mobility anchor to indicate to the receiving mobility entity the termination /// of the IPv4 Home Address binding only as in Home Agent Operation and Local Mobility Anchor Operation. /// </param> /// <param name="global"> /// Set by the initiator, LMA or MAG, to indicate the termination of all Per-Peer mobility Bindings or Multiple Bindings that share /// a common identifier(s) and are served by the initiator and responder as in Local Mobility Anchor Operation and Mobile Access Gateway Operation. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityBindingRevocationIndicationMessage(IpV4Protocol? nextHeader, ushort checksum, Ipv6MobilityBindingRevocationTrigger revocationTrigger, ushort sequenceNumber, bool proxyBinding, bool ipV4HomeAddressBindingOnly, bool global, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, proxyBinding, ipV4HomeAddressBindingOnly, global, options) { RevocationTrigger = revocationTrigger; }
/// <summary> /// Creates an instance from next header, checksum, care of nonce index, care of init cookie, care of keygen token 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="careOfNonceIndex">Will be echoed back by the mobile node to the correspondent node in a subsequent Binding Update.</param> /// <param name="careOfInitCookie">Contains the care-of init cookie.</param> /// <param name="careOfKeygenToken">Contains the 64-bit care-of keygen token used in the return routability procedure.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityCareOfTest(IpV4Protocol? nextHeader, ushort checksum, ushort careOfNonceIndex, ulong careOfInitCookie, ulong careOfKeygenToken, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { CareOfNonceIndex = careOfNonceIndex; CareOfInitCookie = careOfInitCookie; CareOfKeygenToken = careOfKeygenToken; }
/// <summary> /// Creates an instance from next header, checksum, is unsolicited heartbeat response, is response, sequence number 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="isUnsolicitedHeartbeatResponse">Set to true in Unsolicited Heartbeat Response.</param> /// <param name="isResponse"> /// Indicates whether the message is a request or a response. /// When it's set to false, it indicates that the Heartbeat message is a request. /// When it's set to true, it indicates that the Heartbeat message is a response. /// </param> /// <param name="sequenceNumber">Sequence number used for matching the request to the reply.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHeartbeatMessage(IpV4Protocol? nextHeader, ushort checksum, bool isUnsolicitedHeartbeatResponse, bool isResponse, uint sequenceNumber, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.MobilityOptions) { IsUnsolicitedHeartbeatResponse = isUnsolicitedHeartbeatResponse; IsResponse = isResponse; SequenceNumber = sequenceNumber; }
/// <summary> /// Creates an instance from next header, checksum, revocation trigger, sequence number, proxy binding, IPv4 home address binding only, global /// 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="revocationTrigger"> /// Indicating the event that triggered the initiator to send the BRI message. /// </param> /// <param name="sequenceNumber"> /// Used by the initiator to match a returned Binding Revocation Acknowledgement with this Binding Revocation Indication. /// This sequence number could be a random number. /// At any time, implementations must ensure there is no collision between the sequence numbers of all outstanding Binding Revocation Indication /// Messages. /// </param> /// <param name="proxyBinding"> /// Set by the initiator to indicate that the revoked binding(s) is a PMIPv6 binding. /// </param> /// <param name="ipV4HomeAddressBindingOnly"> /// Set by the initiator, home agent, or local mobility anchor to indicate to the receiving mobility entity the termination /// of the IPv4 Home Address binding only as in Home Agent Operation and Local Mobility Anchor Operation. /// </param> /// <param name="global"> /// Set by the initiator, LMA or MAG, to indicate the termination of all Per-Peer mobility Bindings or Multiple Bindings that share /// a common identifier(s) and are served by the initiator and responder as in Local Mobility Anchor Operation and Mobile Access Gateway Operation. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityBindingRevocationIndicationMessage(IpV4Protocol?nextHeader, ushort checksum, Ipv6MobilityBindingRevocationTrigger revocationTrigger, ushort sequenceNumber, bool proxyBinding, bool ipV4HomeAddressBindingOnly, bool global, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, proxyBinding, ipV4HomeAddressBindingOnly, global, options) { RevocationTrigger = revocationTrigger; }
/// <summary> /// Creates an instance from next header, checksum, sequence number, assigned address configuration, buffer, code 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="sequenceNumber">Must be set by the sender so replies can be matched to this message.</param> /// <param name="assignedAddressConfiguration"> /// Assigned address configuration flag. /// When set to true, this message requests a new CoA to be returned by the destination. /// May be set when Code = 0. Must be false when Code = 1. /// </param> /// <param name="buffer"> /// When set, the destination should buffer any packets toward the node indicated in the options of this message. /// Used when Code = 0, should be set to false when Code = 1. /// </param> /// <param name="code">Describes whether the source ip address is a previous care of address.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHandoverInitiateMessage(IpV4Protocol? nextHeader, ushort checksum, ushort sequenceNumber, bool assignedAddressConfiguration, bool buffer, IpV6HandoverInitiateMessageCode code, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { SequenceNumber = sequenceNumber; AssignedAddressConfiguration = assignedAddressConfiguration; Buffer = buffer; Code = code; }
/// <summary> /// Creates an instance from next header, checksum, home agent addresses 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="homeAgentAddresses">A list of alternate home agent addresses for the mobile node.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHomeAgentSwitchMessage(IpV4Protocol? nextHeader, ushort checksum, ReadOnlyCollection<IpV6Address> homeAgentAddresses, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.HomeAgentAddresses + (homeAgentAddresses == null ? 0 : homeAgentAddresses.Count) * IpV6Address.SizeOf) { if (homeAgentAddresses == null) throw new ArgumentNullException("homeAgentAddresses"); HomeAgentAddresses = homeAgentAddresses; }
/// <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 IpV6ExtensionHeaderMobilityBindingRevocationMessage(IpV4Protocol? nextHeader, ushort checksum, ushort sequenceNumber, bool proxyBinding, bool ipV4HomeAddressBindingOnly, bool global, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { SequenceNumber = sequenceNumber; ProxyBinding = proxyBinding; IpV4HomeAddressBindingOnly = ipV4HomeAddressBindingOnly; Global = global; }
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; }
internal static IpV6ExtensionHeaderMobilityBindingRefreshRequest ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) { return(null); } IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return(new IpV6ExtensionHeaderMobilityBindingRefreshRequest(nextHeader, checksum, options)); }
/// <summary> /// Creates an instance from next header, checksum, home agent addresses 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="homeAgentAddresses">A list of alternate home agent addresses for the mobile node.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHomeAgentSwitchMessage(IpV4Protocol?nextHeader, ushort checksum, ReadOnlyCollection <IpV6Address> homeAgentAddresses, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.HomeAgentAddresses + (homeAgentAddresses == null ? 0 : homeAgentAddresses.Count) * IpV6Address.SizeOf) { if (homeAgentAddresses == null) { throw new ArgumentNullException("homeAgentAddresses"); } HomeAgentAddresses = homeAgentAddresses; }
internal IpV6ExtensionHeaderMobilityBindingUpdateBase(IpV4Protocol?nextHeader, ushort checksum, ushort sequenceNumber, bool acknowledge, bool homeRegistration, bool linkLocalAddressCompatibility, bool keyManagementMobilityCapability, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { SequenceNumber = sequenceNumber; Acknowledge = acknowledge; HomeRegistration = homeRegistration; LinkLocalAddressCompatibility = linkLocalAddressCompatibility; KeyManagementMobilityCapability = keyManagementMobilityCapability; Lifetime = lifetime; }
internal IpV6ExtensionHeaderMobilityBindingUpdateBase(IpV4Protocol? nextHeader, ushort checksum, ushort sequenceNumber, bool acknowledge, bool homeRegistration, bool linkLocalAddressCompatibility, bool keyManagementMobilityCapability, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { SequenceNumber = sequenceNumber; Acknowledge = acknowledge; HomeRegistration = homeRegistration; LinkLocalAddressCompatibility = linkLocalAddressCompatibility; KeyManagementMobilityCapability = keyManagementMobilityCapability; Lifetime = lifetime; }
internal static IpV6ExtensionHeaderMobilityCareOfTestInit ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) { return(null); } ulong careOfInitCookie = messageData.ReadULong(MessageDataOffset.CareOfInitCookie, Endianity.Big); IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return(new IpV6ExtensionHeaderMobilityCareOfTestInit(nextHeader, checksum, careOfInitCookie, options)); }
internal static IpV6ExtensionHeaderMobilityHandoverAcknowledgeMessage ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) { return(null); } ushort sequenceNumber = messageData.ReadUShort(MessageDataOffset.SequenceNumber, Endianity.Big); IpV6MobilityHandoverAcknowledgeCode code = (IpV6MobilityHandoverAcknowledgeCode)messageData[MessageDataOffset.Code]; IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return(new IpV6ExtensionHeaderMobilityHandoverAcknowledgeMessage(nextHeader, checksum, sequenceNumber, code, options)); }
internal static IpV6ExtensionHeaderMobilityBindingError ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) { return(null); } IpV6BindingErrorStatus status = (IpV6BindingErrorStatus)messageData[MessageDataOffset.Status]; IpV6Address homeAddress = messageData.ReadIpV6Address(MessageDataOffset.HomeAddress, Endianity.Big); IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return(new IpV6ExtensionHeaderMobilityBindingError(nextHeader, checksum, status, homeAddress, options)); }
internal IpV6ExtensionHeaderMobility(IpV4Protocol?nextHeader, ushort checksum, IpV6MobilityOptions mobilityOptions, int?messageDataMobilityOptionsOffset) : base(nextHeader) { if (messageDataMobilityOptionsOffset.HasValue) { int mobilityOptionsExtraBytes = (8 - (messageDataMobilityOptionsOffset.Value + 6) % 8) % 8; if (mobilityOptions.BytesLength % 8 != mobilityOptionsExtraBytes) { mobilityOptions = mobilityOptions.Pad((8 + mobilityOptionsExtraBytes - (mobilityOptions.BytesLength % 8)) % 8); } } Checksum = checksum; MobilityOptions = mobilityOptions; }
internal static IpV6ExtensionHeaderMobilityHomeTest ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) { return(null); } ushort homeNonceIndex = messageData.ReadUShort(MessageDataOffset.HomeNonceIndex, Endianity.Big); ulong homeInitCookie = messageData.ReadULong(MessageDataOffset.HomeInitCookie, Endianity.Big); ulong homeKeygenToken = messageData.ReadULong(MessageDataOffset.HomeKeygenToken, Endianity.Big); IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return(new IpV6ExtensionHeaderMobilityHomeTest(nextHeader, checksum, homeNonceIndex, homeInitCookie, homeKeygenToken, options)); }
internal static IpV6ExtensionHeaderMobilityHeartbeatMessage ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) { return(null); } bool isUnsolicitedHeartbeatResponse = messageData.ReadBool(MessageDataOffset.IsUnsolicitedHeartbeatResponse, MessageDataMask.IsUnsolicitedHeartbeatResponse); bool isResponse = messageData.ReadBool(MessageDataOffset.IsResponse, MessageDataMask.IsResponse); uint sequenceNumber = messageData.ReadUInt(MessageDataOffset.SequenceNumber, Endianity.Big); IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.MobilityOptions, messageData.Length - MessageDataOffset.MobilityOptions)); return(new IpV6ExtensionHeaderMobilityHeartbeatMessage(nextHeader, checksum, isUnsolicitedHeartbeatResponse, isResponse, sequenceNumber, options)); }
internal static bool ParseMessageDataToFields(DataSegment messageData, out ushort sequenceNumber, out ushort lifetime, out IpV6MobilityOptions options) { if (messageData.Length < MinimumMessageDataLength) { sequenceNumber = 0; lifetime = 0; options = null; return(false); } 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); }
internal static IpV6ExtensionHeaderMobilityHandoverInitiateMessage ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) { return(null); } ushort sequenceNumber = messageData.ReadUShort(MessageDataOffset.SequenceNumber, Endianity.Big); bool assignedAddressConfiguration = messageData.ReadBool(MessageDataOffset.AssignedAddressConfiguration, MessageDataMask.AssignedAddressConfiguration); bool buffer = messageData.ReadBool(MessageDataOffset.Buffer, MessageDataMask.Buffer); IpV6HandoverInitiateMessageCode code = (IpV6HandoverInitiateMessageCode)messageData[MessageDataOffset.Code]; IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return(new IpV6ExtensionHeaderMobilityHandoverInitiateMessage(nextHeader, checksum, sequenceNumber, assignedAddressConfiguration, buffer, code, options)); }
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 next header, checksum, 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="sequenceNumber"> /// A monotonically increasing integer. Set by a sending node in a request message, and used to match a reply to the request. /// </param> /// <param name="lifetime"> /// The requested time in seconds for which the sender wishes to have local forwarding. /// A value of 0xffff (all ones) indicates an infinite lifetime. /// When set to 0, indicates a request to stop localized routing. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityLocalizedRoutingInitiation(IpV4Protocol? nextHeader, ushort checksum, ushort sequenceNumber, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, lifetime, options) { }
internal static IpV6ExtensionHeaderMobilityHandoverAcknowledgeMessage ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) return null; ushort sequenceNumber = messageData.ReadUShort(MessageDataOffset.SequenceNumber, Endianity.Big); IpV6MobilityHandoverAcknowledgeCode code = (IpV6MobilityHandoverAcknowledgeCode)messageData[MessageDataOffset.Code]; IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return new IpV6ExtensionHeaderMobilityHandoverAcknowledgeMessage(nextHeader, checksum, sequenceNumber, code, options); }
internal static IpV6ExtensionHeaderMobilityHeartbeatMessage ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) return null; bool isUnsolicitedHeartbeatResponse = messageData.ReadBool(MessageDataOffset.IsUnsolicitedHeartbeatResponse, MessageDataMask.IsUnsolicitedHeartbeatResponse); bool isResponse = messageData.ReadBool(MessageDataOffset.IsResponse, MessageDataMask.IsResponse); uint sequenceNumber = messageData.ReadUInt(MessageDataOffset.SequenceNumber, Endianity.Big); IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.MobilityOptions, messageData.Length - MessageDataOffset.MobilityOptions)); return new IpV6ExtensionHeaderMobilityHeartbeatMessage(nextHeader, checksum, isUnsolicitedHeartbeatResponse, isResponse, sequenceNumber, options); }
/// <summary> /// Creates an instance from next header, checksum 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="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityBindingRefreshRequest(IpV4Protocol?nextHeader, ushort checksum, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { }
/// <summary> /// Creates an instance from next header, checksum, sequence number, acknowledge, home registration, link local address compatilibity, /// key management mobility capability, 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="sequenceNumber"> /// Used by the receiving node to sequence Binding Updates and by the sending node to match a returned Binding Acknowledgement with this Binding Update. /// </param> /// <param name="acknowledge"> /// Set by the sending mobile node to request a Binding Acknowledgement be returned upon receipt of the Binding Update. /// For Fast Binding Update this must be set to one to request that PAR send a Fast Binding Acknowledgement message. /// </param> /// <param name="homeRegistration"> /// Set by the sending mobile node to request that the receiving node should act as this node's home agent. /// The destination of the packet carrying this message must be that of a router sharing the same subnet prefix as the home address /// of the mobile node in the binding. /// For Fast Binding Update this must be set to one. /// </param> /// <param name="linkLocalAddressCompatibility"> /// Set when the home address reported by the mobile node has the same interface identifier as the mobile node's link-local address. /// </param> /// <param name="keyManagementMobilityCapability"> /// If this is cleared, the protocol used 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.) /// If manual IPsec configuration is used, the bit must be cleared. /// </param> /// <param name="lifetime"> /// The number of time units remaining before the binding must be considered expired. /// A value of zero indicates that the Binding Cache entry for the mobile node must be deleted. /// One time unit is 4 seconds for Binding Update and 1 second for Fast Binding Update. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityFastBindingUpdate(IpV4Protocol? nextHeader, ushort checksum, ushort sequenceNumber, bool acknowledge, bool homeRegistration, bool linkLocalAddressCompatibility, bool keyManagementMobilityCapability, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, acknowledge, homeRegistration, linkLocalAddressCompatibility, keyManagementMobilityCapability, lifetime, options) { }
internal static IpV6ExtensionHeaderMobilityHomeTest ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) return null; ushort homeNonceIndex = messageData.ReadUShort(MessageDataOffset.HomeNonceIndex, Endianity.Big); ulong homeInitCookie = messageData.ReadULong(MessageDataOffset.HomeInitCookie, Endianity.Big); ulong homeKeygenToken = messageData.ReadULong(MessageDataOffset.HomeKeygenToken, Endianity.Big); IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return new IpV6ExtensionHeaderMobilityHomeTest(nextHeader, checksum, homeNonceIndex, homeInitCookie, homeKeygenToken, options); }
/// <summary> /// Creates an instance from next header, checksum 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="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityBindingRefreshRequest(IpV4Protocol? nextHeader, ushort checksum, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { }
/// <summary> /// Creates an instance from next header, checksum, sequence number, code 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="sequenceNumber"> /// Copied from the corresponding field in the Handover Initiate message to which this message is a response, /// to enable the receiver to match this Handover Acknowledge message with an outstanding Handover Initiate message. /// </param> /// <param name="code">Describes whether the handover was accepted or not and more details.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHandoverAcknowledgeMessage(IpV4Protocol?nextHeader, ushort checksum, ushort sequenceNumber, IpV6MobilityHandoverAcknowledgeCode code, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { SequenceNumber = sequenceNumber; Code = code; }
/// <summary> /// Creates an instance from next header, checksum, sequence number, acknowledge, home registration, link local address compatilibity, /// key management mobility capability, 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="sequenceNumber"> /// Used by the receiving node to sequence Binding Updates and by the sending node to match a returned Binding Acknowledgement with this Binding Update. /// </param> /// <param name="acknowledge"> /// Set by the sending mobile node to request a Binding Acknowledgement be returned upon receipt of the Binding Update. /// For Fast Binding Update this must be set to one to request that PAR send a Fast Binding Acknowledgement message. /// </param> /// <param name="homeRegistration"> /// Set by the sending mobile node to request that the receiving node should act as this node's home agent. /// The destination of the packet carrying this message must be that of a router sharing the same subnet prefix as the home address /// of the mobile node in the binding. /// For Fast Binding Update this must be set to one. /// </param> /// <param name="linkLocalAddressCompatibility"> /// Set when the home address reported by the mobile node has the same interface identifier as the mobile node's link-local address. /// </param> /// <param name="keyManagementMobilityCapability"> /// If this is cleared, the protocol used 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.) /// If manual IPsec configuration is used, the bit must be cleared. /// </param> /// <param name="lifetime"> /// The number of time units remaining before the binding must be considered expired. /// A value of zero indicates that the Binding Cache entry for the mobile node must be deleted. /// One time unit is 4 seconds for Binding Update and 1 second for Fast Binding Update. /// </param> /// <param name="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityFastBindingUpdate(IpV4Protocol?nextHeader, ushort checksum, ushort sequenceNumber, bool acknowledge, bool homeRegistration, bool linkLocalAddressCompatibility, bool keyManagementMobilityCapability, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, acknowledge, homeRegistration, linkLocalAddressCompatibility, keyManagementMobilityCapability, lifetime, options) { }
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 next header, checksum, sequence number, assigned address configuration, buffer, code 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="sequenceNumber">Must be set by the sender so replies can be matched to this message.</param> /// <param name="assignedAddressConfiguration"> /// Assigned address configuration flag. /// When set to true, this message requests a new CoA to be returned by the destination. /// May be set when Code = 0. Must be false when Code = 1. /// </param> /// <param name="buffer"> /// When set, the destination should buffer any packets toward the node indicated in the options of this message. /// Used when Code = 0, should be set to false when Code = 1. /// </param> /// <param name="code">Describes whether the source ip address is a previous care of address.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHandoverInitiateMessage(IpV4Protocol?nextHeader, ushort checksum, ushort sequenceNumber, bool assignedAddressConfiguration, bool buffer, IpV6HandoverInitiateMessageCode code, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { SequenceNumber = sequenceNumber; AssignedAddressConfiguration = assignedAddressConfiguration; Buffer = buffer; Code = code; }
/// <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) { }
internal static IpV6ExtensionHeaderMobilityBindingError ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData) { if (messageData.Length < MinimumMessageDataLength) return null; IpV6BindingErrorStatus status = (IpV6BindingErrorStatus)messageData[MessageDataOffset.Status]; IpV6Address homeAddress = messageData.ReadIpV6Address(MessageDataOffset.HomeAddress, Endianity.Big); IpV6MobilityOptions options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return new IpV6ExtensionHeaderMobilityBindingError(nextHeader, checksum, status, homeAddress, options); }
/// <summary> /// Creates an instance from next header, checksum 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="options"> /// Zero or more TLV-encoded mobility options. /// </param> public IpV6ExtensionHeaderMobilityFastNeighborAdvertisement(IpV4Protocol? nextHeader, ushort checksum, IpV6MobilityOptions options) : base(nextHeader, checksum, options, MessageDataOffset.Options) { }
/// <summary> /// Creates an instance from next header, checksum, sequence number, acknowledge, home registration, link local address compatibility, /// key management mobiltiy capability, map registration, mobile router, proxy registration flag, forcing UDP encapsulation, TLV header format, /// bulk binding update, 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="sequenceNumber"> /// Used by the receiving node to sequence Binding Updates and by the sending node to match a returned Binding Acknowledgement with this Binding Update. /// </param> /// <param name="acknowledge"> /// Set by the sending mobile node to request a Binding Acknowledgement be returned upon receipt of the Binding Update. /// For Fast Binding Update this must be set to one to request that PAR send a Fast Binding Acknowledgement message. /// </param> /// <param name="homeRegistration"> /// Set by the sending mobile node to request that the receiving node should act as this node's home agent. /// The destination of the packet carrying this message must be that of a router sharing the same subnet prefix as the home address /// of the mobile node in the binding. /// For Fast Binding Update this must be set to one. /// </param> /// <param name="linkLocalAddressCompatibility"> /// Set when the home address reported by the mobile node has the same interface identifier as the mobile node's link-local address. /// </param> /// <param name="keyManagementMobilityCapability"> /// If this is cleared, the protocol used 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.) /// If manual IPsec configuration is used, the bit must be cleared. /// </param> /// <param name="mapRegistration"> /// Indicates MAP registration. /// When a mobile node registers with the MAP, the MapRegistration and Acknowledge must be set to distinguish this registration /// from a Binding Update being sent to the Home Agent or a correspondent node. /// </param> /// <param name="mobileRouter"> /// Indicates to the Home Agent that the Binding Update is from a Mobile Router. /// If false, the Home Agent assumes that the Mobile Router is behaving as a Mobile Node, /// and it must not forward packets destined for the Mobile Network to the Mobile Router. /// </param> /// <param name="proxyRegistration"> /// Indicates to the local mobility anchor that the Binding Update message is a proxy registration. /// Must be true for proxy registrations and must be false direct registrations sent by a mobile node. /// </param> /// <param name="forcingUdpEncapsulation"> /// Indicates a request for forcing UDP encapsulation regardless of whether a NAT is present on the path between the mobile node and the home agent. /// May be set by the mobile node if it is required to use UDP encapsulation regardless of the presence of a NAT. /// </param> /// <param name="typeLengthValueHeaderFormat"> /// Indicates that the mobile access gateway requests the use of the TLV header for encapsulating IPv6 or IPv4 packets in IPv4. /// </param> /// <param name="bulkBindingUpdate"> /// If true, it informs the local mobility anchor to enable bulk binding update support for the mobility session associated with this message. /// If false, the local mobility anchor must exclude the mobility session associated with this message from any bulk-binding-related operations /// and any binding update, or binding revocation operations with bulk-specific scope will not be relevant to that mobility session. /// This flag is relevant only for Proxy Mobile IPv6 and therefore must be set to false when the ProxyRegistration is false. /// </param> /// <param name="lifetime"> /// The number of time units remaining before the binding must be considered expired. /// A value of zero indicates that the Binding Cache entry for the mobile node must be deleted. /// One time unit is 4 seconds for Binding Update and 1 second for Fast Binding Update. /// </param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityBindingUpdate(IpV4Protocol? nextHeader, ushort checksum, ushort sequenceNumber, bool acknowledge, bool homeRegistration, bool linkLocalAddressCompatibility, bool keyManagementMobilityCapability, bool mapRegistration, bool mobileRouter, bool proxyRegistration, bool forcingUdpEncapsulation, bool typeLengthValueHeaderFormat, bool bulkBindingUpdate, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, acknowledge, homeRegistration, linkLocalAddressCompatibility, keyManagementMobilityCapability, lifetime, options) { MapRegistration = mapRegistration; MobileRouter = mobileRouter; ProxyRegistration = proxyRegistration; ForcingUdpEncapsulation = forcingUdpEncapsulation; TypeLengthValueHeaderFormat = typeLengthValueHeaderFormat; BulkBindingUpdate = bulkBindingUpdate; }
public static IpV6ExtensionHeaderMobility NextIpV6ExtensionHeaderMobility(this Random random, IpV4Protocol?nextHeader) { IpV6MobilityHeaderType mobilityHeaderType = random.NextEnum <IpV6MobilityHeaderType>(); ushort checksum = random.NextUShort(); switch (mobilityHeaderType) { case IpV6MobilityHeaderType.BindingRefreshRequest: // 0 return(new IpV6ExtensionHeaderMobilityBindingRefreshRequest(nextHeader, checksum, random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.HomeTestInit: // 1 return(new IpV6ExtensionHeaderMobilityHomeTestInit(nextHeader, checksum, random.NextULong(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.CareOfTestInit: // 2 return(new IpV6ExtensionHeaderMobilityCareOfTestInit(nextHeader, checksum, random.NextULong(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.HomeTest: // 3 return(new IpV6ExtensionHeaderMobilityHomeTest(nextHeader, checksum, random.NextUShort(), random.NextULong(), random.NextULong(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.CareOfTest: // 4 return(new IpV6ExtensionHeaderMobilityCareOfTest(nextHeader, checksum, random.NextUShort(), random.NextULong(), random.NextULong(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.BindingUpdate: // 5 return(new IpV6ExtensionHeaderMobilityBindingUpdate(nextHeader, checksum, random.NextUShort(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextUShort(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.BindingAcknowledgement: // 6 return(new IpV6ExtensionHeaderMobilityBindingAcknowledgement(nextHeader, checksum, random.NextEnum <IpV6BindingAcknowledgementStatus>(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextUShort(), random.NextUShort(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.BindingError: // 7 return(new IpV6ExtensionHeaderMobilityBindingError(nextHeader, checksum, random.NextEnum <IpV6BindingErrorStatus>(), random.NextIpV6Address(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.FastBindingUpdate: // 8 return(new IpV6ExtensionHeaderMobilityFastBindingUpdate(nextHeader, checksum, random.NextUShort(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextBool(), random.NextUShort(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.FastBindingAcknowledgement: // 9 return(new IpV6ExtensionHeaderMobilityFastBindingAcknowledgement(nextHeader, checksum, random.NextEnum <IpV6BindingAcknowledgementStatus>(), random.NextBool(), random.NextUShort(), random.NextUShort(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.FastNeighborAdvertisement: // 10 return(new IpV6ExtensionHeaderMobilityFastNeighborAdvertisement(nextHeader, checksum, random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.Experimental: // 11 return(new IpV6ExtensionHeaderMobilityExperimental(nextHeader, checksum, random.NextDataSegment(2 + random.Next(10) * 8))); case IpV6MobilityHeaderType.HomeAgentSwitchMessage: // 12 return(new IpV6ExtensionHeaderMobilityHomeAgentSwitchMessage(nextHeader, checksum, random.NextIpV6AddressArray(random.NextInt(0, 10)), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.HeartbeatMessage: // 13 return(new IpV6ExtensionHeaderMobilityHeartbeatMessage(nextHeader, checksum, random.NextBool(), random.NextBool(), random.NextUInt(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.HandoverInitiateMessage: // 14 return(new IpV6ExtensionHeaderMobilityHandoverInitiateMessage(nextHeader, checksum, random.NextUShort(), random.NextBool(), random.NextBool(), random.NextEnum <IpV6HandoverInitiateMessageCode>(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.HandoverAcknowledgeMessage: // 15 return(new IpV6ExtensionHeaderMobilityHandoverAcknowledgeMessage(nextHeader, checksum, random.NextUShort(), random.NextEnum <IpV6MobilityHandoverAcknowledgeCode>(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.BindingRevocationMessage: // 16 IpV6MobilityBindingRevocationType bindingRevocationType = random.NextEnum(IpV6MobilityBindingRevocationType.None); byte revocationTriggerOrStatus = random.NextByte(); ushort sequenceNumber = random.NextUShort(); bool proxyBinding = random.NextBool(); bool ipV4HomeAddressBindingOnly = random.NextBool(); bool global = random.NextBool(); IpV6MobilityOptions options = random.NextIpV6MobilityOptions(); switch (bindingRevocationType) { case IpV6MobilityBindingRevocationType.BindingRevocationIndication: return(new IpV6ExtensionHeaderMobilityBindingRevocationIndicationMessage( nextHeader, checksum, (Ipv6MobilityBindingRevocationTrigger)revocationTriggerOrStatus, sequenceNumber, proxyBinding, ipV4HomeAddressBindingOnly, global, options)); case IpV6MobilityBindingRevocationType.BindingRevocationAcknowledgement: return(new IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage( nextHeader, checksum, (Ipv6MobilityBindingRevocationStatus)revocationTriggerOrStatus, sequenceNumber, proxyBinding, ipV4HomeAddressBindingOnly, global, options)); default: throw new InvalidOperationException(string.Format("Invalid bindingRevocationType value {0}", bindingRevocationType)); } case IpV6MobilityHeaderType.LocalizedRoutingInitiation: // 17 return(new IpV6ExtensionHeaderMobilityLocalizedRoutingInitiation(nextHeader, checksum, random.NextUShort(), random.NextUShort(), random.NextIpV6MobilityOptions())); case IpV6MobilityHeaderType.LocalizedRoutingAcknowledgement: // 18 return(new IpV6ExtensionHeaderMobilityLocalizedRoutingAcknowledgement(nextHeader, checksum, random.NextUShort(), random.NextBool(), random.NextEnum <IpV6MobilityLocalizedRoutingAcknowledgementStatus>(), random.NextUShort(), random.NextIpV6MobilityOptions())); default: throw new InvalidOperationException(string.Format("Invalid mobilityHeaderType value {0}", mobilityHeaderType)); } }
internal IpV6ExtensionHeaderMobility(IpV4Protocol? nextHeader, ushort checksum, IpV6MobilityOptions mobilityOptions, int? messageDataMobilityOptionsOffset) : base(nextHeader) { if (messageDataMobilityOptionsOffset.HasValue) { int mobilityOptionsExtraBytes = (8 - (messageDataMobilityOptionsOffset.Value + 6) % 8) % 8; if (mobilityOptions.BytesLength % 8 != mobilityOptionsExtraBytes) mobilityOptions = mobilityOptions.Pad((8 + mobilityOptionsExtraBytes - (mobilityOptions.BytesLength % 8)) % 8); } Checksum = checksum; MobilityOptions = mobilityOptions; }
internal static bool ParseMessageDataToFields(DataSegment messageData, out ushort sequenceNumber, out bool acknowledge, out bool homeRegistration, out bool linkLocalAddressCompatibility, out bool keyManagementMobilityCapability, out ushort lifetime, out IpV6MobilityOptions options) { if (messageData.Length < MinimumMessageDataLength) { sequenceNumber = 0; acknowledge = false; homeRegistration = false; linkLocalAddressCompatibility = false; keyManagementMobilityCapability = false; lifetime = 0; options = null; return false; } sequenceNumber = messageData.ReadUShort(MessageDataOffset.SequenceNumber, Endianity.Big); acknowledge = messageData.ReadBool(MessageDataOffset.Acknowledge, MessageDataMask.Acknowledge); homeRegistration = messageData.ReadBool(MessageDataOffset.HomeRegistration, MessageDataMask.HomeRegistration); linkLocalAddressCompatibility = messageData.ReadBool(MessageDataOffset.LinkLocalAddressCompatibility, MessageDataMask.LinkLocalAddressCompatibility); keyManagementMobilityCapability = messageData.ReadBool(MessageDataOffset.KeyManagementMobilityCapability, MessageDataMask.KeyManagementMobilityCapability); lifetime = messageData.ReadUShort(MessageDataOffset.Lifetime, Endianity.Big); options = new IpV6MobilityOptions(messageData.Subsegment(MessageDataOffset.Options, messageData.Length - MessageDataOffset.Options)); return true; }
internal static bool ParseMessageDataToFields(DataSegment messageData, out ushort sequenceNumber, out ushort lifetime, out IpV6MobilityOptions options) { if (messageData.Length < MinimumMessageDataLength) { sequenceNumber = 0; lifetime = 0; options = null; return false; } 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 next header, checksum, sequence number, acknowledge, home registration, link local address compatibility, /// key management mobiltiy capability, map registration, mobile router, proxy registration flag, forcing UDP encapsulation, TLV header format, /// bulk binding update, 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="sequenceNumber"> /// Used by the receiving node to sequence Binding Updates and by the sending node to match a returned Binding Acknowledgement with this Binding Update. /// </param> /// <param name="acknowledge"> /// Set by the sending mobile node to request a Binding Acknowledgement be returned upon receipt of the Binding Update. /// For Fast Binding Update this must be set to one to request that PAR send a Fast Binding Acknowledgement message. /// </param> /// <param name="homeRegistration"> /// Set by the sending mobile node to request that the receiving node should act as this node's home agent. /// The destination of the packet carrying this message must be that of a router sharing the same subnet prefix as the home address /// of the mobile node in the binding. /// For Fast Binding Update this must be set to one. /// </param> /// <param name="linkLocalAddressCompatibility"> /// Set when the home address reported by the mobile node has the same interface identifier as the mobile node's link-local address. /// </param> /// <param name="keyManagementMobilityCapability"> /// If this is cleared, the protocol used 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.) /// If manual IPsec configuration is used, the bit must be cleared. /// </param> /// <param name="mapRegistration"> /// Indicates MAP registration. /// When a mobile node registers with the MAP, the MapRegistration and Acknowledge must be set to distinguish this registration /// from a Binding Update being sent to the Home Agent or a correspondent node. /// </param> /// <param name="mobileRouter"> /// Indicates to the Home Agent that the Binding Update is from a Mobile Router. /// If false, the Home Agent assumes that the Mobile Router is behaving as a Mobile Node, /// and it must not forward packets destined for the Mobile Network to the Mobile Router. /// </param> /// <param name="proxyRegistration"> /// Indicates to the local mobility anchor that the Binding Update message is a proxy registration. /// Must be true for proxy registrations and must be false direct registrations sent by a mobile node. /// </param> /// <param name="forcingUdpEncapsulation"> /// Indicates a request for forcing UDP encapsulation regardless of whether a NAT is present on the path between the mobile node and the home agent. /// May be set by the mobile node if it is required to use UDP encapsulation regardless of the presence of a NAT. /// </param> /// <param name="typeLengthValueHeaderFormat"> /// Indicates that the mobile access gateway requests the use of the TLV header for encapsulating IPv6 or IPv4 packets in IPv4. /// </param> /// <param name="bulkBindingUpdate"> /// If true, it informs the local mobility anchor to enable bulk binding update support for the mobility session associated with this message. /// If false, the local mobility anchor must exclude the mobility session associated with this message from any bulk-binding-related operations /// and any binding update, or binding revocation operations with bulk-specific scope will not be relevant to that mobility session. /// This flag is relevant only for Proxy Mobile IPv6 and therefore must be set to false when the ProxyRegistration is false. /// </param> /// <param name="lifetime"> /// The number of time units remaining before the binding must be considered expired. /// A value of zero indicates that the Binding Cache entry for the mobile node must be deleted. /// One time unit is 4 seconds for Binding Update and 1 second for Fast Binding Update. /// </param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityBindingUpdate(IpV4Protocol?nextHeader, ushort checksum, ushort sequenceNumber, bool acknowledge, bool homeRegistration, bool linkLocalAddressCompatibility, bool keyManagementMobilityCapability, bool mapRegistration, bool mobileRouter, bool proxyRegistration, bool forcingUdpEncapsulation, bool typeLengthValueHeaderFormat, bool bulkBindingUpdate, ushort lifetime, IpV6MobilityOptions options) : base(nextHeader, checksum, sequenceNumber, acknowledge, homeRegistration, linkLocalAddressCompatibility, keyManagementMobilityCapability, lifetime, options) { MapRegistration = mapRegistration; MobileRouter = mobileRouter; ProxyRegistration = proxyRegistration; ForcingUdpEncapsulation = forcingUdpEncapsulation; TypeLengthValueHeaderFormat = typeLengthValueHeaderFormat; BulkBindingUpdate = bulkBindingUpdate; }