internal static bool IsExtensionHeader(IpV4Protocol nextHeader) { if (IpV6ExtensionHeaderStandard.IsStandard(nextHeader)) { return(true); } switch (nextHeader) { case IpV4Protocol.EncapsulatingSecurityPayload: // 50 case IpV4Protocol.AuthenticationHeader: // 51 return(true); default: return(false); } }
internal static IpV6ExtensionHeader CreateInstance(IpV4Protocol nextHeader, DataSegment extensionHeaderData, out int numBytesRead) { if (IpV6ExtensionHeaderStandard.IsStandard(nextHeader)) { return(IpV6ExtensionHeaderStandard.CreateInstanceStandard(nextHeader, extensionHeaderData, out numBytesRead)); } switch (nextHeader) { case IpV4Protocol.EncapsulatingSecurityPayload: // 50 return(IpV6ExtensionHeaderEncapsulatingSecurityPayload.CreateInstance(extensionHeaderData, out numBytesRead)); case IpV4Protocol.AuthenticationHeader: // 51 return(IpV6ExtensionHeaderAuthentication.CreateInstance(extensionHeaderData, out numBytesRead)); default: throw new InvalidOperationException("Invalid next header value" + nextHeader); } }