/// <summary>
        /// Creates an instance from status, Prefix Length and Home Address.
        /// </summary>
        /// <param name="status">
        /// Indicates success or failure for the IPv4 home address assignment.
        /// Values from 0 to 127 indicate success.
        /// Higher values (128 to 255) indicate failure.
        /// </param>
        /// <param name="prefixLength">
        /// Used to carry the prefix length of the mobile node's IPv4 home network corresponding to the IPv4 home address contained in the option.
        /// </param>
        /// <param name="homeAddress">
        /// Used to carry the IPv4 home address assigned to the mobile node.
        /// </param>
        public IpV6MobilityOptionIpV4HomeAddressReply(IpV6IpV4HomeAddressReplyStatus status, byte prefixLength, IpV4Address homeAddress)
            : base(IpV6MobilityOptionType.IpV4HomeAddressReply)
        {
            if (prefixLength > MaxPrefixLength)
                throw new ArgumentOutOfRangeException("prefixLength", prefixLength,
                                                      string.Format(CultureInfo.InvariantCulture, "Max prefix length is {0}", MaxPrefixLength));

            Status = status;
            PrefixLength = prefixLength;
            HomeAddress = homeAddress;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an instance from status, Prefix Length and Home Address.
        /// </summary>
        /// <param name="status">
        /// Indicates success or failure for the IPv4 home address assignment.
        /// Values from 0 to 127 indicate success.
        /// Higher values (128 to 255) indicate failure.
        /// </param>
        /// <param name="prefixLength">
        /// Used to carry the prefix length of the mobile node's IPv4 home network corresponding to the IPv4 home address contained in the option.
        /// </param>
        /// <param name="homeAddress">
        /// Used to carry the IPv4 home address assigned to the mobile node.
        /// </param>
        public IpV6MobilityOptionIpV4HomeAddressReply(IpV6IpV4HomeAddressReplyStatus status, byte prefixLength, IpV4Address homeAddress)
            : base(IpV6MobilityOptionType.IpV4HomeAddressReply)
        {
            if (prefixLength > MaxPrefixLength)
            {
                throw new ArgumentOutOfRangeException("prefixLength", prefixLength,
                                                      string.Format(CultureInfo.InvariantCulture, "Max prefix length is {0}", MaxPrefixLength));
            }

            Status       = status;
            PrefixLength = prefixLength;
            HomeAddress  = homeAddress;
        }
Exemplo n.º 3
0
        internal override IpV6MobilityOption CreateInstance(DataSegment data)
        {
            if (data.Length != OptionDataLength)
            {
                return(null);
            }

            IpV6IpV4HomeAddressReplyStatus status = (IpV6IpV4HomeAddressReplyStatus)data[Offset.Status];
            byte        prefixLength = (byte)((data[Offset.PrefixLength] & Mask.PrefixLength) >> Shift.PrefixLength);
            IpV4Address homeAddress  = data.ReadIpV4Address(Offset.HomeAddress, Endianity.Big);

            return(new IpV6MobilityOptionIpV4HomeAddressReply(status, prefixLength, homeAddress));
        }