Top |
Functions
void | nice_address_init () |
NiceAddress * | nice_address_new () |
void | nice_address_free () |
NiceAddress * | nice_address_dup () |
void | nice_address_set_ipv4 () |
void | nice_address_set_ipv6 () |
void | nice_address_set_port () |
guint | nice_address_get_port () |
gboolean | nice_address_set_from_string () |
void | nice_address_set_from_sockaddr () |
void | nice_address_copy_to_sockaddr () |
gboolean | nice_address_equal () |
gboolean | nice_address_equal_no_port () |
void | nice_address_to_string () |
gboolean | nice_address_is_private () |
gboolean | nice_address_is_valid () |
int | nice_address_ip_version () |
Description
The NiceAddress structure will allow you to easily set/get and modify an IPv4 or IPv6 address in order to communicate with the NiceAgent.
Functions
nice_address_init ()
void
nice_address_init (NiceAddress *addr
);
Initialize a NiceAddress into an undefined address
nice_address_new ()
NiceAddress *
nice_address_new (void
);
Create a new NiceAddress with undefined address
You must free it with nice_address_free()
nice_address_free ()
void
nice_address_free (NiceAddress *addr
);
Frees a NiceAddress created with nice_address_new()
or nice_address_dup()
nice_address_dup ()
NiceAddress *
nice_address_dup (const NiceAddress *addr
);
Creates a new NiceAddress with the same address as addr
nice_address_set_ipv4 ()
void nice_address_set_ipv4 (NiceAddress *addr
,guint32 addr_ipv4
);
Set addr
to an IPv4 address using the data from addr_ipv4
This function will reset the port to 0, so make sure you call it before
nice_address_set_port()
nice_address_set_ipv6 ()
void nice_address_set_ipv6 (NiceAddress *addr
,const guchar *addr_ipv6
);
Set addr
to an IPv6 address using the data from addr_ipv6
This function will reset the port to 0, so make sure you call it before
nice_address_set_port()
nice_address_set_port ()
void nice_address_set_port (NiceAddress *addr
,guint port
);
Set the port of addr
to port
nice_address_get_port ()
guint
nice_address_get_port (const NiceAddress *addr
);
Retreive the port of addr
nice_address_set_from_string ()
gboolean nice_address_set_from_string (NiceAddress *addr
,const gchar *str
);
Sets an IPv4 or IPv6 address from the string str
nice_address_set_from_sockaddr ()
void nice_address_set_from_sockaddr (NiceAddress *addr
,const struct sockaddr *sin
);
Sets an IPv4 or IPv6 address from the sockaddr structure sin
nice_address_copy_to_sockaddr ()
void nice_address_copy_to_sockaddr (const NiceAddress *addr
,struct sockaddr *sin
);
Fills the sockaddr structure sin
with the address contained in addr
nice_address_equal ()
gboolean nice_address_equal (const NiceAddress *a
,const NiceAddress *b
);
Compares two NiceAddress structures to see if they contain the same address and the same port.
nice_address_equal_no_port ()
gboolean nice_address_equal_no_port (const NiceAddress *a
,const NiceAddress *b
);
Compares two NiceAddress structures to see if they contain the same address, ignoring the port.
Since: 0.1.8
nice_address_to_string ()
void nice_address_to_string (const NiceAddress *addr
,gchar *dst
);
Transforms the address addr
into a human readable string
nice_address_is_private ()
gboolean
nice_address_is_private (const NiceAddress *addr
);
Verifies if the address in addr
is a private address or not
nice_address_is_valid ()
gboolean
nice_address_is_valid (const NiceAddress *addr
);
Validate whether the NiceAddress addr
is a valid IPv4 or IPv6 address
nice_address_ip_version ()
int
nice_address_ip_version (const NiceAddress *addr
);
Returns the IP version of the address
Types and Values
NiceAddress
typedef struct { union { struct sockaddr addr; struct sockaddr_in ip4; struct sockaddr_in6 ip6; } s; } NiceAddress;
The NiceAddress structure that represents an IPv4 or IPv6 address.
NICE_ADDRESS_STRING_LEN
#define NICE_ADDRESS_STRING_LEN INET6_ADDRSTRLEN
The maximum string length representation of an address.
When using nice_address_to_string()
make sure the string has a size of
at least NICE_ADDRESS_STRING_LEN