## gstnetbuffer

gstnetbuffer — Buffer for use in network sources and sinks

## Synopsis

    #include <gst/netbuffer/gstnetbuffer.h>

                        GstNetBuffer;
    enum                GstNetType;
                        GstNetAddress;
    GstNetBuffer*       gst_netbuffer_new                   (void);
    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);
    GstNetType          gst_netaddress_get_net_type         (GstNetAddress *naddr);
    void                gst_netaddress_set_ip4_address      (GstNetAddress *naddr,
                                                             guint32 address,
                                                             guint16 port);
    void                gst_netaddress_set_ip6_address      (GstNetAddress *naddr,
                                                             guint8 address[16],
                                                             guint16 port);
    gboolean            gst_netaddress_equal                (const GstNetAddress *naddr1,
                                                             const GstNetAddress *naddr2);

## Description

GstNetBuffer is a subclass of a normal GstBuffer that contains two additional metadata fields of type GstNetAddress named 'to' and 'from'. The buffer can be used to store additional information about the origin of the buffer data and is used in various network elements to track the to and from addresses.

Last reviewed on 2006-08-21 (0.10.10)

## Details

### GstNetBuffer

    typedef struct {
      GstBuffer buffer;

      GstNetAddress from;
      GstNetAddress to;
    } GstNetBuffer;

buffer for use in network sources and sinks. It contains the source or destination address of the buffer.

GstBuffer `buffer`; | the parent GstBuffer
GstNetAddress `from`; | the address where this buffer came from.
GstNetAddress `to`; | the address where this buffer should go to.

### enum GstNetType

    typedef enum {
      GST_NET_TYPE_UNKNOWN,
      GST_NET_TYPE_IP4,
      GST_NET_TYPE_IP6,
    } GstNetType;

The Address type used in GstNetAddress.

`GST_NET_TYPE_UNKNOWN` | unknown address type
`GST_NET_TYPE_IP4` | an IPv4 address type
`GST_NET_TYPE_IP6` | and IPv6 address type

### GstNetAddress

    typedef struct {
    } GstNetAddress;

An opaque network address as used in GstNetBuffer.

### gst_netbuffer_new ()

    GstNetBuffer*       gst_netbuffer_new                   (void);

Create a new network buffer.

Returns : | a new GstNetBuffer.

### gst_netaddress_get_ip4_address ()

    gboolean            gst_netaddress_get_ip4_address      (GstNetAddress *naddr,
                                                             guint32 *address,
                                                             guint16 *port);

Get the IPv4 address stored in `naddr` into `address`. This function requires that the address type of `naddr` is of type GST_NET_TYPE_IP4.

`naddr` : | a network address
`address` : | a location to store the address.
`port` : | a location to store the port.
Returns : | TRUE if the address could be retrieved.

### gst_netaddress_get_ip6_address ()

    gboolean            gst_netaddress_get_ip6_address      (GstNetAddress *naddr,
                                                             guint8 address[16],
                                                             guint16 *port);

Get the IPv6 address stored in `naddr` into `address`.

If `naddr` is of type GST_NET_TYPE_IP4, the transitional IP6 address is returned.

`naddr` : | a network address
`address` : | a location to store the result.
`port` : | a location to store the port.
Returns : | TRUE if the address could be retrieved.

### gst_netaddress_get_net_type ()

    GstNetType          gst_netaddress_get_net_type         (GstNetAddress *naddr);

Get the type of address stored in `naddr`.

`naddr` : | a network address
Returns : | the network type stored in `naddr`.

### gst_netaddress_set_ip4_address ()

    void                gst_netaddress_set_ip4_address      (GstNetAddress *naddr,
                                                             guint32 address,
                                                             guint16 port);

Set `naddr` with the IPv4 `address` and `port` pair.

`naddr` : | a network address
`address` : | an IPv4 network address.
`port` : | a port number to set.

### gst_netaddress_set_ip6_address ()

    void                gst_netaddress_set_ip6_address      (GstNetAddress *naddr,
                                                             guint8 address[16],
                                                             guint16 port);

Set `naddr` with the IPv6 `address` and `port` pair.

`naddr` : | a network address
`address` : | an IPv6 network address.
`port` : | a port number to set.

### gst_netaddress_equal ()

    gboolean            gst_netaddress_equal                (const GstNetAddress *naddr1,
                                                             const GstNetAddress *naddr2);

Compare two GstNetAddress structures

`naddr1` : | The first GstNetAddress
`naddr2` : | The second GstNetAddress
Returns : | TRUE if they are identical, FALSE otherwise

Since 0.10.18