net-snmp 5.7
snmp_impl.h
00001 #ifndef SNMP_IMPL_H
00002 #define SNMP_IMPL_H
00003 
00004 #ifdef __cplusplus
00005 extern          "C" {
00006 #endif
00007     /*
00008      * * file: snmp_impl.h
00009      */
00010 
00011     /*
00012      * Definitions for SNMP implementation.
00013      *
00014      *
00015      */
00016 /***********************************************************
00017         Copyright 1988, 1989 by Carnegie Mellon University
00018 
00019                       All Rights Reserved
00020 
00021 Permission to use, copy, modify, and distribute this software and its 
00022 documentation for any purpose and without fee is hereby granted, 
00023 provided that the above copyright notice appear in all copies and that
00024 both that copyright notice and this permission notice appear in 
00025 supporting documentation, and that the name of CMU not be
00026 used in advertising or publicity pertaining to distribution of the
00027 software without specific, written prior permission.  
00028 
00029 CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
00030 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
00031 CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
00032 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
00033 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
00034 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00035 SOFTWARE.
00036 ******************************************************************/
00037 
00038 #include<stdio.h>
00039 #include<net-snmp/types.h>      /* for 'u_char', etc */
00040 
00041 #define COMMUNITY_MAX_LEN       256
00042 
00043     /*
00044      * Space for character representation of an object identifier 
00045      */
00046 #define SPRINT_MAX_LEN          2560
00047 
00048 
00049 #ifndef NULL
00050 #define NULL 0
00051 #endif
00052 
00053 #ifndef TRUE
00054 #define TRUE    1
00055 #endif
00056 #ifndef FALSE
00057 #define FALSE   0
00058 #endif
00059 
00060 #define READ        1
00061 #define WRITE       0
00062 
00063 #define RESERVE1    0
00064 #define RESERVE2    1
00065 #define ACTION      2
00066 #define COMMIT      3
00067 #define FREE        4
00068 #define UNDO        5
00069 #define FINISHED_SUCCESS        9
00070 #define FINISHED_FAILURE        10
00071 
00072     /*
00073      * Access control statements for the agent 
00074      */
00075 #define NETSNMP_OLDAPI_RONLY    0x1     /* read access only */
00076 #define NETSNMP_OLDAPI_RWRITE   0x2     /* read and write access (must have 0x2 bit set) */
00077 #define NETSNMP_OLDAPI_NOACCESS 0x0000  /* no access for anybody */
00078 
00079 #ifndef NETSNMP_NO_LEGACY_DEFINITIONS
00080 #define RONLY           NETSNMP_OLDAPI_RONLY
00081 #define RWRITE          NETSNMP_OLDAPI_RWRITE
00082 #define NOACCESS        NETSNMP_OLDAPI_NOACCESS
00083 #endif
00084 
00085     /*
00086      * defined types (from the SMI, RFC 1157) 
00087      */
00088 #define ASN_IPADDRESS   (ASN_APPLICATION | 0)
00089 #define ASN_COUNTER     (ASN_APPLICATION | 1)
00090 #define ASN_GAUGE       (ASN_APPLICATION | 2)
00091 #define ASN_UNSIGNED    (ASN_APPLICATION | 2)   /* RFC 1902 - same as GAUGE */
00092 #define ASN_TIMETICKS   (ASN_APPLICATION | 3)
00093 #define ASN_OPAQUE      (ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
00094 
00095     /*
00096      * defined types (from the SMI, RFC 1442) 
00097      */
00098 #define ASN_NSAP        (ASN_APPLICATION | 5)   /* historic - don't use */
00099 #define ASN_COUNTER64   (ASN_APPLICATION | 6)
00100 #define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
00101 
00102 #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
00103     /*
00104      * defined types from draft-perkins-opaque-01.txt 
00105      */
00106 #define ASN_FLOAT           (ASN_APPLICATION | 8)
00107 #define ASN_DOUBLE          (ASN_APPLICATION | 9)
00108 #define ASN_INTEGER64        (ASN_APPLICATION | 10)
00109 #define ASN_UNSIGNED64       (ASN_APPLICATION | 11)
00110 #endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
00111 
00112     /*
00113      * changed to ERROR_MSG to eliminate conflict with other includes 
00114      */
00115 #ifndef ERROR_MSG
00116 #define ERROR_MSG(string)       snmp_set_detail(string)
00117 #endif
00118 
00119     /*
00120      * from snmp.c 
00121      */
00122     extern u_char   sid[];      /* size SID_MAX_LEN */
00123     NETSNMP_IMPORT int      snmp_errno;
00124 
00125 
00126     /*
00127      * For calling secauth_build, FIRST_PASS is an indication that a new nonce
00128      * and lastTimeStamp should be recorded.  LAST_PASS is an indication that
00129      * the packet should be checksummed and encrypted if applicable, in
00130      * preparation for transmission.
00131      * 0 means do neither, FIRST_PASS | LAST_PASS means do both.
00132      * For secauth_parse, FIRST_PASS means decrypt the packet, otherwise leave it
00133      * alone.  LAST_PASS is ignored.
00134      */
00135 #define FIRST_PASS      1
00136 #define LAST_PASS       2
00137     u_char         *snmp_comstr_parse(u_char *, size_t *, u_char *,
00138                                       size_t *, long *);
00139     u_char         *snmp_comstr_build(u_char *, size_t *, u_char *,
00140                                       size_t *, long *, size_t);
00141 
00142     int             has_access(u_char, int, int, int);
00143 #ifdef __cplusplus
00144 }
00145 #endif
00146 #endif                          /* SNMP_IMPL_H */