Exemple #1
0
        internal static IpV6ExtensionHeader CreateInstanceStandard(IpV4Protocol nextHeader, DataSegment extensionHeaderData, out int numBytesRead)
        {
            numBytesRead = 0;
            if (extensionHeaderData.Length < MinimumLength)
            {
                return(null);
            }
            IpV4Protocol nextNextHeader = (IpV4Protocol)extensionHeaderData[Offset.NextHeader];
            int          length         = (extensionHeaderData[Offset.HeaderExtensionLength] + 1) * 8;

            if (extensionHeaderData.Length < length)
            {
                return(null);
            }

            DataSegment data = extensionHeaderData.Subsegment(Offset.Data, length - Offset.Data);

            numBytesRead = length;

            // TODO: Implement Shim6.
            switch (nextHeader)
            {
            case IpV4Protocol.IpV6HopByHopOption:     // 0
                return(IpV6ExtensionHeaderHopByHopOptions.ParseData(nextNextHeader, data));

            case IpV4Protocol.IpV6Route:     // 43
                return(IpV6ExtensionHeaderRouting.ParseData(nextNextHeader, data));

            case IpV4Protocol.FragmentHeaderForIpV6:     // 44
                return(IpV6ExtensionHeaderFragmentData.ParseData(nextNextHeader, data));

            case IpV4Protocol.IpV6Opts:                         // 60
                return(IpV6ExtensionHeaderDestinationOptions.ParseData(nextNextHeader, data));

            case IpV4Protocol.MobilityHeader:            // 135
                return(IpV6ExtensionHeaderMobility.ParseData(nextNextHeader, data));

            default:
                throw new InvalidOperationException("Invalid next header value" + nextHeader);
            }
        }
Exemple #2
0
 internal override bool EqualsRoutingData(IpV6ExtensionHeaderRouting other)
 {
     return(EqualsRoutingData(other as IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks));
 }
Exemple #3
0
 internal override bool EqualsRoutingData(IpV6ExtensionHeaderRouting other)
 {
     return(EqualsRoutingData(other as IpV6ExtensionHeaderRoutingSourceRoute));
 }
Exemple #4
0
 internal abstract bool EqualsRoutingData(IpV6ExtensionHeaderRouting other);
Exemple #5
0
 private bool EqualsData(IpV6ExtensionHeaderRouting other)
 {
     return(other != null &&
            RoutingType == other.RoutingType && SegmentsLeft == other.SegmentsLeft && EqualsRoutingData(other));
 }
 internal override bool EqualsRoutingData(IpV6ExtensionHeaderRouting other)
 {
     return(EqualsRoutingData(other as IpV6ExtensionHeaderRoutingHomeAddress));
 }