factory-uri: add some debug
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-address-pool.h
1 /* GStreamer
2  * Copyright (C) 2012 Wim Taymans <wim.taymans at gmail.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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #include <gst/gst.h>
21
22 #ifndef __GST_RTSP_ADDRESS_POOL_H__
23 #define __GST_RTSP_ADDRESS_POOL_H__
24
25 G_BEGIN_DECLS
26
27 #define GST_TYPE_RTSP_ADDRESS_POOL              (gst_rtsp_address_pool_get_type ())
28 #define GST_IS_RTSP_ADDRESS_POOL(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_ADDRESS_POOL))
29 #define GST_IS_RTSP_ADDRESS_POOL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_ADDRESS_POOL))
30 #define GST_RTSP_ADDRESS_POOL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_ADDRESS_POOL, GstRTSPAddressPoolClass))
31 #define GST_RTSP_ADDRESS_POOL(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_ADDRESS_POOL, GstRTSPAddressPool))
32 #define GST_RTSP_ADDRESS_POOL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_ADDRESS_POOL, GstRTSPAddressPoolClass))
33 #define GST_RTSP_ADDRESS_POOL_CAST(obj)         ((GstRTSPAddressPool*)(obj))
34 #define GST_RTSP_ADDRESS_POOL_CLASS_CAST(klass) ((GstRTSPAddressPoolClass*)(klass))
35
36 typedef struct _GstRTSPAddress GstRTSPAddress;
37 typedef struct _GstRTSPAddressClass GstRTSPAddressClass;
38
39 typedef struct _GstRTSPAddressPool GstRTSPAddressPool;
40 typedef struct _GstRTSPAddressPoolClass GstRTSPAddressPoolClass;
41 typedef struct _GstRTSPAddressPoolPrivate GstRTSPAddressPoolPrivate;
42
43 struct _GstRTSPAddress {
44   GstRTSPAddressPool *pool;
45
46   gchar *address;
47   guint16 port;
48   gint n_ports;
49   guint8 ttl;
50
51   gpointer priv;
52 };
53
54 GType gst_rtsp_address_get_type        (void);
55
56 GstRTSPAddress * gst_rtsp_address_copy (GstRTSPAddress *addr);
57 void             gst_rtsp_address_free (GstRTSPAddress *addr);
58
59 typedef enum {
60   GST_RTSP_ADDRESS_FLAG_NONE      = 0,
61   GST_RTSP_ADDRESS_FLAG_IPV4      = (1 << 0),
62   GST_RTSP_ADDRESS_FLAG_IPV6      = (1 << 1),
63   GST_RTSP_ADDRESS_FLAG_EVEN_PORT = (1 << 2)
64 } GstRTSPAddressFlags;
65
66 /**
67  * GstRTSPAddressPool:
68  * @parent: the parent GObject
69  *
70  */
71 struct _GstRTSPAddressPool {
72   GObject       parent;
73
74   GstRTSPAddressPoolPrivate *priv;
75 };
76
77 struct _GstRTSPAddressPoolClass {
78   GObjectClass  parent_class;
79 };
80
81 GType                  gst_rtsp_address_pool_get_type        (void);
82
83 /* create a new address pool */
84 GstRTSPAddressPool *   gst_rtsp_address_pool_new             (void);
85
86 void                   gst_rtsp_address_pool_clear           (GstRTSPAddressPool * pool);
87 void                   gst_rtsp_address_pool_dump            (GstRTSPAddressPool * pool);
88
89 gboolean               gst_rtsp_address_pool_add_range       (GstRTSPAddressPool * pool,
90                                                               const gchar *min_address,
91                                                               const gchar *max_address,
92                                                               guint16 min_port,
93                                                               guint16 max_port,
94                                                               guint8 ttl);
95
96 GstRTSPAddress *       gst_rtsp_address_pool_acquire_address (GstRTSPAddressPool * pool,
97                                                               GstRTSPAddressFlags flags,
98                                                               gint n_ports);
99 G_END_DECLS
100
101 #endif /* __GST_RTSP_ADDRESS_POOL_H__ */