[Nice] [nice/master] Add nice_address_is_valid function
Olivier Crête
olivier.crete at collabora.co.uk
Wed Nov 5 14:01:17 PST 2008
---
address/address.c | 13 +++++++++++++
address/address.h | 4 ++++
nice/libnice.sym | 1 +
3 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/address/address.c b/address/address.c
index 0a00b49..1301792 100644
--- a/address/address.c
+++ b/address/address.c
@@ -299,3 +299,16 @@ nice_address_is_private (const NiceAddress *a)
g_assert_not_reached ();
}
+
+NICEAPI_EXPORT gboolean
+nice_address_is_valid (const NiceAddress *a)
+{
+ switch (a->s.addr.sa_family)
+ {
+ case AF_INET:
+ case AF_INET6:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
diff --git a/address/address.h b/address/address.h
index 10fd721..50cfceb 100644
--- a/address/address.h
+++ b/address/address.h
@@ -107,6 +107,10 @@ nice_address_to_string (const NiceAddress *addr, gchar *dst);
gboolean
nice_address_is_private (const NiceAddress *a);
+G_GNUC_WARN_UNUSED_RESULT
+gboolean
+nice_address_is_valid (const NiceAddress *a);
+
G_END_DECLS
#endif /* _ADDRESS_H */
diff --git a/nice/libnice.sym b/nice/libnice.sym
index 8b92c68..503ea2d 100644
--- a/nice/libnice.sym
+++ b/nice/libnice.sym
@@ -4,6 +4,7 @@ nice_address_equal
nice_address_free
nice_address_get_port
nice_address_is_private
+nice_address_is_valid
nice_address_new
nice_address_set_from_sockaddr
nice_address_set_from_string
--
1.5.6.5
More information about the Nice
mailing list