Example #1
0
        internal static IpV6ExtensionHeaderRouting ParseData(IpV4Protocol nextHeader, DataSegment data)
        {
            if (data.Length < DataMinimumLength)
            {
                return(null);
            }
            IpV6RoutingType routingType  = (IpV6RoutingType)data[DataOffset.RoutingType];
            byte            segmentsLeft = data[DataOffset.SegmentsLeft];
            DataSegment     routingData  = data.Subsegment(DataOffset.TypeSpecificData, data.Length - DataOffset.TypeSpecificData);

            switch (routingType)
            {
            case IpV6RoutingType.SourceRoute:
                return(IpV6ExtensionHeaderRoutingSourceRoute.ParseRoutingData(nextHeader, segmentsLeft, routingData));

            case IpV6RoutingType.Nimrod:
                // Unused.
                return(null);

            case IpV6RoutingType.Type2RoutingHeader:
                return(IpV6ExtensionHeaderRoutingHomeAddress.ParseRoutingData(nextHeader, segmentsLeft, routingData));

            case IpV6RoutingType.RoutingProtocolLowPowerAndLossyNetworksSourceRouteHeader:
                return(IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks.ParseRoutingData(nextHeader, segmentsLeft, routingData));

            default:
                return(null);
            }
        }
Example #2
0
 private bool EqualsRoutingData(IpV6ExtensionHeaderRoutingSourceRoute other)
 {
     return(other != null &&
            Addresses.SequenceEqual(other.Addresses));
 }