00001 #ifndef NET_SNMP_TYPES_H 00002 #define NET_SNMP_TYPES_H 00003 00008 #include <stdio.h> 00009 00010 #ifndef NET_SNMP_CONFIG_H 00011 #error "Please include <net-snmp/net-snmp-config.h> before this file" 00012 #endif 00013 00014 /* 00015 * For 'timeval' 00016 */ 00017 #if TIME_WITH_SYS_TIME 00018 # ifdef WIN32 00019 # include <sys/timeb.h> 00020 # else 00021 # include <sys/time.h> 00022 # endif 00023 # include <time.h> 00024 #else 00025 # if HAVE_SYS_TIME_H 00026 # include <sys/time.h> 00027 # else 00028 # include <time.h> 00029 # endif 00030 #endif 00031 00032 #ifdef HAVE_INTTYPES_H 00033 #include <inttypes.h> 00034 #endif 00035 #include <sys/types.h> 00036 #ifdef HAVE_WINSOCK_H 00037 #include <winsock.h> 00038 #endif 00039 00040 #if HAVE_NETINET_IN_H 00041 #include <netinet/in.h> /* For definition of in_addr_t */ 00042 #endif 00043 00044 #ifdef __cplusplus 00045 extern "C" { 00046 #endif 00047 00048 #ifndef MAX_SUBID /* temporary - duplicate definition protection */ 00049 #ifndef EIGHTBIT_SUBIDS 00050 typedef u_long oid; 00051 #define MAX_SUBID 0xFFFFFFFF 00052 #else 00053 typedef u_char oid; 00054 #define MAX_SUBID 0xFF 00055 #endif 00056 #endif 00057 00058 #ifndef HAVE_SOCKLEN_T 00059 typedef u_int socklen_t; 00060 #endif 00061 00062 #ifndef HAVE_IN_ADDR_T 00063 typedef u_int in_addr_t; 00064 #endif 00065 00066 #ifndef HAVE_SSIZE_T 00067 #if defined(__INT_MAX__) && __INT_MAX__ == 2147483647 00068 typedef int ssize_t; 00069 #else 00070 typedef long ssize_t; 00071 #endif 00072 #endif 00073 00074 #ifndef HAVE_NFDS_T 00075 typedef unsigned long int nfds_t; 00076 #endif 00077 00078 /* 00079 * For the initial release, this will just refer to the 00080 * relevant UCD header files. 00081 * In due course, the types and structures relevant to the 00082 * Net-SNMP API will be identified, and defined here directly. 00083 * 00084 * But for the time being, this header file is primarily a placeholder, 00085 * to allow application writers to adopt the new header file names. 00086 */ 00087 00088 typedef union { 00089 long *integer; 00090 u_char *string; 00091 oid *objid; 00092 u_char *bitstring; 00093 struct counter64 *counter64; 00094 #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES 00095 float *floatVal; 00096 double *doubleVal; 00097 /* 00098 * t_union *unionVal; 00099 */ 00100 #endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */ 00101 } netsnmp_vardata; 00102 00103 00104 #define MAX_OID_LEN 128 /* max subid's in an oid */ 00105 00112 typedef struct variable_list { 00114 struct variable_list *next_variable; 00116 oid *name; 00118 size_t name_length; 00120 u_char type; 00122 netsnmp_vardata val; 00124 size_t val_len; 00126 oid name_loc[MAX_OID_LEN]; 00128 u_char buf[40]; 00130 void *data; 00132 void (*dataFreeHook)(void *); 00133 int index; 00134 } netsnmp_variable_list; 00135 00136 00142 typedef struct snmp_pdu { 00143 00144 #define non_repeaters errstat 00145 #define max_repetitions errindex 00146 00147 /* 00148 * Protocol-version independent fields 00149 */ 00151 long version; 00153 int command; 00155 long reqid; 00157 long msgid; 00159 long transid; 00161 long sessid; 00163 long errstat; 00165 long errindex; 00167 u_long time; 00168 u_long flags; 00169 00170 int securityModel; 00172 int securityLevel; 00173 int msgParseModel; 00174 00180 void *transport_data; 00181 int transport_data_length; 00182 00187 const oid *tDomain; 00188 size_t tDomainLen; 00189 00190 netsnmp_variable_list *variables; 00191 00192 00193 /* 00194 * SNMPv1 & SNMPv2c fields 00195 */ 00197 u_char *community; 00199 size_t community_len; 00200 00201 /* 00202 * Trap information 00203 */ 00205 oid *enterprise; 00206 size_t enterprise_length; 00208 long trap_type; 00210 long specific_type; 00212 unsigned char agent_addr[4]; 00213 00214 /* 00215 * SNMPv3 fields 00216 */ 00218 u_char *contextEngineID; 00220 size_t contextEngineIDLen; 00222 char *contextName; 00224 size_t contextNameLen; 00226 u_char *securityEngineID; 00228 size_t securityEngineIDLen; 00230 char *securityName; 00232 size_t securityNameLen; 00233 00234 /* 00235 * AgentX fields 00236 * (also uses SNMPv1 community field) 00237 */ 00238 int priority; 00239 int range_subid; 00240 00241 void *securityStateRef; 00242 } netsnmp_pdu; 00243 00244 00247 struct snmp_session; 00248 typedef struct snmp_session netsnmp_session; 00249 00250 #define USM_AUTH_KU_LEN 32 00251 #define USM_PRIV_KU_LEN 32 00252 00253 typedef int (*snmp_callback) (int, netsnmp_session *, int, 00254 netsnmp_pdu *, void *); 00255 typedef int (*netsnmp_callback) (int, netsnmp_session *, int, 00256 netsnmp_pdu *, void *); 00260 struct snmp_session { 00261 /* 00262 * Protocol-version independent fields 00263 */ 00265 long version; 00267 int retries; 00269 long timeout; 00270 u_long flags; 00271 struct snmp_session *subsession; 00272 struct snmp_session *next; 00273 00275 char *peername; 00277 u_short remote_port; 00279 char *localname; 00281 u_short local_port; 00285 u_char *(*authenticator) (u_char *, size_t *, u_char *, size_t); 00287 netsnmp_callback callback; 00291 void *callback_magic; 00293 int s_errno; 00295 int s_snmp_errno; 00297 long sessid; 00298 00299 /* 00300 * SNMPv1 & SNMPv2c fields 00301 */ 00303 u_char *community; 00305 size_t community_len; 00307 size_t rcvMsgMaxSize; 00309 size_t sndMsgMaxSize; 00310 00311 /* 00312 * SNMPv3 fields 00313 */ 00315 u_char isAuthoritative; 00317 u_char *contextEngineID; 00319 size_t contextEngineIDLen; 00321 u_int engineBoots; 00323 u_int engineTime; 00325 char *contextName; 00327 size_t contextNameLen; 00329 u_char *securityEngineID; 00331 size_t securityEngineIDLen; 00333 char *securityName; 00335 size_t securityNameLen; 00336 00338 oid *securityAuthProto; 00340 size_t securityAuthProtoLen; 00342 u_char securityAuthKey[USM_AUTH_KU_LEN]; 00344 size_t securityAuthKeyLen; 00346 u_char *securityAuthLocalKey; 00348 size_t securityAuthLocalKeyLen; 00349 00351 oid *securityPrivProto; 00353 size_t securityPrivProtoLen; 00355 u_char securityPrivKey[USM_PRIV_KU_LEN]; 00357 size_t securityPrivKeyLen; 00359 u_char *securityPrivLocalKey; 00361 size_t securityPrivLocalKeyLen; 00362 00364 int securityModel; 00366 int securityLevel; 00368 char *paramName; 00369 00373 void *securityInfo; 00374 00381 void *myvoid; 00382 }; 00383 00384 00385 #include <net-snmp/library/types.h> 00386 #include <net-snmp/definitions.h> 00387 #include <net-snmp/library/snmp_api.h> 00388 00389 #ifdef __cplusplus 00390 } 00391 #endif 00392 00393 #endif /* NET_SNMP_TYPES_H */
1.5.7.1
Last modified: Tuesday, 23-Dec-2025 17:22:04 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.