当前位置: 首页>>代码示例>>C#>>正文


C# DataSegment.ReadIpV6Address方法代码示例

本文整理汇总了C#中DataSegment.ReadIpV6Address方法的典型用法代码示例。如果您正苦于以下问题:C# DataSegment.ReadIpV6Address方法的具体用法?C# DataSegment.ReadIpV6Address怎么用?C# DataSegment.ReadIpV6Address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataSegment的用法示例。


在下文中一共展示了DataSegment.ReadIpV6Address方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateInstance

 internal override IpV6Option CreateInstance(DataSegment data)
 {
     if (data.Length != OptionDataLength)
         return null;
     IpV6Address homeAddress = data.ReadIpV6Address(0, Endianity.Big);
     return new IpV6OptionHomeAddress(homeAddress);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:IpV6OptionHomeAddress.cs

示例2: CreateInstance

        internal override IpV6MobilityOption CreateInstance(DataSegment data)
        {
            if (data.Length < OptionDataMinimumLength)
                return null;

            IpV6LocalMobilityAnchorAddressCode code = (IpV6LocalMobilityAnchorAddressCode)data[Offset.Code];
            switch (code)
            {
                case IpV6LocalMobilityAnchorAddressCode.IpV6:
                {
                    if (data.Length != Offset.LocalMobilityAnchorAddress + IpV6Address.SizeOf)
                        return null;
                    IpV6Address localMobilityAnchorAddress = data.ReadIpV6Address(Offset.LocalMobilityAnchorAddress, Endianity.Big);
                    return new IpV6MobilityOptionLocalMobilityAnchorAddress(localMobilityAnchorAddress);
                }

                case IpV6LocalMobilityAnchorAddressCode.IpV4:
                {
                    if (data.Length != Offset.LocalMobilityAnchorAddress + IpV4Address.SizeOf)
                        return null;
                    IpV4Address localMobilityAnchorAddress = data.ReadIpV4Address(Offset.LocalMobilityAnchorAddress, Endianity.Big);
                    return new IpV6MobilityOptionLocalMobilityAnchorAddress(localMobilityAnchorAddress);
                }

                default:
                    return null;
            }
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:28,代码来源:IpV6MobilityOptionLocalMobilityAnchorAddress.cs

示例3: ParseRoutingData

        internal static IpV6ExtensionHeaderRoutingHomeAddress ParseRoutingData(IpV4Protocol nextHeader, byte segmentsLeft, DataSegment routingData)
        {
            if (routingData.Length != RoutingDataLength)
                return null;

            IpV6Address homeAddress = routingData.ReadIpV6Address(RoutingDataOffset.HomeAddress, Endianity.Big);
            return new IpV6ExtensionHeaderRoutingHomeAddress(nextHeader, segmentsLeft, homeAddress);
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:8,代码来源:IpV6ExtensionHeaderRoutingHomeAddress.cs

示例4: CreateInstance

 /// <summary>
 /// Parses an option from the given data.
 /// </summary>
 /// <param name="data">The data to parse.</param>
 /// <returns>The option if parsing was successful, null otherwise.</returns>
 public IpV6Option CreateInstance(DataSegment data)
 {
     if (data == null) 
         throw new ArgumentNullException("data");
     if (data.Length != OptionDataLength)
         return null;
     IpV6Address homeAddress = data.ReadIpV6Address(0, Endianity.Big);
     return new IpV6OptionHomeAddress(homeAddress);
 }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:14,代码来源:IpV6OptionHomeAddress.cs

示例5: CreateInstance

        internal override IpV6MobilityOption CreateInstance(DataSegment data)
        {
            if (data.Length != OptionDataLength)
                return null;

            if (data[Offset.AddressLength] != AddressLength)
                return null;

            return new IpV6MobilityOptionMobileAccessGatewayIpV6Address(data.ReadIpV6Address(Offset.Address, Endianity.Big));
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:10,代码来源:IpV6MobilityOptionMobileAccessGatewayIpV6Address.cs

示例6: Read

        internal static bool Read(DataSegment data, out IpV6Address address)
        {
            if (data.Length != OptionDataLength)
            {
                address = IpV6Address.Zero;
                return false;
            }

            address = data.ReadIpV6Address(0, Endianity.Big);
            return true;
        }
开发者ID:JackWangCUMT,项目名称:WiFiSpy,代码行数:11,代码来源:IpV6MobilityOptionIpV6Address.cs

示例7: ParseRoutingData

        internal static IpV6ExtensionHeaderRoutingSourceRoute ParseRoutingData(IpV4Protocol nextHeader, byte segmentsLeft, DataSegment routingData)
        {
            if (routingData.Length < RoutingDataMinimumLength)
                return null;

            if ((routingData.Length - RoutingDataMinimumLength) % IpV6Address.SizeOf != 0)
                return null;

            int numAddresses = (routingData.Length - RoutingDataMinimumLength) / 8;
            IpV6Address[] addresses = new IpV6Address[numAddresses];
            for (int i = 0; i != numAddresses; ++i)
                addresses[i] = routingData.ReadIpV6Address(RoutingDataOffset.Addresses + i * IpV6Address.SizeOf, Endianity.Big);
            return new IpV6ExtensionHeaderRoutingSourceRoute(nextHeader, segmentsLeft, addresses);
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:14,代码来源:IpV6ExtensionHeaderRoutingSourceRoute.cs

示例8: ParseMessageData

        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);
        }
开发者ID:JackWangCUMT,项目名称:WiFiSpy,代码行数:10,代码来源:IpV6ExtensionHeaderMobilityBindingError.cs

示例9: CreateInstance

        internal override IpV6MobilityOption CreateInstance(DataSegment data)
        {
            if (data.Length < OptionDataMinimumLength)
                return null;

            bool isIpV4 = data.ReadBool(Offset.IsIpV4, Mask.IsIpV4);
            bool isIpV6 = data.ReadBool(Offset.IsIpV6, Mask.IsIpV6);

            if (isIpV4 && !isIpV6)
            {
                if (data.Length != OptionDataMinimumLength + IpV4Address.SizeOf)
                    return null;
                IpV4Address localMobilityAddress = data.ReadIpV4Address(Offset.LocalMobilityAddress, Endianity.Big);
                return new IpV6MobilityOptionRedirect(localMobilityAddress);
            }
            if (isIpV6 && !isIpV4)
            {
                if (data.Length != OptionDataMinimumLength + IpV6Address.SizeOf)
                    return null;
                IpV6Address localMobilityAddress = data.ReadIpV6Address(Offset.LocalMobilityAddress, Endianity.Big);
                return new IpV6MobilityOptionRedirect(localMobilityAddress);
            }

            return null;
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:25,代码来源:IpV6MobilityOptionRedirect.cs

示例10: CreateSpecificInstance

        internal static IpV6OptionSmfDpdSequenceBased CreateSpecificInstance(DataSegment data)
        {
            IpV6TaggerIdType taggerIdType = (IpV6TaggerIdType)((data[Offset.TaggerIdType] & Mask.TaggerIdType) >> Shift.TaggerIdType);
            int taggerIdLength = (taggerIdType == IpV6TaggerIdType.Null ? 0 : (data[Offset.TaggerIdLength] & Mask.TaggerIdLength) + 1);
            if (data.Length < Offset.TaggerId + taggerIdLength)
                return null;
            DataSegment identifier = data.Subsegment(Offset.TaggerId + taggerIdLength, data.Length - Offset.TaggerId - taggerIdLength);
            switch (taggerIdType)
            {
                case IpV6TaggerIdType.Null:
                    return new IpV6OptionSmfDpdNull(identifier);
                    
                case IpV6TaggerIdType.Default:
                    return new IpV6OptionSmfDpdDefault(data.Subsegment(Offset.TaggerId, taggerIdLength), identifier);

                case IpV6TaggerIdType.IpV4:
                    if (taggerIdLength != IpV4Address.SizeOf)
                        return null;
                    IpV4Address ipV4Address = data.ReadIpV4Address(0, Endianity.Big);
                    return new IpV6OptionSmfDpdIpV4(ipV4Address, identifier);

                case IpV6TaggerIdType.IpV6:
                    if (taggerIdLength != IpV6Address.SizeOf)
                        return null;
                    IpV6Address ipV6Address = data.ReadIpV6Address(0, Endianity.Big);
                    return new IpV6OptionSmfDpdIpV6(ipV6Address, identifier);

                default:
                    return null;
            }
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:31,代码来源:IpV6OptionSmfDpdSequenceBased.cs

示例11: Read

        internal static bool Read(DataSegment data, out byte prefixLength, out IpV6Address networkPrefix)
        {
            if (data.Length != OptionDataLength)
            {
                prefixLength = 0;
                networkPrefix = IpV6Address.Zero;
                return false;
            }

            prefixLength = data[Offset.PrefixLength];
            networkPrefix = data.ReadIpV6Address(Offset.NetworkPrefix, Endianity.Big);
            return true;
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:13,代码来源:IpV6MobilityOptionNetworkPrefix.cs

示例12: CreateInstance

        internal override IpV6MobilityOption CreateInstance(DataSegment data)
        {
            if (data.Length != OptionDataLength)
                return null;

            IpV6MobilityIpV6AddressPrefixCode code = (IpV6MobilityIpV6AddressPrefixCode)data[Offset.Code];
            byte prefixLength = data[Offset.PrefixLength];
            IpV6Address addressOrPrefix = data.ReadIpV6Address(Offset.AddressOrPrefix, Endianity.Big);
            return new IpV6MobilityOptionIpV6AddressPrefix(code, prefixLength, addressOrPrefix);
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:10,代码来源:IpV6MobilityOptionIpV6AddressPrefix.cs

示例13: CreateInstance

        internal override IpV6MobilityOption CreateInstance(DataSegment data)
        {
            if (data.Length < OptionDataMinimumLength)
                return null;

            ushort bindingId = data.ReadUShort(Offset.BindingId, Endianity.Big);
            IpV6BindingAcknowledgementStatus status = (IpV6BindingAcknowledgementStatus)data[Offset.Status];
            bool simultaneousHomeAndForeignBinding = data.ReadBool(Offset.SimultaneousHomeAndForeignBinding, Mask.SimultaneousHomeAndForeignBinding);
            byte priority = (byte)(data[Offset.Priority] & Mask.Priority);
            if (data.Length == OptionDataMinimumLength)
                return new IpV6MobilityOptionBindingIdentifier(bindingId, status, simultaneousHomeAndForeignBinding, priority);
            if (data.Length == OptionDataMinimumLength + IpV4Address.SizeOf)
            {
                IpV4Address careOfAddress = data.ReadIpV4Address(Offset.CareOfAddress, Endianity.Big);
                return new IpV6MobilityOptionBindingIdentifier(bindingId, status, simultaneousHomeAndForeignBinding, priority, careOfAddress);
            }
            if (data.Length == OptionDataMinimumLength + IpV6Address.SizeOf)
            {
                IpV6Address careOfAddress = data.ReadIpV6Address(Offset.CareOfAddress, Endianity.Big);
                return new IpV6MobilityOptionBindingIdentifier(bindingId, status, simultaneousHomeAndForeignBinding, priority, careOfAddress);
            }
            return null;
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:23,代码来源:IpV6MobilityOptionBindingIdentifier.cs

示例14: ParseMessageData

        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);
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:18,代码来源:IpV6ExtensionHeaderMobilityHomeAgentSwitchMessage.cs


注:本文中的DataSegment.ReadIpV6Address方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。