hyperic-sigar 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +339 -0
- data/EXCEPTIONS +104 -0
- data/README +2 -0
- data/Rakefile +87 -0
- data/bindings/SigarWrapper.pm +2934 -0
- data/bindings/ruby/examples/cpu_info.rb +16 -0
- data/bindings/ruby/examples/df.rb +32 -0
- data/bindings/ruby/examples/free.rb +19 -0
- data/bindings/ruby/examples/ifconfig.rb +67 -0
- data/bindings/ruby/examples/netstat.rb +54 -0
- data/bindings/ruby/examples/pargs.rb +18 -0
- data/bindings/ruby/examples/penv.rb +14 -0
- data/bindings/ruby/examples/route.rb +31 -0
- data/bindings/ruby/examples/who.rb +13 -0
- data/bindings/ruby/extconf.rb +110 -0
- data/bindings/ruby/rbsigar.c +628 -0
- data/include/sigar.h +901 -0
- data/include/sigar_fileinfo.h +141 -0
- data/include/sigar_format.h +65 -0
- data/include/sigar_getline.h +18 -0
- data/include/sigar_log.h +82 -0
- data/include/sigar_private.h +365 -0
- data/include/sigar_ptql.h +55 -0
- data/include/sigar_util.h +192 -0
- data/src/os/aix/aix_sigar.c +1927 -0
- data/src/os/aix/sigar_os.h +71 -0
- data/src/os/darwin/darwin_sigar.c +3450 -0
- data/src/os/darwin/sigar_os.h +82 -0
- data/src/os/hpux/dlpi.c +284 -0
- data/src/os/hpux/hpux_sigar.c +1205 -0
- data/src/os/hpux/sigar_os.h +51 -0
- data/src/os/linux/linux_sigar.c +2595 -0
- data/src/os/linux/sigar_os.h +84 -0
- data/src/os/netware/netware_sigar.c +719 -0
- data/src/os/netware/sigar_os.h +26 -0
- data/src/os/osf1/osf1_sigar.c +593 -0
- data/src/os/osf1/sigar_os.h +42 -0
- data/src/os/solaris/get_mib2.c +321 -0
- data/src/os/solaris/get_mib2.h +127 -0
- data/src/os/solaris/hmekstat.h +77 -0
- data/src/os/solaris/kstats.c +182 -0
- data/src/os/solaris/procfs.c +99 -0
- data/src/os/solaris/sigar_os.h +225 -0
- data/src/os/solaris/solaris_sigar.c +2561 -0
- data/src/os/stub/sigar_os.h +8 -0
- data/src/os/stub/stub_sigar.c +303 -0
- data/src/os/win32/peb.c +213 -0
- data/src/os/win32/sigar_os.h +623 -0
- data/src/os/win32/sigar_pdh.h +49 -0
- data/src/os/win32/win32_sigar.c +3718 -0
- data/src/sigar.c +2292 -0
- data/src/sigar_cache.c +181 -0
- data/src/sigar_fileinfo.c +792 -0
- data/src/sigar_format.c +649 -0
- data/src/sigar_getline.c +1849 -0
- data/src/sigar_ptql.c +1966 -0
- data/src/sigar_signal.c +218 -0
- data/src/sigar_util.c +1061 -0
- data/version.properties +11 -0
- metadata +112 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
3
|
+
* This file is part of SIGAR.
|
4
|
+
*
|
5
|
+
* SIGAR is free software; you can redistribute it and/or modify
|
6
|
+
* it under the terms version 2 of the GNU General Public License as
|
7
|
+
* published by the Free Software Foundation. This program is distributed
|
8
|
+
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
9
|
+
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
10
|
+
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
11
|
+
* details.
|
12
|
+
*
|
13
|
+
* You should have received a copy of the GNU General Public License
|
14
|
+
* along with this program; if not, write to the Free Software
|
15
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
16
|
+
* USA.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#ifndef SIGAR_OS_H
|
20
|
+
#define SIGAR_OS_H
|
21
|
+
|
22
|
+
#include <sys/table.h>
|
23
|
+
/* "i will *punch* you in the *face*" --will ferrell */
|
24
|
+
#undef idle
|
25
|
+
#undef usr
|
26
|
+
#undef sys
|
27
|
+
|
28
|
+
#include <errno.h>
|
29
|
+
#include <sys/vm.h>
|
30
|
+
|
31
|
+
#include <mach.h>
|
32
|
+
#include <mach/mach_types.h>
|
33
|
+
#include <mach/vm_statistics.h>
|
34
|
+
|
35
|
+
struct sigar_t {
|
36
|
+
SIGAR_T_BASE;
|
37
|
+
int pagesize;
|
38
|
+
int mhz;
|
39
|
+
int nproc;
|
40
|
+
};
|
41
|
+
|
42
|
+
#endif /* SIGAR_OS_H */
|
@@ -0,0 +1,321 @@
|
|
1
|
+
/*
|
2
|
+
* get_mib2() -- get MIB2 information from Solaris 2.[3-7] kernel
|
3
|
+
*
|
4
|
+
* V. Abell <abe@cc.purdue.edu>
|
5
|
+
* Purdue University Computing Center
|
6
|
+
*/
|
7
|
+
|
8
|
+
|
9
|
+
/*
|
10
|
+
* Copyright 1995 Purdue Research Foundation, West Lafayette, Indiana
|
11
|
+
* 47907. All rights reserved.
|
12
|
+
*
|
13
|
+
* Written by Victor A. Abell <abe@cc.purdue.edu>
|
14
|
+
*
|
15
|
+
* This software is not subject to any license of the American Telephone
|
16
|
+
* and Telegraph Company or the Regents of the University of California.
|
17
|
+
*
|
18
|
+
* Permission is granted to anyone to use this software for any purpose on
|
19
|
+
* any computer system, and to alter it and redistribute it freely, subject
|
20
|
+
* to the following restrictions:
|
21
|
+
*
|
22
|
+
* 1. Neither Victor A Abell nor Purdue University are responsible for
|
23
|
+
* any consequences of the use of this software.
|
24
|
+
*
|
25
|
+
* 2. The origin of this software must not be misrepresented, either by
|
26
|
+
* explicit claim or by omission. Credit to Victor A. Abell and Purdue
|
27
|
+
* University must appear in documentation and sources.
|
28
|
+
*
|
29
|
+
* 3. Altered versions must be plainly marked as such, and must not be
|
30
|
+
* misrepresented as being the original software.
|
31
|
+
*
|
32
|
+
* 4. This notice may not be removed or altered.
|
33
|
+
*/
|
34
|
+
|
35
|
+
/*
|
36
|
+
* Altered for sigar:
|
37
|
+
* - remove static stuff to make thread-safe by Doug MacEachern (3/11/05)
|
38
|
+
*/
|
39
|
+
|
40
|
+
#if 0 /*ndef lint -Wall -Werror*/
|
41
|
+
static char copyright[] =
|
42
|
+
"@(#) Copyright 1995 Purdue Research Foundation.\nAll rights reserved.\n";
|
43
|
+
#endif
|
44
|
+
|
45
|
+
#include "get_mib2.h"
|
46
|
+
|
47
|
+
#include <errno.h>
|
48
|
+
#include <fcntl.h>
|
49
|
+
#include <stdio.h>
|
50
|
+
#include <stdlib.h>
|
51
|
+
#include <string.h>
|
52
|
+
#include <unistd.h>
|
53
|
+
|
54
|
+
#ifdef DMALLOC
|
55
|
+
#include <dmalloc.h>
|
56
|
+
#endif
|
57
|
+
|
58
|
+
/*
|
59
|
+
* close_mib2() - close MIB2 access
|
60
|
+
*
|
61
|
+
* return:
|
62
|
+
*
|
63
|
+
* exit = GET_MIB2_OK if close succeeded
|
64
|
+
* GET_MIB2_* is the error code.
|
65
|
+
*/
|
66
|
+
|
67
|
+
int
|
68
|
+
close_mib2(solaris_mib2_t *mib2)
|
69
|
+
{
|
70
|
+
if (mib2->sd < 0) {
|
71
|
+
(void) strcpy(mib2->errmsg, "close_mib2: socket not open");
|
72
|
+
return(GET_MIB2_ERR_NOTOPEN);
|
73
|
+
}
|
74
|
+
if (close(mib2->sd)) {
|
75
|
+
(void) sprintf(mib2->errmsg, "close_mib2: %s", strerror(errno));
|
76
|
+
return(GET_MIB2_ERR_CLOSE);
|
77
|
+
}
|
78
|
+
mib2->sd = -1;
|
79
|
+
if (mib2->db_len && mib2->db) {
|
80
|
+
mib2->db_len = 0;
|
81
|
+
free((void *)mib2->db);
|
82
|
+
mib2->db = NULL;
|
83
|
+
}
|
84
|
+
if (mib2->smb_len && mib2->smb) {
|
85
|
+
mib2->smb_len = 0;
|
86
|
+
free((void *)mib2->smb);
|
87
|
+
mib2->smb = NULL;
|
88
|
+
}
|
89
|
+
return(GET_MIB2_OK);
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
/*
|
94
|
+
* get_mib2() - get MIB2 data
|
95
|
+
*
|
96
|
+
* return:
|
97
|
+
*
|
98
|
+
* exit = GET_MIB2_OK if get succeeded, and:
|
99
|
+
* *opt = opthdr structure address
|
100
|
+
* *data = data buffer address
|
101
|
+
* *datalen = size of data buffer
|
102
|
+
* GET_MIB2_* is the error code for failure.
|
103
|
+
*/
|
104
|
+
|
105
|
+
int
|
106
|
+
get_mib2(solaris_mib2_t *mib2,
|
107
|
+
struct opthdr **opt,
|
108
|
+
char **data,
|
109
|
+
int *datalen)
|
110
|
+
{
|
111
|
+
struct strbuf d; /* streams data buffer */
|
112
|
+
int err; /* error code */
|
113
|
+
int f; /* flags */
|
114
|
+
int rc; /* reply code */
|
115
|
+
|
116
|
+
/*
|
117
|
+
* If MIB2 access isn't open, open it and issue the preliminary stream
|
118
|
+
* messages.
|
119
|
+
*/
|
120
|
+
if (mib2->sd < 0) {
|
121
|
+
/*
|
122
|
+
* Open access. Return on error.
|
123
|
+
*/
|
124
|
+
if ((err = open_mib2(mib2))) {
|
125
|
+
return(err);
|
126
|
+
}
|
127
|
+
/*
|
128
|
+
* Set up message request and option.
|
129
|
+
*/
|
130
|
+
mib2->req = (struct T_optmgmt_req *)mib2->smb;
|
131
|
+
mib2->op = (struct opthdr *)&mib2->smb[sizeof(struct T_optmgmt_req)];
|
132
|
+
mib2->req->PRIM_type = T_OPTMGMT_REQ;
|
133
|
+
mib2->req->OPT_offset = sizeof(struct T_optmgmt_req);
|
134
|
+
mib2->req->OPT_length = sizeof(struct opthdr);
|
135
|
+
|
136
|
+
#if defined(MI_T_CURRENT)
|
137
|
+
mib2->req->MGMT_flags = MI_T_CURRENT;
|
138
|
+
#else /* !defined(MI_T_CURRENT) */
|
139
|
+
# if defined(T_CURRENT)
|
140
|
+
mib2->req->MGMT_flags = T_CURRENT;
|
141
|
+
# else /* !defined(T_CURRENT) */
|
142
|
+
#error "Neither MI_T_CURRENT nor T_CURRENT are defined."
|
143
|
+
# endif /* defined(T_CURRENT) */
|
144
|
+
#endif /* defined(MI_T_CURRENT) */
|
145
|
+
|
146
|
+
mib2->op->level = MIB2_IP;
|
147
|
+
mib2->op->name = mib2->op->len = 0;
|
148
|
+
mib2->ctlbuf.buf = mib2->smb;
|
149
|
+
mib2->ctlbuf.len = mib2->req->OPT_offset + mib2->req->OPT_length;
|
150
|
+
/*
|
151
|
+
* Put the message.
|
152
|
+
*/
|
153
|
+
if (putmsg(mib2->sd, &mib2->ctlbuf, (struct strbuf *)NULL, 0) == -1) {
|
154
|
+
(void) sprintf(mib2->errmsg,
|
155
|
+
"get_mib2: putmsg request: %s", strerror(errno));
|
156
|
+
return(GET_MIB2_ERR_PUTMSG);
|
157
|
+
}
|
158
|
+
/*
|
159
|
+
* Set up to process replies.
|
160
|
+
*/
|
161
|
+
mib2->op_ack = (struct T_optmgmt_ack *)mib2->smb;
|
162
|
+
mib2->ctlbuf.maxlen = mib2->smb_len;
|
163
|
+
mib2->err_ack = (struct T_error_ack *)mib2->smb;
|
164
|
+
mib2->op = (struct opthdr *)&mib2->smb[sizeof(struct T_optmgmt_ack)];
|
165
|
+
}
|
166
|
+
/*
|
167
|
+
* Get the next (first) reply message.
|
168
|
+
*/
|
169
|
+
f = 0;
|
170
|
+
if ((rc = getmsg(mib2->sd, &mib2->ctlbuf, NULL, &f)) < 0) {
|
171
|
+
(void) sprintf(mib2->errmsg, "get_mib2: getmsg(reply): %s",
|
172
|
+
strerror(errno));
|
173
|
+
return(GET_MIB2_ERR_GETMSGR);
|
174
|
+
}
|
175
|
+
/*
|
176
|
+
* Check for end of data.
|
177
|
+
*/
|
178
|
+
if (rc == 0
|
179
|
+
&& mib2->ctlbuf.len >= sizeof(struct T_optmgmt_ack)
|
180
|
+
&& mib2->op_ack->PRIM_type == T_OPTMGMT_ACK
|
181
|
+
&& mib2->op_ack->MGMT_flags == T_SUCCESS
|
182
|
+
&& mib2->op->len == 0)
|
183
|
+
{
|
184
|
+
err = close_mib2(mib2);
|
185
|
+
if (err) {
|
186
|
+
return(err);
|
187
|
+
}
|
188
|
+
return(GET_MIB2_EOD);
|
189
|
+
}
|
190
|
+
/*
|
191
|
+
* Check for error.
|
192
|
+
*/
|
193
|
+
if (mib2->ctlbuf.len >= sizeof(struct T_error_ack)
|
194
|
+
&& mib2->err_ack->PRIM_type == T_ERROR_ACK)
|
195
|
+
{
|
196
|
+
(void) sprintf(mib2->errmsg,
|
197
|
+
"get_mib2: T_ERROR_ACK: len=%d, TLI=%#x, UNIX=%#x",
|
198
|
+
mib2->ctlbuf.len,
|
199
|
+
(int)mib2->err_ack->TLI_error,
|
200
|
+
(int)mib2->err_ack->UNIX_error);
|
201
|
+
return(GET_MIB2_ERR_ACK);
|
202
|
+
}
|
203
|
+
/*
|
204
|
+
* Check for no data.
|
205
|
+
*/
|
206
|
+
if (rc != MOREDATA
|
207
|
+
|| mib2->ctlbuf.len < sizeof(struct T_optmgmt_ack)
|
208
|
+
|| mib2->op_ack->PRIM_type != T_OPTMGMT_ACK
|
209
|
+
|| mib2->op_ack->MGMT_flags != T_SUCCESS)
|
210
|
+
{
|
211
|
+
(void) sprintf(mib2->errmsg,
|
212
|
+
"get_mib2: T_OPTMGMT_ACK: "
|
213
|
+
"rc=%d len=%d type=%#x flags=%#x",
|
214
|
+
rc, mib2->ctlbuf.len,
|
215
|
+
(int)mib2->op_ack->PRIM_type,
|
216
|
+
(int)mib2->op_ack->MGMT_flags);
|
217
|
+
return(GET_MIB2_ERR_NODATA);
|
218
|
+
}
|
219
|
+
/*
|
220
|
+
* Allocate (or enlarge) the data buffer.
|
221
|
+
*/
|
222
|
+
if (mib2->op->len >= mib2->db_len) {
|
223
|
+
mib2->db_len = mib2->op->len;
|
224
|
+
if (mib2->db == NULL) {
|
225
|
+
mib2->db = (char *)malloc(mib2->db_len);
|
226
|
+
}
|
227
|
+
else {
|
228
|
+
mib2->db = (char *)realloc(mib2->db, mib2->db_len);
|
229
|
+
}
|
230
|
+
if (mib2->db == NULL) {
|
231
|
+
(void) sprintf(mib2->errmsg,
|
232
|
+
"get_mib2: no space for %d byte data buffer",
|
233
|
+
mib2->db_len);
|
234
|
+
return(GET_MIB2_ERR_NOSPC);
|
235
|
+
}
|
236
|
+
}
|
237
|
+
/*
|
238
|
+
* Get the data part of the message -- the MIB2 part.
|
239
|
+
*/
|
240
|
+
d.maxlen = mib2->op->len;
|
241
|
+
d.buf = mib2->db;
|
242
|
+
d.len = 0;
|
243
|
+
f = 0;
|
244
|
+
if ((rc = getmsg(mib2->sd, NULL, &d, &f)) < 0) {
|
245
|
+
(void) sprintf(mib2->errmsg, "get_mib2: getmsg(data): %s",
|
246
|
+
strerror(errno));
|
247
|
+
return(GET_MIB2_ERR_GETMSGD);
|
248
|
+
}
|
249
|
+
if (rc) {
|
250
|
+
(void) sprintf(mib2->errmsg,
|
251
|
+
"get_mib2: getmsg(data): rc=%d maxlen=%d len=%d: %s",
|
252
|
+
rc, d.maxlen, d.len, strerror(errno));
|
253
|
+
return(GET_MIB2_ERR_GETMSGD);
|
254
|
+
}
|
255
|
+
/*
|
256
|
+
* Compose a successful return.
|
257
|
+
*/
|
258
|
+
*opt = mib2->op;
|
259
|
+
*data = mib2->db;
|
260
|
+
*datalen = d.len;
|
261
|
+
return(GET_MIB2_OK);
|
262
|
+
}
|
263
|
+
|
264
|
+
|
265
|
+
/*
|
266
|
+
* open_mib2() - open access to MIB2 data
|
267
|
+
*
|
268
|
+
* return:
|
269
|
+
*
|
270
|
+
* exit = GET_MIB2_OK if open succeeded
|
271
|
+
* GET_MIB2_* is the error code for failure.
|
272
|
+
*/
|
273
|
+
|
274
|
+
int
|
275
|
+
open_mib2(solaris_mib2_t *mib2)
|
276
|
+
{
|
277
|
+
/*
|
278
|
+
* It's an error if the stream device is already open.
|
279
|
+
*/
|
280
|
+
if (mib2->sd >= 0) {
|
281
|
+
(void) strcpy(mib2->errmsg, "open_mib2: MIB2 access already open");
|
282
|
+
return(GET_MIB2_ERR_OPEN);
|
283
|
+
}
|
284
|
+
/*
|
285
|
+
* Open the ARP stream device, push TCP and UDP on it.
|
286
|
+
*/
|
287
|
+
if ((mib2->sd = open(GET_MIB2_ARPDEV, O_RDWR, 0600)) < 0) {
|
288
|
+
(void) sprintf(mib2->errmsg, "open_mib2: %s: %s", GET_MIB2_ARPDEV,
|
289
|
+
strerror(errno));
|
290
|
+
return(GET_MIB2_ERR_ARPOPEN);
|
291
|
+
}
|
292
|
+
if (ioctl(mib2->sd, I_PUSH, GET_MIB2_TCPSTREAM) == -1) {
|
293
|
+
(void) sprintf(mib2->errmsg, "open_mib2: push %s: %s",
|
294
|
+
GET_MIB2_TCPSTREAM, strerror(errno));
|
295
|
+
return(GET_MIB2_ERR_TCPPUSH);
|
296
|
+
}
|
297
|
+
if (ioctl(mib2->sd, I_PUSH, GET_MIB2_UDPSTREAM) == -1) {
|
298
|
+
(void) sprintf(mib2->errmsg, "open_mib2: push %s: %s",
|
299
|
+
GET_MIB2_UDPSTREAM, strerror(errno));
|
300
|
+
return(GET_MIB2_ERR_UDPPUSH);
|
301
|
+
}
|
302
|
+
/*
|
303
|
+
* Allocate a stream message buffer.
|
304
|
+
*/
|
305
|
+
mib2->smb_len = sizeof(struct opthdr) + sizeof(struct T_optmgmt_req);
|
306
|
+
if (mib2->smb_len < (sizeof (struct opthdr) + sizeof(struct T_optmgmt_ack))) {
|
307
|
+
mib2->smb_len = sizeof (struct opthdr) + sizeof(struct T_optmgmt_ack);
|
308
|
+
}
|
309
|
+
if (mib2->smb_len < sizeof(struct T_error_ack)) {
|
310
|
+
mib2->smb_len = sizeof(struct T_error_ack);
|
311
|
+
}
|
312
|
+
if ((mib2->smb = (char *)malloc(mib2->smb_len)) == NULL) {
|
313
|
+
(void) strcpy(mib2->errmsg,
|
314
|
+
"open_mib2: no space for stream message buffer");
|
315
|
+
return(GET_MIB2_ERR_NOSPC);
|
316
|
+
}
|
317
|
+
/*
|
318
|
+
* All is OK. Return that indication.
|
319
|
+
*/
|
320
|
+
return(GET_MIB2_OK);
|
321
|
+
}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
/*
|
2
|
+
* get_mib2.h -- definitions for the get_mib2() function
|
3
|
+
*
|
4
|
+
* V. Abell <abe@cc.purdue.edu>
|
5
|
+
* Purdue University Computing Center
|
6
|
+
*/
|
7
|
+
|
8
|
+
|
9
|
+
/*
|
10
|
+
* Copyright 1995 Purdue Research Foundation, West Lafayette, Indiana
|
11
|
+
* 47907. All rights reserved.
|
12
|
+
*
|
13
|
+
* Written by Victor A. Abell <abe@cc.purdue.edu>
|
14
|
+
*
|
15
|
+
* This software is not subject to any license of the American Telephone
|
16
|
+
* and Telegraph Company or the Regents of the University of California.
|
17
|
+
*
|
18
|
+
* Permission is granted to anyone to use this software for any purpose on
|
19
|
+
* any computer system, and to alter it and redistribute it freely, subject
|
20
|
+
* to the following restrictions:
|
21
|
+
*
|
22
|
+
* 1. Neither Victor A Abell nor Purdue University are responsible for
|
23
|
+
* any consequences of the use of this software.
|
24
|
+
*
|
25
|
+
* 2. The origin of this software must not be misrepresented, either by
|
26
|
+
* explicit claim or by omission. Credit to Victor A. Abell and Purdue
|
27
|
+
* University must appear in documentation and sources.
|
28
|
+
*
|
29
|
+
* 3. Altered versions must be plainly marked as such, and must not be
|
30
|
+
* misrepresented as being the original software.
|
31
|
+
*
|
32
|
+
* 4. This notice may not be removed or altered.
|
33
|
+
*/
|
34
|
+
|
35
|
+
/*
|
36
|
+
* Altered for sigar:
|
37
|
+
* - remove static stuff to make thread-safe by Doug MacEachern (3/11/05)
|
38
|
+
*/
|
39
|
+
|
40
|
+
#if !defined(GET_MIB2_H)
|
41
|
+
#define GET_MIB2_H
|
42
|
+
|
43
|
+
|
44
|
+
/*
|
45
|
+
* Required header files
|
46
|
+
*/
|
47
|
+
|
48
|
+
#include <stropts.h>
|
49
|
+
#include <sys/types.h>
|
50
|
+
#include <sys/socket.h>
|
51
|
+
#include <sys/stream.h>
|
52
|
+
#include <sys/tihdr.h>
|
53
|
+
#include <sys/tiuser.h>
|
54
|
+
#include <inet/mib2.h>
|
55
|
+
#include <inet/led.h>
|
56
|
+
|
57
|
+
|
58
|
+
/*
|
59
|
+
* Miscellaneous definitions
|
60
|
+
*/
|
61
|
+
|
62
|
+
#define GET_MIB2_ARPDEV "/dev/arp" /* ARP stream devi9ce */
|
63
|
+
#define GET_MIB2_ERRMSGL 1024 /* ErrMsg buffer length */
|
64
|
+
#define GET_MIB2_TCPSTREAM "tcp" /* TCP stream name */
|
65
|
+
#define GET_MIB2_UDPSTREAM "udp" /* UDP stream name */
|
66
|
+
|
67
|
+
|
68
|
+
/*
|
69
|
+
* get_mib2() response codes
|
70
|
+
*
|
71
|
+
* -1 End of MIB2 information
|
72
|
+
* 0 Next MIB2 structure returned
|
73
|
+
* >0 Error code
|
74
|
+
*/
|
75
|
+
|
76
|
+
#define GET_MIB2_EOD -1 /* end of data */
|
77
|
+
#define GET_MIB2_OK 0 /* function succeeded */
|
78
|
+
#define GET_MIB2_ERR_ACK 1 /* getmsg() ACK error received */
|
79
|
+
#define GET_MIB2_ERR_ARPOPEN 2 /* error opening ARPDEV */
|
80
|
+
#define GET_MIB2_ERR_CLOSE 3 /* MIB2 access close error */
|
81
|
+
#define GET_MIB2_ERR_GETMSGD 4 /* error getting message data */
|
82
|
+
#define GET_MIB2_ERR_GETMSGR 5 /* error getting message reply */
|
83
|
+
#define GET_MIB2_ERR_NODATA 6 /* data expected; not received */
|
84
|
+
#define GET_MIB2_ERR_NOSPC 7 /* no malloc() space */
|
85
|
+
#define GET_MIB2_ERR_NOTOPEN 8 /* MIB2 access not open */
|
86
|
+
#define GET_MIB2_ERR_OPEN 9 /* MIB2 access open error */
|
87
|
+
#define GET_MIB2_ERR_PUTMSG 10 /* error putting request message */
|
88
|
+
#define GET_MIB2_ERR_TCPPUSH 11 /* error pushing TCPSTREAM */
|
89
|
+
#define GET_MIB2_ERR_UDPPUSH 12 /* error pushing UDPSTREAM */
|
90
|
+
|
91
|
+
#define GET_MIB2_ERR_MAX 13 /* maximum error number + 1 */
|
92
|
+
|
93
|
+
|
94
|
+
typedef struct {
|
95
|
+
char *db; /* data buffer */
|
96
|
+
int db_len; /* data buffer length */
|
97
|
+
char *smb; /* stream message buffer */
|
98
|
+
size_t smb_len; /* size of Smb[] */
|
99
|
+
int sd; /* stream device descriptor */
|
100
|
+
char errmsg[GET_MIB2_ERRMSGL]; /* error message buffer */
|
101
|
+
struct T_optmgmt_ack *op_ack; /* message ACK pointer */
|
102
|
+
struct strbuf ctlbuf; /* streams control buffer */
|
103
|
+
struct T_error_ack *err_ack; /* message error pointer */
|
104
|
+
struct opthdr *op; /* message option pointer */
|
105
|
+
struct T_optmgmt_req *req; /* message request pointer */
|
106
|
+
} solaris_mib2_t;
|
107
|
+
|
108
|
+
/*
|
109
|
+
* Function prototypes
|
110
|
+
*/
|
111
|
+
|
112
|
+
int close_mib2( /* close acccess to MIB2 information */
|
113
|
+
solaris_mib2_t *mib2
|
114
|
+
);
|
115
|
+
int get_mib2( /* get MIB2 information */
|
116
|
+
solaris_mib2_t *mib2,
|
117
|
+
struct opthdr **opt, /* opthdr pointer return (see
|
118
|
+
* <sys/socket.h> */
|
119
|
+
char **data, /* data buffer return address */
|
120
|
+
int *datalen /* data buffer length return
|
121
|
+
* address */
|
122
|
+
);
|
123
|
+
int open_mib2( /* open acccess to MIB2 information */
|
124
|
+
solaris_mib2_t *mib2
|
125
|
+
);
|
126
|
+
|
127
|
+
#endif /* !defined(GET_MIB2_H) */
|