xref: /illumos-gate/usr/src/cmd/picl/plugins/sun4v/lib/snmp/snmplib.h (revision b31b5de1357c915fe7dab4d9646d9d84f9fe69bc)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SNMPLIB_H
28 #define	_SNMPLIB_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #ifdef USE_SOCKETS
35 #include <sys/types.h>
36 #include <sys/socket.h>
37 #include <netinet/in.h>
38 #include <arpa/inet.h>
39 #endif
40 
41 /*
42  * Groups of OIDs are registered with the picl snmp library to provide
43  * the library with a hint as to the set of OIDs to do GETBULK requests
44  */
45 typedef struct oidgroup {
46 	struct oidgroup *next;
47 	char		*oidstrs;
48 	int		n_oids;
49 	int		is_volatile;
50 } oidgroup_t;
51 
52 /*
53  * Private (opaque to clients) handle to manage per-client snmp data
54  */
55 struct picl_snmphdl {
56 	oidgroup_t	*group;
57 #ifdef USE_SOCKETS
58 	struct sockaddr_in	agent_addr;
59 #endif
60 	int		fd;
61 };
62 
63 #define	MIBCACHE_BLK_SZ		256
64 #define	MIBCACHE_BLK_SHIFT	8
65 #define	REFRESHQ_BLK_SZ		256
66 #define	REFRESHQ_BLK_SHIFT	8
67 
68 #define	HRTIME_SCALE		10LL	/* internal time in 10s of seconds */
69 #define	MAX_INCACHE_TIME	(300 / HRTIME_SCALE)
70 #define	MAX_INT_LEN		16	/* #chars to print */
71 
72 #define	DS_SNMP_DRIVER   	"/devices/pseudo/ds_snmp@0:ds_snmp"
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif	/* _SNMPLIB_H */
79