Debian Codegraph @

upstream/debian-unstable/man3/BIO_parse_hostserv.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "BIO_PARSE_HOSTSERV 3SSL"
58 .TH BIO_PARSE_HOSTSERV 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 BIO_hostserv_priorities,
65 BIO_parse_hostserv
66 \&\- utility routines to parse a standard host and service string
67 .SH SYNOPSIS
68 .IX Header "SYNOPSIS"
69 .Vb 1
70 \& #include <openssl/bio.h>
71 \&
72 \& enum BIO_hostserv_priorities {
73 \& BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV
74 \& };
75 \& int BIO_parse_hostserv(const char *hostserv, char **host, char **service,
76 \& enum BIO_hostserv_priorities hostserv_prio);
77 .Ve
78 .SH DESCRIPTION
79 .IX Header "DESCRIPTION"
80 \&\fBBIO_parse_hostserv()\fR will parse the information given in \fBhostserv\fR,
81 create strings with the hostname and service name and give those
82 back via \fBhost\fR and \fBservice\fR. Those will need to be freed after
83 they are used. \fBhostserv_prio\fR helps determine if \fBhostserv\fR shall
84 be interpreted primarily as a hostname or a service name in ambiguous
85 cases.
86 .PP
87 The syntax the \fBBIO_parse_hostserv()\fR recognises is:
88 .PP
89 .Vb 7
90 \& host + \*(Aq:\*(Aq + service
91 \& host + \*(Aq:\*(Aq + \*(Aq*\*(Aq
92 \& host + \*(Aq:\*(Aq
93 \& \*(Aq:\*(Aq + service
94 \& \*(Aq*\*(Aq + \*(Aq:\*(Aq + service
95 \& host
96 \& service
97 .Ve
98 .PP
99 The host part can be a name or an IP address. If it's a IPv6
100 address, it MUST be enclosed in brackets, such as '[::1]'.
101 .PP
102 The service part can be a service name or its port number. A service name
103 will be mapped to a port number using the system function \fBgetservbyname()\fR.
104 .PP
105 The returned values will depend on the given \fBhostserv\fR string
106 and \fBhostserv_prio\fR, as follows:
107 .PP
108 .Vb 5
109 \& host + \*(Aq:\*(Aq + service => *host = "host", *service = "service"
110 \& host + \*(Aq:\*(Aq + \*(Aq*\*(Aq => *host = "host", *service = NULL
111 \& host + \*(Aq:\*(Aq => *host = "host", *service = NULL
112 \& \*(Aq:\*(Aq + service => *host = NULL, *service = "service"
113 \& \*(Aq*\*(Aq + \*(Aq:\*(Aq + service => *host = NULL, *service = "service"
114 \&
115 \& in case no \*(Aq:\*(Aq is present in the string, the result depends on
116 \& hostserv_prio, as follows:
117 \&
118 \& when hostserv_prio == BIO_PARSE_PRIO_HOST
119 \& host => *host = "host", *service untouched
120 \&
121 \& when hostserv_prio == BIO_PARSE_PRIO_SERV
122 \& service => *host untouched, *service = "service"
123 .Ve
124 .SH "RETURN VALUES"
125 .IX Header "RETURN VALUES"
126 \&\fBBIO_parse_hostserv()\fR returns 1 on success or 0 on error.
127 .SH "SEE ALSO"
128 .IX Header "SEE ALSO"
129 \&\fBBIO_ADDRINFO\fR\|(3)
130 .SH COPYRIGHT
131 .IX Header "COPYRIGHT"
132 Copyright 2016\-2021 The OpenSSL Project Authors. All Rights Reserved.
133 .PP
134 Licensed under the Apache License 2.0 (the "License"). You may not use
135 this file except in compliance with the License. You can obtain a copy
136 in the file LICENSE in the source distribution or at
137 <https://www.openssl.org/source/license.html>.