Lely core libraries 2.3.4
|
This header file is part of the I/O library; it contains the network address declarations. More...
Go to the source code of this file.
Data Structures | |
struct | __io_addr |
An opaque network address type. More... | |
struct | io_addrinfo |
A network address info structure. More... | |
Macros | |
#define | IO_ADDR_INIT |
The static initializer for io_addr_t. | |
#define | IO_ADDR_BTH_STRLEN 18 |
The maximum number of bytes required to hold the text representation of a Bluetooth device address, including the terminating null byte. | |
#define | IO_ADDR_IPV4_STRLEN 16 |
The maximum number of bytes required to hold the text representation of an IPv4 internet address, including the terminating null byte. | |
#define | IO_ADDR_IPV6_STRLEN 46 |
The maximum number of bytes required to hold the text representation of an IPv6 internet address, including the terminating null byte. | |
#define | IO_ADDR_UNIX_STRLEN 108 |
The maximum number of bytes required to hold the text representation of a UNIX domain socket path name, including the terminating null byte. | |
#define | IO_ADDRINFO_INIT |
The static initializer for struct io_addrinfo. | |
Functions | |
int | io_addr_cmp (const void *p1, const void *p2) |
Compares two network addresses. More... | |
int | io_addr_get_rfcomm_a (const io_addr_t *addr, char *ba, int *port) |
Obtains an RFCOMM Bluetooth device address and port number from a network address. More... | |
int | io_addr_set_rfcomm_a (io_addr_t *addr, const char *ba, int port) |
Initializes a network address from an RFCOMM Bluetooth device address and port number. More... | |
int | io_addr_get_rfcomm_n (const io_addr_t *addr, uint8_t ba[6], int *port) |
Obtains an RFCOMM Bluetooth device address and port number from a network address. More... | |
void | io_addr_set_rfcomm_n (io_addr_t *addr, const uint8_t ba[6], int port) |
Initializes a network address from an RFCOMM Bluetooth device address and port number. More... | |
void | io_addr_set_rfcomm_local (io_addr_t *addr, int port) |
Initializes a network address with the local Bluetooth (RFCOMM) device address (FF:FF:FF:00:00:00) and a port number. More... | |
int | io_addr_get_ipv4_a (const io_addr_t *addr, char *ip, int *port) |
Obtains an IPv4 address and port number from a network address. More... | |
int | io_addr_set_ipv4_a (io_addr_t *addr, const char *ip, int port) |
Initializes a network address from an IPv4 address and port number. More... | |
int | io_addr_get_ipv4_n (const io_addr_t *addr, uint8_t ip[4], int *port) |
Obtains an IPv4 address and port number from a network address. More... | |
void | io_addr_set_ipv4_n (io_addr_t *addr, const uint8_t ip[4], int port) |
Initializes a network address from an IPv4 address and port number. More... | |
void | io_addr_set_ipv4_loopback (io_addr_t *addr, int port) |
Initializes a network address with the IPv4 loopback address and a port number. More... | |
void | io_addr_set_ipv4_broadcast (io_addr_t *addr, int port) |
Initializes a network address with the IPv4 broadcast address and a port number. More... | |
int | io_addr_get_ipv6_a (const io_addr_t *addr, char *ip, int *port) |
Obtains an IPv6 address and port number from a network address. More... | |
int | io_addr_set_ipv6_a (io_addr_t *addr, const char *ip, int port) |
Initializes a network address from an IPv6 address and port number. More... | |
int | io_addr_get_ipv6_n (const io_addr_t *addr, uint8_t ip[16], int *port) |
Obtains an IPv6 address and port number from a network address. More... | |
void | io_addr_set_ipv6_n (io_addr_t *addr, const uint8_t ip[16], int port) |
Initializes a network address from an IPv6 address and port number. More... | |
void | io_addr_set_ipv6_loopback (io_addr_t *addr, int port) |
Initializes a network address with the IPv6 loopback address and a port number. More... | |
int | io_addr_get_unix (const io_addr_t *addr, char *path) |
Obtains a UNIX domain socket path name from a network address. More... | |
void | io_addr_set_unix (io_addr_t *addr, const char *path) |
Initializes a network address from a UNIX domain socket path name. More... | |
int | io_addr_get_domain (const io_addr_t *addr) |
Obtains the domain of a network address. More... | |
int | io_addr_get_port (const io_addr_t *addr, int *port) |
Obtains the port number of an IPv4 or IPv6 network address. More... | |
int | io_addr_set_port (io_addr_t *addr, int port) |
Initializes the port number of an IPv4 or IPv6 network address. More... | |
int | io_addr_is_loopback (const io_addr_t *addr) |
Returns 1 if the network address is a loopback address, and 0 if not. | |
int | io_addr_is_broadcast (const io_addr_t *addr) |
Returns 1 if the network address is a broadcast address, and 0 if not. | |
int | io_addr_is_multicast (const io_addr_t *addr) |
Returns 1 if the network address is a multicast address, and 0 if not. | |
int | io_get_addrinfo (int maxinfo, struct io_addrinfo *info, const char *nodename, const char *servname, const struct io_addrinfo *hints) |
Obtains a list of network addresses corresponding to a host and/or service name. More... | |
This header file is part of the I/O library; it contains the network address declarations.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file addr.h.
int io_addr_cmp | ( | const void * | p1, |
const void * | p2 | ||
) |
int io_addr_get_rfcomm_a | ( | const io_addr_t * | addr, |
char * | ba, | ||
int * | port | ||
) |
Obtains an RFCOMM Bluetooth device address and port number from a network address.
addr | a pointer to a network address. |
ba | the address of a string containing at least IO_ADDR_BTH_STRLEN characters (can be NULL). On success, if ba is not NULL, *ba contains the text representation of the Bluetooth address. |
port | the address of a port number (can be NULL). On success, if port is not NULL, *port contains the port number or channel. |
int io_addr_set_rfcomm_a | ( | io_addr_t * | addr, |
const char * | ba, | ||
int | port | ||
) |
Initializes a network address from an RFCOMM Bluetooth device address and port number.
addr | a pointer to the network address to be initialized. |
ba | the text representation of a Bluetooth address. If ba is NULL or an empty string, the wildcard address (00:00:00:00:00:00) is used. |
port | the port number or channel. If port is 0, io_socket_bind() will dynamically assign a port number. |
int io_addr_get_rfcomm_n | ( | const io_addr_t * | addr, |
uint8_t | ba[6], | ||
int * | port | ||
) |
Obtains an RFCOMM Bluetooth device address and port number from a network address.
addr | a pointer to a network address. |
ba | the address of an array containing at least 6 four bytes (can be NULL). On success, if ba is not NULL, *ba contains the Bluetooth address in network byte order. |
port | the address of a port number (can be NULL). On success, if port is not NULL, *port contains the port number or channel. |
void io_addr_set_rfcomm_n | ( | io_addr_t * | addr, |
const uint8_t | ba[6], | ||
int | port | ||
) |
Initializes a network address from an RFCOMM Bluetooth device address and port number.
addr | a pointer to the network address to be initialized. |
ba | a pointer to a Bluetooth address in network byte order. If ba is, the wildcard address (00:00:00:00:00:00) is used. |
port | the port number or channel. If port is 0, io_socket_bind() will dynamically assign a port number. |
void io_addr_set_rfcomm_local | ( | io_addr_t * | addr, |
int | port | ||
) |
Initializes a network address with the local Bluetooth (RFCOMM) device address (FF:FF:FF:00:00:00) and a port number.
addr | a pointer to the network address to be initialized. |
port | the port number or PSM (Protocol Service Multiplexer). If port is 0, io_socket_bind() will dynamically assign a port number. |
int io_addr_get_ipv4_a | ( | const io_addr_t * | addr, |
char * | ip, | ||
int * | port | ||
) |
Obtains an IPv4 address and port number from a network address.
addr | a pointer to a network address. |
ip | the address of a string containing at least IO_ADDR_IPV4_STRLEN characters (can be NULL). On success, if ip is not NULL, *ip contains the text representation of the IPv4 address. |
port | the address of a port number (can be NULL). On success, if port is not NULL, *port contains the port number. |
int io_addr_set_ipv4_a | ( | io_addr_t * | addr, |
const char * | ip, | ||
int | port | ||
) |
Initializes a network address from an IPv4 address and port number.
addr | a pointer to the network address to be initialized. |
ip | the text representation of an IPv4 address. If ip is NULL or an empty string, the wildcard address (INADDR_ANY) is used. |
port | the port number. |
int io_addr_get_ipv4_n | ( | const io_addr_t * | addr, |
uint8_t | ip[4], | ||
int * | port | ||
) |
Obtains an IPv4 address and port number from a network address.
addr | a pointer to a network address. |
ip | the address of an array containing at least 4 four bytes (can be NULL). On success, if ip is not NULL, *ip contains the IPv4 address in network byte order. |
port | the address of a port number (can be NULL). On success, if port is not NULL, *port contains the port number. |
void io_addr_set_ipv4_n | ( | io_addr_t * | addr, |
const uint8_t | ip[4], | ||
int | port | ||
) |
Initializes a network address from an IPv4 address and port number.
addr | a pointer to the network address to be initialized. |
ip | a pointer to an IPv4 address in network byte order. If ip is NULL, the wildcard address (INADDR_ANY) is used. |
port | the port number. |
void io_addr_set_ipv4_loopback | ( | io_addr_t * | addr, |
int | port | ||
) |
void io_addr_set_ipv4_broadcast | ( | io_addr_t * | addr, |
int | port | ||
) |
int io_addr_get_ipv6_a | ( | const io_addr_t * | addr, |
char * | ip, | ||
int * | port | ||
) |
Obtains an IPv6 address and port number from a network address.
addr | a pointer to a network address. |
ip | the address of a string containing at least IO_ADDR_IPV6_STRLEN characters (can be NULL). On success, if ip is not NULL, *ip contains the text representation of the IPv6 address. |
port | the address of a port number (can be NULL). On success, if port is not NULL, *port contains the port number. |
int io_addr_set_ipv6_a | ( | io_addr_t * | addr, |
const char * | ip, | ||
int | port | ||
) |
Initializes a network address from an IPv6 address and port number.
addr | a pointer to the network address to be initialized. |
ip | the text representation of an IPv6 address. If ip is NULL or an empty string, the wildcard address (in6addr_any) is used. |
port | the port number. |
int io_addr_get_ipv6_n | ( | const io_addr_t * | addr, |
uint8_t | ip[16], | ||
int * | port | ||
) |
Obtains an IPv6 address and port number from a network address.
addr | a pointer to a network address. |
ip | the address of an array containing at least 16 four bytes (can be NULL). On success, if ip is not NULL, *ip contains the IPv6 address in network byte order. |
port | the address of a port number (can be NULL). On success, if port is not NULL, *port contains the port number. |
void io_addr_set_ipv6_n | ( | io_addr_t * | addr, |
const uint8_t | ip[16], | ||
int | port | ||
) |
Initializes a network address from an IPv6 address and port number.
addr | a pointer to the network address to be initialized. |
ip | a pointer to an IPv6 address in network byte order. If ip is NULL, the wildcard address (in6addr_any) is used. |
port | the port number. |
void io_addr_set_ipv6_loopback | ( | io_addr_t * | addr, |
int | port | ||
) |
int io_addr_get_unix | ( | const io_addr_t * | addr, |
char * | path | ||
) |
Obtains a UNIX domain socket path name from a network address.
addr | a pointer to a network address. |
path | the address of a string containing at least IO_ADDR_UNIX_STRLEN characters (can be NULL). On success, if path is not NULL, *path contains the path name. |
void io_addr_set_unix | ( | io_addr_t * | addr, |
const char * | path | ||
) |
Initializes a network address from a UNIX domain socket path name.
addr | a pointer to the network address to be initialized. |
path | a pointer to a path name. |
int io_addr_get_domain | ( | const io_addr_t * | addr | ) |
Obtains the domain of a network address.
int io_addr_get_port | ( | const io_addr_t * | addr, |
int * | port | ||
) |
Obtains the port number of an IPv4 or IPv6 network address.
addr | a pointer to a network address. |
port | the address of a port number (can be NULL). On success, if port is not NULL, *port contains the port number. |
int io_addr_set_port | ( | io_addr_t * | addr, |
int | port | ||
) |
Initializes the port number of an IPv4 or IPv6 network address.
addr | a pointer to the network address to be initialized. |
port | the port number. |
int io_get_addrinfo | ( | int | maxinfo, |
struct io_addrinfo * | info, | ||
const char * | nodename, | ||
const char * | servname, | ||
const struct io_addrinfo * | hints | ||
) |
Obtains a list of network addresses corresponding to a host and/or service name.
maxinfo | the maximum number of io_addrinfo structs to return. |
info | an array of at least maxinfo io_addrinfo structs (can be NULL). On success, *info contains at most maxinfo structures describing the network addresses. |
nodename | a pointer to a string containing a host (node) name or numeric address (can be NULL). |
servname | a pointer to a string containing a service name or port number (can be NULL). |
hints | a pointer to a network address structure containing hints about the domain and type of sockets the caller supports. If not NULL, only the domain and type fields of *hints are taken into account, if they are non-zero. |