gst_plugins_base/gst-libs/gst/netbuffer/gstnetbuffer.h
changeset 2 5505e8908944
parent 0 0e761a78d257
child 7 567bb019e3e3
equal deleted inserted replaced
1:4c282e7dd6d3 2:5505e8908944
       
     1 /* GStreamer
       
     2  * Copyright (C) <2005> Wim Taymans <wim@fluendo.com>
       
     3  *
       
     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.
       
     8  *
       
     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.
       
    13  *
       
    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.
       
    18  */
       
    19 
       
    20 #ifndef __GST_NETBUFFER_H__
       
    21 #define __GST_NETBUFFER_H__
       
    22 
       
    23 #include <gst/gst.h>
       
    24 
       
    25 G_BEGIN_DECLS
       
    26 
       
    27 typedef struct _GstNetBuffer GstNetBuffer;
       
    28 typedef struct _GstNetBufferClass GstNetBufferClass;
       
    29 typedef struct _GstNetAddress GstNetAddress;
       
    30 
       
    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))
       
    37 
       
    38 /**
       
    39  * GstNetType:
       
    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
       
    43  *
       
    44  * The Address type used in #GstNetAddress.
       
    45  */
       
    46 typedef enum {
       
    47   GST_NET_TYPE_UNKNOWN,
       
    48   GST_NET_TYPE_IP4,
       
    49   GST_NET_TYPE_IP6,
       
    50 } GstNetType;
       
    51 
       
    52 /**
       
    53  * GstNetAddress:
       
    54  *
       
    55  * An opaque network address as used in #GstNetBuffer.
       
    56  */
       
    57 struct _GstNetAddress {
       
    58   /*< private >*/
       
    59   GstNetType    type;
       
    60   union {
       
    61     guint8        ip6[16];
       
    62     guint32       ip4;
       
    63   } address;
       
    64   guint16       port;
       
    65   /*< private >*/
       
    66   gpointer _gst_reserved[GST_PADDING];
       
    67 };
       
    68 
       
    69 /**
       
    70  * GstNetBuffer:
       
    71  * @buffer: the parent #GstBuffer
       
    72  * @from: the address where this buffer came from.
       
    73  * @to: the address where this buffer should go to.
       
    74  *
       
    75  * buffer for use in network sources and sinks.
       
    76  * It contains the source or destination address of the buffer.
       
    77  */
       
    78 struct _GstNetBuffer {
       
    79   GstBuffer buffer;
       
    80 
       
    81   GstNetAddress from;
       
    82   GstNetAddress to;
       
    83 
       
    84   /*< private >*/
       
    85   gpointer _gst_reserved[GST_PADDING];
       
    86 };
       
    87 
       
    88 struct _GstNetBufferClass {
       
    89   GstBufferClass  buffer_class;
       
    90 
       
    91   /*< private >*/
       
    92   gpointer _gst_reserved[GST_PADDING];
       
    93 };
       
    94 
       
    95 /* creating buffers */
       
    96 #ifdef __SYMBIAN32__
       
    97 IMPORT_C
       
    98 #endif
       
    99 
       
   100 GType           gst_netbuffer_get_type          (void);
       
   101 #ifdef __SYMBIAN32__
       
   102 IMPORT_C
       
   103 #endif
       
   104 
       
   105 
       
   106 GstNetBuffer*   gst_netbuffer_new               (void);
       
   107 
       
   108 /* address operations */
       
   109 #ifdef __SYMBIAN32__
       
   110 IMPORT_C
       
   111 #endif
       
   112 
       
   113 void            gst_netaddress_set_ip4_address  (GstNetAddress *naddr, guint32 address, guint16 port);
       
   114 #ifdef __SYMBIAN32__
       
   115 IMPORT_C
       
   116 #endif
       
   117 
       
   118 void            gst_netaddress_set_ip6_address  (GstNetAddress *naddr, guint8 address[16], guint16 port);
       
   119 #ifdef __SYMBIAN32__
       
   120 IMPORT_C
       
   121 #endif
       
   122 
       
   123 
       
   124 GstNetType      gst_netaddress_get_net_type     (GstNetAddress *naddr);
       
   125 #ifdef __SYMBIAN32__
       
   126 IMPORT_C
       
   127 #endif
       
   128 
       
   129 gboolean        gst_netaddress_get_ip4_address  (GstNetAddress *naddr, guint32 *address, guint16 *port);
       
   130 #ifdef __SYMBIAN32__
       
   131 IMPORT_C
       
   132 #endif
       
   133 
       
   134 gboolean        gst_netaddress_get_ip6_address  (GstNetAddress *naddr, guint8 address[16], guint16 *port);
       
   135 #ifdef __SYMBIAN32__
       
   136 IMPORT_C
       
   137 #endif
       
   138 
       
   139 
       
   140 gboolean        gst_netaddress_equal            (const GstNetAddress *naddr1,
       
   141                                                  const GstNetAddress *naddr2);
       
   142 
       
   143 G_END_DECLS
       
   144 
       
   145 #endif /* __GST_NETBUFFER_H__ */
       
   146