Debian Codegraph @

agent/mibgroup/kernel_sunos5.h

raw
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 #ifndef _KERNEL_SUNOS5_H /* duplicate include prevention */
14 #define _KERNEL_SUNOS5_H
15
16 #include <inet/mib2.h>
17
18 #ifndef HAVE_COUNTER64
19 typedef uint64_t Counter64;
20 #endif
21
22 #define COPY_IPADDR(fp, from, tp, to) \
23 fp = from; \
24 tp = to; \
25 *tp++ = *fp++; \
26 *tp++ = *fp++; \
27 *tp++ = *fp++; \
28 *tp++ = *fp++;
29
30 #ifdef MIB2_IP_TRAFFIC_STATS
31 #define SOLARIS_HAVE_RFC4293_SUPPORT
32 #endif
33
34 #ifdef MIB2_IP6
35 #define SOLARIS_HAVE_IPV6_MIB_SUPPORT
36 #endif
37
38 /*-
39 * Manifest constants
40 */
41
42 #define KSTAT_DATA_MAX 100 /* Maximum number of kstat entries. To be changed later */
43
44 /*-
45 * Macros
46 */
47 #define CACHE_MOREDATA 0x001 /* There are unread data outside cache */
48
49 /*-
50 * Enumeration types
51 */
52
53 typedef enum { GET_FIRST, GET_EXACT, GET_NEXT } req_e;
54 typedef enum { FOUND, NOT_FOUND, NEED_NEXT } found_e;
55
56 typedef enum {
57 MIB_SYSTEM = 0,
58 MIB_INTERFACES = 1,
59 MIB_AT = 2,
60 MIB_IP = 3,
61 MIB_IP_ADDR = 4,
62 MIB_IP_ROUTE = 5,
63 MIB_IP_NET = 6,
64 MIB_ICMP = 7,
65 MIB_TCP = 8,
66 MIB_TCP_CONN = 9,
67 MIB_UDP = 10,
68 MIB_UDP_LISTEN = 11,
69 MIB_EGP = 12,
70 MIB_CMOT = 13,
71 MIB_TRANSMISSION = 14,
72 MIB_SNMP = 15,
73 #ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
74 #ifdef SOLARIS_HAVE_RFC4293_SUPPORT
75 MIB_IP_TRAFFIC_STATS,
76 #endif
77 MIB_IP6,
78 MIB_IP6_ADDR,
79 MIB_IP6_ROUTE,
80 MIB_ICMP6,
81 MIB_TCP6_CONN,
82 MIB_UDP6_ENDPOINT,
83 #endif
84 #ifdef MIB2_SCTP
85 MIB_SCTP,
86 MIB_SCTP_CONN,
87 MIB_SCTP_CONN_LOCAL,
88 MIB_SCTP_CONN_REMOTE,
89 #endif
90 MIBCACHE_SIZE
91 } mibgroup_e;
92
93 /*-
94 * Structure definitions (use "typedef struct foo {} foo;" form)
95 */
96
97 /*
98 * MIB-II cache. Simple buffering scheme - last read block is in the cache
99 */
100
101 typedef struct mibcache {
102 mibgroup_e cache_groupid; /* MIB-II group */
103 size_t cache_size; /* Size of this cache table in bytes */
104 void *cache_addr; /* Pointer to real cache memory */
105 size_t cache_length; /* Useful length in bytes */
106 size_t cache_ttl; /* Time this type of cache entry stays valid */
107 time_t cache_time; /* CURRENT time left for this cache entry */
108 int cache_flags; /* Cache state */
109 int cache_last_found; /* Index of last cache element that was found */
110 void *cache_comp; /* Compare routine used to set the cache */
111 void *cache_arg; /* Argument for compare routine used to set the cache */
112 } mibcache;
113
114 /*
115 * Mapping between mibgroup_t, mibtable_t and mib2.h defines
116 */
117
118 typedef struct mibmap {
119 int group; /* mib2.h group name */
120 int table; /* mib2.h table name */
121 } mibmap;
122
123 /*
124 * Structures, missing in <inet/mib2.h>
125 */
126 typedef unsigned long TimeTicks;
127
128 typedef struct mib2_ifEntry {
129 unsigned int ifIndex; /* ifEntry 1 */
130 DeviceName ifDescr; /* ifEntry 2 */
131 unsigned int ifType; /* ifEntry 3 */
132 unsigned int ifMtu; /* ifEntry 4 */
133 int ifSpeed; /* ifEntry 5 */
134 PhysAddress ifPhysAddress; /* ifEntry 6 */
135 unsigned int ifAdminStatus; /* ifEntry 7 */
136 unsigned int ifOperStatus; /* ifEntry 8 */
137 TimeTicks ifLastChange; /* ifEntry 9 */
138 int ifInOctets; /* ifEntry 10 */
139 int ifInUcastPkts; /* ifEntry 11 */
140 int ifInNUcastPkts; /* ifEntry 12 */
141 int ifInDiscards; /* ifEntry 13 */
142 int ifInErrors; /* ifEntry 14 */
143 int ifInUnknownProtos; /* ifEntry 15 */
144 int ifOutOctets; /* ifEntry 16 */
145 int ifOutUcastPkts; /* ifEntry 17 */
146 int ifOutNUcastPkts; /* ifEntry 18 */
147 int ifOutDiscards; /* ifEntry 19 */
148 int ifOutErrors; /* ifEntry 20 */
149 Gauge ifOutQLen; /* ifEntry 21 */
150 unsigned int ifSpecific; /* ifEntry 22 */
151
152 /*
153 * Support ifXTable.
154 */
155 Counter64 ifHCInOctets;
156 Counter64 ifHCInUcastPkts;
157 Counter64 ifHCInMulticastPkts;
158 Counter64 ifHCInBroadcastPkts;
159 Counter64 ifHCOutOctets;
160 Counter64 ifHCOutUcastPkts;
161 Counter64 ifHCOutMulticastPkts;
162 Counter64 ifHCOutBroadcastPkts;
163
164 /*
165 * Counters not part of ifTable or ifXTable
166 */
167 int ifCollisions;
168 int flags; /* interface flags (IFF_*) */
169
170 Gauge ifHighSpeed;
171 } mib2_ifEntry_t;
172
173 /*-
174 * Static const definitions (must be declared static and initialized)
175 */
176
177
178 /*-
179 * Global variable declarations (using extern and without initialization)
180 */
181
182 /*-
183 * Function prototypes (use void as argument type if there are no arguments)
184 */
185
186 #ifdef _STDC_COMPAT
187 #ifdef __cplusplus
188 extern "C" {
189 #endif
190 #endif
191 void init_kernel_sunos5(void);
192
193 int getKstat(const char *statname, const char *varname,
194 void *value);
195 int getMibstat(mibgroup_e grid, void *resp,
196 size_t entrysize, req_e req_type,
197 int (*comp) (void *, void *), void *arg);
198 int Get_everything(void *, void *);
199 int getKstatInt(const char *classname,
200 const char *statname, const char *varname,
201 int *value);
202
203 int getKstatString(const char *statname, const char *varname,
204 char *value, size_t value_len);
205
206 int solaris2_if_nametoindex(const char *, int);
207
208 #ifdef _STDC_COMPAT
209 #ifdef __cplusplus
210 }
211 #endif
212 #endif
213 #endif