]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/BIO_parse_hostserv.pod
Following the license change, modify the boilerplates in doc/man3/
[thirdparty/openssl.git] / doc / man3 / BIO_parse_hostserv.pod
CommitLineData
28a0841b
RL
1=pod
2
3=head1 NAME
4
d4ea9659
RS
5BIO_hostserv_priorities,
6BIO_parse_hostserv
7- utility routines to parse a standard host and service string
28a0841b
RL
8
9=head1 SYNOPSIS
10
11 #include <openssl/bio.h>
12
13 enum BIO_hostserv_priorities {
14 BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV
15 };
16 int BIO_parse_hostserv(const char *hostserv, char **host, char **service,
17 enum BIO_hostserv_priorities hostserv_prio);
18
19=head1 DESCRIPTION
20
21BIO_parse_hostserv() will parse the information given in B<hostserv>,
22create strings with the host name and service name and give those
23back via B<host> and B<service>. Those will need to be freed after
24they are used. B<hostserv_prio> helps determine if B<hostserv> shall
b9b6a7e5 25be interpreted primarily as a host name or a service name in ambiguous
28a0841b
RL
26cases.
27
28The syntax the BIO_parse_hostserv() recognises is:
29
30 host + ':' + service
31 host + ':' + '*'
32 host + ':'
33 ':' + service
34 '*' + ':' + service
35 host
36 service
37
38The host part can be a name or an IP address. If it's a IPv6
39address, it MUST be enclosed in brackets, such as '[::1]'.
40
41The service part can be a service name or its port number.
42
43The returned values will depend on the given B<hostserv> string
44and B<hostserv_prio>, as follows:
45
46 host + ':' + service => *host = "host", *service = "service"
47 host + ':' + '*' => *host = "host", *service = NULL
48 host + ':' => *host = "host", *service = NULL
49 ':' + service => *host = NULL, *service = "service"
50 '*' + ':' + service => *host = NULL, *service = "service"
1bc74519 51
28a0841b
RL
52 in case no ':' is present in the string, the result depends on
53 hostserv_prio, as follows:
1bc74519 54
28a0841b
RL
55 when hostserv_prio == BIO_PARSE_PRIO_HOST
56 host => *host = "host", *service untouched
1bc74519 57
28a0841b
RL
58 when hostserv_prio == BIO_PARSE_PRIO_SERV
59 service => *host untouched, *service = "service"
60
1f13ad31
PY
61=head1 RETURN VALUES
62
63BIO_parse_hostserv() returns 1 on success or 0 on error.
64
28a0841b
RL
65=head1 SEE ALSO
66
67L<BIO_ADDRINFO(3)>
99ec4fdb 68
e2f92610
RS
69=head1 COPYRIGHT
70
61f805c1 71Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 72
4746f25a 73Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
74this file except in compliance with the License. You can obtain a copy
75in the file LICENSE in the source distribution or at
76L<https://www.openssl.org/source/license.html>.
77
78=cut