net-snmp 5.7
libsnmp.h
00001 #ifndef _LIBSNMP_H_
00002 #define _LIBSNMP_H_
00003 
00004 #ifdef __cplusplus
00005 extern          "C" {
00006 #endif
00007 
00008     /*
00009      * Definitions for the Simple Network Management Protocol (RFC 1067).
00010      *
00011      */
00012 /**********************************************************************
00013  *
00014  *           Copyright 1998 by Carnegie Mellon University
00015  * 
00016  *                       All Rights Reserved
00017  * 
00018  * Permission to use, copy, modify, and distribute this software and its
00019  * documentation for any purpose and without fee is hereby granted,
00020  * provided that the above copyright notice appear in all copies and that
00021  * both that copyright notice and this permission notice appear in
00022  * supporting documentation, and that the name of CMU not be
00023  * used in advertising or publicity pertaining to distribution of the
00024  * software without specific, written prior permission.
00025  * 
00026  * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
00027  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
00028  * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
00029  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
00030  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
00031  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00032  * SOFTWARE.
00033  * 
00034  * $Id$
00035  * 
00036  **********************************************************************/
00037 
00038 #include <ucd-snmp/ucd-snmp-config.h>
00039 
00040 #if HAVE_STDLIB_H
00041 #include <stdlib.h>
00042 #endif
00043 #if HAVE_UNISTD_H
00044 #include <unistd.h>
00045 #endif
00046 #if HAVE_STRING_H
00047 #include <string.h>
00048 #else
00049 #include <strings.h>
00050 #endif
00051 #include <sys/types.h>
00052 #if HAVE_NETINET_IN_H
00053 #include <netinet/in.h>
00054 #endif
00055 #if TIME_WITH_SYS_TIME
00056 # include <sys/time.h>
00057 # include <time.h>
00058 #else
00059 # if HAVE_SYS_TIME_H
00060 #  include <sys/time.h>
00061 # else
00062 #  include <time.h>
00063 # endif
00064 #endif
00065 #if HAVE_SYS_SELECT_H
00066 #include <sys/select.h>
00067 #endif
00068 #include <stdio.h>
00069 #include <ctype.h>
00070 #if HAVE_NETDB_H
00071 #include <netdb.h>
00072 #endif
00073 #if HAVE_ARPA_INET_H
00074 #include <arpa/inet.h>
00075 #endif
00076 
00077 #ifdef UCD_SNMP_LIBRARY
00078 
00079 #include <ucd-snmp/asn1.h>
00080 #include <ucd-snmp/snmp_api.h>
00081 #include <ucd-snmp/snmp_impl.h>
00082 #include <ucd-snmp/snmp_client.h>
00083 #include <ucd-snmp/mib.h>
00084 #include <ucd-snmp/parse.h>
00085 #include <ucd-snmp/snmp.h>
00086 #include <ucd-snmp/system.h>
00087 #include <ucd-snmp/int64.h>
00088 #include <ucd-snmp/version.h>
00089 
00090 #define Version version         /* netsnmp_session member */
00091 
00092 #define SMI_NOSUCHOBJECT      SNMP_NOSUCHOBJECT
00093 #define SMI_NOSUCHINSTANCE    SNMP_NOSUCHINSTANCE
00094 #define SMI_ENDOFMIBVIEW      SNMP_ENDOFMIBVIEW
00095 
00096 
00097 #else                           /* !UCD_SNMP_LIBRARY */
00098 
00099 #include <sys/types.h>
00100 #ifndef WIN32
00101 #include <netinet/in.h>
00102 #endif
00103 
00104 #include <snmp/asn1.h>
00105 #include <snmp/snmp_error.h>
00106 #include <snmp/mibii.h>
00107 #include <snmp/snmp_extra.h>
00108 #include <snmp/snmp_dump.h>
00109 
00110 #include <snmp/snmp_session.h>
00111 
00112 #include <snmp/snmp_vars.h>
00113 #include <snmp/snmp_pdu.h>
00114 #include <snmp/snmp_msg.h>
00115 
00116 #include <snmp/snmp_coexist.h>
00117 #include <snmp/version.h>
00118 #include <snmp/snmp_api_error.h>
00119 #include <snmp/mini-client.h>
00120 
00121 #include <snmp/snmp_impl.h>
00122 #include <snmp/snmp_api.h>
00123 #include <snmp/snmp_client.h>
00124 #include <snmp/snmp-internal.h>
00125 #include <snmp/mib.h>
00126 #include <snmp/parse.h>
00127 #include <snmp/snmp_compat.h>
00128 
00129     /*
00130      * Load UC-Davis differential 
00131      */
00132 
00133 #define SNMP_MSG_GET GET_REQ_MSG
00134 #define SNMP_MSG_GETNEXT GETNEXT_REQ_MSG
00135 #define SNMP_MSG_RESPONSE GET_RSP_MSG
00136 #ifndef NETSNMP_NO_WRITE_SUPPORT
00137 #define SNMP_MSG_SET SET_REQ_MSG
00138 #endif /* !NETSNMP_NO_WRITE_SUPPORT */
00139 #define SNMP_MSG_TRAP TRP_REQ_MSG
00140 #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5)
00141 #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6)
00142 #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7)
00143 #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8)
00144 #define SNMP_NOSUCHOBJECT    SMI_NOSUCHOBJECT
00145 #define SNMP_NOSUCHINSTANCE  SMI_NOSUCHINSTANCE
00146 #define SNMP_ENDOFMIBVIEW    SMI_ENDOFMIBVIEW
00147 
00148 #define ASN_IPADDRESS   (ASN_APPLICATION | 0)
00149 #define ASN_UNSIGNED    (ASN_APPLICATION | 2)   /* RFC 1902 - same as GAUGE */
00150 #define ASN_TIMETICKS   (ASN_APPLICATION | 3)
00151 
00152 #define snmp_perror(X) perror(X)
00153 #define snmp_set_dump_packet(X)
00154 #define snmp_set_quick_print(X)
00155 #define snmp_set_do_debugging(X)
00156 #define snmp_set_full_objid(X)
00157 #define snmp_set_suffix_only(X)
00158 
00159 #define VersionInfo snmp_Version
00160 #define get_node read_objid
00161 #define version Version         /* netsnmp_session member */
00162 
00163 #define SNMP_VERSION_2c SNMP_VERSION_2
00164 #define SNMP_VERSION_2p 129
00165 
00166 #define SOCK_STARTUP winsock_startup()
00167 #define SOCK_CLEANUP winsock_cleanup()
00168 
00169 #endif                          /* !UCD_SNMP_LIBRARY */
00170 
00171 #ifdef __cplusplus
00172 }
00173 #endif
00174 #endif                          /* _LIBSNMP_H_ */