Lines Matching refs:ai

48 static void ucma_convert_to_ai(struct addrinfo *ai,  in ucma_convert_to_ai()  argument
51 memset(ai, 0, sizeof(*ai)); in ucma_convert_to_ai()
53 ai->ai_flags = AI_PASSIVE; in ucma_convert_to_ai()
55 ai->ai_flags |= AI_NUMERICHOST; in ucma_convert_to_ai()
57 ai->ai_family = rai->ai_family; in ucma_convert_to_ai()
64 ai->ai_socktype = SOCK_STREAM; in ucma_convert_to_ai()
67 ai->ai_socktype = SOCK_DGRAM; in ucma_convert_to_ai()
73 ai->ai_protocol = IPPROTO_TCP; in ucma_convert_to_ai()
77 ai->ai_protocol = IPPROTO_UDP; in ucma_convert_to_ai()
80 if (ai->ai_socktype == SOCK_STREAM) in ucma_convert_to_ai()
81 ai->ai_protocol = IPPROTO_TCP; in ucma_convert_to_ai()
82 else if (ai->ai_socktype == SOCK_DGRAM) in ucma_convert_to_ai()
83 ai->ai_protocol = IPPROTO_UDP; in ucma_convert_to_ai()
88 ai->ai_addrlen = rai->ai_src_len; in ucma_convert_to_ai()
89 ai->ai_addr = rai->ai_src_addr; in ucma_convert_to_ai()
91 ai->ai_addrlen = rai->ai_dst_len; in ucma_convert_to_ai()
92 ai->ai_addr = rai->ai_dst_addr; in ucma_convert_to_ai()
94 ai->ai_canonname = rai->ai_dst_canonname; in ucma_convert_to_ai()
95 ai->ai_next = NULL; in ucma_convert_to_ai()
146 const struct addrinfo *ai) in ucma_convert_to_rai() argument
153 switch (ai->ai_socktype) { in ucma_convert_to_rai()
166 switch (ai->ai_protocol) { in ucma_convert_to_rai()
176 if (ai->ai_flags & AI_PASSIVE) { in ucma_convert_to_rai()
178 if (ai->ai_canonname) in ucma_convert_to_rai()
179 rai->ai_src_canonname = strdup(ai->ai_canonname); in ucma_convert_to_rai()
187 (struct sockaddr_in6 *) ai->ai_addr, in ucma_convert_to_rai()
188 ai->ai_addrlen); in ucma_convert_to_rai()
190 rai->ai_family = ai->ai_family; in ucma_convert_to_rai()
192 ai->ai_addr, ai->ai_addrlen); in ucma_convert_to_rai()
195 if (ai->ai_canonname) in ucma_convert_to_rai()
196 rai->ai_dst_canonname = strdup(ai->ai_canonname); in ucma_convert_to_rai()
204 (struct sockaddr_in6 *) ai->ai_addr, in ucma_convert_to_rai()
205 ai->ai_addrlen); in ucma_convert_to_rai()
207 rai->ai_family = ai->ai_family; in ucma_convert_to_rai()
209 ai->ai_addr, ai->ai_addrlen); in ucma_convert_to_rai()
220 struct addrinfo *ai; in ucma_getaddrinfo() local
225 ret = getaddrinfo(node, service, &ai_hints, &ai); in ucma_getaddrinfo()
227 ret = getaddrinfo(node, service, NULL, &ai); in ucma_getaddrinfo()
232 ret = ucma_convert_to_rai(rai, hints, ai); in ucma_getaddrinfo()
233 freeaddrinfo(ai); in ucma_getaddrinfo()