xref: /illumos-gate/usr/src/cmd/picl/plugins/sun4v/lib/snmp/snmplib.h (revision bcd524b5c10222cf2a1ef37ac7ea8bf1baa3a2ee)
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 2007 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #ifdef USE_SOCKETS
37 #include <sys/types.h>
38 #include <sys/socket.h>
39 #include <netinet/in.h>
40 #include <arpa/inet.h>
41 #endif
42 
43 /*
44  * Groups of OIDs are registered with the picl snmp library to provide
45  * the library with a hint as to the set of OIDs to do GETBULK requests
46  */
47 typedef struct oidgroup {
48 	struct oidgroup *next;
49 	char		*oidstrs;
50 	int		n_oids;
51 	int		is_volatile;
52 } oidgroup_t;
53 
54 /*
55  * Private (opaque to clients) handle to manage per-client snmp data
56  */
57 struct picl_snmphdl {
58 	oidgroup_t	*group;
59 #ifdef USE_SOCKETS
60 	struct sockaddr_in	agent_addr;
61 #endif
62 	int		fd;
63 };
64 
65 #define	MIBCACHE_BLK_SZ		256
66 #define	MIBCACHE_BLK_SHIFT	8
67 #define	MAX_INCACHE_TIME	300	/* in secs */
68 #define	MAX_INT_LEN		16	/* #chars to print */
69 
70 #define	DS_SNMP_DRIVER   	"/devices/pseudo/ds_snmp@0:ds_snmp"
71 
72 #ifdef	__cplusplus
73 }
74 #endif
75 
76 #endif	/* _SNMPLIB_H */
77