2012-11-14 14:49:06 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2012 Wim Taymans <wim.taymans at gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_RTSP_ADDRESS_POOL_H__
|
|
|
|
#define __GST_RTSP_ADDRESS_POOL_H__
|
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
#include "rtsp-server-prelude.h"
|
|
|
|
|
2012-11-14 14:49:06 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GST_TYPE_RTSP_ADDRESS_POOL (gst_rtsp_address_pool_get_type ())
|
|
|
|
#define GST_IS_RTSP_ADDRESS_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_ADDRESS_POOL))
|
|
|
|
#define GST_IS_RTSP_ADDRESS_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_ADDRESS_POOL))
|
|
|
|
#define GST_RTSP_ADDRESS_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_ADDRESS_POOL, GstRTSPAddressPoolClass))
|
|
|
|
#define GST_RTSP_ADDRESS_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_ADDRESS_POOL, GstRTSPAddressPool))
|
|
|
|
#define GST_RTSP_ADDRESS_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_ADDRESS_POOL, GstRTSPAddressPoolClass))
|
|
|
|
#define GST_RTSP_ADDRESS_POOL_CAST(obj) ((GstRTSPAddressPool*)(obj))
|
|
|
|
#define GST_RTSP_ADDRESS_POOL_CLASS_CAST(klass) ((GstRTSPAddressPoolClass*)(klass))
|
|
|
|
|
2013-09-24 15:30:18 +00:00
|
|
|
/**
|
|
|
|
* GstRTSPAddressPoolResult:
|
|
|
|
* @GST_RTSP_ADDRESS_POOL_OK: no error
|
|
|
|
* @GST_RTSP_ADDRESS_POOL_EINVAL:invalid arguments were provided to a function
|
|
|
|
* @GST_RTSP_ADDRESS_POOL_ERESERVED: the addres has already been reserved
|
|
|
|
* @GST_RTSP_ADDRESS_POOL_ERANGE: the address is not in the pool
|
|
|
|
* @GST_RTSP_ADDRESS_POOL_ELAST: last error
|
|
|
|
*
|
|
|
|
* Result codes from RTSP address pool functions.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
GST_RTSP_ADDRESS_POOL_OK = 0,
|
|
|
|
/* errors */
|
|
|
|
GST_RTSP_ADDRESS_POOL_EINVAL = -1,
|
|
|
|
GST_RTSP_ADDRESS_POOL_ERESERVED = -2,
|
|
|
|
GST_RTSP_ADDRESS_POOL_ERANGE = -3,
|
|
|
|
|
|
|
|
GST_RTSP_ADDRESS_POOL_ELAST = -4,
|
|
|
|
} GstRTSPAddressPoolResult;
|
|
|
|
|
|
|
|
|
2012-11-15 12:25:14 +00:00
|
|
|
typedef struct _GstRTSPAddress GstRTSPAddress;
|
|
|
|
|
2012-11-14 14:49:06 +00:00
|
|
|
typedef struct _GstRTSPAddressPool GstRTSPAddressPool;
|
|
|
|
typedef struct _GstRTSPAddressPoolClass GstRTSPAddressPoolClass;
|
|
|
|
typedef struct _GstRTSPAddressPoolPrivate GstRTSPAddressPoolPrivate;
|
|
|
|
|
2013-07-11 10:18:26 +00:00
|
|
|
/**
|
|
|
|
* GstRTSPAddress:
|
|
|
|
* @pool: the #GstRTSPAddressPool owner of this address
|
|
|
|
* @address: the address
|
|
|
|
* @port: the port number
|
|
|
|
* @n_ports: number of ports
|
|
|
|
* @ttl: TTL or 0 for unicast addresses
|
|
|
|
*
|
|
|
|
* An address
|
|
|
|
*/
|
2012-11-15 12:25:14 +00:00
|
|
|
struct _GstRTSPAddress {
|
|
|
|
GstRTSPAddressPool *pool;
|
|
|
|
|
|
|
|
gchar *address;
|
|
|
|
guint16 port;
|
|
|
|
gint n_ports;
|
|
|
|
guint8 ttl;
|
|
|
|
|
2013-07-11 10:18:26 +00:00
|
|
|
/*<private >*/
|
2012-11-15 12:25:14 +00:00
|
|
|
gpointer priv;
|
|
|
|
};
|
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2012-11-15 12:25:14 +00:00
|
|
|
GType gst_rtsp_address_get_type (void);
|
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2012-11-15 12:25:14 +00:00
|
|
|
GstRTSPAddress * gst_rtsp_address_copy (GstRTSPAddress *addr);
|
2017-05-18 09:35:18 +00:00
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2012-11-15 12:25:14 +00:00
|
|
|
void gst_rtsp_address_free (GstRTSPAddress *addr);
|
|
|
|
|
2013-07-11 10:18:26 +00:00
|
|
|
/**
|
|
|
|
* GstRTSPAddressFlags:
|
|
|
|
* @GST_RTSP_ADDRESS_FLAG_NONE: no flags
|
|
|
|
* @GST_RTSP_ADDRESS_FLAG_IPV4: an IPv4 address
|
|
|
|
* @GST_RTSP_ADDRESS_FLAG_IPV6: and IPv6 address
|
|
|
|
* @GST_RTSP_ADDRESS_FLAG_EVEN_PORT: address with an even port
|
|
|
|
* @GST_RTSP_ADDRESS_FLAG_MULTICAST: a multicast address
|
|
|
|
* @GST_RTSP_ADDRESS_FLAG_UNICAST: a unicast address
|
|
|
|
*
|
|
|
|
* Flags used to control allocation of addresses
|
|
|
|
*/
|
2012-11-14 14:49:06 +00:00
|
|
|
typedef enum {
|
|
|
|
GST_RTSP_ADDRESS_FLAG_NONE = 0,
|
|
|
|
GST_RTSP_ADDRESS_FLAG_IPV4 = (1 << 0),
|
|
|
|
GST_RTSP_ADDRESS_FLAG_IPV6 = (1 << 1),
|
2013-02-19 21:34:16 +00:00
|
|
|
GST_RTSP_ADDRESS_FLAG_EVEN_PORT = (1 << 2),
|
|
|
|
GST_RTSP_ADDRESS_FLAG_MULTICAST = (1 << 3),
|
|
|
|
GST_RTSP_ADDRESS_FLAG_UNICAST = (1 << 4),
|
2012-11-14 14:49:06 +00:00
|
|
|
} GstRTSPAddressFlags;
|
|
|
|
|
2013-02-19 21:34:16 +00:00
|
|
|
/**
|
|
|
|
* GST_RTSP_ADDRESS_POOL_ANY_IPV4:
|
|
|
|
*
|
2013-07-16 10:36:56 +00:00
|
|
|
* Used with gst_rtsp_address_pool_add_range() to bind to all
|
2013-02-19 21:34:16 +00:00
|
|
|
* IPv4 addresses
|
|
|
|
*/
|
2013-07-11 10:18:26 +00:00
|
|
|
#define GST_RTSP_ADDRESS_POOL_ANY_IPV4 "0.0.0.0"
|
2013-02-19 21:34:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_RTSP_ADDRESS_POOL_ANY_IPV6:
|
|
|
|
*
|
2013-07-16 10:36:56 +00:00
|
|
|
* Used with gst_rtsp_address_pool_add_range() to bind to all
|
2013-02-19 21:34:16 +00:00
|
|
|
* IPv6 addresses
|
|
|
|
*/
|
|
|
|
#define GST_RTSP_ADDRESS_POOL_ANY_IPV6 "::"
|
|
|
|
|
2012-11-14 14:49:06 +00:00
|
|
|
/**
|
|
|
|
* GstRTSPAddressPool:
|
|
|
|
* @parent: the parent GObject
|
|
|
|
*
|
2013-07-11 10:18:26 +00:00
|
|
|
* An address pool, all member are private
|
2012-11-14 14:49:06 +00:00
|
|
|
*/
|
|
|
|
struct _GstRTSPAddressPool {
|
|
|
|
GObject parent;
|
|
|
|
|
2013-07-11 10:18:26 +00:00
|
|
|
/*< private >*/
|
2012-11-14 14:49:06 +00:00
|
|
|
GstRTSPAddressPoolPrivate *priv;
|
2013-12-12 00:36:07 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2012-11-14 14:49:06 +00:00
|
|
|
};
|
|
|
|
|
2013-07-11 10:18:26 +00:00
|
|
|
/**
|
|
|
|
* GstRTSPAddressPoolClass:
|
|
|
|
*
|
|
|
|
* Opaque Address pool class.
|
|
|
|
*/
|
2012-11-14 14:49:06 +00:00
|
|
|
struct _GstRTSPAddressPoolClass {
|
|
|
|
GObjectClass parent_class;
|
2013-12-12 00:36:07 +00:00
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2012-11-14 14:49:06 +00:00
|
|
|
};
|
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2012-11-14 14:49:06 +00:00
|
|
|
GType gst_rtsp_address_pool_get_type (void);
|
|
|
|
|
|
|
|
/* create a new address pool */
|
2017-05-18 09:35:18 +00:00
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2012-11-14 14:49:06 +00:00
|
|
|
GstRTSPAddressPool * gst_rtsp_address_pool_new (void);
|
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2012-11-14 15:17:33 +00:00
|
|
|
void gst_rtsp_address_pool_clear (GstRTSPAddressPool * pool);
|
2017-05-18 09:35:18 +00:00
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2012-11-14 14:49:06 +00:00
|
|
|
void gst_rtsp_address_pool_dump (GstRTSPAddressPool * pool);
|
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2012-11-14 14:49:06 +00:00
|
|
|
gboolean gst_rtsp_address_pool_add_range (GstRTSPAddressPool * pool,
|
|
|
|
const gchar *min_address,
|
|
|
|
const gchar *max_address,
|
|
|
|
guint16 min_port,
|
|
|
|
guint16 max_port,
|
|
|
|
guint8 ttl);
|
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2012-11-15 12:25:14 +00:00
|
|
|
GstRTSPAddress * gst_rtsp_address_pool_acquire_address (GstRTSPAddressPool * pool,
|
2012-11-14 14:49:06 +00:00
|
|
|
GstRTSPAddressFlags flags,
|
2012-11-15 12:25:14 +00:00
|
|
|
gint n_ports);
|
2013-02-13 23:01:43 +00:00
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2013-09-24 15:30:18 +00:00
|
|
|
GstRTSPAddressPoolResult gst_rtsp_address_pool_reserve_address (GstRTSPAddressPool * pool,
|
|
|
|
const gchar *ip_address,
|
2013-02-13 23:01:43 +00:00
|
|
|
guint port,
|
|
|
|
guint n_ports,
|
2013-09-24 15:30:18 +00:00
|
|
|
guint ttl,
|
|
|
|
GstRTSPAddress ** address);
|
2013-02-13 23:01:43 +00:00
|
|
|
|
2018-03-13 13:30:41 +00:00
|
|
|
GST_RTSP_SERVER_API
|
2013-02-19 21:34:16 +00:00
|
|
|
gboolean gst_rtsp_address_pool_has_unicast_addresses (GstRTSPAddressPool * pool);
|
2013-02-13 23:01:43 +00:00
|
|
|
|
2015-11-10 19:17:18 +00:00
|
|
|
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPAddress, gst_rtsp_address_free)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPAddressPool, gst_object_unref)
|
|
|
|
#endif
|
|
|
|
|
2012-11-14 14:49:06 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_RTSP_ADDRESS_POOL_H__ */
|