diff options
| author | cvs2svn <admin@example.com> | 2021-08-18 16:06:57 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2021-08-18 16:06:57 +0000 |
| commit | d56c8fa8260d226f98b26f017b45b9c2b135f38d (patch) | |
| tree | 348178b41617813cc93787187984a734ef8379ca /src/lib/libcrypto/man/BIO_s_connect.3 | |
| parent | 18b9c1bcab7c37d8c5bd05b8e0d14d0c59d96650 (diff) | |
| download | openbsd-tb_20210818.tar.gz openbsd-tb_20210818.tar.bz2 openbsd-tb_20210818.zip | |
This commit was manufactured by cvs2git to create tag 'tb_20210818'.tb_20210818
Diffstat (limited to 'src/lib/libcrypto/man/BIO_s_connect.3')
| -rw-r--r-- | src/lib/libcrypto/man/BIO_s_connect.3 | 390 |
1 files changed, 0 insertions, 390 deletions
diff --git a/src/lib/libcrypto/man/BIO_s_connect.3 b/src/lib/libcrypto/man/BIO_s_connect.3 deleted file mode 100644 index 7ddde85f53..0000000000 --- a/src/lib/libcrypto/man/BIO_s_connect.3 +++ /dev/null | |||
| @@ -1,390 +0,0 @@ | |||
| 1 | .\" $OpenBSD: BIO_s_connect.3,v 1.11 2018/05/12 20:12:17 schwarze Exp $ | ||
| 2 | .\" OpenSSL 186bb907 Apr 13 11:05:13 2015 -0700 | ||
| 3 | .\" | ||
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
| 5 | .\" Copyright (c) 2000, 2015 The OpenSSL Project. All rights reserved. | ||
| 6 | .\" | ||
| 7 | .\" Redistribution and use in source and binary forms, with or without | ||
| 8 | .\" modification, are permitted provided that the following conditions | ||
| 9 | .\" are met: | ||
| 10 | .\" | ||
| 11 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 12 | .\" notice, this list of conditions and the following disclaimer. | ||
| 13 | .\" | ||
| 14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 15 | .\" notice, this list of conditions and the following disclaimer in | ||
| 16 | .\" the documentation and/or other materials provided with the | ||
| 17 | .\" distribution. | ||
| 18 | .\" | ||
| 19 | .\" 3. All advertising materials mentioning features or use of this | ||
| 20 | .\" software must display the following acknowledgment: | ||
| 21 | .\" "This product includes software developed by the OpenSSL Project | ||
| 22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 23 | .\" | ||
| 24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 25 | .\" endorse or promote products derived from this software without | ||
| 26 | .\" prior written permission. For written permission, please contact | ||
| 27 | .\" openssl-core@openssl.org. | ||
| 28 | .\" | ||
| 29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 31 | .\" permission of the OpenSSL Project. | ||
| 32 | .\" | ||
| 33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 34 | .\" acknowledgment: | ||
| 35 | .\" "This product includes software developed by the OpenSSL Project | ||
| 36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 37 | .\" | ||
| 38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 50 | .\" | ||
| 51 | .Dd $Mdocdate: May 12 2018 $ | ||
| 52 | .Dt BIO_S_CONNECT 3 | ||
| 53 | .Os | ||
| 54 | .Sh NAME | ||
| 55 | .Nm BIO_s_connect , | ||
| 56 | .Nm BIO_new_connect , | ||
| 57 | .Nm BIO_set_conn_hostname , | ||
| 58 | .Nm BIO_set_conn_port , | ||
| 59 | .Nm BIO_set_conn_ip , | ||
| 60 | .Nm BIO_set_conn_int_port , | ||
| 61 | .Nm BIO_get_conn_hostname , | ||
| 62 | .Nm BIO_get_conn_port , | ||
| 63 | .Nm BIO_get_conn_ip , | ||
| 64 | .Nm BIO_get_conn_int_port , | ||
| 65 | .Nm BIO_set_nbio , | ||
| 66 | .Nm BIO_do_connect | ||
| 67 | .Nd connect BIO | ||
| 68 | .Sh SYNOPSIS | ||
| 69 | .In openssl/bio.h | ||
| 70 | .Ft const BIO_METHOD * | ||
| 71 | .Fo BIO_s_connect | ||
| 72 | .Fa void | ||
| 73 | .Fc | ||
| 74 | .Ft BIO * | ||
| 75 | .Fo BIO_new_connect | ||
| 76 | .Fa "const char *name" | ||
| 77 | .Fc | ||
| 78 | .Ft long | ||
| 79 | .Fo BIO_set_conn_hostname | ||
| 80 | .Fa "BIO *b" | ||
| 81 | .Fa "char *name" | ||
| 82 | .Fc | ||
| 83 | .Ft long | ||
| 84 | .Fo BIO_set_conn_port | ||
| 85 | .Fa "BIO *b" | ||
| 86 | .Fa "char *port" | ||
| 87 | .Fc | ||
| 88 | .Ft long | ||
| 89 | .Fo BIO_set_conn_ip | ||
| 90 | .Fa "BIO *b" | ||
| 91 | .Fa "char *ip" | ||
| 92 | .Fc | ||
| 93 | .Ft long | ||
| 94 | .Fo BIO_set_conn_int_port | ||
| 95 | .Fa "BIO *b" | ||
| 96 | .Fa "char *port" | ||
| 97 | .Fc | ||
| 98 | .Ft char * | ||
| 99 | .Fo BIO_get_conn_hostname | ||
| 100 | .Fa "BIO *b" | ||
| 101 | .Fc | ||
| 102 | .Ft char * | ||
| 103 | .Fo BIO_get_conn_port | ||
| 104 | .Fa "BIO *b" | ||
| 105 | .Fc | ||
| 106 | .Ft char * | ||
| 107 | .Fo BIO_get_conn_ip | ||
| 108 | .Fa "BIO *b" | ||
| 109 | .Fa "dummy" | ||
| 110 | .Fc | ||
| 111 | .Ft long | ||
| 112 | .Fo BIO_get_conn_int_port | ||
| 113 | .Fa "BIO *b" | ||
| 114 | .Fa "int port" | ||
| 115 | .Fc | ||
| 116 | .Ft long | ||
| 117 | .Fo BIO_set_nbio | ||
| 118 | .Fa "BIO *b" | ||
| 119 | .Fa "long n" | ||
| 120 | .Fc | ||
| 121 | .Ft int | ||
| 122 | .Fo BIO_do_connect | ||
| 123 | .Fa "BIO *b" | ||
| 124 | .Fc | ||
| 125 | .Sh DESCRIPTION | ||
| 126 | .Fn BIO_s_connect | ||
| 127 | returns the connect BIO method. | ||
| 128 | This is a wrapper around the platform's TCP/IP socket connection routines. | ||
| 129 | .Pp | ||
| 130 | Using connect BIOs, TCP/IP connections can be made and data | ||
| 131 | transferred using only BIO routines. | ||
| 132 | In this way any platform specific operations | ||
| 133 | are hidden by the BIO abstraction. | ||
| 134 | .Pp | ||
| 135 | Read and write operations on a connect BIO will perform I/O | ||
| 136 | on the underlying connection. | ||
| 137 | If no connection is established and the port and hostname (see below) | ||
| 138 | is set up properly, then a connection is established first. | ||
| 139 | .Pp | ||
| 140 | Connect BIOs support | ||
| 141 | .Xr BIO_puts 3 | ||
| 142 | but not | ||
| 143 | .Xr BIO_gets 3 . | ||
| 144 | .Pp | ||
| 145 | If the close flag is set on a connect BIO, then any active connection | ||
| 146 | is shutdown and the socket closed when the BIO is freed. | ||
| 147 | .Pp | ||
| 148 | Calling | ||
| 149 | .Xr BIO_reset 3 | ||
| 150 | on a connect BIO will close any active connection and reset the BIO | ||
| 151 | into a state where it can connect to the same host again. | ||
| 152 | .Pp | ||
| 153 | .Xr BIO_get_fd 3 | ||
| 154 | places the underlying socket in | ||
| 155 | .Fa c | ||
| 156 | if it is not | ||
| 157 | .Dv NULL | ||
| 158 | and also returns the socket. | ||
| 159 | If | ||
| 160 | .Fa c | ||
| 161 | is not | ||
| 162 | .Dv NULL | ||
| 163 | it should be of type | ||
| 164 | .Vt "int *" . | ||
| 165 | .Pp | ||
| 166 | .Fn BIO_set_conn_hostname | ||
| 167 | uses the string | ||
| 168 | .Fa name | ||
| 169 | to set the hostname. | ||
| 170 | The hostname can be an IP address. | ||
| 171 | The hostname can also include the port in the form | ||
| 172 | .Ar hostname : Ns Ar port . | ||
| 173 | It is also acceptable to use the forms | ||
| 174 | .Ar hostname Ns / Ns Pa any/other/path | ||
| 175 | or | ||
| 176 | .Ar hostname : Ns Ar port Ns / Ns Pa any/other/path . | ||
| 177 | .Pp | ||
| 178 | .Fn BIO_set_conn_port | ||
| 179 | sets the port to | ||
| 180 | .Fa port . | ||
| 181 | .Fa port | ||
| 182 | is looked up as a service using | ||
| 183 | .Xr getaddrinfo 3 | ||
| 184 | .Pp | ||
| 185 | .Fn BIO_set_conn_ip | ||
| 186 | sets the IP address to | ||
| 187 | .Fa ip | ||
| 188 | using binary form i.e. four bytes specifying the IP address | ||
| 189 | in big-endian form. | ||
| 190 | .Pp | ||
| 191 | .Fn BIO_set_conn_int_port | ||
| 192 | sets the port using | ||
| 193 | .Fa port . | ||
| 194 | .Fa port | ||
| 195 | should | ||
| 196 | be of type | ||
| 197 | .Vt "int *" . | ||
| 198 | .Pp | ||
| 199 | .Fn BIO_get_conn_hostname | ||
| 200 | returns the hostname of the connect BIO or | ||
| 201 | .Dv NULL | ||
| 202 | if the BIO is initialized but no hostname is set. | ||
| 203 | This return value is an internal pointer which should not be modified. | ||
| 204 | .Pp | ||
| 205 | .Fn BIO_get_conn_port | ||
| 206 | returns the port as a string. | ||
| 207 | This return value is an internal pointer which should not be modified. | ||
| 208 | .Pp | ||
| 209 | .Fn BIO_get_conn_ip | ||
| 210 | returns the IP address in binary form. | ||
| 211 | .Pp | ||
| 212 | .Fn BIO_get_conn_int_port | ||
| 213 | returns the port as an | ||
| 214 | .Vt int . | ||
| 215 | .Pp | ||
| 216 | .Fn BIO_set_nbio | ||
| 217 | sets the non-blocking I/O flag to | ||
| 218 | .Fa n . | ||
| 219 | If | ||
| 220 | .Fa n | ||
| 221 | is zero then blocking I/O is set. | ||
| 222 | If | ||
| 223 | .Fa n | ||
| 224 | is 1 then non-blocking I/O is set. | ||
| 225 | Blocking I/O is the default. | ||
| 226 | The call to | ||
| 227 | .Fn BIO_set_nbio | ||
| 228 | should be made before the connection is established | ||
| 229 | because non-blocking I/O is set during the connect process. | ||
| 230 | .Pp | ||
| 231 | .Fn BIO_new_connect | ||
| 232 | combines | ||
| 233 | .Xr BIO_new 3 | ||
| 234 | and | ||
| 235 | .Fn BIO_set_conn_hostname | ||
| 236 | into a single call. | ||
| 237 | It creates a new connect BIO with | ||
| 238 | .Fa name . | ||
| 239 | .Pp | ||
| 240 | .Fn BIO_do_connect | ||
| 241 | attempts to connect the supplied BIO. | ||
| 242 | It returns 1 if the connection was established successfully. | ||
| 243 | A zero or negative value is returned if the connection | ||
| 244 | could not be established. | ||
| 245 | The call | ||
| 246 | .Xr BIO_should_retry 3 | ||
| 247 | should be used for non-blocking connect BIOs | ||
| 248 | to determine if the call should be retried. | ||
| 249 | .Pp | ||
| 250 | If blocking I/O is set then a non-positive return value from any | ||
| 251 | I/O call is caused by an error condition, although a zero return | ||
| 252 | will normally mean that the connection was closed. | ||
| 253 | .Pp | ||
| 254 | If the port name is supplied as part of the host name then this will | ||
| 255 | override any value set with | ||
| 256 | .Fn BIO_set_conn_port . | ||
| 257 | This may be undesirable if the application does not wish to allow | ||
| 258 | connection to arbitrary ports. | ||
| 259 | This can be avoided by checking for the presence of the | ||
| 260 | .Sq \&: | ||
| 261 | character in the passed hostname and either indicating an error | ||
| 262 | or truncating the string at that point. | ||
| 263 | .Pp | ||
| 264 | The values returned by | ||
| 265 | .Fn BIO_get_conn_hostname , | ||
| 266 | .Fn BIO_get_conn_port , | ||
| 267 | .Fn BIO_get_conn_ip , | ||
| 268 | and | ||
| 269 | .Fn BIO_get_conn_int_port | ||
| 270 | are updated when a connection attempt is made. | ||
| 271 | Before any connection attempt the values returned | ||
| 272 | are those set by the application itself. | ||
| 273 | .Pp | ||
| 274 | Applications do not have to call | ||
| 275 | .Fn BIO_do_connect | ||
| 276 | but may wish to do so to separate the connection process | ||
| 277 | from other I/O processing. | ||
| 278 | .Pp | ||
| 279 | If non-blocking I/O is set, | ||
| 280 | then retries will be requested as appropriate. | ||
| 281 | .Pp | ||
| 282 | In addition to | ||
| 283 | .Xr BIO_should_read 3 | ||
| 284 | and | ||
| 285 | .Xr BIO_should_write 3 | ||
| 286 | it is also possible for | ||
| 287 | .Xr BIO_should_io_special 3 | ||
| 288 | to be true during the initial connection process with the reason | ||
| 289 | .Dv BIO_RR_CONNECT . | ||
| 290 | If this is returned, it is an indication | ||
| 291 | that a connection attempt would block. | ||
| 292 | The application should then take appropriate action to wait | ||
| 293 | until the underlying socket has connected and retry the call. | ||
| 294 | .Pp | ||
| 295 | .Fn BIO_set_conn_hostname , | ||
| 296 | .Fn BIO_set_conn_port , | ||
| 297 | .Fn BIO_set_conn_ip , | ||
| 298 | .Fn BIO_set_conn_int_port , | ||
| 299 | .Fn BIO_get_conn_hostname , | ||
| 300 | .Fn BIO_get_conn_port , | ||
| 301 | .Fn BIO_get_conn_ip , | ||
| 302 | .Fn BIO_get_conn_int_port , | ||
| 303 | .Fn BIO_set_nbio , | ||
| 304 | and | ||
| 305 | .Fn BIO_do_connect | ||
| 306 | are macros. | ||
| 307 | .Sh RETURN VALUES | ||
| 308 | .Fn BIO_s_connect | ||
| 309 | returns the connect BIO method. | ||
| 310 | .Pp | ||
| 311 | .Xr BIO_get_fd 3 | ||
| 312 | returns the socket or -1 if the BIO has not been initialized. | ||
| 313 | .Pp | ||
| 314 | .Fn BIO_set_conn_hostname , | ||
| 315 | .Fn BIO_set_conn_port , | ||
| 316 | .Fn BIO_set_conn_ip , | ||
| 317 | and | ||
| 318 | .Fn BIO_set_conn_int_port | ||
| 319 | always return 1. | ||
| 320 | .Pp | ||
| 321 | .Fn BIO_get_conn_hostname | ||
| 322 | returns the connected hostname or | ||
| 323 | .Dv NULL | ||
| 324 | if none is set. | ||
| 325 | .Pp | ||
| 326 | .Fn BIO_get_conn_port | ||
| 327 | returns a string representing the connected port or | ||
| 328 | .Dv NULL | ||
| 329 | if not set. | ||
| 330 | .Pp | ||
| 331 | .Fn BIO_get_conn_ip | ||
| 332 | returns a pointer to the connected IP address in binary form | ||
| 333 | or all zeros if not set. | ||
| 334 | .Pp | ||
| 335 | .Fn BIO_get_conn_int_port | ||
| 336 | returns the connected port or 0 if none was set. | ||
| 337 | .Pp | ||
| 338 | .Fn BIO_set_nbio | ||
| 339 | always returns 1. | ||
| 340 | .Pp | ||
| 341 | .Fn BIO_do_connect | ||
| 342 | returns 1 if the connection was successfully | ||
| 343 | established and 0 or -1 if the connection failed. | ||
| 344 | .Sh EXAMPLES | ||
| 345 | This example connects to a webserver on the local host and attempts | ||
| 346 | to retrieve a page and copy the result to standard output. | ||
| 347 | .Bd -literal -offset 2n | ||
| 348 | BIO *cbio, *out; | ||
| 349 | int len; | ||
| 350 | char tmpbuf[1024]; | ||
| 351 | |||
| 352 | ERR_load_crypto_strings(); | ||
| 353 | cbio = BIO_new_connect("localhost:http"); | ||
| 354 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
| 355 | if (BIO_do_connect(cbio) <= 0) { | ||
| 356 | fprintf(stderr, "Error connecting to server\en"); | ||
| 357 | ERR_print_errors_fp(stderr); | ||
| 358 | /* whatever ... */ | ||
| 359 | } | ||
| 360 | BIO_puts(cbio, "GET / HTTP/1.0\en\en"); | ||
| 361 | for(;;) { | ||
| 362 | len = BIO_read(cbio, tmpbuf, 1024); | ||
| 363 | if (len <= 0) | ||
| 364 | break; | ||
| 365 | BIO_write(out, tmpbuf, len); | ||
| 366 | } | ||
| 367 | BIO_free(cbio); | ||
| 368 | BIO_free(out); | ||
| 369 | .Ed | ||
| 370 | .Sh SEE ALSO | ||
| 371 | .Xr BIO_new 3 | ||
| 372 | .Sh HISTORY | ||
| 373 | .Fn BIO_s_connect , | ||
| 374 | .Fn BIO_new_connect , | ||
| 375 | .Fn BIO_set_nbio , | ||
| 376 | and | ||
| 377 | .Fn BIO_do_connect | ||
| 378 | first appeared in SSLeay 0.8.0. | ||
| 379 | .Fn BIO_set_conn_hostname , | ||
| 380 | .Fn BIO_set_conn_port , | ||
| 381 | .Fn BIO_set_conn_ip , | ||
| 382 | .Fn BIO_set_conn_int_port , | ||
| 383 | .Fn BIO_get_conn_hostname , | ||
| 384 | .Fn BIO_get_conn_port , | ||
| 385 | .Fn BIO_get_conn_ip , | ||
| 386 | and | ||
| 387 | .Fn BIO_get_conn_int_port | ||
| 388 | first appeared in SSLeay 0.9.0. | ||
| 389 | All these functions have been available since | ||
| 390 | .Ox 2.4 . | ||
