avahi
0.7
|
Definitions and functions to manipulate IP addresses. More...
#include <inttypes.h>
#include <sys/types.h>
#include <avahi-common/cdecl.h>
Go to the source code of this file.
Data Structures | |
struct | AvahiIPv4Address |
An IPv4 address. More... | |
struct | AvahiIPv6Address |
An IPv6 address. More... | |
struct | AvahiAddress |
Protocol (address family) independent address structure. More... | |
Macros | |
#define | AVAHI_ADDRESS_STR_MAX 40 /* IPv6 Max = 4*8 + 7 + 1 for NUL */ |
Maximum size of an address in string form. More... | |
#define | AVAHI_IF_VALID(ifindex) (((ifindex) >= 0) || ((ifindex) == AVAHI_IF_UNSPEC)) |
Return TRUE if the specified interface index is valid. More... | |
#define | AVAHI_PROTO_VALID(protocol) (((protocol) == AVAHI_PROTO_INET) || ((protocol) == AVAHI_PROTO_INET6) || ((protocol) == AVAHI_PROTO_UNSPEC)) |
Return TRUE if the specified protocol is valid. More... | |
Typedefs | |
typedef int | AvahiProtocol |
Protocol family specification, takes the values AVAHI_PROTO_INET, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC. More... | |
typedef int | AvahiIfIndex |
Numeric network interface index. More... | |
typedef struct AvahiIPv4Address | AvahiIPv4Address |
An IPv4 address. More... | |
typedef struct AvahiIPv6Address | AvahiIPv6Address |
An IPv6 address. More... | |
typedef struct AvahiAddress | AvahiAddress |
Protocol (address family) independent address structure. More... | |
Enumerations | |
enum | { AVAHI_PROTO_INET = 0, AVAHI_PROTO_INET6 = 1, AVAHI_PROTO_UNSPEC = -1 } |
Values for AvahiProtocol. More... | |
enum | { AVAHI_IF_UNSPEC = -1 } |
Special values for AvahiIfIndex. More... | |
Functions | |
Comparison | |
int | avahi_address_cmp (const AvahiAddress *a, const AvahiAddress *b) |
Compare two addresses. More... | |
String conversion | |
char * | avahi_address_snprint (char *ret_s, size_t length, const AvahiAddress *a) |
Convert the specified address *a to a human readable character string, use AVAHI_ADDRESS_STR_MAX to allocate an array of the right size. More... | |
AvahiAddress * | avahi_address_parse (const char *s, AvahiProtocol af, AvahiAddress *ret_addr) |
Convert the specified human readable character string to an address structure. More... | |
Protocol/address family handling | |
int | avahi_proto_to_af (AvahiProtocol proto) |
Map AVAHI_PROTO_xxx constants to Unix AF_xxx constants. More... | |
AvahiProtocol | avahi_af_to_proto (int af) |
Map Unix AF_xxx constants to AVAHI_PROTO_xxx constants. More... | |
const char * | avahi_proto_to_string (AvahiProtocol proto) |
Return a textual representation of the specified protocol number. More... | |
Definitions and functions to manipulate IP addresses.
Definition in file address.h.
#define AVAHI_ADDRESS_STR_MAX 40 /* IPv6 Max = 4*8 + 7 + 1 for NUL */ |
Maximum size of an address in string form.
#define AVAHI_IF_VALID | ( | ifindex | ) | (((ifindex) >= 0) || ((ifindex) == AVAHI_IF_UNSPEC)) |
#define AVAHI_PROTO_VALID | ( | protocol | ) | (((protocol) == AVAHI_PROTO_INET) || ((protocol) == AVAHI_PROTO_INET6) || ((protocol) == AVAHI_PROTO_UNSPEC)) |
typedef struct AvahiAddress AvahiAddress |
Protocol (address family) independent address structure.
typedef int AvahiIfIndex |
typedef struct AvahiIPv4Address AvahiIPv4Address |
An IPv4 address.
typedef struct AvahiIPv6Address AvahiIPv6Address |
An IPv6 address.
typedef int AvahiProtocol |
anonymous enum |
anonymous enum |
int avahi_address_cmp | ( | const AvahiAddress * | a, |
const AvahiAddress * | b | ||
) |
Compare two addresses.
Returns 0 when equal, a negative value when a < b, a positive value when a > b.
AvahiAddress* avahi_address_parse | ( | const char * | s, |
AvahiProtocol | af, | ||
AvahiAddress * | ret_addr | ||
) |
Convert the specified human readable character string to an address structure.
Set af to AVAHI_UNSPEC for automatic address family detection.
char* avahi_address_snprint | ( | char * | ret_s, |
size_t | length, | ||
const AvahiAddress * | a | ||
) |
Convert the specified address *a to a human readable character string, use AVAHI_ADDRESS_STR_MAX to allocate an array of the right size.
AvahiProtocol avahi_af_to_proto | ( | int | af | ) |
Map Unix AF_xxx constants to AVAHI_PROTO_xxx constants.
int avahi_proto_to_af | ( | AvahiProtocol | proto | ) |
Map AVAHI_PROTO_xxx constants to Unix AF_xxx constants.
const char* avahi_proto_to_string | ( | AvahiProtocol | proto | ) |
Return a textual representation of the specified protocol number.
i.e. "IPv4", "IPv6" or "UNSPEC"