and added files
[bcm963xx.git] / userapps / opensource / net-snmp / agent / mibgroup / kernel_sunos5.h
1 /*- This is a -*- C -*- compatible header file
2  *
3  * Generic public interface for SUNOS5_INSTRUMENTATION
4  *
5  * This file contains manifest constants (#defines), macros, enumerations,
6  * public structure definitions, static const definitions, global variable
7  * declarations, and function prototypes.
8  *
9  * This file contains types and structures for SunOS 5.x instrumentation
10  *
11  */
12
13 #include <inet/mib2.h>
14
15 #define COPY_IPADDR(fp, from, tp, to)                                   \
16         fp = from;                                                      \
17         tp = to;                                                        \
18         *tp++ = *fp++;                                                  \
19         *tp++ = *fp++;                                                  \
20         *tp++ = *fp++;                                                  \
21         *tp++ = *fp++;
22
23 #ifndef ZZ_SUNOS5_INSTR         /* duplicate include prevention */
24 #define ZZ_SUNOS5_INSTR
25
26
27 /*-
28  * Manifest constants
29  */
30
31 #define KSTAT_DATA_MAX  100     /* Maximum number of kstat entries. To be changed later  */
32 #define MIBCACHE_SIZE   20      /* Number of MIB cache entries */
33
34 /*-
35  * Macros
36  */
37 #define CACHE_MOREDATA  0x001   /* There are unread data outside cache */
38
39 /*-
40  * Enumeration types
41  */
42
43 typedef enum { GET_FIRST, GET_EXACT, GET_NEXT } req_e;
44 typedef enum { FOUND, NOT_FOUND, NEED_NEXT } found_e;
45
46 typedef enum {
47     MIB_SYSTEM = 0,
48     MIB_INTERFACES = 1,
49     MIB_AT = 2,
50     MIB_IP = 3,
51     MIB_IP_ADDR = 4,
52     MIB_IP_ROUTE = 5,
53     MIB_IP_NET = 6,
54     MIB_ICMP = 7,
55     MIB_TCP = 8,
56     MIB_TCP_CONN = 9,
57     MIB_UDP = 10,
58     MIB_UDP_LISTEN = 11,
59     MIB_EGP = 12,
60     MIB_CMOT = 13,
61     MIB_TRANSMISSION = 14,
62     MIB_SNMP = 15
63 } mibgroup_e;
64
65 /*-
66  * Structure definitions (use "typedef struct foo {} foo;" form)
67  */
68
69 /*
70  * MIB-II cache. Simple buffering scheme - last read block is in the cache 
71  */
72
73 typedef struct mibcache {
74     mibgroup_e      cache_groupid;      /* MIB-II group */
75     size_t          cache_size; /* Size of this cache table in bytes */
76     void           *cache_addr; /* Pointer to real cache memory */
77     size_t          cache_length;       /* Useful length in bytes */
78     size_t          cache_ttl;  /* Time this type of cache entry stays valid */
79     time_t          cache_time; /* CURRENT time left for this cache entry */
80     int             cache_flags;        /* Cache state */
81     int             cache_last_found;   /* Index of last cache element that was found */
82     void           *cache_comp; /* Compare routine used to set the cache */
83     void           *cache_arg;  /* Argument for compare routine used to set the cache */
84 } mibcache;
85
86 /*
87  * Mapping between mibgroup_t, mibtable_t and mib2.h defines 
88  */
89
90 typedef struct mibmap {
91     int             group;      /* mib2.h group name */
92     int             table;      /* mib2.h table name */
93 } mibmap;
94
95 /*
96  * Structures, missing in <inet/mib2.h> 
97  */
98 typedef unsigned long TimeTicks;
99
100 typedef struct mib2_ifEntry {
101     int             ifIndex;    /* ifEntry 1 */
102     DeviceName      ifDescr;    /* ifEntry 2 */
103     int             ifType;     /* ifEntry 3 */
104     int             ifMtu;      /* ifEntry 4 */
105     Gauge           ifSpeed;    /* ifEntry 5 */
106     PhysAddress     ifPhysAddress;      /* ifEntry 6 */
107     int             ifAdminStatus;      /* ifEntry 7 */
108     int             ifOperStatus;       /* ifEntry 8 */
109     TimeTicks       ifLastChange;       /* ifEntry 9 */
110     Counter         ifInOctets; /* ifEntry 10 */
111     Counter         ifInUcastPkts;      /* ifEntry 11 */
112     Counter         ifInNUcastPkts;     /* ifEntry 12 */
113     Counter         ifInDiscards;       /* ifEntry 13 */
114     Counter         ifInErrors; /* ifEntry 14 */
115     Counter         ifInUnknownProtos;  /* ifEntry 15 */
116     Counter         ifOutOctets;        /* ifEntry 16 */
117     Counter         ifOutUcastPkts;     /* ifEntry 17 */
118     Counter         ifOutNUcastPkts;    /* ifEntry 18 */
119     Counter         ifOutDiscards;      /* ifEntry 19 */
120     Counter         ifOutErrors;        /* ifEntry 20 */
121     Gauge           ifOutQLen;  /* ifEntry 21 */
122     int             ifSpecific; /* ifEntry 22 */
123 } mib2_ifEntry_t;
124
125 /*-
126  * Static const definitions (must be declared static and initialized)
127  */
128
129
130 /*-
131  * Global variable declarations (using extern and without initialization)
132  */
133
134 /*-
135  * Function prototypes (use void as argument type if there are no arguments)
136  */
137
138 #ifdef _STDC_COMPAT
139 #ifdef __cplusplus
140 extern          "C" {
141 #endif
142 #endif
143     void            init_kernel_sunos5(void);
144
145     int             getKstat(const char *statname, const char *varname,
146                              void *value);
147     int             getMibstat(mibgroup_e grid, void *resp,
148                                size_t entrysize, req_e req_type,
149                                int (*comp) (void *, void *), void *arg);
150     int             Get_everything(void *, void *);
151     int             getKstatInt(const char *classname,
152                                 const char *statname, const char *varname,
153                                 int *value);
154
155 #ifdef _STDC_COMPAT
156 #ifdef __cplusplus
157 }
158 #endif
159 #endif
160 /*-
161  * These variables describe the formatting of this file.  If you don't like the
162  * template defaults, feel free to change them here (not in your .emacs file).
163  *
164  * Local Variables:
165  * comment-column: 32
166  * c-indent-level: 4
167  * c-continued-statement-offset: 4
168  * c-brace-offset: -4
169  * c-argdecl-indent: 0
170  * c-label-offset: -4
171  * fill-column: 79
172  * fill-prefix: " * "
173  * End:
174  */
175 #endif