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