Adding signature checking
[platform/core/system/tizen-platform-wrapper.git] / src / foreign.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 FOREIGN_H
25 #define FOREIGN_H
26
27 #define _FOREIGN_MASK_HOME_    1
28 #define _FOREIGN_MASK_UID_     2
29 #define _FOREIGN_MASK_USER_    4
30 #define _FOREIGN_MASK_GID_     8
31 #define _FOREIGN_MASK_EHOME_  16
32 #define _FOREIGN_MASK_EUID_   32
33 #define _FOREIGN_MASK_EUSER_  64
34
35 #define _FOREIGNS_TO_USE_   ( _FOREIGN_MASK_HOME_  \
36                             | _FOREIGN_MASK_USER_  )
37
38 #define _FOREIGN_HAS_(x)  (0 != ((_FOREIGNS_TO_USE_) & (_FOREIGN_MASK_##x##_)))
39
40 enum fkey {
41     _FOREIGN_INVALID_ = -1, 
42 #if _FOREIGN_HAS_(HOME)
43     HOME,
44 #endif
45 #if _FOREIGN_HAS_(UID)
46     UID, 
47 #endif
48 #if _FOREIGN_HAS_(USER)
49     USER,
50 #endif
51 #if _FOREIGN_HAS_(GID)
52     GID, 
53 #endif
54 #if _FOREIGN_HAS_(EHOME)
55     EHOME, 
56 #endif
57 #if _FOREIGN_HAS_(EUID)
58     EUID, 
59 #endif
60 #if _FOREIGN_HAS_(EUSER)
61     EUSER,
62 #endif
63     _FOREIGN_COUNT_
64 };
65
66 /* get the foreign key for the 'name' of 'length' */
67 enum fkey foreign( const char *name, size_t length);
68
69 #endif
70