Lines Matching refs:ai
110 freeaddrinfo(struct addrinfo *ai) in freeaddrinfo() argument
114 for(; ai != NULL;) { in freeaddrinfo()
115 next = ai->ai_next; in freeaddrinfo()
116 free(ai); in freeaddrinfo()
117 ai = next; in freeaddrinfo()
126 struct addrinfo *ai; in malloc_ai() local
128 ai = malloc(sizeof(*ai) + sizeof(struct sockaddr_in)); in malloc_ai()
129 if (ai == NULL) in malloc_ai()
132 memset(ai, '\0', sizeof(*ai) + sizeof(struct sockaddr_in)); in malloc_ai()
134 ai->ai_addr = (struct sockaddr *)(ai + 1); in malloc_ai()
136 ai->ai_addrlen = sizeof(struct sockaddr_in); in malloc_ai()
137 ai->ai_addr->sa_family = ai->ai_family = AF_INET; in malloc_ai()
139 ((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port; in malloc_ai()
140 ((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr; in malloc_ai()
144 ai->ai_socktype = hints->ai_socktype; in malloc_ai()
146 ai->ai_socktype = SOCK_STREAM; in malloc_ai()
149 ai->ai_protocol = hints->ai_protocol; in malloc_ai()
151 return (ai); in malloc_ai()