예제 #1
0
static void CASelectReturned(fd_set *readFds, int ret)
{
    (void)ret;
    int fd = -1;
    CATransportFlags_t flags = CA_DEFAULT_FLAGS;

    while (!caglobals.ip.terminate)
    {
        ISSET(u6,  readFds, CA_IPV6)
        else ISSET(u6s, readFds, CA_IPV6 | CA_SECURE)
        else ISSET(u4,  readFds, CA_IPV4)
        else ISSET(u4s, readFds, CA_IPV4 | CA_SECURE)
        else ISSET(m6,  readFds, CA_MULTICAST | CA_IPV6)
        else ISSET(m6s, readFds, CA_MULTICAST | CA_IPV6 | CA_SECURE)
        else ISSET(m4,  readFds, CA_MULTICAST | CA_IPV4)
        else ISSET(m4s, readFds, CA_MULTICAST | CA_IPV4 | CA_SECURE)
        else if (FD_ISSET(caglobals.ip.netlinkFd, readFds))
        {
            CAHandleNetlink();
            break;
        }
        else
        {
            CAInterface_t *ifchanged = CAFindInterfaceChange();
            if (ifchanged)
            {
                CAProcessNewInterface(ifchanged);
            }
            break;
        }

        (void)CAReceiveMessage(fd, flags);
        FD_CLR(fd, readFds);
    }
}
예제 #2
0
static void CASelectReturned(fd_set *readFds, int ret)
{
    (void)ret;
    int fd = -1;
    CATransportFlags_t flags = CA_DEFAULT_FLAGS;

    while (!caglobals.ip.terminate)
    {
        ISSET(u6,  readFds, CA_IPV6)
        else ISSET(u6s, readFds, CA_IPV6 | CA_SECURE)
        else ISSET(u4,  readFds, CA_IPV4)
        else ISSET(u4s, readFds, CA_IPV4 | CA_SECURE)
        else ISSET(m6,  readFds, CA_MULTICAST | CA_IPV6)
        else ISSET(m6s, readFds, CA_MULTICAST | CA_IPV6 | CA_SECURE)
        else ISSET(m4,  readFds, CA_MULTICAST | CA_IPV4)
        else ISSET(m4s, readFds, CA_MULTICAST | CA_IPV4 | CA_SECURE)
        else if (FD_ISSET(caglobals.ip.netlinkFd, readFds))
        {
            CAHandleNetlink();
            break;
        }
        else if (FD_ISSET(caglobals.ip.shutdownFds[0], readFds))
        {
            char buf[10] = {0};
            ssize_t len = read(caglobals.ip.shutdownFds[0], buf, sizeof (buf));
            if (-1 == len)
            {
                continue;
            }

            CAInterface_t *ifchanged = CAFindInterfaceChange();
            if (ifchanged)
            {
                CAProcessNewInterface(ifchanged);
                OICFree(ifchanged);
            }
            break;
        }
        else
        {
            break;
        }

        (void)CAReceiveMessage(fd, flags);
        FD_CLR(fd, readFds);
    }
}