2 * Copyright (C) <2005> Wim Taymans <wim@fluendo.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_NETBUFFER_H__
21 #define __GST_NETBUFFER_H__
27 typedef struct _GstNetBuffer GstNetBuffer;
28 typedef struct _GstNetBufferClass GstNetBufferClass;
29 typedef struct _GstNetAddress GstNetAddress;
31 #define GST_TYPE_NETBUFFER (gst_netbuffer_get_type())
32 #define GST_IS_NETBUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NETBUFFER))
33 #define GST_IS_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NETBUFFER))
34 #define GST_NETBUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_NETBUFFER, GstNetBufferClass))
35 #define GST_NETBUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NETBUFFER, GstNetBuffer))
36 #define GST_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NETBUFFER, GstNetBufferClass))
40 * @GST_NET_TYPE_UNKNOWN: unknown address type
41 * @GST_NET_TYPE_IP4: an IPv4 address type
42 * @GST_NET_TYPE_IP6: and IPv6 address type
44 * The Address type used in #GstNetAddress.
53 * GST_NETADDRESS_MAX_LEN:
55 * The maximum length of a string representation of a GstNetAddress as produced
56 * by gst_netaddress_to_string().
60 #define GST_NETADDRESS_MAX_LEN 64
65 * An opaque network address as used in #GstNetBuffer.
67 struct _GstNetAddress {
76 gpointer _gst_reserved[GST_PADDING];
81 * @buffer: the parent #GstBuffer
82 * @from: the address where this buffer came from.
83 * @to: the address where this buffer should go to.
85 * buffer for use in network sources and sinks.
86 * It contains the source or destination address of the buffer.
88 struct _GstNetBuffer {
95 gpointer _gst_reserved[GST_PADDING];
98 struct _GstNetBufferClass {
99 GstBufferClass buffer_class;
102 gpointer _gst_reserved[GST_PADDING];
105 /* creating buffers */
106 GType gst_netbuffer_get_type (void);
108 GstNetBuffer* gst_netbuffer_new (void);
110 /* address operations */
111 void gst_netaddress_set_ip4_address (GstNetAddress *naddr, guint32 address, guint16 port);
112 void gst_netaddress_set_ip6_address (GstNetAddress *naddr, guint8 address[16], guint16 port);
113 gint gst_netaddress_set_address_bytes (GstNetAddress *naddr, GstNetType type,
114 guint8 address[16], guint16 port);
116 GstNetType gst_netaddress_get_net_type (const GstNetAddress *naddr);
117 gboolean gst_netaddress_get_ip4_address (const GstNetAddress *naddr, guint32 *address, guint16 *port);
118 gboolean gst_netaddress_get_ip6_address (const GstNetAddress *naddr, guint8 address[16], guint16 *port);
119 gint gst_netaddress_get_address_bytes (const GstNetAddress *naddr, guint8 address[16], guint16 *port);
121 gboolean gst_netaddress_equal (const GstNetAddress *naddr1,
122 const GstNetAddress *naddr2);
124 gint gst_netaddress_to_string (const GstNetAddress *naddr, gchar *dest, gulong len);
128 #endif /* __GST_NETBUFFER_H__ */