Commit cf273d8a authored by Olivier Crete's avatar Olivier Crete Committed by Wim Taymans
Browse files

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
parent 6c50e003
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):
......@@ -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
......
......@@ -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;
}
......@@ -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__ */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment