Add trivial function to compare GstNetAddress. See #520626.

Original commit message from CVS:
Patch by: Olivier Crete  <tester at tester ca>
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/netbuffer/gstnetbuffer.c: (gst_netaddress_equal):
* gst-libs/gst/netbuffer/gstnetbuffer.h:
Add trivial function to compare GstNetAddress. See #520626.
API: GstNetBuffer::gst_netaddress_equal
This commit is contained in:
Olivier Crete 2008-03-07 18:17:44 +00:00 committed by Wim Taymans
parent 6c50e0031a
commit cf273d8add
4 changed files with 54 additions and 0 deletions

View file

@ -1,3 +1,13 @@
2008-03-07 Wim Taymans <wim.taymans@collabora.co.uk>
Patch by: Olivier Crete <tester at tester ca>
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/netbuffer/gstnetbuffer.c: (gst_netaddress_equal):
* gst-libs/gst/netbuffer/gstnetbuffer.h:
Add trivial function to compare GstNetAddress. See #520626.
API: GstNetBuffer::gst_netaddress_equal
2008-03-07 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init):

View file

@ -595,6 +595,7 @@ gst_netaddress_get_ip6_address
gst_netaddress_get_net_type
gst_netaddress_set_ip4_address
gst_netaddress_set_ip6_address
gst_netaddress_equal
<SUBSECTION Standard>
GstNetBufferClass
GST_TYPE_NETBUFFER

View file

@ -237,3 +237,43 @@ gst_netaddress_get_ip6_address (GstNetAddress * naddr, guint8 address[16],
return TRUE;
}
/**
* gst_netaddress_equal:
* @naddr1: The first #GstNetAddress
* @naddr2: The second #GstNetAddress
*
* Compare two #GstNetAddress structures
*
* Returns: TRUE if they are identical, FALSE otherwise
*
* Since: 0.10.18
*/
gboolean
gst_netaddress_equal (const GstNetAddress * naddr1,
const GstNetAddress * naddr2)
{
g_return_val_if_fail (naddr1 != NULL, FALSE);
g_return_val_if_fail (naddr2 != NULL, FALSE);
if (naddr1->type != naddr2->type)
return FALSE;
if (naddr1->port != naddr2->port)
return FALSE;
switch (naddr1->type) {
case GST_NET_TYPE_IP4:
if (naddr1->address.ip4 != naddr2->address.ip4)
return FALSE;
break;
case GST_NET_TYPE_IP6:
if (memcmp (naddr1->address.ip6, naddr2->address.ip6,
sizeof (naddr1->address.ip6)))
return FALSE;
break;
default:
break;
}
return TRUE;
}

View file

@ -105,6 +105,9 @@ GstNetType gst_netaddress_get_net_type (GstNetAddress *naddr);
gboolean gst_netaddress_get_ip4_address (GstNetAddress *naddr, guint32 *address, guint16 *port);
gboolean gst_netaddress_get_ip6_address (GstNetAddress *naddr, guint8 address[16], guint16 *port);
gboolean gst_netaddress_equal (const GstNetAddress *naddr1,
const GstNetAddress *naddr2);
G_END_DECLS
#endif /* __GST_NETBUFFER_H__ */