1BIO_PARSE_HOSTSERV(3)               OpenSSL              BIO_PARSE_HOSTSERV(3)
2
3
4

NAME

6       BIO_hostserv_priorities, BIO_parse_hostserv - utility routines to parse
7       a standard host and service string
8

SYNOPSIS

10        #include <openssl/bio.h>
11
12        enum BIO_hostserv_priorities {
13            BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV
14        };
15        int BIO_parse_hostserv(const char *hostserv, char **host, char **service,
16                               enum BIO_hostserv_priorities hostserv_prio);
17

DESCRIPTION

19       BIO_parse_hostserv() will parse the information given in hostserv,
20       create strings with the hostname and service name and give those back
21       via host and service.  Those will need to be freed after they are used.
22       hostserv_prio helps determine if hostserv shall be interpreted
23       primarily as a hostname or a service name in ambiguous cases.
24
25       The syntax the BIO_parse_hostserv() recognises is:
26
27        host + ':' + service
28        host + ':' + '*'
29        host + ':'
30               ':' + service
31        '*'  + ':' + service
32        host
33        service
34
35       The host part can be a name or an IP address.  If it's a IPv6 address,
36       it MUST be enclosed in brackets, such as '[::1]'.
37
38       The service part can  be a service name or its port number.
39
40       The returned values will depend on the given hostserv string and
41       hostserv_prio, as follows:
42
43        host + ':' + service  => *host = "host", *service = "service"
44        host + ':' + '*'      => *host = "host", *service = NULL
45        host + ':'            => *host = "host", *service = NULL
46               ':' + service  => *host = NULL, *service = "service"
47         '*' + ':' + service  => *host = NULL, *service = "service"
48
49        in case no ':' is present in the string, the result depends on
50        hostserv_prio, as follows:
51
52        when hostserv_prio == BIO_PARSE_PRIO_HOST
53        host                 => *host = "host", *service untouched
54
55        when hostserv_prio == BIO_PARSE_PRIO_SERV
56        service              => *host untouched, *service = "service"
57

RETURN VALUES

59       BIO_parse_hostserv() returns 1 on success or 0 on error.
60

SEE ALSO

62       BIO_ADDRINFO(3)
63
65       Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
66
67       Licensed under the OpenSSL license (the "License").  You may not use
68       this file except in compliance with the License.  You can obtain a copy
69       in the file LICENSE in the source distribution or at
70       <https://www.openssl.org/source/license.html>.
71
72
73
741.1.1q                            2023-02-06             BIO_PARSE_HOSTSERV(3)
Impressum