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


C# DataSegment.ReadBool方法代码示例

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


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

示例1: 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

示例2: CreateInstance

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

            bool isServer = data.ReadBool(Offset.IsServer, Mask.IsServer);
            return new IpV6MobilityOptionIpV4DhcpSupportMode(isServer);
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:8,代码来源:IpV6MobilityOptionIpV4DhcpSupportMode.cs

示例3: CreateInstance

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

            bool latePathSwitch = data.ReadBool(Offset.LatePathSwitch, Mask.LatePathSwitch);
            byte lifetime = data[Offset.Lifetime];
            return new IpV6MobilityOptionTransientBinding(latePathSwitch, lifetime);
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:9,代码来源:IpV6MobilityOptionTransientBinding.cs

示例4: CreateInstance

        internal static IpV6Option CreateInstance(DataSegment data)
        {
            if (data.Length < OptionDataMinimumLength)
                return null;

            bool hashIndicator = data.ReadBool(Offset.HashIndicator, Mask.HashIndicator);
            if (hashIndicator)
                return new IpV6OptionSimplifiedMulticastForwardingDuplicatePacketDetectionSequenceHashAssistValue(data);
            return IpV6OptionSimplifiedMulticastForwardingDuplicatePacketDetectionSequenceBased.CreateSpecificInstance(data);
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:10,代码来源:IpV6OptionSimplifiedMulticastForwardingDuplicatePacketDetection.cs

示例5: CreateInstance

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

            bool hashIndicator = data.ReadBool(Offset.HashIndicator, Mask.HashIndicator);
            if (hashIndicator)
                return new IpV6OptionSmfDpdSequenceHashAssistValue(data);
            return IpV6OptionSmfDpdSequenceBased.CreateSpecificInstance(data);
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:10,代码来源:IpV6OptionSmfDpd.cs

示例6: ParseData

        internal static IpV6ExtensionHeaderFragmentData ParseData(IpV4Protocol nextHeader, DataSegment data)
        {
            if (data.Length != DataLength)
                return null;

            ushort fragmentOffset = (ushort)((data.ReadUShort(DataOffset.FragmentOffset, Endianity.Big) & DataMask.FragmentOffset) >> DataShift.FragmentOffset);
            bool moreFragments = data.ReadBool(DataOffset.MoreFragments, DataMask.MoreFragments);
            uint identification = data.ReadUInt(DataOffset.Identification, Endianity.Big);

            return new IpV6ExtensionHeaderFragmentData(nextHeader, fragmentOffset, moreFragments, identification);
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:11,代码来源:IpV6ExtensionHeaderFragmentData.cs

示例7: 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

示例8: ParseMessageData

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

示例9: ParseMessageData

        internal static IpV6ExtensionHeaderMobilityLocalizedRoutingAcknowledgement ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData)
        {
            ushort sequenceNumber;
            ushort lifetime;
            IpV6MobilityOptions options;
            if (!ParseMessageDataToFields(messageData, out sequenceNumber, out lifetime, out options))
                return null;

            bool unsolicited = messageData.ReadBool(MessageDataOffset.Unsolicited, MessageDataMask.Unsolicited);
            IpV6MobilityLocalizedRoutingAcknowledgementStatus status = (IpV6MobilityLocalizedRoutingAcknowledgementStatus)messageData[MessageDataOffset.Status];

            return new IpV6ExtensionHeaderMobilityLocalizedRoutingAcknowledgement(nextHeader, checksum, sequenceNumber, unsolicited, status, lifetime, options);
        }
开发者ID:JackWangCUMT,项目名称:WiFiSpy,代码行数:13,代码来源:IpV6ExtensionHeaderMobilityLocalizedRoutingAcknowledgement.cs

示例10: ParseMessageDataToFields

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

示例11: CreateInstance

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

            bool udpEncapsulationRequired = data.ReadBool(Offset.UdpEncapsulationRequired, Mask.UdpEncapsulationRequired);
            uint refreshTime = data.ReadUInt(Offset.RefreshTime, Endianity.Big);
            return new IpV6MobilityOptionNatDetection(udpEncapsulationRequired, refreshTime);
        }
开发者ID:JackWangCUMT,项目名称:WiFiSpy,代码行数:9,代码来源:IpV6MobilityOptionNatDetection.cs

示例12: ParseMessageDataFields

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

示例13: ParseMessageData

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

示例14: ParseMessageData

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

示例15: ParseMessageData

        internal static IpV6ExtensionHeaderMobilityBindingUpdate ParseMessageData(IpV4Protocol nextHeader, ushort checksum, DataSegment messageData)
        {
            ushort sequenceNumber;
            bool acknowledge;
            bool homeRegistration;
            bool linkLocalAddressCompatibility;
            bool keyManagementMobilityCapability;
            ushort lifetime;
            IpV6MobilityOptions options;
            if (!ParseMessageDataToFields(messageData, out sequenceNumber, out acknowledge, out homeRegistration, out linkLocalAddressCompatibility, 
                                          out keyManagementMobilityCapability, out lifetime, out options))
            {
                return null;
            }

            bool mapRegistration = messageData.ReadBool(MessageDataOffset.MapRegistration, MessageDataMask.MapRegistration);
            bool mobileRouter = messageData.ReadBool(MessageDataOffset.MobileRouter, MessageDataMask.MobileRouter);
            bool proxyRegistration = messageData.ReadBool(MessageDataOffset.ProxyRegistration, MessageDataMask.ProxyRegistration);
            bool forcingUdpEncapsulation = messageData.ReadBool(MessageDataOffset.ForcingUdpEncapsulation, MessageDataMask.ForcingUdpEncapsulation);
            bool tlvHeaderFormat = messageData.ReadBool(MessageDataOffset.TlvHeaderFormat, MessageDataMask.TlvHeaderFormat);
            bool bulkBindingUpdate = messageData.ReadBool(MessageDataOffset.BulkBindingUpdate, MessageDataMask.BulkBindingUpdate);

            return new IpV6ExtensionHeaderMobilityBindingUpdate(nextHeader, checksum, sequenceNumber, acknowledge, homeRegistration,
                                                                linkLocalAddressCompatibility, keyManagementMobilityCapability, mapRegistration, mobileRouter,
                                                                proxyRegistration, forcingUdpEncapsulation, tlvHeaderFormat, bulkBindingUpdate, lifetime,
                                                                options);
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:27,代码来源:IpV6ExtensionHeaderMobilityBindingUpdate.cs


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