family_to_level函数

#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);
        }
    }
}

猜你喜欢

转载自www.cnblogs.com/soldierback/p/10804856.html
今日推荐