Initial release including wifi display based on gst-rtsp-server-1.4.1
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-permissions.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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #include <gst/gst.h>
21
22 #ifndef __GST_RTSP_PERMISSIONS_H__
23 #define __GST_RTSP_PERMISSIONS_H__
24
25 typedef struct _GstRTSPPermissions GstRTSPPermissions;
26
27 G_BEGIN_DECLS
28
29 GType gst_rtsp_permissions_get_type (void);
30
31 #define GST_TYPE_RTSP_PERMISSIONS        (gst_rtsp_permissions_get_type ())
32 #define GST_IS_RTSP_PERMISSIONS(obj)     (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_RTSP_PERMISSIONS))
33 #define GST_RTSP_PERMISSIONS_CAST(obj)   ((GstRTSPPermissions*)(obj))
34 #define GST_RTSP_PERMISSIONS(obj)        (GST_RTSP_PERMISSIONS_CAST(obj))
35
36 /**
37  * GstRTSPPermissions:
38  *
39  * The opaque permissions structure. It is used to define the permissions
40  * of objects in different roles.
41  */
42 struct _GstRTSPPermissions {
43   GstMiniObject mini_object;
44 };
45
46 /* refcounting */
47 /**
48  * gst_rtsp_permissions_ref:
49  * @permissions: The permissions to refcount
50  *
51  * Increase the refcount of this permissions.
52  *
53  * Returns: (transfer full): @permissions (for convenience when doing assignments)
54  */
55 #ifdef _FOOL_GTK_DOC_
56 G_INLINE_FUNC GstRTSPPermissions * gst_rtsp_permissions_ref (GstRTSPPermissions * permissions);
57 #endif
58
59 static inline GstRTSPPermissions *
60 gst_rtsp_permissions_ref (GstRTSPPermissions * permissions)
61 {
62   return (GstRTSPPermissions *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (permissions));
63 }
64
65 /**
66  * gst_rtsp_permissions_unref:
67  * @permissions: (transfer full): the permissions to refcount
68  *
69  * Decrease the refcount of an permissions, freeing it if the refcount reaches 0.
70  */
71 #ifdef _FOOL_GTK_DOC_
72 G_INLINE_FUNC void gst_rtsp_permissions_unref (GstRTSPPermissions * permissions);
73 #endif
74
75 static inline void
76 gst_rtsp_permissions_unref (GstRTSPPermissions * permissions)
77 {
78   gst_mini_object_unref (GST_MINI_OBJECT_CAST (permissions));
79 }
80
81
82 GstRTSPPermissions *  gst_rtsp_permissions_new             (void);
83
84 void                  gst_rtsp_permissions_add_role        (GstRTSPPermissions *permissions,
85                                                             const gchar *role,
86                                                             const gchar *fieldname, ...);
87 void                  gst_rtsp_permissions_add_role_valist (GstRTSPPermissions *permissions,
88                                                             const gchar *role,
89                                                             const gchar *fieldname,
90                                                             va_list var_args);
91 void                  gst_rtsp_permissions_remove_role     (GstRTSPPermissions *permissions,
92                                                             const gchar *role);
93 const GstStructure *  gst_rtsp_permissions_get_role        (GstRTSPPermissions *permissions,
94                                                             const gchar *role);
95
96 gboolean              gst_rtsp_permissions_is_allowed      (GstRTSPPermissions *permissions,
97                                                             const gchar *role, const gchar *permission);
98
99 G_END_DECLS
100
101 #endif /* __GST_RTSP_PERMISSIONS_H__ */