/* Validate whether the NextHeader is a known valid protocol or one of the user configured protocols from the upper layer. */
BOOLEAN Ip6IsValidProtocol(IN IP6_SERVICE *IpSb, IN UINT8 NextHeader)
/* Validate whether the NextHeader is a known valid protocol or one of the user configured protocols from the upper layer. */
BOOLEAN Ip6IsValidProtocol(IN IP6_SERVICE *IpSb, IN UINT8 NextHeader)
{
  LIST_ENTRY    *Entry;
  IP6_PROTOCOL  *IpInstance;
  if ((NextHeader == EFI_IP_PROTO_TCP) ||
      (NextHeader == EFI_IP_PROTO_UDP) ||
      (NextHeader == IP6_ICMP) ||
      (NextHeader == IP6_ESP)
      )
  {
    return TRUE;
  }
  if (IpSb == NULL) {
    return FALSE;
  }
  if (IpSb->Signature != IP6_SERVICE_SIGNATURE) {
    return FALSE;
  }
  NET_LIST_FOR_EACH (Entry, &IpSb->Children) {
    IpInstance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);
    if (IpInstance->State == IP6_STATE_CONFIGED) {
      if (IpInstance->ConfigData.DefaultProtocol == NextHeader) {
        return TRUE;
      }
    }
  }
  return FALSE;
}