1 #ifndef SNMP_IMPL_H 2 #define SNMP_IMPL_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 /* 8 * * file: snmp_impl.h 9 */ 10 11 /* 12 * Definitions for SNMP implementation. 13 * 14 * 15 */ 16 /*********************************************************** 17 Copyright 1988, 1989 by Carnegie Mellon University 18 19 All Rights Reserved 20 21 Permission to use, copy, modify, and distribute this software and its 22 documentation for any purpose and without fee is hereby granted, 23 provided that the above copyright notice appear in all copies and that 24 both that copyright notice and this permission notice appear in 25 supporting documentation, and that the name of CMU not be 26 used in advertising or publicity pertaining to distribution of the 27 software without specific, written prior permission. 28 29 CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 30 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 31 CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 32 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 33 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 34 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 35 SOFTWARE. 36 ******************************************************************/ 37 38 #include<stdio.h> 39 #include<net-snmp/types.h> /* for 'u_char', etc */ 40 41 #define COMMUNITY_MAX_LEN 256 42 43 /* 44 * Space for character representation of an object identifier 45 */ 46 #define SPRINT_MAX_LEN 2560 47 48 49 #ifndef NULL 50 #define NULL 0 51 #endif 52 53 #ifndef TRUE 54 #define TRUE 1 55 #endif 56 #ifndef FALSE 57 #define FALSE 0 58 #endif 59 60 #define READ 1 61 #define WRITE 0 62 63 #define RESERVE1 0 64 #define RESERVE2 1 65 #define ACTION 2 66 #define COMMIT 3 67 #define FREE 4 68 #define UNDO 5 69 #define FINISHED_SUCCESS 9 70 #define FINISHED_FAILURE 10 71 72 /* 73 * Access control statements for the agent 74 */ 75 #define NETSNMP_OLDAPI_RONLY 0x1 /* read access only */ 76 #define NETSNMP_OLDAPI_RWRITE 0x2 /* read and write access (must have 0x2 bit set) */ 77 #define NETSNMP_OLDAPI_NOACCESS 0x0000 /* no access for anybody */ 78 79 #ifndef NETSNMP_NO_LEGACY_DEFINITIONS 80 #define RONLY NETSNMP_OLDAPI_RONLY 81 #define RWRITE NETSNMP_OLDAPI_RWRITE 82 #define NOACCESS NETSNMP_OLDAPI_NOACCESS 83 #endif 84 85 /* 86 * defined types (from the SMI, RFC 1157) 87 */ 88 #define ASN_IPADDRESS (ASN_APPLICATION | 0) 89 #define ASN_COUNTER (ASN_APPLICATION | 1) 90 #define ASN_GAUGE (ASN_APPLICATION | 2) 91 #define ASN_UNSIGNED (ASN_APPLICATION | 2) /* RFC 1902 - same as GAUGE */ 92 #define ASN_TIMETICKS (ASN_APPLICATION | 3) 93 #define ASN_OPAQUE (ASN_APPLICATION | 4) /* changed so no conflict with other includes */ 94 95 /* 96 * defined types (from the SMI, RFC 1442) 97 */ 98 #define ASN_NSAP (ASN_APPLICATION | 5) /* historic - don't use */ 99 #define ASN_COUNTER64 (ASN_APPLICATION | 6) 100 #define ASN_UINTEGER (ASN_APPLICATION | 7) /* historic - don't use */ 101 102 #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES 103 /* 104 * defined types from draft-perkins-opaque-01.txt 105 */ 106 #define ASN_FLOAT (ASN_APPLICATION | 8) 107 #define ASN_DOUBLE (ASN_APPLICATION | 9) 108 #define ASN_INTEGER64 (ASN_APPLICATION | 10) 109 #define ASN_UNSIGNED64 (ASN_APPLICATION | 11) 110 #endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */ 111 112 /* 113 * changed to ERROR_MSG to eliminate conflict with other includes 114 */ 115 #ifndef ERROR_MSG 116 #define ERROR_MSG(string) snmp_set_detail(string) 117 #endif 118 119 /* 120 * from snmp.c 121 */ 122 extern u_char sid[]; /* size SID_MAX_LEN */ 123 NETSNMP_IMPORT int snmp_errno; 124 125 126 /* 127 * For calling secauth_build, FIRST_PASS is an indication that a new nonce 128 * and lastTimeStamp should be recorded. LAST_PASS is an indication that 129 * the packet should be checksummed and encrypted if applicable, in 130 * preparation for transmission. 131 * 0 means do neither, FIRST_PASS | LAST_PASS means do both. 132 * For secauth_parse, FIRST_PASS means decrypt the packet, otherwise leave it 133 * alone. LAST_PASS is ignored. 134 */ 135 #define FIRST_PASS 1 136 #define LAST_PASS 2 137 u_char *snmp_comstr_parse(u_char *, size_t *, u_char *, 138 size_t *, long *); 139 u_char *snmp_comstr_build(u_char *, size_t *, u_char *, 140 size_t *, long *, size_t); 141 142 int has_access(u_char, int, int, int); 143 #ifdef __cplusplus 144 } 145 #endif 146 #endif /* SNMP_IMPL_H */ 147