client: remove reference to server
[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-server.h"
33 #include "rtsp-media.h"
34 #include "rtsp-mount-points.h"
35 #include "rtsp-session-pool.h"
36 #include "rtsp-session-media.h"
37 #include "rtsp-auth.h"
38 #include "rtsp-sdp.h"
39
40 #define GST_TYPE_RTSP_CLIENT              (gst_rtsp_client_get_type ())
41 #define GST_IS_RTSP_CLIENT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_CLIENT))
42 #define GST_IS_RTSP_CLIENT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_CLIENT))
43 #define GST_RTSP_CLIENT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
44 #define GST_RTSP_CLIENT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClient))
45 #define GST_RTSP_CLIENT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
46 #define GST_RTSP_CLIENT_CAST(obj)         ((GstRTSPClient*)(obj))
47 #define GST_RTSP_CLIENT_CLASS_CAST(klass) ((GstRTSPClientClass*)(klass))
48
49 /**
50  * GstRTSPClientState:
51  * @request: the complete request
52  * @uri: the complete url parsed from @request
53  * @method: the parsed method of @uri
54  * @session: the session, can be NULL
55  * @sessmedia: the session media for the url can be NULL
56  * @factory: the media factory for the url, can be NULL.
57  * @media: the media for the url can be NULL
58  * @stream: the stream for the url can be NULL
59  * @response: the response
60  *
61  * Information passed around containing the client state of a request.
62  */
63 struct _GstRTSPClientState {
64   GstRTSPMessage      *request;
65   GstRTSPUrl          *uri;
66   GstRTSPMethod        method;
67   GstRTSPSession      *session;
68   GstRTSPSessionMedia *sessmedia;
69   GstRTSPMediaFactory *factory;
70   GstRTSPMedia        *media;
71   GstRTSPStream       *stream;
72   GstRTSPMessage      *response;
73 };
74
75 /**
76  * GstRTSPClient:
77  * @lock: lock protecting the client object
78  * @connection: the connection object handling the client request.
79  * @watch: watch for the connection
80  * @close_response_seq: sequence number of message with close header
81  * @server_ip: ip address of the server
82  * @is_ipv6: if we are IPv6
83  * @use_client_settings: whether to allow client transport settings for multicast
84  * @session_pool: handle to the session pool used by the client.
85  * @mount_points: handle to the mount points used by the client.
86  * @auth: authorization object
87  * @uri: cached uri
88  * @media: cached media
89  * @transports: a list of #GstRTSPStreamTransport using @connection.
90  * @sessions: a list of sessions managed by @connection.
91  *
92  * The client structure.
93  */
94 struct _GstRTSPClient {
95   GObject       parent;
96
97   GMutex             lock;
98   GstRTSPConnection *connection;
99   GstRTSPWatch      *watch;
100   guint              close_response_seq;
101   gchar             *server_ip;
102   gboolean           is_ipv6;
103   gboolean           use_client_settings;
104
105   GstRTSPSessionPool   *session_pool;
106   GstRTSPMountPoints   *mount_points;
107   GstRTSPAuth          *auth;
108
109   GstRTSPUrl     *uri;
110   GstRTSPMedia   *media;
111
112   GList *transports;
113   GList *sessions;
114 };
115
116 struct _GstRTSPClientClass {
117   GObjectClass  parent_class;
118
119   GstSDPMessage * (*create_sdp) (GstRTSPClient *client, GstRTSPMedia *media);
120
121   /* signals */
122   void     (*closed)                  (GstRTSPClient *client);
123   void     (*new_session)             (GstRTSPClient *client, GstRTSPSession *session);
124   void     (*options_request)         (GstRTSPClient *client, GstRTSPClientState *state);
125   void     (*describe_request)        (GstRTSPClient *client, GstRTSPClientState *state);
126   void     (*setup_request)           (GstRTSPClient *client, GstRTSPClientState *state);
127   void     (*play_request)            (GstRTSPClient *client, GstRTSPClientState *state);
128   void     (*pause_request)           (GstRTSPClient *client, GstRTSPClientState *state);
129   void     (*teardown_request)        (GstRTSPClient *client, GstRTSPClientState *state);
130   void     (*set_parameter_request)   (GstRTSPClient *client, GstRTSPClientState *state);
131   void     (*get_parameter_request)   (GstRTSPClient *client, GstRTSPClientState *state);
132 };
133
134 GType                 gst_rtsp_client_get_type          (void);
135
136 GstRTSPClient *       gst_rtsp_client_new               (void);
137
138 void                  gst_rtsp_client_set_session_pool  (GstRTSPClient *client,
139                                                          GstRTSPSessionPool *pool);
140 GstRTSPSessionPool *  gst_rtsp_client_get_session_pool  (GstRTSPClient *client);
141
142 void                  gst_rtsp_client_set_mount_points  (GstRTSPClient *client,
143                                                          GstRTSPMountPoints *mounts);
144 GstRTSPMountPoints *  gst_rtsp_client_get_mount_points  (GstRTSPClient *client);
145
146 void                  gst_rtsp_client_set_use_client_settings (GstRTSPClient * client,
147                                                                gboolean use_client_settings);
148 gboolean              gst_rtsp_client_get_use_client_settings (GstRTSPClient * client);
149
150 void                  gst_rtsp_client_set_auth          (GstRTSPClient *client, GstRTSPAuth *auth);
151 GstRTSPAuth *         gst_rtsp_client_get_auth          (GstRTSPClient *client);
152
153
154 gboolean              gst_rtsp_client_accept            (GstRTSPClient *client,
155                                                          GSocket *socket,
156                                                          GCancellable *cancellable,
157                                                          GError **error);
158
159 gboolean              gst_rtsp_client_use_socket        (GstRTSPClient * client,
160                                                          GSocket *socket,
161                                                          const gchar * ip,
162                                                          gint port,
163                                                          const gchar *initial_buffer,
164                                                          GError **error);
165
166 guint                 gst_rtsp_client_attach            (GstRTSPClient *client,
167                                                          GMainContext *context);
168
169
170 G_END_DECLS
171
172 #endif /* __GST_RTSP_CLIENT_H__ */