2 * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GST_NET_ADDRESS_META_H__
21 #define __GST_NET_ADDRESS_META_H__
27 typedef struct _GstNetAddress GstNetAddress;
31 * @GST_NET_TYPE_UNKNOWN: unknown address type
32 * @GST_NET_TYPE_IP4: an IPv4 address type
33 * @GST_NET_TYPE_IP6: and IPv6 address type
35 * The Address type used in #GstNetAddress.
44 * GST_NETADDRESS_MAX_LEN:
46 * The maximum length of a string representation of a GstNetAddress as produced
47 * by gst_net_address_to_string().
51 #define GST_NETADDRESS_MAX_LEN 64
56 * An opaque network address as used in #GstNetAddressMeta.
58 struct _GstNetAddress {
67 gpointer _gst_reserved[GST_PADDING];
70 typedef struct _GstNetAddressMeta GstNetAddressMeta;
75 * Buffer metadata for network addresses.
77 struct _GstNetAddressMeta {
83 const GstMetaInfo *gst_net_address_meta_get_info (void);
84 #define GST_NET_ADDRESS_META_INFO (gst_net_address_meta_get_info())
86 #define gst_buffer_get_net_address_meta(b) \
87 ((GstNetAddressMeta*)gst_buffer_get_meta((b),GST_NET_ADDRESS_META_INFO))
88 #define gst_buffer_add_net_address_meta(b) \
89 ((GstNetAddressMeta*)gst_buffer_add_meta((b),GST_NET_ADDRESS_META_INFO,NULL))
91 /* address operations */
92 void gst_net_address_set_ip4_address (GstNetAddress *naddr, guint32 address, guint16 port);
93 void gst_net_address_set_ip6_address (GstNetAddress *naddr, guint8 address[16], guint16 port);
94 gint gst_net_address_set_address_bytes (GstNetAddress *naddr, GstNetType type,
95 guint8 address[16], guint16 port);
97 GstNetType gst_net_address_get_net_type (const GstNetAddress *naddr);
98 gboolean gst_net_address_get_ip4_address (const GstNetAddress *naddr,
99 guint32 *address, guint16 *port);
100 gboolean gst_net_address_get_ip6_address (const GstNetAddress *naddr,
101 guint8 address[16], guint16 *port);
102 gint gst_net_address_get_address_bytes (const GstNetAddress *naddr,
103 guint8 address[16], guint16 *port);
105 gboolean gst_net_address_equal (const GstNetAddress *naddr1,
106 const GstNetAddress *naddr2);
108 gint gst_net_address_to_string (const GstNetAddress *naddr,
109 gchar *dest, gsize len);
113 #endif /* __GST_NET_ADDRESS_META_H__ */