snmp_common.h
Go to the documentation of this file.
1 /**
2  * @file snmp_common.h
3  * @brief Definitions common to SNMP agent and SNMP manager
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _SNMP_COMMON_H
30 #define _SNMP_COMMON_H
31 
32 //Dependencies
33 #include "core/net.h"
34 
35 //SNMPv1 support
36 #ifndef SNMP_V1_SUPPORT
37  #define SNMP_V1_SUPPORT ENABLED
38 #elif (SNMP_V1_SUPPORT != ENABLED && SNMP_V1_SUPPORT != DISABLED)
39  #error SNMP_V1_SUPPORT parameter is not valid
40 #endif
41 
42 //SNMPv2c support
43 #ifndef SNMP_V2C_SUPPORT
44  #define SNMP_V2C_SUPPORT ENABLED
45 #elif (SNMP_V2C_SUPPORT != ENABLED && SNMP_V2C_SUPPORT != DISABLED)
46  #error SNMP_V2C_SUPPORT parameter is not valid
47 #endif
48 
49 //SNMPv3 support
50 #ifndef SNMP_V3_SUPPORT
51  #define SNMP_V3_SUPPORT DISABLED
52 #elif (SNMP_V3_SUPPORT != ENABLED && SNMP_V3_SUPPORT != DISABLED)
53  #error SNMP_V3_SUPPORT parameter is not valid
54 #endif
55 
56 //Maximum size of SNMP messages
57 #ifndef SNMP_MAX_MSG_SIZE
58  #define SNMP_MAX_MSG_SIZE 1452
59 #elif (SNMP_MAX_MSG_SIZE < 484 || SNMP_MAX_MSG_SIZE > 65535)
60  #error SNMP_MAX_MSG_SIZE parameter is not valid
61 #endif
62 
63 //Maximum size for context engine identifier
64 #ifndef SNMP_MAX_CONTEXT_ENGINE_SIZE
65  #define SNMP_MAX_CONTEXT_ENGINE_SIZE 32
66 #elif (SNMP_MAX_CONTEXT_ENGINE_SIZE < 1)
67  #error SNMP_MAX_CONTEXT_ENGINE_SIZE parameter is not valid
68 #endif
69 
70 //Maximum length for context name
71 #ifndef SNMP_MAX_CONTEXT_NAME_LEN
72  #define SNMP_MAX_CONTEXT_NAME_LEN 32
73 #elif (SNMP_MAX_CONTEXT_NAME_LEN < 1)
74  #error SNMP_MAX_CONTEXT_NAME_LEN parameter is not valid
75 #endif
76 
77 //Maximum length for user names and community names
78 #ifndef SNMP_MAX_USER_NAME_LEN
79  #define SNMP_MAX_USER_NAME_LEN 32
80 #elif (SNMP_MAX_USER_NAME_LEN < 1)
81  #error SNMP_MAX_USER_NAME_LEN parameter is not valid
82 #endif
83 
84 //Maximum size for user public values
85 #ifndef SNMP_MAX_PUBLIC_VALUE_SIZE
86  #define SNMP_MAX_PUBLIC_VALUE_SIZE 32
87 #elif (SNMP_MAX_PUBLIC_VALUE_SIZE < 1)
88  #error SNMP_MAX_PUBLIC_VALUE_SIZE parameter is not valid
89 #endif
90 
91 //Maximum length for group names
92 #ifndef SNMP_MAX_GROUP_NAME_LEN
93  #define SNMP_MAX_GROUP_NAME_LEN 32
94 #elif (SNMP_MAX_GROUP_NAME_LEN < 1)
95  #error SNMP_MAX_GROUP_NAME_LEN parameter is not valid
96 #endif
97 
98 //Maximum length for view names
99 #ifndef SNMP_MAX_VIEW_NAME_LEN
100  #define SNMP_MAX_VIEW_NAME_LEN 32
101 #elif (SNMP_MAX_VIEW_NAME_LEN < 1)
102  #error SNMP_MAX_VIEW_NAME_LEN parameter is not valid
103 #endif
104 
105 //Maximum length for bit masks
106 #ifndef SNMP_MAX_BIT_MASK_SIZE
107  #define SNMP_MAX_BIT_MASK_SIZE 16
108 #elif (SNMP_MAX_BIT_MASK_SIZE < 1)
109  #error SNMP_MAX_MASK_SIZE parameter is not valid
110 #endif
111 
112 //Maximum size for object identifiers
113 #ifndef SNMP_MAX_OID_SIZE
114  #define SNMP_MAX_OID_SIZE 16
115 #elif (SNMP_MAX_OID_SIZE < 1)
116  #error SNMP_MAX_OID_SIZE parameter is not valid
117 #endif
118 
119 //SNMP port number
120 #define SNMP_PORT 161
121 //SNMP trap port number
122 #define SNMP_TRAP_PORT 162
123 
124 //C++ guard
125 #ifdef __cplusplus
126  extern "C" {
127 #endif
128 
129 
130 /**
131  * @brief SNMP version identifiers
132  **/
133 
134 typedef enum
135 {
139 } SnmpVersion;
140 
141 
142 /**
143  * @brief SNMP PDU types
144  **/
145 
146 typedef enum
147 {
157 } SnmpPduType;
158 
159 
160 /**
161  * @brief SNMP generic trap types
162  **/
163 
164 typedef enum
165 {
174 
175 
176 /**
177  * @brief SNMP error status
178  **/
179 
180 typedef enum
181 {
202 
203 
204 /**
205  * @brief SNMP exceptions
206  **/
207 
208 typedef enum
209 {
213 } SnmpException;
214 
215 
216 /**
217  * @brief SNMP engine ID format
218  **/
219 
220 typedef enum
221 {
228 
229 
230 //C++ guard
231 #ifdef __cplusplus
232  }
233 #endif
234 
235 #endif
SnmpErrorStatus
SNMP error status.
Definition: snmp_common.h:180
TCP/IP stack core.
SnmpException
SNMP exceptions.
Definition: snmp_common.h:208
SnmpVersion
SNMP version identifiers.
Definition: snmp_common.h:134
SnmpEngineIdFormat
SNMP engine ID format.
Definition: snmp_common.h:220
SnmpPduType
SNMP PDU types.
Definition: snmp_common.h:146
SnmpGenericTrapType
SNMP generic trap types.
Definition: snmp_common.h:164