mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
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:
parent
6c50e0031a
commit
cf273d8add
4 changed files with 54 additions and 0 deletions
10
ChangeLog
10
ChangeLog
|
@ -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):
|
||||
|
|
|
@ -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__ */
|
||||
|
|
Loading…
Reference in a new issue