| 1 |
#ifndef _LIBSNMP_H_ |
| 2 |
#define _LIBSNMP_H_ |
| 3 |
|
| 4 |
#ifdef __cplusplus |
| 5 |
extern "C" { |
| 6 |
#endif |
| 7 |
|
| 8 |
/* |
| 9 |
* Definitions for the Simple Network Management Protocol (RFC 1067). |
| 10 |
* |
| 11 |
*/ |
| 12 |
/********************************************************************** |
| 13 |
* |
| 14 |
* Copyright 1998 by Carnegie Mellon University |
| 15 |
* |
| 16 |
* All Rights Reserved |
| 17 |
* |
| 18 |
* Permission to use, copy, modify, and distribute this software and its |
| 19 |
* documentation for any purpose and without fee is hereby granted, |
| 20 |
* provided that the above copyright notice appear in all copies and that |
| 21 |
* both that copyright notice and this permission notice appear in |
| 22 |
* supporting documentation, and that the name of CMU not be |
| 23 |
* used in advertising or publicity pertaining to distribution of the |
| 24 |
* software without specific, written prior permission. |
| 25 |
* |
| 26 |
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING |
| 27 |
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL |
| 28 |
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR |
| 29 |
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
| 30 |
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
| 31 |
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
| 32 |
* SOFTWARE. |
| 33 |
* |
| 34 |
* $Id$ |
| 35 |
* |
| 36 |
**********************************************************************/ |
| 37 |
|
| 38 |
#include <ucd-snmp/ucd-snmp-config.h> |
| 39 |
|
| 40 |
#ifdef HAVE_STDLIB_H |
| 41 |
#include <stdlib.h> |
| 42 |
#endif |
| 43 |
#ifdef HAVE_UNISTD_H |
| 44 |
#include <unistd.h> |
| 45 |
#endif |
| 46 |
#ifdef HAVE_STRING_H |
| 47 |
#include <string.h> |
| 48 |
#else |
| 49 |
#include <strings.h> |
| 50 |
#endif |
| 51 |
#include <sys/types.h> |
| 52 |
#ifdef HAVE_NETINET_IN_H |
| 53 |
#include <netinet/in.h> |
| 54 |
#endif |
| 55 |
#ifdef TIME_WITH_SYS_TIME |
| 56 |
# include <sys/time.h> |
| 57 |
# include <time.h> |
| 58 |
#else |
| 59 |
# ifdef HAVE_SYS_TIME_H |
| 60 |
# include <sys/time.h> |
| 61 |
# else |
| 62 |
# include <time.h> |
| 63 |
# endif |
| 64 |
#endif |
| 65 |
#ifdef HAVE_SYS_SELECT_H |
| 66 |
#include <sys/select.h> |
| 67 |
#endif |
| 68 |
#include <stdio.h> |
| 69 |
#include <ctype.h> |
| 70 |
#ifdef HAVE_NETDB_H |
| 71 |
#include <netdb.h> |
| 72 |
#endif |
| 73 |
#ifdef HAVE_ARPA_INET_H |
| 74 |
#include <arpa/inet.h> |
| 75 |
#endif |
| 76 |
|
| 77 |
#ifdef UCD_SNMP_LIBRARY |
| 78 |
|
| 79 |
#include <ucd-snmp/asn1.h> |
| 80 |
#include <ucd-snmp/snmp_api.h> |
| 81 |
#include <ucd-snmp/snmp_impl.h> |
| 82 |
#include <ucd-snmp/snmp_client.h> |
| 83 |
#include <ucd-snmp/mib.h> |
| 84 |
#include <ucd-snmp/parse.h> |
| 85 |
#include <ucd-snmp/snmp.h> |
| 86 |
#include <ucd-snmp/system.h> |
| 87 |
#include <ucd-snmp/int64.h> |
| 88 |
#include <ucd-snmp/version.h> |
| 89 |
|
| 90 |
#define Version version /* netsnmp_session member */ |
| 91 |
|
| 92 |
#define SMI_NOSUCHOBJECT SNMP_NOSUCHOBJECT |
| 93 |
#define SMI_NOSUCHINSTANCE SNMP_NOSUCHINSTANCE |
| 94 |
#define SMI_ENDOFMIBVIEW SNMP_ENDOFMIBVIEW |
| 95 |
|
| 96 |
|
| 97 |
#else /* !UCD_SNMP_LIBRARY */ |
| 98 |
|
| 99 |
#include <sys/types.h> |
| 100 |
#ifndef WIN32 |
| 101 |
#include <netinet/in.h> |
| 102 |
#endif |
| 103 |
|
| 104 |
#include <snmp/asn1.h> |
| 105 |
#include <snmp/snmp_error.h> |
| 106 |
#include <snmp/mibii.h> |
| 107 |
#include <snmp/snmp_extra.h> |
| 108 |
#include <snmp/snmp_dump.h> |
| 109 |
|
| 110 |
#include <snmp/snmp_session.h> |
| 111 |
|
| 112 |
#include <snmp/snmp_vars.h> |
| 113 |
#include <snmp/snmp_pdu.h> |
| 114 |
#include <snmp/snmp_msg.h> |
| 115 |
|
| 116 |
#include <snmp/snmp_coexist.h> |
| 117 |
#include <snmp/version.h> |
| 118 |
#include <snmp/snmp_api_error.h> |
| 119 |
#include <snmp/mini-client.h> |
| 120 |
|
| 121 |
#include <snmp/snmp_impl.h> |
| 122 |
#include <snmp/snmp_api.h> |
| 123 |
#include <snmp/snmp_client.h> |
| 124 |
#include <snmp/snmp-internal.h> |
| 125 |
#include <snmp/mib.h> |
| 126 |
#include <snmp/parse.h> |
| 127 |
#include <snmp/snmp_compat.h> |
| 128 |
|
| 129 |
/* |
| 130 |
* Load UC-Davis differential |
| 131 |
*/ |
| 132 |
|
| 133 |
#define SNMP_MSG_GET GET_REQ_MSG |
| 134 |
#define SNMP_MSG_GETNEXT GETNEXT_REQ_MSG |
| 135 |
#define SNMP_MSG_RESPONSE GET_RSP_MSG |
| 136 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 137 |
#define SNMP_MSG_SET SET_REQ_MSG |
| 138 |
#endif /* !NETSNMP_NO_WRITE_SUPPORT */ |
| 139 |
#define SNMP_MSG_TRAP TRP_REQ_MSG |
| 140 |
#define SNMP_MSG_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) |
| 141 |
#define SNMP_MSG_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) |
| 142 |
#define SNMP_MSG_TRAP2 (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) |
| 143 |
#define SNMP_MSG_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) |
| 144 |
#define SNMP_NOSUCHOBJECT SMI_NOSUCHOBJECT |
| 145 |
#define SNMP_NOSUCHINSTANCE SMI_NOSUCHINSTANCE |
| 146 |
#define SNMP_ENDOFMIBVIEW SMI_ENDOFMIBVIEW |
| 147 |
|
| 148 |
#define ASN_IPADDRESS (ASN_APPLICATION | 0) |
| 149 |
#define ASN_UNSIGNED (ASN_APPLICATION | 2) /* RFC 1902 - same as GAUGE */ |
| 150 |
#define ASN_TIMETICKS (ASN_APPLICATION | 3) |
| 151 |
|
| 152 |
#define snmp_perror(X) perror(X) |
| 153 |
#define snmp_set_dump_packet(X) |
| 154 |
#define snmp_set_quick_print(X) |
| 155 |
#define snmp_set_do_debugging(X) |
| 156 |
#define snmp_set_full_objid(X) |
| 157 |
#define snmp_set_suffix_only(X) |
| 158 |
|
| 159 |
#define VersionInfo snmp_Version |
| 160 |
#define get_node read_objid |
| 161 |
#define version Version /* netsnmp_session member */ |
| 162 |
|
| 163 |
#define SNMP_VERSION_2c SNMP_VERSION_2 |
| 164 |
#define SNMP_VERSION_2p 129 |
| 165 |
|
| 166 |
#define SOCK_STARTUP winsock_startup() |
| 167 |
#define SOCK_CLEANUP winsock_cleanup() |
| 168 |
|
| 169 |
#endif /* !UCD_SNMP_LIBRARY */ |
| 170 |
|
| 171 |
#ifdef __cplusplus |
| 172 |
} |
| 173 |
#endif |
| 174 |
#endif /* _LIBSNMP_H_ */ |