net-snmp
5.4.1
|
00001 /* Portions of this file are subject to the following copyright(s). See 00002 * the Net-SNMP's COPYING file for more details and other copyrights 00003 * that may apply: 00004 */ 00005 /* 00006 * Portions of this file are copyrighted by: 00007 * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. 00008 * Use is subject to license terms specified in the COPYING file 00009 * distributed with the Net-SNMP package. 00010 */ 00011 00012 /* 00013 * CMU compatability definitions and structures. 00014 * 00015 * (since the UCD package split from the CMU one 00016 * about 8 years ago, that's probably enough time 00017 * for people to convert any outstanding code!) 00018 */ 00019 00020 #ifndef NET_SNMP_CMU_COMPAT_H 00021 #define NET_SNMP_CMU_COMPAT_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* 00028 * ============================ 00029 * * 00030 * * Enumerations and definitions 00031 * * 00032 * * ============================ 00033 */ 00034 #include <net-snmp/definitions.h> 00035 /* 00036 * From parse.h 00037 */ 00038 #define ACCESS_READONLY MIB_ACCESS_READONLY 00039 #define ACCESS_READWRITE MIB_ACCESS_READWRITE 00040 #define ACCESS_WRITEONLY MIB_ACCESS_WRITEONLY 00041 #define ACCESS_NOACCESS MIB_ACCESS_NOACCESS 00042 #define ACCESS_NOTIFY MIB_ACCESS_NOTIFY 00043 #define ACCESS_CREATE MIB_ACCESS_CREATE 00044 #define STATUS_MANDATORY MIB_STATUS_MANDATORY 00045 #define STATUS_OPTIONAL MIB_STATUS_OPTIONAL 00046 #define STATUS_OBSOLETE MIB_STATUS_OBSOLETE 00047 #define STATUS_DEPRECATED MIB_STATUS_DEPRECATED 00048 #define STATUS_CURRENT MIB_STATUS_CURRENT 00049 /* 00050 * From smnp_impl.h 00051 */ 00052 #define INTEGER ASN_INTEGER 00053 #define STRING ASN_OCTET_STR 00054 #define OBJID ASN_OBJECT_ID 00055 #define NULLOBJ ASN_NULL 00056 #define BITSTRING ASN_BIT_STR /* HISTORIC - don't use */ 00057 #define IPADDRESS ASN_IPADDRESS 00058 #define COUNTER ASN_COUNTER 00059 #define GAUGE ASN_GAUGE 00060 #define UNSIGNED ASN_UNSIGNED 00061 #define TIMETICKS ASN_TIMETICKS 00062 #define ASNT_OPAQUE ASN_OPAQUE 00063 #define NSAP ASN_NSAP 00064 #define COUNTER64 ASN_COUNTER64 00065 #define UINTEGER ASN_UINTEGER 00066 /* 00067 * From snmp.h 00068 */ 00069 #define GET_REQ_MSG SNMP_MSG_GET 00070 #define GETNEXT_REQ_MSG SNMP_MSG_GETNEXT 00071 #define GET_RSP_MSG SNMP_MSG_RESPONSE 00072 #define SET_REQ_MSG SNMP_MSG_SET 00073 #define TRP_REQ_MSG SNMP_MSG_TRAP 00074 #define BULK_REQ_MSG SNMP_MSG_GETBULK 00075 #define INFORM_REQ_MSG SNMP_MSG_INFORM 00076 #define TRP2_REQ_MSG SNMP_MSG_TRAP2 00077 #define REPORT_RSP_MSG SNMP_MSG_REPORT 00078 /* 00079 * since CMU V1.5 00080 */ 00081 #define SNMP_PDU_GET SNMP_MSG_GET 00082 #define SNMP_PDU_GETNEXT SNMP_MSG_GETNEXT 00083 #define SNMP_PDU_RESPONSE SNMP_MSG_RESPONSE 00084 #define SNMP_PDU_SET SNMP_MSG_SET 00085 #define SNMP_PDU_GETBULK SNMP_MSG_GETBULK 00086 #define SNMP_PDU_INFORM SNMP_MSG_INFORM 00087 #define SNMP_PDU_V2TRAP SNMP_MSG_TRAP2 00088 #define SNMP_PDU_REPORT SNMP_MSG_REPORT 00089 #define SNMP_TRAP_AUTHENTICATIONFAILURE SNMP_TRAP_AUTHFAIL 00090 #define SMI_INTEGER ASN_INTEGER 00091 #define SMI_STRING ASN_OCTET_STR 00092 #define SMI_OBJID ASN_OBJECT_ID 00093 #define SMI_NULLOBJ ASN_NULL 00094 #define SMI_IPADDRESS ASN_IPADDRESS 00095 #define SMI_COUNTER32 ASN_COUNTER 00096 #define SMI_GAUGE32 ASN_GAUGE 00097 #define SMI_UNSIGNED32 SMI_GAUGE32 00098 #define SMI_TIMETICKS ASN_TIMETICKS 00099 #define SMI_OPAQUE ASN_OPAQUE 00100 #define SMI_COUNTER64 ASN_COUNTER64 00101 /* 00102 * ============================ 00103 * * 00104 * * Function declarations 00105 * * and global variables 00106 * * 00107 * * ============================ 00108 */ 00109 extern int snmp_dump_packet; /* from snmp_api.h */ 00110 extern int quick_print; /* from snmp_api.h */ 00111 00112 #include <net-snmp/types.h> /* for snmp_pdu & snmp_session */ 00113 00114 int mib_TxtToOid(char *, oid **, size_t *); /* from snmp.h */ 00115 int mib_OidToTxt(oid *, size_t, char *, size_t); /* from snmp.h */ 00116 u_char *cmu_snmp_parse(netsnmp_session * session, netsnmp_pdu *pdu, u_char * data, size_t length); /* from snmp.h */ 00117 00118 00119 00120 00121 /* 00122 * ============================ 00123 * * 00124 * * MIB-II data structures 00125 * * (from mib.h) 00126 * * 00127 * * ============================ 00128 */ 00129 00130 00131 struct mib_system { 00132 char sysDescr[32]; /* textual description */ 00133 u_char sysObjectID[16]; /* OBJECT IDENTIFIER of system */ 00134 u_char ObjIDLen; /* length of sysObjectID */ 00135 u_int sysUpTime; /* Uptime in 100/s of a second */ 00136 }; 00137 00138 struct mib_interface { 00139 int ifNumber; /* number of interfaces */ 00140 }; 00141 00142 struct mib_ifEntry { 00143 int ifIndex; /* index of this interface */ 00144 char ifDescr[32]; /* english description of interface */ 00145 int ifType; /* network type of device */ 00146 int ifMtu; /* size of largest packet in bytes */ 00147 u_int ifSpeed; /* bandwidth in bits/sec */ 00148 u_char ifPhysAddress[11]; /* interface's address */ 00149 u_char PhysAddrLen; /* length of physAddr */ 00150 int ifAdminStatus; /* desired state of interface */ 00151 int ifOperStatus; /* current operational status */ 00152 u_int ifLastChange; /* value of sysUpTime when current state entered */ 00153 u_int ifInOctets; /* number of octets received on interface */ 00154 u_int ifInUcastPkts; /* number of unicast packets delivered */ 00155 u_int ifInNUcastPkts; /* number of broadcasts or multicasts */ 00156 u_int ifInDiscards; /* number of packets discarded with no error */ 00157 u_int ifInErrors; /* number of packets containing errors */ 00158 u_int ifInUnknownProtos; /* number of packets with unknown protocol */ 00159 u_int ifOutOctets; /* number of octets transmitted */ 00160 u_int ifOutUcastPkts; /* number of unicast packets sent */ 00161 u_int ifOutNUcastPkts; /* number of broadcast or multicast pkts */ 00162 u_int ifOutDiscards; /* number of packets discarded with no error */ 00163 u_int ifOutErrors; /* number of pkts discarded with an error */ 00164 u_int ifOutQLen; /* number of packets in output queue */ 00165 }; 00166 00167 struct mib_atEntry { 00168 int atIfIndex; /* interface on which this entry maps */ 00169 u_char atPhysAddress[11]; /* physical address of destination */ 00170 u_char PhysAddressLen; /* length of atPhysAddress */ 00171 u_int atNetAddress; /* IP address of physical address */ 00172 }; 00173 00174 struct mib_ip { 00175 int ipForwarding; /* 1 if gateway, 2 if host */ 00176 int ipDefaultTTL; /* default TTL for pkts originating here */ 00177 u_int ipInReceives; /* no. of IP packets received from interfaces */ 00178 u_int ipInHdrErrors; /* number of pkts discarded due to header errors */ 00179 u_int ipInAddrErrors; /* no. of pkts discarded due to bad address */ 00180 u_int ipForwDatagrams; /* number pf pkts forwarded through this entity */ 00181 u_int ipInUnknownProtos; /* no. of local-addressed pkts w/unknown proto */ 00182 u_int ipInDiscards; /* number of error-free packets discarded */ 00183 u_int ipInDelivers; /* number of datagrams delivered to upper level */ 00184 u_int ipOutRequests; /* number of IP datagrams originating locally */ 00185 u_int ipOutDiscards; /* number of error-free output IP pkts discarded */ 00186 u_int ipOutNoRoutes; /* number of IP pkts discarded due to no route */ 00187 int ipReasmTimeout; /* seconds fragment is held awaiting reassembly */ 00188 u_int ipReasmReqds; /* no. of fragments needing reassembly (here) */ 00189 u_int ipReasmOKs; /* number of fragments reassembled */ 00190 u_int ipReasmFails; /* number of failures in IP reassembly */ 00191 u_int ipFragOKs; /* number of datagrams fragmented here */ 00192 u_int ipFragFails; /* no. pkts unable to be fragmented here */ 00193 u_int ipFragCreates; /* number of IP fragments created here */ 00194 }; 00195 00196 struct mib_ipAddrEntry { 00197 u_int ipAdEntAddr; /* IP address of this entry */ 00198 int ipAdEntIfIndex; /* IF for this entry */ 00199 u_int ipAdEntNetMask; /* subnet mask of this entry */ 00200 int ipAdEntBcastAddr; /* read the MIB for this one */ 00201 int ipAdEntReasmMaxSize; 00202 /* max size for dg reassembly {ipAddrEntry 5} */ 00203 }; 00204 00205 struct mib_ipRouteEntry { 00206 u_int ipRouteDest; /* destination IP addr for this route */ 00207 int ipRouteIfIndex; /* index of local IF for this route */ 00208 int ipRouteMetric1; /* Primary routing metric */ 00209 int ipRouteMetric2; /* Alternate routing metric */ 00210 int ipRouteMetric3; /* Alternate routing metric */ 00211 int ipRouteMetric4; /* Alternate routing metric */ 00212 u_int ipRouteNextHop; /* IP addr of next hop */ 00213 int ipRouteType; /* Type of this route */ 00214 int ipRouteProto; /* How this route was learned */ 00215 int ipRouteAge; /* No. of seconds since updating this route */ 00216 }; 00217 00218 struct mib_icmp { 00219 u_int icmpInMsgs; /* Total of ICMP msgs received */ 00220 u_int icmpInErrors; /* Total of ICMP msgs received with errors */ 00221 u_int icmpInDestUnreachs; 00222 u_int icmpInTimeExcds; 00223 u_int icmpInParmProbs; 00224 u_int icmpInSrcQuenchs; 00225 u_int icmpInRedirects; 00226 u_int icmpInEchos; 00227 u_int icmpInEchoReps; 00228 u_int icmpInTimestamps; 00229 u_int icmpInTimestampReps; 00230 u_int icmpInAddrMasks; 00231 u_int icmpInAddrMaskReps; 00232 u_int icmpOutMsgs; 00233 u_int icmpOutErrors; 00234 u_int icmpOutDestUnreachs; 00235 u_int icmpOutTimeExcds; 00236 u_int icmpOutParmProbs; 00237 u_int icmpOutSrcQuenchs; 00238 u_int icmpOutRedirects; 00239 u_int icmpOutEchos; 00240 u_int icmpOutEchoReps; 00241 u_int icmpOutTimestamps; 00242 u_int icmpOutTimestampReps; 00243 u_int icmpOutAddrMasks; 00244 u_int icmpOutAddrMaskReps; 00245 }; 00246 00247 struct mib_tcp { 00248 int tcpRtoAlgorithm; /* retransmission timeout algorithm */ 00249 int tcpRtoMin; /* minimum retransmission timeout (mS) */ 00250 int tcpRtoMax; /* maximum retransmission timeout (mS) */ 00251 int tcpMaxConn; /* maximum tcp connections possible */ 00252 u_int tcpActiveOpens; /* number of SYN-SENT -> CLOSED transitions */ 00253 u_int tcpPassiveOpens; /* number of SYN-RCVD -> LISTEN transitions */ 00254 u_int tcpAttemptFails; /*(SYN-SENT,SYN-RCVD)->CLOSED or SYN-RCVD->LISTEN */ 00255 u_int tcpEstabResets; /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */ 00256 u_int tcpCurrEstab; /* number in ESTABLISHED or CLOSE-WAIT state */ 00257 u_int tcpInSegs; /* number of segments received */ 00258 u_int tcpOutSegs; /* number of segments sent */ 00259 u_int tcpRetransSegs; /* number of retransmitted segments */ 00260 }; 00261 00262 struct mib_tcpConnEntry { 00263 int tcpConnState; /* State of this connection */ 00264 u_int tcpConnLocalAddress; /* local IP address for this connection */ 00265 int tcpConnLocalPort; /* local port for this connection */ 00266 u_int tcpConnRemAddress; /* remote IP address for this connection */ 00267 int tcpConnRemPort; /* remote port for this connection */ 00268 }; 00269 00270 struct mib_udp { 00271 u_int udpInDatagrams; /* No. of UDP datagrams delivered to users */ 00272 u_int udpNoPorts; /* No. of UDP datagrams to port with no listener */ 00273 u_int udpInErrors; /* No. of UDP datagrams unable to be delivered */ 00274 u_int udpOutDatagrams; /* No. of UDP datagrams sent from this entity */ 00275 }; 00276 00277 struct mib_egp { 00278 u_int egpInMsgs; /* No. of EGP msgs received without error */ 00279 u_int egpInErrors; /* No. of EGP msgs received with error */ 00280 u_int egpOutMsgs; /* No. of EGP msgs sent */ 00281 u_int egpOutErrors; /* No. of (outgoing) EGP msgs dropped due to error */ 00282 }; 00283 00284 struct mib_egpNeighEntry { 00285 int egpNeighState; /* local EGP state with this entry's neighbor */ 00286 u_int egpNeighAddr; /* IP address of this entry's neighbor */ 00287 }; 00288 00289 #ifdef __cplusplus 00290 } 00291 #endif 00292 #endif /* NET_SNMP_CMU_COMPAT_H */