]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/net/snmp/lib/v2_0/include/mib.h
Initial revision
[karo-tx-redboot.git] / packages / net / snmp / lib / v2_0 / include / mib.h
1 //==========================================================================
2 //
3 //      ./lib/current/include/mib.h
4 //
5 //
6 //==========================================================================
7 //####ECOSGPLCOPYRIGHTBEGIN####
8 // -------------------------------------------
9 // This file is part of eCos, the Embedded Configurable Operating System.
10 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
11 //
12 // eCos is free software; you can redistribute it and/or modify it under
13 // the terms of the GNU General Public License as published by the Free
14 // Software Foundation; either version 2 or (at your option) any later version.
15 //
16 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
17 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 // for more details.
20 //
21 // You should have received a copy of the GNU General Public License along
22 // with eCos; if not, write to the Free Software Foundation, Inc.,
23 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 //
25 // As a special exception, if other files instantiate templates or use macros
26 // or inline functions from this file, or you compile this file and link it
27 // with other works to produce a work based on this file, this file does not
28 // by itself cause the resulting work to be covered by the GNU General Public
29 // License. However the source code for this file must still be made available
30 // in accordance with section (3) of the GNU General Public License.
31 //
32 // This exception does not invalidate any other reasons why a work based on
33 // this file might be covered by the GNU General Public License.
34 //
35 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
36 // at http://sources.redhat.com/ecos/ecos-license/
37 // -------------------------------------------
38 //####ECOSGPLCOPYRIGHTEND####
39 //####UCDSNMPCOPYRIGHTBEGIN####
40 //
41 // -------------------------------------------
42 //
43 // Portions of this software may have been derived from the UCD-SNMP
44 // project,  <http://ucd-snmp.ucdavis.edu/>  from the University of
45 // California at Davis, which was originally based on the Carnegie Mellon
46 // University SNMP implementation.  Portions of this software are therefore
47 // covered by the appropriate copyright disclaimers included herein.
48 //
49 // The release used was version 4.1.2 of May 2000.  "ucd-snmp-4.1.2"
50 // -------------------------------------------
51 //
52 //####UCDSNMPCOPYRIGHTEND####
53 //==========================================================================
54 //#####DESCRIPTIONBEGIN####
55 //
56 // Author(s):    hmt
57 // Contributors: hmt
58 // Date:         2000-05-30
59 // Purpose:      Port of UCD-SNMP distribution to eCos.
60 // Description:  
61 //              
62 //
63 //####DESCRIPTIONEND####
64 //
65 //==========================================================================
66 /********************************************************************
67        Copyright 1989, 1991, 1992 by Carnegie Mellon University
68
69                           Derivative Work -
70 Copyright 1996, 1998, 1999, 2000 The Regents of the University of California
71
72                          All Rights Reserved
73
74 Permission to use, copy, modify and distribute this software and its
75 documentation for any purpose and without fee is hereby granted,
76 provided that the above copyright notice appears in all copies and
77 that both that copyright notice and this permission notice appear in
78 supporting documentation, and that the name of CMU and The Regents of
79 the University of California not be used in advertising or publicity
80 pertaining to distribution of the software without specific written
81 permission.
82
83 CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALL
84 WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
85 WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL CMU OR
86 THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,
87 INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
88 FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
89 CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
90 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
91 *********************************************************************/
92 #ifndef MIB_H
93 #define MIB_H
94
95 #ifdef __cplusplus
96 extern "C" {
97 #endif
98 /*
99  * mib.h - Definitions for the variables as defined in the MIB
100  *
101  * Update: 1998-07-17 <jhy@gsu.edu>
102  * Added prototypes for print_oid_report* functions.
103  */
104 /***********************************************************
105         Copyright 1988, 1989 by Carnegie Mellon University
106
107                       All Rights Reserved
108
109 Permission to use, copy, modify, and distribute this software and its 
110 documentation for any purpose and without fee is hereby granted, 
111 provided that the above copyright notice appear in all copies and that
112 both that copyright notice and this permission notice appear in 
113 supporting documentation, and that the name of CMU not be
114 used in advertising or publicity pertaining to distribution of the
115 software without specific, written prior permission.  
116
117 CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
118 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
119 CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
120 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
121 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
122 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
123 SOFTWARE.
124 ******************************************************************/
125
126 #ifdef CMU_COMPATIBLE
127
128 struct  mib_system {
129     char    sysDescr[32];   /* textual description */
130     u_char  sysObjectID[16];/* OBJECT IDENTIFIER of system */
131     u_char  ObjIDLen;       /* length of sysObjectID */
132     u_int  sysUpTime;       /* Uptime in 100/s of a second */    
133 };
134
135 struct mib_interface {
136     int    ifNumber;        /* number of interfaces */
137 };
138
139 struct mib_ifEntry {
140     int    ifIndex;         /* index of this interface  */
141     char    ifDescr[32];    /* english description of interface */
142     int    ifType;          /* network type of device   */
143     int    ifMtu;           /* size of largest packet in bytes  */
144     u_int  ifSpeed;         /* bandwidth in bits/sec    */
145     u_char  ifPhysAddress[11];  /* interface's address */
146     u_char  PhysAddrLen;    /* length of physAddr */
147     int    ifAdminStatus;  /* desired state of interface */
148     int    ifOperStatus;   /* current operational status */
149     u_int  ifLastChange;   /* value of sysUpTime when current state entered */
150     u_int  ifInOctets;      /* number of octets received on interface */
151     u_int  ifInUcastPkts;  /* number of unicast packets delivered */
152     u_int  ifInNUcastPkts; /* number of broadcasts or multicasts */
153     u_int  ifInDiscards;   /* number of packets discarded with no error */
154     u_int  ifInErrors;      /* number of packets containing errors */
155     u_int  ifInUnknownProtos;   /* number of packets with unknown protocol */
156     u_int  ifOutOctets;    /* number of octets transmitted */
157     u_int  ifOutUcastPkts; /* number of unicast packets sent */
158     u_int  ifOutNUcastPkts;/* number of broadcast or multicast pkts */
159     u_int  ifOutDiscards;  /* number of packets discarded with no error */
160     u_int  ifOutErrors;    /* number of pkts discarded with an error */
161     u_int  ifOutQLen;       /* number of packets in output queue */
162 };
163
164 struct mib_atEntry {
165     int    atIfIndex;       /* interface on which this entry maps */
166     u_char  atPhysAddress[11]; /* physical address of destination */
167     u_char  PhysAddressLen; /* length of atPhysAddress */
168     u_int  atNetAddress;   /* IP address of physical address */
169 };
170
171 struct mib_ip {
172     int    ipForwarding;   /* 1 if gateway, 2 if host */
173     int    ipDefaultTTL;   /* default TTL for pkts originating here */
174     u_int  ipInReceives;   /* no. of IP packets received from interfaces */
175     u_int  ipInHdrErrors;  /* number of pkts discarded due to header errors */
176     u_int  ipInAddrErrors; /* no. of pkts discarded due to bad address */
177     u_int  ipForwDatagrams;/* number pf pkts forwarded through this entity */
178     u_int  ipInUnknownProtos;/* no. of local-addressed pkts w/unknown proto */
179     u_int  ipInDiscards;   /* number of error-free packets discarded */
180     u_int  ipInDelivers;   /* number of datagrams delivered to upper level */
181     u_int  ipOutRequests;  /* number of IP datagrams originating locally */
182     u_int  ipOutDiscards;  /* number of error-free output IP pkts discarded */
183     u_int  ipOutNoRoutes;  /* number of IP pkts discarded due to no route */
184     int    ipReasmTimeout; /* seconds fragment is held awaiting reassembly */
185     u_int  ipReasmReqds;   /* no. of fragments needing reassembly (here) */
186     u_int  ipReasmOKs;      /* number of fragments reassembled */
187     u_int  ipReasmFails;   /* number of failures in IP reassembly */
188     u_int  ipFragOKs;       /* number of datagrams fragmented here */
189     u_int  ipFragFails;    /* no. pkts unable to be fragmented here */
190     u_int  ipFragCreates;  /* number of IP fragments created here */
191 };
192
193 struct mib_ipAddrEntry {
194     u_int  ipAdEntAddr;    /* IP address of this entry */
195     int    ipAdEntIfIndex; /* IF for this entry */
196     u_int  ipAdEntNetMask; /* subnet mask of this entry */
197     int    ipAdEntBcastAddr;/* read the MIB for this one */
198 };
199
200 struct mib_ipRouteEntry {
201     u_int  ipRouteDest;    /* destination IP addr for this route */
202     int    ipRouteIfIndex; /* index of local IF for this route */
203     int    ipRouteMetric1; /* Primary routing metric */
204     int    ipRouteMetric2; /* Alternate routing metric */
205     int    ipRouteMetric3; /* Alternate routing metric */
206     int    ipRouteMetric4; /* Alternate routing metric */
207     u_int  ipRouteNextHop; /* IP addr of next hop */
208     int    ipRouteType;    /* Type of this route */
209     int    ipRouteProto;   /* How this route was learned */
210     int    ipRouteAge;      /* No. of seconds since updating this route */
211 };
212
213 struct mib_icmp {
214     u_int  icmpInMsgs;      /* Total of ICMP msgs received */
215     u_int  icmpInErrors;   /* Total of ICMP msgs received with errors */
216     u_int  icmpInDestUnreachs;
217     u_int  icmpInTimeExcds;
218     u_int  icmpInParmProbs;
219     u_int  icmpInSrcQuenchs;
220     u_int  icmpInRedirects;
221     u_int  icmpInEchos;
222     u_int  icmpInEchoReps;
223     u_int  icmpInTimestamps;
224     u_int  icmpInTimestampReps;
225     u_int  icmpInAddrMasks;
226     u_int  icmpInAddrMaskReps;
227     u_int  icmpOutMsgs;
228     u_int  icmpOutErrors;
229     u_int  icmpOutDestUnreachs;
230     u_int  icmpOutTimeExcds;
231     u_int  icmpOutParmProbs;
232     u_int  icmpOutSrcQuenchs;
233     u_int  icmpOutRedirects;
234     u_int  icmpOutEchos;
235     u_int  icmpOutEchoReps;
236     u_int  icmpOutTimestamps;
237     u_int  icmpOutTimestampReps;
238     u_int  icmpOutAddrMasks;
239     u_int  icmpOutAddrMaskReps;
240 };
241
242 struct  mib_tcp {
243     int    tcpRtoAlgorithm;     /* retransmission timeout algorithm */
244     int    tcpRtoMin;           /* minimum retransmission timeout (mS) */
245     int    tcpRtoMax;           /* maximum retransmission timeout (mS) */ 
246     int    tcpMaxConn;          /* maximum tcp connections possible */
247     u_int  tcpActiveOpens;      /* number of SYN-SENT -> CLOSED transitions */
248     u_int  tcpPassiveOpens;     /* number of SYN-RCVD -> LISTEN transitions */
249     u_int  tcpAttemptFails;/*(SYN-SENT,SYN-RCVD)->CLOSED or SYN-RCVD->LISTEN*/
250     u_int  tcpEstabResets;      /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */
251     u_int  tcpCurrEstab;        /* number in ESTABLISHED or CLOSE-WAIT state */
252     u_int  tcpInSegs;           /* number of segments received */
253     u_int  tcpOutSegs;          /* number of segments sent */
254     u_int  tcpRetransSegs;      /* number of retransmitted segments */
255 };
256
257 struct mib_tcpConnEntry {
258     int    tcpConnState;        /* State of this connection */
259     u_int  tcpConnLocalAddress;/* local IP address for this connection */
260     int    tcpConnLocalPort;    /* local port for this connection */
261     u_int  tcpConnRemAddress;   /* remote IP address for this connection */
262     int    tcpConnRemPort;      /* remote port for this connection */
263 };
264
265 struct mib_udp {
266     u_int  udpInDatagrams; /* No. of UDP datagrams delivered to users */
267     u_int  udpNoPorts;      /* No. of UDP datagrams to port with no listener */
268     u_int  udpInErrors;    /* No. of UDP datagrams unable to be delivered */
269     u_int  udpOutDatagrams;/* No. of UDP datagrams sent from this entity */
270 };
271
272 struct  mib_egp {
273     u_int  egpInMsgs;   /* No. of EGP msgs received without error */
274     u_int  egpInErrors;/* No. of EGP msgs received with error */
275     u_int  egpOutMsgs;  /* No. of EGP msgs sent */
276     u_int  egpOutErrors;/* No. of (outgoing) EGP msgs dropped due to error */
277 };
278
279 struct  mib_egpNeighEntry {
280     int    egpNeighState;  /* local EGP state with this entry's neighbor */
281     u_int  egpNeighAddr;   /* IP address of this entry's neighbor */
282 };
283
284 #endif /* CMU_COMPATIBLE */
285
286 #define MIB 1, 3, 6, 1, 2, 1
287
288 #define MIB_IFTYPE_OTHER                    1
289 #define MIB_IFTYPE_REGULAR1822              2
290 #define MIB_IFTYPE_HDH1822                  3
291 #define MIB_IFTYPE_DDNX25                   4
292 #define MIB_IFTYPE_RFC877X25                5
293 #define MIB_IFTYPE_ETHERNETCSMACD           6
294 #define MIB_IFTYPE_ISO88023CSMACD           7
295 #define MIB_IFTYPE_ISO88024TOKENBUS         8
296 #define MIB_IFTYPE_ISO88025TOKENRING        9
297 #define MIB_IFTYPE_ISO88026MAN              10
298 #define MIB_IFTYPE_STARLAN                  11
299 #define MIB_IFTYPE_PROTEON10MBIT            12
300 #define MIB_IFTYPE_PROTEON80MBIT            13
301 #define MIB_IFTYPE_HYPERCHANNEL             14
302 #define MIB_IFTYPE_FDDI                     15
303 #define MIB_IFTYPE_LAPB                     16
304 #define MIB_IFTYPE_SDLC                     17
305 #define MIB_IFTYPE_T1CARRIER                18
306 #define MIB_IFTYPE_CEPT                     19
307 #define MIB_IFTYPE_BASICISDN                20
308 #define MIB_IFTYPE_PRIMARYISDN              21
309 #define MIB_IFTYPE_PROPPOINTTOPOINTSERIAL   22
310
311 #define MIB_IFSTATUS_UP         1
312 #define MIB_IFSTATUS_DOWN       2
313 #define MIB_IFSTATUS_TESTING    3
314
315 #define MIB_FORWARD_GATEWAY     1
316 #define MIB_FORWARD_HOST        2
317
318 #define MIB_IPROUTETYPE_OTHER   1
319 #define MIB_IPROUTETYPE_INVALID 2
320 #define MIB_IPROUTETYPE_DIRECT  3
321 #define MIB_IPROUTETYPE_REMOTE  4
322
323 #define MIB_IPROUTEPROTO_OTHER      1
324 #define MIB_IPROUTEPROTO_LOCAL      2
325 #define MIB_IPROUTEPROTO_NETMGMT    3
326 #define MIB_IPROUTEPROTO_ICMP       4
327 #define MIB_IPROUTEPROTO_EGP        5
328 #define MIB_IPROUTEPROTO_GGP        6
329 #define MIB_IPROUTEPROTO_HELLO      7
330 #define MIB_IPROUTEPROTO_RIP        8
331 #define MIB_IPROUTEPROTO_ISIS       9
332 #define MIB_IPROUTEPROTO_ESIS       10
333 #define MIB_IPROUTEPROTO_CISCOIGRP  11
334 #define MIB_IPROUTEPROTO_BBNSPFIGP  12
335 #define MIB_IPROUTEPROTO_OIGP       13
336
337 #define MIB_TCPRTOALG_OTHER     1
338 #define MIB_TCPRTOALG_CONSTANT  2
339 #define MIB_TCPRTOALG_RSRE      3
340 #define MIB_TCPRTOALG_VANJ      4
341
342 #define MIB_TCPCONNSTATE_CLOSED         1
343 #define MIB_TCPCONNSTATE_LISTEN         2
344 #define MIB_TCPCONNSTATE_SYNSENT        3
345 #define MIB_TCPCONNSTATE_SYNRECEIVED    4
346 #define MIB_TCPCONNSTATE_ESTABLISHED    5
347 #define MIB_TCPCONNSTATE_FINWAIT1       6
348 #define MIB_TCPCONNSTATE_FINWAIT2       7
349 #define MIB_TCPCONNSTATE_CLOSEWAIT      8
350 #define MIB_TCPCONNSTATE_LASTACK        9
351 #define MIB_TCPCONNSTATE_CLOSING        10
352 #define MIB_TCPCONNSTATE_TIMEWAIT       11
353
354 #define MIB_EGPNEIGHSTATE_IDLE          1
355 #define MIB_EGPNEIGHSTATE_AQUISITION    2
356 #define MIB_EGPNEIGHSTATE_DOWN          3
357 #define MIB_EGPNEIGHSTATE_UP            4
358 #define MIB_EGPNEIGHSTATE_CEASE         5
359
360 struct variable_list;
361
362 void print_mib (FILE *);
363 void print_ascii_dump (FILE *);
364 int read_objid (const char *, oid *, size_t *);
365 void register_mib_handlers (void);
366 void init_mib (void);
367 void print_variable (oid *, size_t, struct variable_list *);
368 void fprint_variable (FILE *, oid *, size_t, struct variable_list *);
369 void sprint_variable (char *, oid *, size_t, struct variable_list *);
370 void print_value (oid *, size_t, struct variable_list *);
371 void fprint_value (FILE *, oid *, size_t, struct variable_list *);
372 void sprint_value (char *, oid *, size_t, struct variable_list *);
373 void print_objid (oid *, size_t);
374 void fprint_objid (FILE *, oid *, size_t);
375 char *sprint_objid (char *, oid *, size_t);
376 void print_description (oid *, size_t);
377 void fprint_description (FILE *, oid *, size_t);
378 int get_module_node (const char *, const char *, oid *, size_t *);
379 int get_wild_node(const char *, oid *, size_t *);
380 int get_node (const char *, oid *, size_t *);
381 struct tree *get_symbol (oid *, size_t, struct tree *, char *);
382 struct tree *get_tree (oid *, size_t, struct tree *);
383 struct tree *get_tree_head (void);
384 void  set_function (struct tree *);
385 void sprint_hexstring (char *, const u_char *, size_t);
386 void sprint_asciistring(char *buf, u_char *cp, size_t len);
387
388 void print_oid_report (FILE *);
389 void print_oid_report_enable_labeledoid (void);
390 void print_oid_report_enable_oid (void);
391 void print_oid_report_enable_suffix (void);
392 void print_oid_report_enable_symbolic (void);
393
394 void clear_tree_flags(register struct tree *tp);
395
396 char *snmp_out_toggle_options(char *);
397 void snmp_out_toggle_options_usage(const char *, FILE *);
398 char *snmp_in_toggle_options(char *);
399 void snmp_in_toggle_options_usage(const char *, FILE *);
400
401 #ifdef __cplusplus
402 }
403 #endif
404
405 #endif /* MIB_H */