xref: /onnv-gate/usr/src/cmd/picl/plugins/sun4v/lib/snmp/snmplib.h (revision 7746:222587546619)
13941Svenki /*
23941Svenki  * CDDL HEADER START
33941Svenki  *
43941Svenki  * The contents of this file are subject to the terms of the
53941Svenki  * Common Development and Distribution License (the "License").
63941Svenki  * You may not use this file except in compliance with the License.
73941Svenki  *
83941Svenki  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93941Svenki  * or http://www.opensolaris.org/os/licensing.
103941Svenki  * See the License for the specific language governing permissions
113941Svenki  * and limitations under the License.
123941Svenki  *
133941Svenki  * When distributing Covered Code, include this CDDL HEADER in each
143941Svenki  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153941Svenki  * If applicable, add the following below this CDDL HEADER, with the
163941Svenki  * fields enclosed by brackets "[]" replaced with your own identifying
173941Svenki  * information: Portions Copyright [yyyy] [name of copyright owner]
183941Svenki  *
193941Svenki  * CDDL HEADER END
203941Svenki  */
213941Svenki 
223941Svenki /*
23*7746SKelly.Moyer@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
243941Svenki  * Use is subject to license terms.
253941Svenki  */
263941Svenki 
273941Svenki #ifndef	_SNMPLIB_H
283941Svenki #define	_SNMPLIB_H
293941Svenki 
303941Svenki #ifdef	__cplusplus
313941Svenki extern "C" {
323941Svenki #endif
333941Svenki 
343941Svenki #ifdef USE_SOCKETS
353941Svenki #include <sys/types.h>
363941Svenki #include <sys/socket.h>
373941Svenki #include <netinet/in.h>
383941Svenki #include <arpa/inet.h>
393941Svenki #endif
403941Svenki 
413941Svenki /*
423941Svenki  * Groups of OIDs are registered with the picl snmp library to provide
433941Svenki  * the library with a hint as to the set of OIDs to do GETBULK requests
443941Svenki  */
453941Svenki typedef struct oidgroup {
463941Svenki 	struct oidgroup *next;
473941Svenki 	char		*oidstrs;
483941Svenki 	int		n_oids;
493941Svenki 	int		is_volatile;
503941Svenki } oidgroup_t;
513941Svenki 
523941Svenki /*
533941Svenki  * Private (opaque to clients) handle to manage per-client snmp data
543941Svenki  */
553941Svenki struct picl_snmphdl {
563941Svenki 	oidgroup_t	*group;
573941Svenki #ifdef USE_SOCKETS
583941Svenki 	struct sockaddr_in	agent_addr;
593941Svenki #endif
603941Svenki 	int		fd;
613941Svenki };
623941Svenki 
633941Svenki #define	MIBCACHE_BLK_SZ		256
643941Svenki #define	MIBCACHE_BLK_SHIFT	8
65*7746SKelly.Moyer@Sun.COM #define	REFRESHQ_BLK_SZ		256
66*7746SKelly.Moyer@Sun.COM #define	REFRESHQ_BLK_SHIFT	8
67*7746SKelly.Moyer@Sun.COM 
68*7746SKelly.Moyer@Sun.COM #define	HRTIME_SCALE		10LL	/* internal time in 10s of seconds */
69*7746SKelly.Moyer@Sun.COM #define	MAX_INCACHE_TIME	(300 / HRTIME_SCALE)
703941Svenki #define	MAX_INT_LEN		16	/* #chars to print */
713941Svenki 
723941Svenki #define	DS_SNMP_DRIVER   	"/devices/pseudo/ds_snmp@0:ds_snmp"
733941Svenki 
743941Svenki #ifdef	__cplusplus
753941Svenki }
763941Svenki #endif
773941Svenki 
783941Svenki #endif	/* _SNMPLIB_H */
79