gstnetbuffer

gstnetbuffer — Buffer for use in network sources and sinks

Functions

Types and Values

Includes

#include <gst/netbuffer/gstnetbuffer.h>

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)

Functions

gst_netbuffer_new ()

GstNetBuffer *
gst_netbuffer_new (void);

Create a new network buffer.

Returns

a new GstNetBuffer.


gst_netaddress_get_net_type ()

GstNetType
gst_netaddress_get_net_type (const GstNetAddress *naddr);

Get the type of address stored in naddr .

Parameters

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.

Note that port and address must be expressed in network byte order, use g_htons() and g_htonl() to convert them to network byte order.

Parameters

naddr

a network address

 

address

an IPv4 network address.

 

port

a port number to set.

 

gst_netaddress_get_ip4_address ()

gboolean
gst_netaddress_get_ip4_address (const 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.

Note that port and address are expressed in network byte order, use g_ntohs() and g_ntohl() to convert them to host order.

Parameters

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_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.

Note that port must be expressed in network byte order, use g_htons() to convert it to network byte order.

Parameters

naddr

a network address

 

address

an IPv6 network address.

 

port

a port number to set.

 

gst_netaddress_get_ip6_address ()

gboolean
gst_netaddress_get_ip6_address (const 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.

Note that port is expressed in network byte order, use g_ntohs() to convert it to host order.

Parameters

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_address_bytes ()

gint
gst_netaddress_get_address_bytes (const GstNetAddress *naddr,
                                  guint8 address[16],
                                  guint16 *port);

Get just the address bytes stored in naddr into address .

Note that port is expressed in network byte order, use g_ntohs() to convert it to host order. IP4 addresses are also stored in network byte order.

Parameters

naddr

a network address

 

address

a location to store the result.

 

port

a location to store the port.

 

Returns

number of bytes actually copied

Since 0.10.22


gst_netaddress_set_address_bytes ()

gint
gst_netaddress_set_address_bytes (GstNetAddress *naddr,
                                  GstNetType type,
                                  guint8 address[16],
                                  guint16 port);

Set just the address bytes stored in naddr into address .

Note that port must be expressed in network byte order, use g_htons() to convert it to network byte order. IP4 address bytes must also be stored in network byte order.

Parameters

naddr

a network address

 

type

the address type (IPv4 or IPV6)

 

address

a location to store the result.

 

port

a location to store the port.

 

Returns

number of bytes actually copied

Since 0.10.22


gst_netaddress_equal ()

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

Compare two GstNetAddress structures

Parameters

naddr1

The first GstNetAddress

 

naddr2

The second GstNetAddress

 

Returns

TRUE if they are identical, FALSE otherwise

Since 0.10.18


gst_netaddress_to_string ()

gint
gst_netaddress_to_string (const GstNetAddress *naddr,
                          gchar *dest,
                          gulong len);

Copies a string representation of naddr into dest . Up to len bytes are copied.

Parameters

naddr

a GstNetAddress

 

dest

destination

 

len

len of dest

 

Returns

the number of bytes which would be produced if the buffer was large enough

Since 0.10.24

Types and Values

struct GstNetBuffer

struct GstNetBuffer {
  GstBuffer buffer;

  GstNetAddress from;
  GstNetAddress to;
};

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

Members

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

The Address type used in GstNetAddress.

Members

GST_NET_TYPE_UNKNOWN

unknown address type

 

GST_NET_TYPE_IP4

an IPv4 address type

 

GST_NET_TYPE_IP6

and IPv6 address type

 

GST_NETADDRESS_MAX_LEN

#define GST_NETADDRESS_MAX_LEN 64

The maximum length of a string representation of a GstNetAddress as produced by gst_netaddress_to_string().

Since 0.10.24


struct GstNetAddress

struct GstNetAddress {
};

An opaque network address as used in GstNetBuffer.