1BIO_ADDR(3ossl)                     OpenSSL                    BIO_ADDR(3ossl)
2
3
4

NAME

6       BIO_ADDR, BIO_ADDR_new, BIO_ADDR_clear, BIO_ADDR_free,
7       BIO_ADDR_rawmake, BIO_ADDR_family, BIO_ADDR_rawaddress,
8       BIO_ADDR_rawport, BIO_ADDR_hostname_string, BIO_ADDR_service_string,
9       BIO_ADDR_path_string - BIO_ADDR routines
10

SYNOPSIS

12        #include <sys/types.h>
13        #include <openssl/bio.h>
14
15        typedef union bio_addr_st BIO_ADDR;
16
17        BIO_ADDR *BIO_ADDR_new(void);
18        void BIO_ADDR_free(BIO_ADDR *);
19        void BIO_ADDR_clear(BIO_ADDR *ap);
20        int BIO_ADDR_rawmake(BIO_ADDR *ap, int family,
21                             const void *where, size_t wherelen, unsigned short port);
22        int BIO_ADDR_family(const BIO_ADDR *ap);
23        int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l);
24        unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap);
25        char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric);
26        char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric);
27        char *BIO_ADDR_path_string(const BIO_ADDR *ap);
28

DESCRIPTION

30       The BIO_ADDR type is a wrapper around all types of socket addresses
31       that OpenSSL deals with, currently transparently supporting AF_INET,
32       AF_INET6 and AF_UNIX according to what's available on the platform at
33       hand.
34
35       BIO_ADDR_new() creates a new unfilled BIO_ADDR, to be used with
36       routines that will fill it with information, such as BIO_accept_ex().
37
38       BIO_ADDR_free() frees a BIO_ADDR created with BIO_ADDR_new().
39
40       BIO_ADDR_clear() clears any data held within the provided BIO_ADDR and
41       sets it back to an uninitialised state.
42
43       BIO_ADDR_rawmake() takes a protocol family, a byte array of size
44       wherelen with an address in network byte order pointed at by where and
45       a port number in network byte order in port (except for the AF_UNIX
46       protocol family, where port is meaningless and therefore ignored) and
47       populates the given BIO_ADDR with them.  In case this creates a AF_UNIX
48       BIO_ADDR, wherelen is expected to be the length of the path string (not
49       including the terminating NUL, such as the result of a call to
50       strlen()).  Read on about the addresses in "RAW ADDRESSES" below.
51
52       BIO_ADDR_family() returns the protocol family of the given BIO_ADDR.
53       The possible non-error results are one of the constants AF_INET,
54       AF_INET6 and AF_UNIX. It will also return AF_UNSPEC if the BIO_ADDR has
55       not been initialised.
56
57       BIO_ADDR_rawaddress() will write the raw address of the given BIO_ADDR
58       in the area pointed at by p if p is non-NULL, and will set *l to be the
59       amount of bytes the raw address takes up if l is non-NULL.  A technique
60       to only find out the size of the address is a call with p set to NULL.
61       The raw address will be in network byte order, most significant byte
62       first.  In case this is a AF_UNIX BIO_ADDR, l gets the length of the
63       path string (not including the terminating NUL, such as the result of a
64       call to strlen()).  Read on about the addresses in "RAW ADDRESSES"
65       below.
66
67       BIO_ADDR_rawport() returns the raw port of the given BIO_ADDR.  The raw
68       port will be in network byte order.
69
70       BIO_ADDR_hostname_string() returns a character string with the hostname
71       of the given BIO_ADDR.  If numeric is 1, the string will contain the
72       numerical form of the address.  This only works for BIO_ADDR of the
73       protocol families AF_INET and AF_INET6.  The returned string has been
74       allocated on the heap and must be freed with OPENSSL_free().
75
76       BIO_ADDR_service_string() returns a character string with the service
77       name of the port of the given BIO_ADDR.  If numeric is 1, the string
78       will contain the port number.  This only works for BIO_ADDR of the
79       protocol families AF_INET and AF_INET6.  The returned string has been
80       allocated on the heap and must be freed with OPENSSL_free().
81
82       BIO_ADDR_path_string() returns a character string with the path of the
83       given BIO_ADDR.  This only works for BIO_ADDR of the protocol family
84       AF_UNIX.  The returned string has been allocated on the heap and must
85       be freed with OPENSSL_free().
86

RAW ADDRESSES

88       Both BIO_ADDR_rawmake() and BIO_ADDR_rawaddress() take a pointer to a
89       network byte order address of a specific site.  Internally, those are
90       treated as a pointer to struct in_addr (for AF_INET), struct in6_addr
91       (for AF_INET6) or char * (for AF_UNIX), all depending on the protocol
92       family the address is for.
93

RETURN VALUES

95       The string producing functions BIO_ADDR_hostname_string(),
96       BIO_ADDR_service_string() and BIO_ADDR_path_string() will return NULL
97       on error and leave an error indication on the OpenSSL error stack.
98
99       All other functions described here return 0 or NULL when the
100       information they should return isn't available.
101

SEE ALSO

103       BIO_connect(3), BIO_s_connect(3)
104
106       Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
107
108       Licensed under the Apache License 2.0 (the "License").  You may not use
109       this file except in compliance with the License.  You can obtain a copy
110       in the file LICENSE in the source distribution or at
111       <https://www.openssl.org/source/license.html>.
112
113
114
1153.0.9                             2023-07-27                   BIO_ADDR(3ossl)
Impressum