|
Packit |
fcad23 |
/*- This is a -*- C -*- compatible header file
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* Generic public interface for SUNOS5_INSTRUMENTATION
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* This file contains manifest constants (#defines), macros, enumerations,
|
|
Packit |
fcad23 |
* public structure definitions, static const definitions, global variable
|
|
Packit |
fcad23 |
* declarations, and function prototypes.
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
* This file contains types and structures for SunOS 5.x instrumentation
|
|
Packit |
fcad23 |
*
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#ifndef _KERNEL_SUNOS5_H /* duplicate include prevention */
|
|
Packit |
fcad23 |
#define _KERNEL_SUNOS5_H
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#include <inet/mib2.h>
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#ifndef HAVE_COUNTER64
|
|
Packit |
fcad23 |
typedef uint64_t Counter64;
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#define COPY_IPADDR(fp, from, tp, to) \
|
|
Packit |
fcad23 |
fp = from; \
|
|
Packit |
fcad23 |
tp = to; \
|
|
Packit |
fcad23 |
*tp++ = *fp++; \
|
|
Packit |
fcad23 |
*tp++ = *fp++; \
|
|
Packit |
fcad23 |
*tp++ = *fp++; \
|
|
Packit |
fcad23 |
*tp++ = *fp++;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#ifdef MIB2_IP_TRAFFIC_STATS
|
|
Packit |
fcad23 |
#define SOLARIS_HAVE_RFC4293_SUPPORT
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#ifdef MIB2_IP6
|
|
Packit |
fcad23 |
#define SOLARIS_HAVE_IPV6_MIB_SUPPORT
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*-
|
|
Packit |
fcad23 |
* Manifest constants
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#define KSTAT_DATA_MAX 100 /* Maximum number of kstat entries. To be changed later */
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*-
|
|
Packit |
fcad23 |
* Macros
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
#define CACHE_MOREDATA 0x001 /* There are unread data outside cache */
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*-
|
|
Packit |
fcad23 |
* Enumeration types
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
typedef enum { GET_FIRST, GET_EXACT, GET_NEXT } req_e;
|
|
Packit |
fcad23 |
typedef enum { FOUND, NOT_FOUND, NEED_NEXT } found_e;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
typedef enum {
|
|
Packit |
fcad23 |
MIB_SYSTEM = 0,
|
|
Packit |
fcad23 |
MIB_INTERFACES = 1,
|
|
Packit |
fcad23 |
MIB_AT = 2,
|
|
Packit |
fcad23 |
MIB_IP = 3,
|
|
Packit |
fcad23 |
MIB_IP_ADDR = 4,
|
|
Packit |
fcad23 |
MIB_IP_ROUTE = 5,
|
|
Packit |
fcad23 |
MIB_IP_NET = 6,
|
|
Packit |
fcad23 |
MIB_ICMP = 7,
|
|
Packit |
fcad23 |
MIB_TCP = 8,
|
|
Packit |
fcad23 |
MIB_TCP_CONN = 9,
|
|
Packit |
fcad23 |
MIB_UDP = 10,
|
|
Packit |
fcad23 |
MIB_UDP_LISTEN = 11,
|
|
Packit |
fcad23 |
MIB_EGP = 12,
|
|
Packit |
fcad23 |
MIB_CMOT = 13,
|
|
Packit |
fcad23 |
MIB_TRANSMISSION = 14,
|
|
Packit |
fcad23 |
MIB_SNMP = 15,
|
|
Packit |
fcad23 |
#ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
|
|
Packit |
fcad23 |
#ifdef SOLARIS_HAVE_RFC4293_SUPPORT
|
|
Packit |
fcad23 |
MIB_IP_TRAFFIC_STATS,
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
MIB_IP6,
|
|
Packit |
fcad23 |
MIB_IP6_ADDR,
|
|
Packit |
fcad23 |
MIB_IP6_ROUTE,
|
|
Packit |
fcad23 |
MIB_ICMP6,
|
|
Packit |
fcad23 |
MIB_TCP6_CONN,
|
|
Packit |
fcad23 |
MIB_UDP6_ENDPOINT,
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
#ifdef MIB2_SCTP
|
|
Packit |
fcad23 |
MIB_SCTP,
|
|
Packit |
fcad23 |
MIB_SCTP_CONN,
|
|
Packit |
fcad23 |
MIB_SCTP_CONN_LOCAL,
|
|
Packit |
fcad23 |
MIB_SCTP_CONN_REMOTE,
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
MIBCACHE_SIZE
|
|
Packit |
fcad23 |
} mibgroup_e;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*-
|
|
Packit |
fcad23 |
* Structure definitions (use "typedef struct foo {} foo;" form)
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* MIB-II cache. Simple buffering scheme - last read block is in the cache
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
typedef struct mibcache {
|
|
Packit |
fcad23 |
mibgroup_e cache_groupid; /* MIB-II group */
|
|
Packit |
fcad23 |
size_t cache_size; /* Size of this cache table in bytes */
|
|
Packit |
fcad23 |
void *cache_addr; /* Pointer to real cache memory */
|
|
Packit |
fcad23 |
size_t cache_length; /* Useful length in bytes */
|
|
Packit |
fcad23 |
size_t cache_ttl; /* Time this type of cache entry stays valid */
|
|
Packit |
fcad23 |
time_t cache_time; /* CURRENT time left for this cache entry */
|
|
Packit |
fcad23 |
int cache_flags; /* Cache state */
|
|
Packit |
fcad23 |
int cache_last_found; /* Index of last cache element that was found */
|
|
Packit |
fcad23 |
void *cache_comp; /* Compare routine used to set the cache */
|
|
Packit |
fcad23 |
void *cache_arg; /* Argument for compare routine used to set the cache */
|
|
Packit |
fcad23 |
} mibcache;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* Mapping between mibgroup_t, mibtable_t and mib2.h defines
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
typedef struct mibmap {
|
|
Packit |
fcad23 |
int group; /* mib2.h group name */
|
|
Packit |
fcad23 |
int table; /* mib2.h table name */
|
|
Packit |
fcad23 |
} mibmap;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* Structures, missing in <inet/mib2.h>
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
typedef unsigned long TimeTicks;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
typedef struct mib2_ifEntry {
|
|
Packit |
fcad23 |
int ifIndex; /* ifEntry 1 */
|
|
Packit |
fcad23 |
DeviceName ifDescr; /* ifEntry 2 */
|
|
Packit |
fcad23 |
int ifType; /* ifEntry 3 */
|
|
Packit |
fcad23 |
int ifMtu; /* ifEntry 4 */
|
|
Packit |
fcad23 |
Gauge ifSpeed; /* ifEntry 5 */
|
|
Packit |
fcad23 |
PhysAddress ifPhysAddress; /* ifEntry 6 */
|
|
Packit |
fcad23 |
int ifAdminStatus; /* ifEntry 7 */
|
|
Packit |
fcad23 |
int ifOperStatus; /* ifEntry 8 */
|
|
Packit |
fcad23 |
TimeTicks ifLastChange; /* ifEntry 9 */
|
|
Packit |
fcad23 |
Counter ifInOctets; /* ifEntry 10 */
|
|
Packit |
fcad23 |
Counter ifInUcastPkts; /* ifEntry 11 */
|
|
Packit |
fcad23 |
Counter ifInNUcastPkts; /* ifEntry 12 */
|
|
Packit |
fcad23 |
Counter ifInDiscards; /* ifEntry 13 */
|
|
Packit |
fcad23 |
Counter ifInErrors; /* ifEntry 14 */
|
|
Packit |
fcad23 |
Counter ifInUnknownProtos; /* ifEntry 15 */
|
|
Packit |
fcad23 |
Counter ifOutOctets; /* ifEntry 16 */
|
|
Packit |
fcad23 |
Counter ifOutUcastPkts; /* ifEntry 17 */
|
|
Packit |
fcad23 |
Counter ifOutNUcastPkts; /* ifEntry 18 */
|
|
Packit |
fcad23 |
Counter ifOutDiscards; /* ifEntry 19 */
|
|
Packit |
fcad23 |
Counter ifOutErrors; /* ifEntry 20 */
|
|
Packit |
fcad23 |
Gauge ifOutQLen; /* ifEntry 21 */
|
|
Packit |
fcad23 |
int ifSpecific; /* ifEntry 22 */
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* Support ifXTable.
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
Counter64 ifHCInOctets;
|
|
Packit |
fcad23 |
Counter64 ifHCInUcastPkts;
|
|
Packit |
fcad23 |
Counter64 ifHCInMulticastPkts;
|
|
Packit |
fcad23 |
Counter64 ifHCInBroadcastPkts;
|
|
Packit |
fcad23 |
Counter64 ifHCOutOctets;
|
|
Packit |
fcad23 |
Counter64 ifHCOutUcastPkts;
|
|
Packit |
fcad23 |
Counter64 ifHCOutMulticastPkts;
|
|
Packit |
fcad23 |
Counter64 ifHCOutBroadcastPkts;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*
|
|
Packit |
fcad23 |
* Counters not part of ifTable or ifXTable
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
Counter ifCollisions;
|
|
Packit |
fcad23 |
int flags; /* interface flags (IFF_*) */
|
|
Packit |
fcad23 |
} mib2_ifEntry_t;
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*-
|
|
Packit |
fcad23 |
* Static const definitions (must be declared static and initialized)
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*-
|
|
Packit |
fcad23 |
* Global variable declarations (using extern and without initialization)
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
/*-
|
|
Packit |
fcad23 |
* Function prototypes (use void as argument type if there are no arguments)
|
|
Packit |
fcad23 |
*/
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#ifdef _STDC_COMPAT
|
|
Packit |
fcad23 |
#ifdef __cplusplus
|
|
Packit |
fcad23 |
extern "C" {
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
void init_kernel_sunos5(void);
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
int getKstat(const char *statname, const char *varname,
|
|
Packit |
fcad23 |
void *value);
|
|
Packit |
fcad23 |
int getMibstat(mibgroup_e grid, void *resp,
|
|
Packit |
fcad23 |
size_t entrysize, req_e req_type,
|
|
Packit |
fcad23 |
int (*comp) (void *, void *), void *arg);
|
|
Packit |
fcad23 |
int Get_everything(void *, void *);
|
|
Packit |
fcad23 |
int getKstatInt(const char *classname,
|
|
Packit |
fcad23 |
const char *statname, const char *varname,
|
|
Packit |
fcad23 |
int *value);
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
int getKstatString(const char *statname, const char *varname,
|
|
Packit |
fcad23 |
char *value, size_t value_len);
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
int solaris2_if_nametoindex(const char *, int);
|
|
Packit |
fcad23 |
|
|
Packit |
fcad23 |
#ifdef _STDC_COMPAT
|
|
Packit |
fcad23 |
#ifdef __cplusplus
|
|
Packit |
fcad23 |
}
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
#endif
|
|
Packit |
fcad23 |
#endif
|