Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
snmp_opts.h
Go to the documentation of this file.
00001 /** 00002 * @file 00003 * SNMP server options list 00004 */ 00005 00006 /* 00007 * Copyright (c) 2015 Dirk Ziegelmeier 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without modification, 00011 * are permitted provided that the following conditions are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. The name of the author may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00024 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00026 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00029 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00030 * OF SUCH DAMAGE. 00031 * 00032 * This file is part of the lwIP TCP/IP stack. 00033 * 00034 * Author: Dirk Ziegelmeier 00035 * 00036 */ 00037 #ifndef LWIP_HDR_SNMP_OPTS_H 00038 #define LWIP_HDR_SNMP_OPTS_H 00039 00040 #include "lwip/opt.h" 00041 00042 /** 00043 * @defgroup snmp_opts Options 00044 * @ingroup snmp 00045 * @{ 00046 */ 00047 00048 /** 00049 * LWIP_SNMP==1: This enables the lwIP SNMP agent. UDP must be available 00050 * for SNMP transport. 00051 * If you want to use your own SNMP agent, leave this disabled. 00052 * To integrate MIB2 of an external agent, you need to enable 00053 * LWIP_MIB2_CALLBACKS and MIB2_STATS. This will give you the callbacks 00054 * and statistics counters you need to get MIB2 working. 00055 */ 00056 #if !defined LWIP_SNMP || defined __DOXYGEN__ 00057 #define LWIP_SNMP 0 00058 #endif 00059 00060 /** 00061 * SNMP_USE_NETCONN: Use netconn API instead of raw API. 00062 * Makes SNMP agent run in a worker thread, so blocking operations 00063 * can be done in MIB calls. 00064 */ 00065 #if !defined SNMP_USE_NETCONN || defined __DOXYGEN__ 00066 #define SNMP_USE_NETCONN 0 00067 #endif 00068 00069 /** 00070 * SNMP_USE_RAW: Use raw API. 00071 * SNMP agent does not run in a worker thread, so blocking operations 00072 * should not be done in MIB calls. 00073 */ 00074 #if !defined SNMP_USE_RAW || defined __DOXYGEN__ 00075 #define SNMP_USE_RAW 1 00076 #endif 00077 00078 #if SNMP_USE_NETCONN && SNMP_USE_RAW 00079 #error SNMP stack can use only one of the APIs {raw, netconn} 00080 #endif 00081 00082 #if LWIP_SNMP && !SNMP_USE_NETCONN && !SNMP_USE_RAW 00083 #error SNMP stack needs a receive API and UDP {raw, netconn} 00084 #endif 00085 00086 #if SNMP_USE_NETCONN 00087 /** 00088 * SNMP_STACK_SIZE: Stack size of SNMP netconn worker thread 00089 */ 00090 #if !defined SNMP_STACK_SIZE || defined __DOXYGEN__ 00091 #define SNMP_STACK_SIZE DEFAULT_THREAD_STACKSIZE 00092 #endif 00093 00094 /** 00095 * SNMP_THREAD_PRIO: SNMP netconn worker thread priority 00096 */ 00097 #if !defined SNMP_THREAD_PRIO || defined __DOXYGEN__ 00098 #define SNMP_THREAD_PRIO DEFAULT_THREAD_PRIO 00099 #endif 00100 #endif /* SNMP_USE_NETCONN */ 00101 00102 /** 00103 * SNMP_TRAP_DESTINATIONS: Number of trap destinations. At least one trap 00104 * destination is required 00105 */ 00106 #if !defined SNMP_TRAP_DESTINATIONS || defined __DOXYGEN__ 00107 #define SNMP_TRAP_DESTINATIONS 1 00108 #endif 00109 00110 /** 00111 * Only allow SNMP write actions that are 'safe' (e.g. disabling netifs is not 00112 * a safe action and disabled when SNMP_SAFE_REQUESTS = 1). 00113 * Unsafe requests are disabled by default! 00114 */ 00115 #if !defined SNMP_SAFE_REQUESTS || defined __DOXYGEN__ 00116 #define SNMP_SAFE_REQUESTS 1 00117 #endif 00118 00119 /** 00120 * The maximum length of strings used. 00121 */ 00122 #if !defined SNMP_MAX_OCTET_STRING_LEN || defined __DOXYGEN__ 00123 #define SNMP_MAX_OCTET_STRING_LEN 127 00124 #endif 00125 00126 /** 00127 * The maximum number of Sub ID's inside an object identifier. 00128 * Indirectly this also limits the maximum depth of SNMP tree. 00129 */ 00130 #if !defined SNMP_MAX_OBJ_ID_LEN || defined __DOXYGEN__ 00131 #define SNMP_MAX_OBJ_ID_LEN 50 00132 #endif 00133 00134 #if !defined SNMP_MAX_VALUE_SIZE || defined __DOXYGEN__ 00135 /** 00136 * The maximum size of a value. 00137 */ 00138 #define SNMP_MIN_VALUE_SIZE (2 * sizeof(u32_t*)) /* size required to store the basic types (8 bytes for counter64) */ 00139 /** 00140 * The minimum size of a value. 00141 */ 00142 #define SNMP_MAX_VALUE_SIZE LWIP_MAX(LWIP_MAX((SNMP_MAX_OCTET_STRING_LEN), sizeof(u32_t)*(SNMP_MAX_OBJ_ID_LEN)), SNMP_MIN_VALUE_SIZE) 00143 #endif 00144 00145 /** 00146 * The snmp read-access community. Used for write-access and traps, too 00147 * unless SNMP_COMMUNITY_WRITE or SNMP_COMMUNITY_TRAP are enabled, respectively. 00148 */ 00149 #if !defined SNMP_COMMUNITY || defined __DOXYGEN__ 00150 #define SNMP_COMMUNITY "public" 00151 #endif 00152 00153 /** 00154 * The snmp write-access community. 00155 * Set this community to "" in order to disallow any write access. 00156 */ 00157 #if !defined SNMP_COMMUNITY_WRITE || defined __DOXYGEN__ 00158 #define SNMP_COMMUNITY_WRITE "private" 00159 #endif 00160 00161 /** 00162 * The snmp community used for sending traps. 00163 */ 00164 #if !defined SNMP_COMMUNITY_TRAP || defined __DOXYGEN__ 00165 #define SNMP_COMMUNITY_TRAP "public" 00166 #endif 00167 00168 /** 00169 * The maximum length of community string. 00170 * If community names shall be adjusted at runtime via snmp_set_community() calls, 00171 * enter here the possible maximum length (+1 for terminating null character). 00172 */ 00173 #if !defined SNMP_MAX_COMMUNITY_STR_LEN || defined __DOXYGEN__ 00174 #define SNMP_MAX_COMMUNITY_STR_LEN LWIP_MAX(LWIP_MAX(sizeof(SNMP_COMMUNITY), sizeof(SNMP_COMMUNITY_WRITE)), sizeof(SNMP_COMMUNITY_TRAP)) 00175 #endif 00176 00177 /** 00178 * The OID identifiying the device. This may be the enterprise OID itself or any OID located below it in tree. 00179 */ 00180 #if !defined SNMP_DEVICE_ENTERPRISE_OID || defined __DOXYGEN__ 00181 #define SNMP_LWIP_ENTERPRISE_OID 26381 00182 /** 00183 * IANA assigned enterprise ID for lwIP is 26381 00184 * @see http://www.iana.org/assignments/enterprise-numbers 00185 * 00186 * @note this enterprise ID is assigned to the lwIP project, 00187 * all object identifiers living under this ID are assigned 00188 * by the lwIP maintainers! 00189 * @note don't change this define, use snmp_set_device_enterprise_oid() 00190 * 00191 * If you need to create your own private MIB you'll need 00192 * to apply for your own enterprise ID with IANA: 00193 * http://www.iana.org/numbers.html 00194 */ 00195 #define SNMP_DEVICE_ENTERPRISE_OID {1, 3, 6, 1, 4, 1, SNMP_LWIP_ENTERPRISE_OID} 00196 /** 00197 * Length of SNMP_DEVICE_ENTERPRISE_OID 00198 */ 00199 #define SNMP_DEVICE_ENTERPRISE_OID_LEN 7 00200 #endif 00201 00202 /** 00203 * SNMP_DEBUG: Enable debugging for SNMP messages. 00204 */ 00205 #if !defined SNMP_DEBUG || defined __DOXYGEN__ 00206 #define SNMP_DEBUG LWIP_DBG_OFF 00207 #endif 00208 00209 /** 00210 * SNMP_MIB_DEBUG: Enable debugging for SNMP MIBs. 00211 */ 00212 #if !defined SNMP_MIB_DEBUG || defined __DOXYGEN__ 00213 #define SNMP_MIB_DEBUG LWIP_DBG_OFF 00214 #endif 00215 00216 /** 00217 * Indicates if the MIB2 implementation of LWIP SNMP stack is used. 00218 */ 00219 #if !defined SNMP_LWIP_MIB2 || defined __DOXYGEN__ 00220 #define SNMP_LWIP_MIB2 LWIP_SNMP 00221 #endif 00222 00223 /** 00224 * Value return for sysDesc field of MIB2. 00225 */ 00226 #if !defined SNMP_LWIP_MIB2_SYSDESC || defined __DOXYGEN__ 00227 #define SNMP_LWIP_MIB2_SYSDESC "lwIP" 00228 #endif 00229 00230 /** 00231 * Value return for sysName field of MIB2. 00232 * To make sysName field settable, call snmp_mib2_set_sysname() to provide the necessary buffers. 00233 */ 00234 #if !defined SNMP_LWIP_MIB2_SYSNAME || defined __DOXYGEN__ 00235 #define SNMP_LWIP_MIB2_SYSNAME "FQDN-unk" 00236 #endif 00237 00238 /** 00239 * Value return for sysContact field of MIB2. 00240 * To make sysContact field settable, call snmp_mib2_set_syscontact() to provide the necessary buffers. 00241 */ 00242 #if !defined SNMP_LWIP_MIB2_SYSCONTACT || defined __DOXYGEN__ 00243 #define SNMP_LWIP_MIB2_SYSCONTACT "" 00244 #endif 00245 00246 /** 00247 * Value return for sysLocation field of MIB2. 00248 * To make sysLocation field settable, call snmp_mib2_set_syslocation() to provide the necessary buffers. 00249 */ 00250 #if !defined SNMP_LWIP_MIB2_SYSLOCATION || defined __DOXYGEN__ 00251 #define SNMP_LWIP_MIB2_SYSLOCATION "" 00252 #endif 00253 00254 /** 00255 * This value is used to limit the repetitions processed in GetBulk requests (value == 0 means no limitation). 00256 * This may be useful to limit the load for a single request. 00257 * According to SNMP RFC 1905 it is allowed to not return all requested variables from a GetBulk request if system load would be too high. 00258 * so the effect is that the client will do more requests to gather all data. 00259 * For the stack this could be useful in case that SNMP processing is done in TCP/IP thread. In this situation a request with many 00260 * repetitions could block the thread for a longer time. Setting limit here will keep the stack more responsive. 00261 */ 00262 #if !defined SNMP_LWIP_GETBULK_MAX_REPETITIONS || defined __DOXYGEN__ 00263 #define SNMP_LWIP_GETBULK_MAX_REPETITIONS 0 00264 #endif 00265 00266 /** 00267 * @} 00268 */ 00269 00270 /* 00271 ------------------------------------ 00272 ---------- SNMPv3 options ---------- 00273 ------------------------------------ 00274 */ 00275 00276 /** 00277 * LWIP_SNMP_V3==1: This enables EXPERIMENTAL SNMPv3 support. LWIP_SNMP must 00278 * also be enabled. 00279 * THIS IS UNDER DEVELOPMENT AND SHOULD NOT BE ENABLED IN PRODUCTS. 00280 */ 00281 #ifndef LWIP_SNMP_V3 00282 #define LWIP_SNMP_V3 0 00283 #endif 00284 00285 #ifndef LWIP_SNMP_V3_CRYPTO 00286 #define LWIP_SNMP_V3_CRYPTO LWIP_SNMP_V3 00287 #endif 00288 00289 #ifndef LWIP_SNMP_V3_MBEDTLS 00290 #define LWIP_SNMP_V3_MBEDTLS LWIP_SNMP_V3 00291 #endif 00292 00293 #endif /* LWIP_HDR_SNMP_OPTS_H */
Generated on Sun Jul 17 2022 08:25:30 by 1.7.2