rtsp: move network includes where they are needed
[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., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include <gst/gst.h>
21
22 #include "rtsp-session-pool.h"
23 #include "rtsp-media-mapping.h"
24 #include "rtsp-media-factory-uri.h"
25 #include "rtsp-client.h"
26
27 #ifndef __GST_RTSP_SERVER_H__
28 #define __GST_RTSP_SERVER_H__
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_RTSP_SERVER              (gst_rtsp_server_get_type ())
33 #define GST_IS_RTSP_SERVER(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SERVER))
34 #define GST_IS_RTSP_SERVER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SERVER))
35 #define GST_RTSP_SERVER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
36 #define GST_RTSP_SERVER(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServer))
37 #define GST_RTSP_SERVER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
38 #define GST_RTSP_SERVER_CAST(obj)         ((GstRTSPServer*)(obj))
39 #define GST_RTSP_SERVER_CLASS_CAST(klass) ((GstRTSPServerClass*)(klass))
40
41 typedef struct _GstRTSPServer GstRTSPServer;
42 typedef struct _GstRTSPServerClass GstRTSPServerClass;
43
44 struct _GstRTSPServer {
45   GObject       parent;
46
47   /* server information */
48   gchar *address;
49   gchar *service;
50   gint   backlog;
51
52   struct  sockaddr_in server_sin;
53
54   /* socket and channels */
55   GstPollFD    server_sock;
56   GIOChannel  *io_channel;
57   GSource     *io_watch;
58
59   /* sessions on this server */
60   GstRTSPSessionPool  *session_pool;
61
62   /* media mapper for this server */
63   GstRTSPMediaMapping *media_mapping;
64 };
65
66 /**
67  * GstRTSPServerClass:
68  *
69  * @accept_client: Create, configure, accept and return a new GstRTSPClient 
70  *   object that handles the new connection on @channel.
71  *
72  * The RTSP server class structure
73  */
74 struct _GstRTSPServerClass {
75   GObjectClass  parent_class;
76
77   GstRTSPClient * (*accept_client) (GstRTSPServer *server, GIOChannel *channel);
78 };
79
80 GType                 gst_rtsp_server_get_type             (void);
81
82 GstRTSPServer *       gst_rtsp_server_new                  (void);
83
84 void                  gst_rtsp_server_set_address          (GstRTSPServer *server, const gchar *address);
85 gchar *               gst_rtsp_server_get_address          (GstRTSPServer *server);
86
87 void                  gst_rtsp_server_set_service          (GstRTSPServer *server, const gchar *service);
88 gchar *               gst_rtsp_server_get_service          (GstRTSPServer *server);
89
90 void                  gst_rtsp_server_set_backlog          (GstRTSPServer *server, gint backlog);
91 gint                  gst_rtsp_server_get_backlog          (GstRTSPServer *server);
92
93 void                  gst_rtsp_server_set_session_pool     (GstRTSPServer *server, GstRTSPSessionPool *pool);
94 GstRTSPSessionPool *  gst_rtsp_server_get_session_pool     (GstRTSPServer *server);
95
96 void                  gst_rtsp_server_set_media_mapping    (GstRTSPServer *server, GstRTSPMediaMapping *mapping);
97 GstRTSPMediaMapping * gst_rtsp_server_get_media_mapping    (GstRTSPServer *server);
98
99 gboolean              gst_rtsp_server_io_func              (GIOChannel *channel, GIOCondition condition,
100                                                             GstRTSPServer *server);
101
102 GIOChannel *          gst_rtsp_server_get_io_channel       (GstRTSPServer *server);
103 GSource *             gst_rtsp_server_create_watch         (GstRTSPServer *server);
104 guint                 gst_rtsp_server_attach               (GstRTSPServer *server,
105                                                             GMainContext *context);
106
107 G_END_DECLS
108
109 #endif /* __GST_RTSP_SERVER_H__ */