Adding signature checking
[platform/core/system/tizen-platform-wrapper.git] / src / context.h
1 /*
2  * Copyright (C) 2013-2014 Intel Corporation.
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 Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * Authors:
19  *   José Bollo <jose.bollo@open.eurogiciel.org>
20  *   Stéphane Desneux <stephane.desneux@open.eurogiciel.org>
21  *   Jean-Benoit Martin <jean-benoit.martin@open.eurogiciel.org>
22  *
23  */
24 #ifndef CONTEXT_H
25 #define CONTEXT_H
26
27 #ifndef HEAP_H
28 #error "you should include heap.h"
29 #endif
30
31 #ifndef FOREIGN_H
32 #error "you should include foreign.h"
33 #endif
34
35 enum STATE { RESET=0, ERROR, VALID };
36
37 #define _USER_NOT_SET_  ((uid_t)-1)
38
39 struct tzplatform_context {
40 #ifndef NOT_MULTI_THREAD_SAFE
41     pthread_mutex_t mutex;
42 #endif
43     enum STATE state;
44     uid_t user;
45     struct heap heap;
46     const char *values[_TZPLATFORM_VARIABLES_COUNT_];
47 };
48
49 inline uid_t get_uid(struct tzplatform_context *context);
50
51 #if _FOREIGN_HAS_(EUID)
52 inline uid_t get_euid(struct tzplatform_context *context);
53 #endif
54
55 #if _FOREIGN_HAS_(GID)
56 inline gid_t get_gid(struct tzplatform_context *context);
57 #endif
58
59 #endif
60