📄 apr__network__io_8h-source.html
字号:
00304 <span class="comment"> * @param thesocket The socket to close </span>
00305 <span class="comment"> */</span>
00306 APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket);
00307 <span class="comment"></span>
00308 <span class="comment">/**</span>
00309 <span class="comment"> * Bind the socket to its associated port</span>
00310 <span class="comment"> * @param sock The socket to bind </span>
00311 <span class="comment"> * @param sa The socket address to bind to</span>
00312 <span class="comment"> * @remark This may be where we will find out if there is any other process</span>
00313 <span class="comment"> * using the selected port.</span>
00314 <span class="comment"> */</span>
00315 APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock,
00316 apr_sockaddr_t *sa);
00317 <span class="comment"></span>
00318 <span class="comment">/**</span>
00319 <span class="comment"> * Listen to a bound socket for connections.</span>
00320 <span class="comment"> * @param sock The socket to listen on </span>
00321 <span class="comment"> * @param backlog The number of outstanding connections allowed in the sockets</span>
00322 <span class="comment"> * listen queue. If this value is less than zero, the listen</span>
00323 <span class="comment"> * queue size is set to zero. </span>
00324 <span class="comment"> */</span>
00325 APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock,
00326 apr_int32_t backlog);
00327 <span class="comment"></span>
00328 <span class="comment">/**</span>
00329 <span class="comment"> * Accept a new connection request</span>
00330 <span class="comment"> * @param new_sock A copy of the socket that is connected to the socket that</span>
00331 <span class="comment"> * made the connection request. This is the socket which should</span>
00332 <span class="comment"> * be used for all future communication.</span>
00333 <span class="comment"> * @param sock The socket we are listening on.</span>
00334 <span class="comment"> * @param connection_pool The pool for the new socket.</span>
00335 <span class="comment"> */</span>
00336 APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new_sock,
00337 apr_socket_t *sock,
00338 apr_pool_t *connection_pool);
00339 <span class="comment"></span>
00340 <span class="comment">/**</span>
00341 <span class="comment"> * Issue a connection request to a socket either on the same machine </span>
00342 <span class="comment"> * or a different one.</span>
00343 <span class="comment"> * @param sock The socket we wish to use for our side of the connection </span>
00344 <span class="comment"> * @param sa The address of the machine we wish to connect to.</span>
00345 <span class="comment"> */</span>
00346 APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock,
00347 apr_sockaddr_t *sa);
00348 <span class="comment"></span>
00349 <span class="comment">/**</span>
00350 <span class="comment"> * Create apr_sockaddr_t from hostname, address family, and port.</span>
00351 <span class="comment"> * @param sa The new apr_sockaddr_t.</span>
00352 <span class="comment"> * @param hostname The hostname or numeric address string to resolve/parse, or</span>
00353 <span class="comment"> * NULL to build an address that corresponds to 0.0.0.0 or ::</span>
00354 <span class="comment"> * @param family The address family to use, or APR_UNSPEC if the system should </span>
00355 <span class="comment"> * decide.</span>
00356 <span class="comment"> * @param port The port number.</span>
00357 <span class="comment"> * @param flags Special processing flags:</span>
00358 <span class="comment"> * <PRE></span>
00359 <span class="comment"> * APR_IPV4_ADDR_OK first query for IPv4 addresses; only look</span>
00360 <span class="comment"> * for IPv6 addresses if the first query failed;</span>
00361 <span class="comment"> * only valid if family is APR_UNSPEC and hostname</span>
00362 <span class="comment"> * isn't NULL; mutually exclusive with</span>
00363 <span class="comment"> * APR_IPV6_ADDR_OK</span>
00364 <span class="comment"> * APR_IPV6_ADDR_OK first query for IPv6 addresses; only look</span>
00365 <span class="comment"> * for IPv4 addresses if the first query failed;</span>
00366 <span class="comment"> * only valid if family is APR_UNSPEC and hostname</span>
00367 <span class="comment"> * isn't NULL and APR_HAVE_IPV6; mutually exclusive</span>
00368 <span class="comment"> * with APR_IPV4_ADDR_OK</span>
00369 <span class="comment"> * </PRE></span>
00370 <span class="comment"> * @param p The pool for the apr_sockaddr_t and associated storage.</span>
00371 <span class="comment"> */</span>
00372 APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa,
00373 const <span class="keywordtype">char</span> *hostname,
00374 apr_int32_t family,
00375 apr_port_t port,
00376 apr_int32_t flags,
00377 apr_pool_t *p);
00378 <span class="comment"></span>
00379 <span class="comment">/**</span>
00380 <span class="comment"> * Look up the host name from an apr_sockaddr_t.</span>
00381 <span class="comment"> * @param hostname The hostname.</span>
00382 <span class="comment"> * @param sa The apr_sockaddr_t.</span>
00383 <span class="comment"> * @param flags Special processing flags.</span>
00384 <span class="comment"> */</span>
00385 APR_DECLARE(apr_status_t) apr_getnameinfo(<span class="keywordtype">char</span> **hostname,
00386 apr_sockaddr_t *sa,
00387 apr_int32_t flags);
00388 <span class="comment"></span>
00389 <span class="comment">/**</span>
00390 <span class="comment"> * Parse hostname/IP address with scope id and port.</span>
00391 <span class="comment"> *</span>
00392 <span class="comment"> * Any of the following strings are accepted:</span>
00393 <span class="comment"> * 8080 (just the port number)</span>
00394 <span class="comment"> * www.apache.org (just the hostname)</span>
00395 <span class="comment"> * www.apache.org:8080 (hostname and port number)</span>
00396 <span class="comment"> * [fe80::1]:80 (IPv6 numeric address string only)</span>
00397 <span class="comment"> * [fe80::1%eth0] (IPv6 numeric address string and scope id)</span>
00398 <span class="comment"> *</span>
00399 <span class="comment"> * Invalid strings:</span>
00400 <span class="comment"> * (empty string)</span>
00401 <span class="comment"> * [abc] (not valid IPv6 numeric address string)</span>
00402 <span class="comment"> * abc:65536 (invalid port number)</span>
00403 <span class="comment"> *</span>
00404 <span class="comment"> * @param addr The new buffer containing just the hostname. On output, *addr </span>
00405 <span class="comment"> * will be NULL if no hostname/IP address was specfied.</span>
00406 <span class="comment"> * @param scope_id The new buffer containing just the scope id. On output, </span>
00407 <span class="comment"> * *scope_id will be NULL if no scope id was specified.</span>
00408 <span class="comment"> * @param port The port number. On output, *port will be 0 if no port was </span>
00409 <span class="comment"> * specified.</span>
00410 <span class="comment"> * ### FIXME: 0 is a legal port (per RFC 1700). this should</span>
00411 <span class="comment"> * ### return something besides zero if the port is missing.</span>
00412 <span class="comment"> * @param str The input string to be parsed.</span>
00413 <span class="comment"> * @param p The pool from which *addr and *scope_id are allocated.</span>
00414 <span class="comment"> * @remark If scope id shouldn't be allowed, check for scope_id != NULL in </span>
00415 <span class="comment"> * addition to checking the return code. If addr/hostname should be </span>
00416 <span class="comment"> * required, check for addr == NULL in addition to checking the </span>
00417 <span class="comment"> * return code.</span>
00418 <span class="comment"> */</span>
00419 APR_DECLARE(apr_status_t) apr_parse_addr_port(<span class="keywordtype">char</span> **addr,
00420 <span class="keywordtype">char</span> **scope_id,
00421 apr_port_t *port,
00422 const <span class="keywordtype">char</span> *str,
00423 apr_pool_t *p);
00424 <span class="comment"></span>
00425 <span class="comment">/**</span>
00426 <span class="comment"> * Get name of the current machine</span>
00427 <span class="comment"> * @param buf A buffer to store the hostname in.</span>
00428 <span class="comment"> * @param len The maximum length of the hostname that can be stored in the</span>
00429 <span class="comment"> * buffer provided. The suggested length is APRMAXHOSTLEN + 1.</span>
00430 <span class="comment"> * @param cont The pool to use.</span>
00431 <span class="comment"> * @remark If the buffer was not large enough, an error will be returned.</span>
00432 <span class="comment"> */</span>
00433 APR_DECLARE(apr_status_t) apr_gethostname(<span class="keywordtype">char</span> *buf, <span class="keywordtype">int</span> len, apr_pool_t *cont);
00434 <span class="comment"></span>
00435 <span class="comment">/**</span>
00436 <span class="comment"> * Return the data associated with the current socket</span>
00437 <span class="comment"> * @param data The user data associated with the socket.</span>
00438 <span class="comment"> * @param key The key to associate with the user data.</span>
00439 <span class="comment"> * @param sock The currently open socket.</span>
00440 <span class="comment"> */</span>
00441 APR_DECLARE(apr_status_t) apr_socket_data_get(<span class="keywordtype">void</span> **data, const <span class="keywordtype">char</span> *key,
00442 apr_socket_t *sock);
00443 <span class="comment"></span>
00444 <span class="comment">/**</span>
00445 <span class="comment"> * Set the data associated with the current socket.</span>
00446 <span class="comment"> * @param sock The currently open socket.</span>
00447 <span class="comment"> * @param data The user data to associate with the socket.</span>
00448 <span class="comment"> * @param key The key to associate with the data.</span>
00449 <span class="comment"> * @param cleanup The cleanup to call when the socket is destroyed.</span>
00450 <span class="comment"> */</span>
00451 APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, <span class="keywordtype">void</span> *data,
00452 const <span class="keywordtype">char</span> *key,
00453 apr_status_t (*cleanup)(<span class="keywordtype">void</span>*));
00454 <span class="comment"></span>
00455 <span class="comment">/**</span>
00456 <span class="comment"> * Send data over a network.</span>
00457 <span class="comment"> * @param sock The socket to send the data over.</span>
00458 <span class="comment"> * @param buf The buffer which contains the data to be sent. </span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -