Lines Matching refs:sktPtr

625 …Slocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interfaceIndex, int *sktPtr)  in SetupSocket()  argument
635 assert(sktPtr != NULL); in SetupSocket()
636 assert(*sktPtr == -1); in SetupSocket()
639 if (intfAddr->sa_family == AF_INET) *sktPtr = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); in SetupSocket()
641 else if (intfAddr->sa_family == AF_INET6) *sktPtr = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP); in SetupSocket()
645 …if (*sktPtr < 0) { err = errno; perror((intfAddr->sa_family == AF_INET) ? "socket AF_INET" : "sock… in SetupSocket()
651 err = setsockopt(*sktPtr, SOL_SOCKET, SO_REUSEPORT, &kOn, sizeof(kOn)); in SetupSocket()
653 err = setsockopt(*sktPtr, SOL_SOCKET, SO_REUSEADDR, &kOn, sizeof(kOn)); in SetupSocket()
668 err = setsockopt(*sktPtr, IPPROTO_IP, IP_PKTINFO, &kOn, sizeof(kOn)); in SetupSocket()
672 err = setsockopt(*sktPtr, IPPROTO_IP, IP_RECVDSTADDR, &kOn, sizeof(kOn)); in SetupSocket()
678 err = setsockopt(*sktPtr, IPPROTO_IP, IP_RECVIF, &kOn, sizeof(kOn)); in SetupSocket()
689 setsockopt(*sktPtr, IPPROTO_IP, IP_RECVTTL, &kOn, sizeof(kOn)); in SetupSocket()
699 err = setsockopt(*sktPtr, IPPROTO_IP, IP_ADD_MEMBERSHIP, &imr, sizeof(imr)); in SetupSocket()
706 …err = setsockopt(*sktPtr, IPPROTO_IP, IP_MULTICAST_IF, &((struct sockaddr_in*)intfAddr)->sin_addr,… in SetupSocket()
713 err = setsockopt(*sktPtr, IPPROTO_IP, IP_TTL, &kIntTwoFiveFive, sizeof(kIntTwoFiveFive)); in SetupSocket()
721 …err = setsockopt(*sktPtr, IPPROTO_IP, IP_MULTICAST_TTL, &kByteTwoFiveFive, sizeof(kByteTwoFiveFive… in SetupSocket()
723 …err = setsockopt(*sktPtr, IPPROTO_IP, IP_MULTICAST_TTL, &kIntTwoFiveFive, sizeof(kIntTwoFiveFive)); in SetupSocket()
733 err = bind(*sktPtr, (struct sockaddr *) &bindAddr, sizeof(bindAddr)); in SetupSocket()
746 err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_2292_PKTINFO, &kOn, sizeof(kOn)); in SetupSocket()
755 err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_2292_HOPLIMIT, &kOn, sizeof(kOn)); in SetupSocket()
766 err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_JOIN_GROUP, &imr6, sizeof(imr6)); in SetupSocket()
779 err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_MULTICAST_IF, &multicast_if, sizeof(multicast_if)); in SetupSocket()
787 err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_V6ONLY, &kOn, sizeof(kOn)); in SetupSocket()
794 …err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &kIntTwoFiveFive, sizeof(kIntTwoFiveFiv… in SetupSocket()
802 …err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &kByteTwoFiveFive, sizeof(kByteTwoFiv… in SetupSocket()
804 …err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &kIntTwoFiveFive, sizeof(kIntTwoFiveF… in SetupSocket()
820 err = bind(*sktPtr, (struct sockaddr *) &bindAddr6, sizeof(bindAddr6)); in SetupSocket()
829 err = fcntl(*sktPtr, F_GETFL, 0); in SetupSocket()
833 err = fcntl(*sktPtr, F_SETFL, err | O_NONBLOCK); in SetupSocket()
839 if (err != 0 && *sktPtr != -1) in SetupSocket()
841 int sktClosed = close(*sktPtr); in SetupSocket()
843 *sktPtr = -1; in SetupSocket()
845 assert((err == 0) == (*sktPtr != -1)); in SetupSocket()