avahi-common/address.h File Reference

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...

Defines

#define AVAHI_ADDRESS_STR_MAX   40
 Maximum size of an address in string form.
#define AVAHI_IF_VALID(ifindex)   (((ifindex) >= 0) || ((ifindex) == AVAHI_IF_UNSPEC))
 Return TRUE if the specified interface index is valid.
#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.

Typedefs

typedef int AvahiProtocol
 Protocol family specification, takes the values AVAHI_PROTO_INET, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC.
typedef int AvahiIfIndex
 Numeric network interface index.

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.
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.
AvahiAddressavahi_address_parse (const char *s, AvahiProtocol af, AvahiAddress *ret_addr)
 Convert the specified human readable character string to an address structure.
Protocol/address family handling


int avahi_proto_to_af (AvahiProtocol proto)
 Map AVAHI_PROTO_xxx constants to Unix AF_xxx constants.
AvahiProtocol avahi_af_to_proto (int af)
 Map Unix AF_xxx constants to AVAHI_PROTO_xxx constants.
const char * avahi_proto_to_string (AvahiProtocol proto)
 Return a textual representation of the specified protocol number.


Detailed Description

Definitions and functions to manipulate IP addresses.

Definition in file address.h.


Define Documentation

#define AVAHI_ADDRESS_STR_MAX   40

Maximum size of an address in string form.

Examples:
client-browse-services.c.

Definition at line 53 of file address.h.

#define AVAHI_IF_VALID ( ifindex   )     (((ifindex) >= 0) || ((ifindex) == AVAHI_IF_UNSPEC))

Return TRUE if the specified interface index is valid.

Definition at line 56 of file address.h.

#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.

Definition at line 59 of file address.h.


Typedef Documentation

typedef int AvahiIfIndex

Numeric network interface index.

Takes OS dependent values and the special constant AVAHI_IF_UNSPEC

Definition at line 38 of file address.h.

typedef int AvahiProtocol

Protocol family specification, takes the values AVAHI_PROTO_INET, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC.

Definition at line 35 of file address.h.


Enumeration Type Documentation

anonymous enum

Values for AvahiProtocol.

Enumerator:
AVAHI_PROTO_INET  IPv4.
AVAHI_PROTO_INET6  IPv6.
AVAHI_PROTO_UNSPEC  Unspecified/all protocol(s).

Definition at line 41 of file address.h.

anonymous enum

Special values for AvahiIfIndex.

Enumerator:
AVAHI_IF_UNSPEC  Unspecified/all interface(s).

Definition at line 48 of file address.h.


Function Documentation

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.

Examples:
client-browse-services.c.

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"


Generated on Fri Dec 12 22:23:40 2008 for avahi by  doxygen 1.5.7.1