client: fix compilation
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-server.h
1 /* GStreamer
2  * Copyright (C) 2008 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 #ifndef __GST_RTSP_SERVER_H__
21 #define __GST_RTSP_SERVER_H__
22
23 #include <gst/gst.h>
24
25 G_BEGIN_DECLS
26
27 typedef struct _GstRTSPServer GstRTSPServer;
28 typedef struct _GstRTSPServerClass GstRTSPServerClass;
29
30 #include "rtsp-session-pool.h"
31 #include "rtsp-mount-points.h"
32 #include "rtsp-media-factory-uri.h"
33 #include "rtsp-client.h"
34 #include "rtsp-auth.h"
35
36 #define GST_TYPE_RTSP_SERVER              (gst_rtsp_server_get_type ())
37 #define GST_IS_RTSP_SERVER(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SERVER))
38 #define GST_IS_RTSP_SERVER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SERVER))
39 #define GST_RTSP_SERVER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
40 #define GST_RTSP_SERVER(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServer))
41 #define GST_RTSP_SERVER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
42 #define GST_RTSP_SERVER_CAST(obj)         ((GstRTSPServer*)(obj))
43 #define GST_RTSP_SERVER_CLASS_CAST(klass) ((GstRTSPServerClass*)(klass))
44
45 #define GST_RTSP_SERVER_GET_LOCK(server)  (&(GST_RTSP_SERVER_CAST(server)->lock))
46 #define GST_RTSP_SERVER_LOCK(server)      (g_mutex_lock(GST_RTSP_SERVER_GET_LOCK(server)))
47 #define GST_RTSP_SERVER_UNLOCK(server)    (g_mutex_unlock(GST_RTSP_SERVER_GET_LOCK(server)))
48
49 /**
50  * GstRTSPServer:
51  *
52  * This object listens on a port, creates and manages the clients connected to
53  * it.
54  */
55 struct _GstRTSPServer {
56   GObject      parent;
57
58   GMutex       lock;
59
60   /* server information */
61   gchar       *address;
62   gchar       *service;
63   gint         backlog;
64   gint         max_threads;
65
66   GSocket     *socket;
67
68   /* sessions on this server */
69   GstRTSPSessionPool  *session_pool;
70
71   /* mount points for this server */
72   GstRTSPMountPoints *mount_points;
73
74   /* authentication manager */
75   GstRTSPAuth *auth;
76
77   /* the clients that are connected */
78   GList   *clients;
79 };
80
81 /**
82  * GstRTSPServerClass:
83  *
84  * @create_client: Create, configure a new GstRTSPClient
85  *          object that handles the new connection on @socket.
86  * @accept_client: accept a new GstRTSPClient
87  *
88  * The RTSP server class structure
89  */
90 struct _GstRTSPServerClass {
91   GObjectClass  parent_class;
92
93   GThreadPool *pool;
94
95   GstRTSPClient * (*create_client)      (GstRTSPServer *server);
96   gboolean        (*accept_client)      (GstRTSPServer *server, GstRTSPClient *client,
97                                          GSocket *socket, GError **error);
98   /* signals */
99   void            (*client_connected)   (GstRTSPServer *server, GstRTSPClient *client);
100 };
101
102 GType                 gst_rtsp_server_get_type             (void);
103
104 GstRTSPServer *       gst_rtsp_server_new                  (void);
105
106 void                  gst_rtsp_server_set_address          (GstRTSPServer *server, const gchar *address);
107 gchar *               gst_rtsp_server_get_address          (GstRTSPServer *server);
108
109 void                  gst_rtsp_server_set_service          (GstRTSPServer *server, const gchar *service);
110 gchar *               gst_rtsp_server_get_service          (GstRTSPServer *server);
111
112 int                   gst_rtsp_server_get_bound_port       (GstRTSPServer *server);
113
114 void                  gst_rtsp_server_set_backlog          (GstRTSPServer *server, gint backlog);
115 gint                  gst_rtsp_server_get_backlog          (GstRTSPServer *server);
116
117 void                  gst_rtsp_server_set_session_pool     (GstRTSPServer *server, GstRTSPSessionPool *pool);
118 GstRTSPSessionPool *  gst_rtsp_server_get_session_pool     (GstRTSPServer *server);
119
120 void                  gst_rtsp_server_set_mount_points     (GstRTSPServer *server, GstRTSPMountPoints *mounts);
121 GstRTSPMountPoints *  gst_rtsp_server_get_mount_points     (GstRTSPServer *server);
122
123 void                  gst_rtsp_server_set_auth             (GstRTSPServer *server, GstRTSPAuth *auth);
124 GstRTSPAuth *         gst_rtsp_server_get_auth             (GstRTSPServer *server);
125
126 void                  gst_rtsp_server_set_max_threads      (GstRTSPServer *server, gint max_threads);
127 gint                  gst_rtsp_server_get_max_threads      (GstRTSPServer *server);
128
129 gboolean              gst_rtsp_server_transfer_connection  (GstRTSPServer * server, GSocket *socket,
130                                                             const gchar * ip, gint port,
131                                                             const gchar *initial_buffer);
132
133 gboolean              gst_rtsp_server_io_func              (GSocket *socket, GIOCondition condition,
134                                                             GstRTSPServer *server);
135
136 GSocket *             gst_rtsp_server_create_socket        (GstRTSPServer *server,
137                                                             GCancellable  *cancellable,
138                                                             GError **error);
139 GSource *             gst_rtsp_server_create_source        (GstRTSPServer *server,
140                                                             GCancellable * cancellable,
141                                                             GError **error);
142 guint                 gst_rtsp_server_attach               (GstRTSPServer *server,
143                                                             GMainContext *context);
144
145 G_END_DECLS
146
147 #endif /* __GST_RTSP_SERVER_H__ */