#include "sofia-sip/su_config.h"
#include "sofia-sip/su_types.h"
#include <sofia-sip/su_errno.h>
#include <stdio.h>
#include <sofia-sip/su_addrinfo.h>
Include dependency graph for su.h:

Go to the source code of this file.
Data Structures | |
| union | su_sockaddr_u |
| Common socket address structure. More... | |
| struct | su_iovec_s |
| IO vector for su_vsend() and su_vrecv(). More... | |
Defines | |
| #define | SU_MAXHOST |
| Maximum size of host name. | |
| #define | SU_MAXSERV |
| Maximum size of service name. | |
| #define | SU_ADDRSIZE |
| Maximum size of address in text format. | |
| #define | SU_SERVSIZE |
| Maximum size of port number in text format. | |
| #define | SU_ADDR(su) |
| Get pointer to address field. | |
| #define | SU_ADDRLEN(su) |
| Get length of address field. | |
| #define | SU_HAS_INADDR_ANY(su) |
| Test if su_sockaddr_t is INADDR_ANY or IN6ADDR_ANY. | |
| #define | SU_SOCKADDR_SIZE(su) |
| Calculate correct size of su_sockaddr_t structure. | |
Typedefs | |
| typedef int | su_socket_t |
| Socket descriptor type. | |
| typedef su_iovec_s | su_iovec_t |
| I/O vector for scatter-gather I/O. | |
Enumerations | |
| enum | { INVALID_SOCKET, SOCKET_ERROR, su_success, su_failure } |
Functions | |
| SOFIAPUBFUN su_socket_t | su_socket (int af, int sock, int proto) |
| Create an endpoint for communication. | |
| SOFIAPUBFUN int | su_close (su_socket_t s) |
| Close an socket descriptor. | |
| SOFIAPUBFUN int | su_ioctl (su_socket_t s, int request,...) |
| Control socket. | |
| SOFIAPUBFUN int | su_isblocking (void) |
| Checks if the previous call failed because it would have blocked. | |
| SOFIAPUBFUN int | su_setblocking (su_socket_t s, int blocking) |
| Set/reset blocking option. | |
| SOFIAPUBFUN int | su_setreuseaddr (su_socket_t s, int reuse) |
| Set/reset address reusing option. | |
| SOFIAPUBFUN int | su_soerror (su_socket_t s) |
| Get the error code associated with the socket. | |
| SOFIAPUBFUN int | su_getmsgsize (su_socket_t s) |
| Get size of message available in socket. | |
| SOFIAPUBFUN int | su_vsend (su_socket_t s, su_iovec_t const iov[], int iovlen, int flags, su_sockaddr_t const *su, socklen_t sulen) |
| Scatter-gather send. | |
| SOFIAPUBFUN int | su_vrecv (su_socket_t s, su_iovec_t iov[], int iovlen, int flags, su_sockaddr_t *su, socklen_t *sulen) |
| Scatter-gather receive. | |
| SOFIAPUBFUN int | su_getlocalip (su_sockaddr_t *sin) |
| Return local IP address. | |
| SOFIAPUBFUN int | su_cmp_sockaddr (su_sockaddr_t const *a, su_sockaddr_t const *b) |
| Compare two socket addresses. | |
| SOFIAPUBFUN int | su_match_sockaddr (su_sockaddr_t const *a, su_sockaddr_t const *b) |
| Check if socket address b match with a. | |
| SOFIAPUBFUN void | su_canonize_sockaddr (su_sockaddr_t *su) |
| Convert mapped/compat address to IPv4 address. | |
| #define SU_ADDR | ( | su | ) |
Get pointer to address field.
The macro SU_ADDR() returns pointer to the address field (sin_data, sin_addr or sin_addr6, depending on the address family).
| #define SU_ADDRLEN | ( | su | ) |
Get length of address field.
The macro SU_ADDRLEN() returns length of the address field (sin_data, sin_addr or sin_addr6, depending on the address family).
| anonymous enum |
| INVALID_SOCKET | Invalid socket descriptor. |
| SOCKET_ERROR | Error from su_socket() call. |
| su_success | Return code for a successful call. |
| su_failure | Return code for an unsuccessful call. |
| SOFIAPUBFUN int su_getlocalip | ( | su_sockaddr_t * | sa | ) |
| SOFIAPUBFUN int su_match_sockaddr | ( | su_sockaddr_t const * | a, | |
| su_sockaddr_t const * | b | |||
| ) |
Check if socket address b match with a.
The function su_match_sockaddr() returns true if the socket address b matches with the socket address a. This happens if either all the interesting fields are identical: address family, port number, address, and scope ID (in case of IPv6) or that the a contains a wildcard (zero) in their place.