client: remove unused include
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-client.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 #include <gst/gst.h>
21 #include <gst/rtsp/gstrtspconnection.h>
22
23 #ifndef __GST_RTSP_CLIENT_H__
24 #define __GST_RTSP_CLIENT_H__
25
26 G_BEGIN_DECLS
27
28 typedef struct _GstRTSPClient GstRTSPClient;
29 typedef struct _GstRTSPClientClass GstRTSPClientClass;
30 typedef struct _GstRTSPClientState GstRTSPClientState;
31
32 #include "rtsp-media.h"
33 #include "rtsp-mount-points.h"
34 #include "rtsp-session-pool.h"
35 #include "rtsp-session-media.h"
36 #include "rtsp-auth.h"
37 #include "rtsp-sdp.h"
38
39 #define GST_TYPE_RTSP_CLIENT              (gst_rtsp_client_get_type ())
40 #define GST_IS_RTSP_CLIENT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_CLIENT))
41 #define GST_IS_RTSP_CLIENT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_CLIENT))
42 #define GST_RTSP_CLIENT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
43 #define GST_RTSP_CLIENT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClient))
44 #define GST_RTSP_CLIENT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
45 #define GST_RTSP_CLIENT_CAST(obj)         ((GstRTSPClient*)(obj))
46 #define GST_RTSP_CLIENT_CLASS_CAST(klass) ((GstRTSPClientClass*)(klass))
47
48 /**
49  * GstRTSPClientState:
50  * @request: the complete request
51  * @uri: the complete url parsed from @request
52  * @method: the parsed method of @uri
53  * @session: the session, can be NULL
54  * @sessmedia: the session media for the url can be NULL
55  * @factory: the media factory for the url, can be NULL.
56  * @media: the media for the url can be NULL
57  * @stream: the stream for the url can be NULL
58  * @response: the response
59  *
60  * Information passed around containing the client state of a request.
61  */
62 struct _GstRTSPClientState {
63   GstRTSPMessage      *request;
64   GstRTSPUrl          *uri;
65   GstRTSPMethod        method;
66   GstRTSPSession      *session;
67   GstRTSPSessionMedia *sessmedia;
68   GstRTSPMediaFactory *factory;
69   GstRTSPMedia        *media;
70   GstRTSPStream       *stream;
71   GstRTSPMessage      *response;
72 };
73
74 /**
75  * GstRTSPClientSendFunc:
76  * @client: a #GstRTSPClient
77  * @message: a #GstRTSPMessage
78  * @close: close the connection
79  * @user_data: user data when registering the callback
80  *
81  * This callback is called when @client wants to send @message. When @close is
82  * %TRUE, the connection should be closed when the message has been sent.
83  *
84  * Returns: %TRUE on success.
85  */
86 typedef gboolean (*GstRTSPClientSendFunc)      (GstRTSPClient *client,
87                                                 GstRTSPMessage *message,
88                                                 gboolean close,
89                                                 gpointer user_data);
90
91 /**
92  * GstRTSPClient:
93  * @lock: lock protecting the client object
94  * @connection: the connection object handling the client request.
95  * @watch: watch for the connection
96  * @close_seq: sequence number of message with close header
97  * @server_ip: ip address of the server
98  * @is_ipv6: if we are IPv6
99  * @use_client_settings: whether to allow client transport settings for multicast
100  * @send_func: a #GstRTSPClientSendFunc called when an RTSP message needs to be
101  *             sent to the client.
102  * @send_data: user data passed to @send_func
103  * @send_notify: notify called when @send_data is no longer used.
104  * @session_pool: handle to the session pool used by the client.
105  * @mount_points: handle to the mount points used by the client.
106  * @auth: authorization object
107  * @uri: cached uri
108  * @media: cached media
109  * @transports: a list of #GstRTSPStreamTransport using @connection.
110  * @sessions: a list of sessions managed by @connection.
111  *
112  * The client structure.
113  */
114 struct _GstRTSPClient {
115   GObject       parent;
116
117   GMutex             lock;
118   GstRTSPConnection *connection;
119   GstRTSPWatch      *watch;
120   guint              close_seq;
121   gchar             *server_ip;
122   gboolean           is_ipv6;
123   gboolean           use_client_settings;
124
125   GstRTSPClientSendFunc send_func;
126   gpointer              send_data;
127   GDestroyNotify        send_notify;
128
129   GstRTSPSessionPool   *session_pool;
130   GstRTSPMountPoints   *mount_points;
131   GstRTSPAuth          *auth;
132
133   GstRTSPUrl     *uri;
134   GstRTSPMedia   *media;
135
136   GList *transports;
137   GList *sessions;
138 };
139
140 struct _GstRTSPClientClass {
141   GObjectClass  parent_class;
142
143   GstSDPMessage * (*create_sdp) (GstRTSPClient *client, GstRTSPMedia *media);
144
145   /* signals */
146   void     (*closed)                  (GstRTSPClient *client);
147   void     (*new_session)             (GstRTSPClient *client, GstRTSPSession *session);
148   void     (*options_request)         (GstRTSPClient *client, GstRTSPClientState *state);
149   void     (*describe_request)        (GstRTSPClient *client, GstRTSPClientState *state);
150   void     (*setup_request)           (GstRTSPClient *client, GstRTSPClientState *state);
151   void     (*play_request)            (GstRTSPClient *client, GstRTSPClientState *state);
152   void     (*pause_request)           (GstRTSPClient *client, GstRTSPClientState *state);
153   void     (*teardown_request)        (GstRTSPClient *client, GstRTSPClientState *state);
154   void     (*set_parameter_request)   (GstRTSPClient *client, GstRTSPClientState *state);
155   void     (*get_parameter_request)   (GstRTSPClient *client, GstRTSPClientState *state);
156 };
157
158 GType                 gst_rtsp_client_get_type          (void);
159
160 GstRTSPClient *       gst_rtsp_client_new               (void);
161
162 void                  gst_rtsp_client_set_session_pool  (GstRTSPClient *client,
163                                                          GstRTSPSessionPool *pool);
164 GstRTSPSessionPool *  gst_rtsp_client_get_session_pool  (GstRTSPClient *client);
165
166 void                  gst_rtsp_client_set_mount_points  (GstRTSPClient *client,
167                                                          GstRTSPMountPoints *mounts);
168 GstRTSPMountPoints *  gst_rtsp_client_get_mount_points  (GstRTSPClient *client);
169
170 void                  gst_rtsp_client_set_use_client_settings (GstRTSPClient * client,
171                                                                gboolean use_client_settings);
172 gboolean              gst_rtsp_client_get_use_client_settings (GstRTSPClient * client);
173
174 void                  gst_rtsp_client_set_auth          (GstRTSPClient *client, GstRTSPAuth *auth);
175 GstRTSPAuth *         gst_rtsp_client_get_auth          (GstRTSPClient *client);
176
177 void                  gst_rtsp_client_set_send_func     (GstRTSPClient *client,
178                                                          GstRTSPClientSendFunc func,
179                                                          gpointer user_data,
180                                                          GDestroyNotify notify);
181 GstRTSPResult         gst_rtsp_client_handle_message    (GstRTSPClient *client,
182                                                          GstRTSPMessage *message);
183
184 gboolean              gst_rtsp_client_accept            (GstRTSPClient *client,
185                                                          GSocket *socket,
186                                                          GCancellable *cancellable,
187                                                          GError **error);
188
189 gboolean              gst_rtsp_client_use_socket        (GstRTSPClient * client,
190                                                          GSocket *socket,
191                                                          const gchar * ip,
192                                                          gint port,
193                                                          const gchar *initial_buffer,
194                                                          GError **error);
195
196 guint                 gst_rtsp_client_attach            (GstRTSPClient *client,
197                                                          GMainContext *context);
198
199
200 G_END_DECLS
201
202 #endif /* __GST_RTSP_CLIENT_H__ */