Move the connection code in one place
[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., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <unistd.h>
23 #include <errno.h>
24 #include <string.h>
25 #include <sys/time.h>
26 #include <sys/types.h>
27 #include <netinet/in.h>
28 #include <netdb.h>
29 #include <sys/socket.h>
30 #include <sys/wait.h>
31 #include <fcntl.h>
32 #include <arpa/inet.h>
33
34 #include <gst/gst.h>
35 #include <gst/rtsp/gstrtspconnection.h>
36
37 #ifndef __GST_RTSP_CLIENT_H__
38 #define __GST_RTSP_CLIENT_H__
39
40 #include "rtsp-media.h"
41 #include "rtsp-session-pool.h"
42
43 G_BEGIN_DECLS
44
45 #define GST_TYPE_RTSP_CLIENT              (gst_rtsp_client_get_type ())
46 #define GST_IS_RTSP_CLIENT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_CLIENT))
47 #define GST_IS_RTSP_CLIENT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_CLIENT))
48 #define GST_RTSP_CLIENT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
49 #define GST_RTSP_CLIENT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClient))
50 #define GST_RTSP_CLIENT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
51 #define GST_RTSP_CLIENT_CAST(obj)         ((GstRTSPClient*)(obj))
52 #define GST_RTSP_CLIENT_CLASS_CAST(klass) ((GstRTSPClientClass*)(klass))
53
54 typedef struct _GstRTSPClient GstRTSPClient;
55 typedef struct _GstRTSPClientClass GstRTSPClientClass;
56
57 /**
58  * GstRTSPClient:
59  *
60  * @connection: the connection object handling the client request.
61  * @address: the address of the connection
62  * @media: handle to the media handled by the client.
63  * @pool: handle to the session pool used by the client.
64  * @thread: thread to handle the client connection
65  *
66  * The client structure.
67  */
68 struct _GstRTSPClient {
69   GObject       parent;
70
71   GstRTSPConnection *connection;
72   struct sockaddr_in address;
73
74   GstRTSPMedia *media;
75
76   GstRTSPSessionPool *pool;
77
78   GThread *thread;
79 };
80
81 struct _GstRTSPClientClass {
82   GObjectClass  parent_class;
83 };
84
85 GType                gst_rtsp_client_get_type          (void);
86
87 GstRTSPClient *      gst_rtsp_client_new               (void);
88
89 void                 gst_rtsp_client_set_session_pool  (GstRTSPClient *client, 
90                                                         GstRTSPSessionPool *pool);
91 GstRTSPSessionPool * gst_rtsp_client_get_session_pool  (GstRTSPClient *client);
92
93 gboolean             gst_rtsp_client_accept            (GstRTSPClient *client, 
94                                                         GIOChannel *channel);
95
96 G_END_DECLS
97
98 #endif /* __GST_RTSP_CLIENT_H__ */