1 /*
2  * Copyright (C) 2003-2015 FreeIPMI Core Team
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program 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
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  */
18 
19 #ifndef IPMI_PRIVILEGE_LEVEL_SPEC_H
20 #define IPMI_PRIVILEGE_LEVEL_SPEC_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define IPMI_PRIVILEGE_LEVEL_RESERVED      0x00
27 #define IPMI_PRIVILEGE_LEVEL_HIGHEST_LEVEL 0x00 /* IPMI 2.0 */
28 #define IPMI_PRIVILEGE_LEVEL_UNSPECIFIED   0x00 /* RMCP+ Cipher Suite Priv Config */
29 #define IPMI_PRIVILEGE_LEVEL_CALLBACK      0x01
30 #define IPMI_PRIVILEGE_LEVEL_USER          0x02
31 #define IPMI_PRIVILEGE_LEVEL_OPERATOR      0x03
32 #define IPMI_PRIVILEGE_LEVEL_ADMIN         0x04
33 #define IPMI_PRIVILEGE_LEVEL_OEM           0x05
34 #define IPMI_PRIVILEGE_LEVEL_NO_ACCESS     0x0F
35 
36 #define IPMI_PRIVILEGE_LEVEL_VALID(__privilege_level)       \
37   (((__privilege_level) == IPMI_PRIVILEGE_LEVEL_CALLBACK    \
38     || (__privilege_level) == IPMI_PRIVILEGE_LEVEL_USER     \
39     || (__privilege_level) == IPMI_PRIVILEGE_LEVEL_OPERATOR \
40     || (__privilege_level) == IPMI_PRIVILEGE_LEVEL_ADMIN    \
41     || (__privilege_level) == IPMI_PRIVILEGE_LEVEL_OEM) ? 1 : 0)
42 
43 #define IPMI_1_5_PRIVILEGE_LEVEL_VALID(__privilege_level) \
44   IPMI_PRIVILEGE_LEVEL_VALID (__privilege_level)
45 
46 #define IPMI_2_0_PRIVILEGE_LEVEL_VALID(__privilege_level)     \
47   (((__privilege_level) == IPMI_PRIVILEGE_LEVEL_HIGHEST_LEVEL \
48     || IPMI_PRIVILEGE_LEVEL_VALID (__privilege_level)) ? 1 : 0)
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif /* IPMI_PRIVILEGE_LEVEL_SPEC_H */
55