1BIO_PARSE_HOSTSERV(3ossl)           OpenSSL          BIO_PARSE_HOSTSERV(3ossl)
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.  A service
39       name will be mapped to a port number using the system function
40       getservbyname().
41
42       The returned values will depend on the given hostserv string and
43       hostserv_prio, as follows:
44
45        host + ':' + service  => *host = "host", *service = "service"
46        host + ':' + '*'      => *host = "host", *service = NULL
47        host + ':'            => *host = "host", *service = NULL
48               ':' + service  => *host = NULL, *service = "service"
49         '*' + ':' + service  => *host = NULL, *service = "service"
50
51        in case no ':' is present in the string, the result depends on
52        hostserv_prio, as follows:
53
54        when hostserv_prio == BIO_PARSE_PRIO_HOST
55        host                 => *host = "host", *service untouched
56
57        when hostserv_prio == BIO_PARSE_PRIO_SERV
58        service              => *host untouched, *service = "service"
59

RETURN VALUES

61       BIO_parse_hostserv() returns 1 on success or 0 on error.
62

SEE ALSO

64       BIO_ADDRINFO(3)
65
67       Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
68
69       Licensed under the Apache License 2.0 (the "License").  You may not use
70       this file except in compliance with the License.  You can obtain a copy
71       in the file LICENSE in the source distribution or at
72       <https://www.openssl.org/source/license.html>.
73
74
75
763.0.5                             2022-07-05         BIO_PARSE_HOSTSERV(3ossl)
Impressum