Top |
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 () |
gchar * | nice_address_dup_string () |
gboolean | nice_address_is_private () |
gboolean | nice_address_is_linklocal () |
gboolean | nice_address_is_valid () |
int | nice_address_ip_version () |
The NiceAddress structure will allow you to easily set/get and modify an IPv4 or IPv6 address in order to communicate with the NiceAgent.
void
nice_address_init (NiceAddress *addr
);
Initialize a NiceAddress into an undefined address
NiceAddress *
nice_address_new (void
);
Create a new NiceAddress with undefined address
You must free it with nice_address_free()
void
nice_address_free (NiceAddress *addr
);
Frees a NiceAddress created with nice_address_new()
or nice_address_dup()
NiceAddress *
nice_address_dup (const NiceAddress *addr
);
Creates a new NiceAddress with the same address as addr
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()
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()
void nice_address_set_port (NiceAddress *addr
,guint port
);
Set the port of addr
to port
guint
nice_address_get_port (const NiceAddress *addr
);
Retreive the port of addr
gboolean nice_address_set_from_string (NiceAddress *addr
,const gchar *str
);
Sets an IPv4 or IPv6 address from the string str
void nice_address_set_from_sockaddr (NiceAddress *addr
,const struct sockaddr *sin
);
Sets an IPv4 or IPv6 address from the sockaddr structure sin
void nice_address_copy_to_sockaddr (const NiceAddress *addr
,struct sockaddr *sin
);
Fills the sockaddr structure sin
with the address contained in addr
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.
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
void nice_address_to_string (const NiceAddress *addr
,gchar *dst
);
Transforms the address addr
into a human readable string
[skip]
gchar *
nice_address_dup_string (const NiceAddress *addr
);
Transforms the address addr
into a newly allocated human readable string
Since: 0.1.20
gboolean
nice_address_is_private (const NiceAddress *addr
);
Verifies if the address in addr
is a private address or not
gboolean
nice_address_is_linklocal (const NiceAddress *addr
);
Verifies if the address in addr
is a link-local address or not
Since: 0.1.19
gboolean
nice_address_is_valid (const NiceAddress *addr
);
Validate whether the NiceAddress addr
is a valid IPv4 or IPv6 address
int
nice_address_ip_version (const NiceAddress *addr
);
Returns the IP version of the address
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.
#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