diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-02-10 15:27:06 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-02-10 15:27:06 +0100 |
commit | 7501bff8432444b7ae8e7f3d9289c0d61f3f0b64 (patch) | |
tree | bd53603f464c3747e897a8996158a0fef7b41bc3 /doc/socket_functions.rst | |
parent | 0f124df68d87c9073f76efeff1a901a69b1f3e13 (diff) | |
parent | 9e9336185f86bd97ff22f54e4d561c2cccccecf5 (diff) |
Merge branch 'release/debian/4.10-1'debian/4.10-1
Diffstat (limited to 'doc/socket_functions.rst')
-rw-r--r-- | doc/socket_functions.rst | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/socket_functions.rst b/doc/socket_functions.rst new file mode 100644 index 0000000..ead0f08 --- /dev/null +++ b/doc/socket_functions.rst @@ -0,0 +1,34 @@ +================ +Socket functions +================ + +.. code-block:: c + + #include <libHX/socket.h> + + int HX_socket_from_env(const struct addrinfo *ai, const char *intf); + int HX_sockaddr_is_local(const struct sockaddr *, socklen_t, unsigned int flags); + int HX_ipaddr_is_local(const char *, unsigned int flags); + +``HX_socket_from_env`` + The function looks up the current process's file descriptors for a + socket that is listening and which matches the given addrinfo and + (optionally) intf if the latter is not NULL``. Upon success, the fd + number is returned, or -1 if no file descriptor matched. No errors are + signalled. + +``HX_sockaddr_is_local`` + Attempts to determine if the given socket address refers to a local + address. This function may be helpful in determining whether a process + should spend any time (or not) on compressing data before sending to a + peer. The definition of "local" is generally dependent upon the network + APIs. The ``flags`` parameter can contain ``AI_V4MAPPED`` if + IPv4-mapped IPv6 addresses should be recognized. The function returns + >0 if the address is considered local, 0 if not, and any other + negative value for a system error that makes the result + indeterminate. + +``HX_ipaddr_is_local`` + Takes a text representation of an IPv6/IPv4 address and, after + transformation, calls ``HX_sockaddr_is_local``. ``flags`` and + return value behave the same as that. |