#include <netinet/in.h> #include <sys/socket.h> int family_to_level(int family) { switch (family) { case AF_INET: { return (IPPROTO_IP); } #ifdef IPV6 case AF_INET6: { return (IPPROTO_IPV6); } #endif default: { return (-1); } } }
#include <netinet/in.h> #include <sys/socket.h> int family_to_level(int family) { switch (family) { case AF_INET: { return (IPPROTO_IP); } #ifdef IPV6 case AF_INET6: { return (IPPROTO_IPV6); } #endif default: { return (-1); } } }