auth: add authentication object
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-auth.h
1 /* GStreamer
2  * Copyright (C) 2010 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 #ifndef __GST_RTSP_AUTH_H__
23 #define __GST_RTSP_AUTH_H__
24
25 typedef struct _GstRTSPAuth GstRTSPAuth;
26 typedef struct _GstRTSPAuthClass GstRTSPAuthClass;
27
28 #include "rtsp-client.h"
29 #include "rtsp-media-mapping.h"
30 #include "rtsp-session-pool.h"
31
32 G_BEGIN_DECLS
33
34 #define GST_TYPE_RTSP_AUTH              (gst_rtsp_auth_get_type ())
35 #define GST_IS_RTSP_AUTH(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_AUTH))
36 #define GST_IS_RTSP_AUTH_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_AUTH))
37 #define GST_RTSP_AUTH_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_AUTH, GstRTSPAuthClass))
38 #define GST_RTSP_AUTH(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_AUTH, GstRTSPAuth))
39 #define GST_RTSP_AUTH_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_AUTH, GstRTSPAuthClass))
40 #define GST_RTSP_AUTH_CAST(obj)         ((GstRTSPAuth*)(obj))
41 #define GST_RTSP_AUTH_CLASS_CAST(klass) ((GstRTSPAuthClass*)(klass))
42
43 /**
44  * GstRTSPAuth:
45  *
46  * The authentication structure.
47  */
48 struct _GstRTSPAuth {
49   GObject       parent;
50
51   /*< private >*/
52   gchar        *basic;
53   GstRTSPMethod methods;
54 };
55
56 struct _GstRTSPAuthClass {
57   GObjectClass  parent_class;
58
59   gboolean (*check_method) (GstRTSPAuth *auth, GstRTSPMethod method,
60           GstRTSPClient * client, GstRTSPUrl * uri,
61           GstRTSPSession * session, GstRTSPMessage * request);
62 };
63
64 GType               gst_rtsp_auth_get_type          (void);
65
66 GstRTSPAuth *       gst_rtsp_auth_new               (void);
67
68 void                gst_rtsp_auth_set_basic         (GstRTSPAuth *auth, const gchar * basic);
69
70 gboolean            gst_rtsp_auth_check_method      (GstRTSPAuth *auth, GstRTSPMethod method,
71                                                      GstRTSPClient * client, GstRTSPUrl * uri,
72                                                      GstRTSPSession * session, GstRTSPMessage * request);
73
74 /* helpers */
75 gchar *             gst_rtsp_auth_make_basic        (const gchar * user, const gchar * pass);
76
77 G_END_DECLS
78
79 #endif /* __GST_RTSP_AUTH_H__ */