Lines Matching refs:ai
154 fake_getaddrinfo(const char *hostname, struct addrinfo *ai)
163 ai->ai_family = he ? he->h_addrtype : AF_INET;
164 ai->ai_socktype = SOCK_STREAM;
165 ai->ai_protocol = 0;
166 ai->ai_addrlen = sizeof(struct sockaddr_in);
167 if (NULL == (ai->ai_addr = malloc(ai->ai_addrlen)))
169 sa = (struct sockaddr_in*)ai->ai_addr;
170 memset(sa, 0, ai->ai_addrlen);
178 ai->ai_next = NULL;
182 fake_freeaddrinfo(struct addrinfo *ai)
184 free(ai->ai_addr);
2626 struct addrinfo ai, *aitop;
2629 memset(&ai, 0, sizeof(ai));
2630 ai.ai_family = AF_INET;
2631 ai.ai_socktype = SOCK_RAW;
2632 ai.ai_flags = 0;
2633 if ((ai_result = getaddrinfo(address, NULL, &ai, &aitop)) != 0) {
2682 bind_socket_ai(struct addrinfo *ai, int reuse)
2710 if (ai != NULL) {
2711 r = bind(fd, ai->ai_addr, ai->ai_addrlen);
2731 struct addrinfo ai;
2735 memset(&ai, 0, sizeof(ai));
2736 ai.ai_family = AF_INET;
2737 ai.ai_socktype = SOCK_STREAM;
2738 ai.ai_flags = AI_PASSIVE; /* turn NULL host name into INADDR_ANY */
2740 if ((ai_result = getaddrinfo(address, strport, &ai, &aitop)) != 0) {
2749 static struct addrinfo ai[2]; /* We will be returning the address of some of this memory so it has to last even after this call. */
2752 if (fake_getaddrinfo(address, &ai[cur]) < 0) {
2756 aitop = &ai[cur];
2792 struct addrinfo *ai = make_addrinfo(address, port);
2795 if (ai == NULL) {
2801 if (connect(fd, ai->ai_addr, ai->ai_addrlen) == -1) {
2820 freeaddrinfo(ai);
2822 fake_freeaddrinfo(ai);