/// <summary> /// Creates an instance from status, Prefix Length and Home Address. /// </summary> /// <param name="status"> /// Indicates success or failure for the IPv4 home address binding. /// Values from 0 to 127 indicate success. /// Higher values indicate failure. /// </param> /// <param name="prefixLength"> /// The prefix length of the address allocated. /// This field is only valid in case of success and must be set to zero and ignored in case of failure. /// This field overrides what the mobile node requested (if not equal to the requested length). /// </param> /// <param name="homeAddress"> /// The IPv4 home address that the home agent will use in the binding cache entry. /// This could be a public or private address. /// This field must contain the mobile node's IPv4 home address. /// If the address were dynamically allocated, the home agent will add the address to inform the mobile node. /// Otherwise, if the address is statically allocated to the mobile node, the home agent will copy it from the binding update message. /// </param> public IpV6MobilityOptionIpV4AddressAcknowledgement(IpV6AddressAcknowledgementStatus status, byte prefixLength, IpV4Address homeAddress) : base(IpV6MobilityOptionType.IpV4AddressAcknowledgement) { if (prefixLength > MaxPrefixLength) throw new ArgumentOutOfRangeException("prefixLength", prefixLength, string.Format(CultureInfo.InvariantCulture, "Exceeded maximum value {0}", MaxPrefixLength)); Status = status; PrefixLength = prefixLength; HomeAddress = homeAddress; }
/// <summary> /// Creates an instance from status, Prefix Length and Home Address. /// </summary> /// <param name="status"> /// Indicates success or failure for the IPv4 home address binding. /// Values from 0 to 127 indicate success. /// Higher values indicate failure. /// </param> /// <param name="prefixLength"> /// The prefix length of the address allocated. /// This field is only valid in case of success and must be set to zero and ignored in case of failure. /// This field overrides what the mobile node requested (if not equal to the requested length). /// </param> /// <param name="homeAddress"> /// The IPv4 home address that the home agent will use in the binding cache entry. /// This could be a public or private address. /// This field must contain the mobile node's IPv4 home address. /// If the address were dynamically allocated, the home agent will add the address to inform the mobile node. /// Otherwise, if the address is statically allocated to the mobile node, the home agent will copy it from the binding update message. /// </param> public IpV6MobilityOptionIpV4AddressAcknowledgement(IpV6AddressAcknowledgementStatus status, byte prefixLength, IpV4Address homeAddress) : base(IpV6MobilityOptionType.IpV4AddressAcknowledgement) { if (prefixLength > MaxPrefixLength) { throw new ArgumentOutOfRangeException("prefixLength", prefixLength, string.Format(CultureInfo.InvariantCulture, "Exceeded maximum value {0}", MaxPrefixLength)); } Status = status; PrefixLength = prefixLength; HomeAddress = homeAddress; }
internal override IpV6MobilityOption CreateInstance(DataSegment data) { if (data.Length != OptionDataLength) { return(null); } IpV6AddressAcknowledgementStatus status = (IpV6AddressAcknowledgementStatus)data[Offset.Status]; byte prefixLength = (byte)((data[Offset.PrefixLength] & Mask.PrefixLength) >> Shift.PrefixLength); IpV4Address homeAddress = data.ReadIpV4Address(Offset.HomeAddress, Endianity.Big); return(new IpV6MobilityOptionIpV4AddressAcknowledgement(status, prefixLength, homeAddress)); }