Lines Matching refs:ap
63 void BIO_ADDR_free(BIO_ADDR *ap) in BIO_ADDR_free() argument
65 OPENSSL_free(ap); in BIO_ADDR_free()
81 BIO_ADDR *BIO_ADDR_dup(const BIO_ADDR *ap) in BIO_ADDR_dup() argument
85 if (ap != NULL) { in BIO_ADDR_dup()
87 if (ret != NULL && !BIO_ADDR_copy(ret, ap)) { in BIO_ADDR_dup()
95 void BIO_ADDR_clear(BIO_ADDR *ap) in BIO_ADDR_clear() argument
97 memset(ap, 0, sizeof(*ap)); in BIO_ADDR_clear()
98 ap->sa.sa_family = AF_UNSPEC; in BIO_ADDR_clear()
105 int BIO_ADDR_make(BIO_ADDR *ap, const struct sockaddr *sa) in BIO_ADDR_make() argument
108 memcpy(&(ap->s_in), sa, sizeof(struct sockaddr_in)); in BIO_ADDR_make()
113 memcpy(&(ap->s_in6), sa, sizeof(struct sockaddr_in6)); in BIO_ADDR_make()
119 memcpy(&(ap->s_un), sa, sizeof(struct sockaddr_un)); in BIO_ADDR_make()
127 int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, in BIO_ADDR_rawmake() argument
133 if (wherelen + 1 > sizeof(ap->s_un.sun_path)) in BIO_ADDR_rawmake()
135 memset(&ap->s_un, 0, sizeof(ap->s_un)); in BIO_ADDR_rawmake()
136 ap->s_un.sun_family = family; in BIO_ADDR_rawmake()
137 strncpy(ap->s_un.sun_path, where, sizeof(ap->s_un.sun_path) - 1); in BIO_ADDR_rawmake()
144 memset(&ap->s_in, 0, sizeof(ap->s_in)); in BIO_ADDR_rawmake()
145 ap->s_in.sin_family = family; in BIO_ADDR_rawmake()
146 ap->s_in.sin_port = port; in BIO_ADDR_rawmake()
147 ap->s_in.sin_addr = *(struct in_addr *)where; in BIO_ADDR_rawmake()
154 memset(&ap->s_in6, 0, sizeof(ap->s_in6)); in BIO_ADDR_rawmake()
155 ap->s_in6.sin6_family = family; in BIO_ADDR_rawmake()
156 ap->s_in6.sin6_port = port; in BIO_ADDR_rawmake()
157 ap->s_in6.sin6_addr = *(struct in6_addr *)where; in BIO_ADDR_rawmake()
165 int BIO_ADDR_family(const BIO_ADDR *ap) in BIO_ADDR_family() argument
167 return ap->sa.sa_family; in BIO_ADDR_family()
170 int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l) in BIO_ADDR_rawaddress() argument
175 if (ap->sa.sa_family == AF_INET) { in BIO_ADDR_rawaddress()
176 len = sizeof(ap->s_in.sin_addr); in BIO_ADDR_rawaddress()
177 addrptr = &ap->s_in.sin_addr; in BIO_ADDR_rawaddress()
180 else if (ap->sa.sa_family == AF_INET6) { in BIO_ADDR_rawaddress()
181 len = sizeof(ap->s_in6.sin6_addr); in BIO_ADDR_rawaddress()
182 addrptr = &ap->s_in6.sin6_addr; in BIO_ADDR_rawaddress()
186 else if (ap->sa.sa_family == AF_UNIX) { in BIO_ADDR_rawaddress()
187 len = strlen(ap->s_un.sun_path); in BIO_ADDR_rawaddress()
188 addrptr = &ap->s_un.sun_path; in BIO_ADDR_rawaddress()
204 unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap) in BIO_ADDR_rawport() argument
206 if (ap->sa.sa_family == AF_INET) in BIO_ADDR_rawport()
207 return ap->s_in.sin_port; in BIO_ADDR_rawport()
209 if (ap->sa.sa_family == AF_INET6) in BIO_ADDR_rawport()
210 return ap->s_in6.sin6_port; in BIO_ADDR_rawport()
228 static int addr_strings(const BIO_ADDR *ap, int numeric, in addr_strings() argument
243 if ((ret = getnameinfo(BIO_ADDR_sockaddr(ap), in addr_strings()
244 BIO_ADDR_sockaddr_size(ap), in addr_strings()
267 ntohs(BIO_ADDR_rawport(ap))); in addr_strings()
277 *hostname = OPENSSL_strdup(inet_ntoa(ap->s_in.sin_addr)); in addr_strings()
280 BIO_snprintf(serv, sizeof(serv), "%d", ntohs(ap->s_in.sin_port)); in addr_strings()
301 char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric) in BIO_ADDR_hostname_string() argument
305 if (addr_strings(ap, numeric, &hostname, NULL)) in BIO_ADDR_hostname_string()
311 char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric) in BIO_ADDR_service_string() argument
315 if (addr_strings(ap, numeric, NULL, &service)) in BIO_ADDR_service_string()
321 char *BIO_ADDR_path_string(const BIO_ADDR *ap) in BIO_ADDR_path_string() argument
324 if (ap->sa.sa_family == AF_UNIX) in BIO_ADDR_path_string()
325 return OPENSSL_strdup(ap->s_un.sun_path); in BIO_ADDR_path_string()
335 const struct sockaddr *BIO_ADDR_sockaddr(const BIO_ADDR *ap) in BIO_ADDR_sockaddr() argument
337 return &(ap->sa); in BIO_ADDR_sockaddr()
346 struct sockaddr *BIO_ADDR_sockaddr_noconst(BIO_ADDR *ap) in BIO_ADDR_sockaddr_noconst() argument
348 return &(ap->sa); in BIO_ADDR_sockaddr_noconst()
357 socklen_t BIO_ADDR_sockaddr_size(const BIO_ADDR *ap) in BIO_ADDR_sockaddr_size() argument
359 if (ap->sa.sa_family == AF_INET) in BIO_ADDR_sockaddr_size()
360 return sizeof(ap->s_in); in BIO_ADDR_sockaddr_size()
362 if (ap->sa.sa_family == AF_INET6) in BIO_ADDR_sockaddr_size()
363 return sizeof(ap->s_in6); in BIO_ADDR_sockaddr_size()
366 if (ap->sa.sa_family == AF_UNIX) in BIO_ADDR_sockaddr_size()
367 return sizeof(ap->s_un); in BIO_ADDR_sockaddr_size()
369 return sizeof(*ap); in BIO_ADDR_sockaddr_size()