1*8275SEric Cheng /* 2*8275SEric Cheng * CDDL HEADER START 3*8275SEric Cheng * 4*8275SEric Cheng * The contents of this file are subject to the terms of the 5*8275SEric Cheng * Common Development and Distribution License (the "License"). 6*8275SEric Cheng * You may not use this file except in compliance with the License. 7*8275SEric Cheng * 8*8275SEric Cheng * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*8275SEric Cheng * or http://www.opensolaris.org/os/licensing. 10*8275SEric Cheng * See the License for the specific language governing permissions 11*8275SEric Cheng * and limitations under the License. 12*8275SEric Cheng * 13*8275SEric Cheng * When distributing Covered Code, include this CDDL HEADER in each 14*8275SEric Cheng * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*8275SEric Cheng * If applicable, add the following below this CDDL HEADER, with the 16*8275SEric Cheng * fields enclosed by brackets "[]" replaced with your own identifying 17*8275SEric Cheng * information: Portions Copyright [yyyy] [name of copyright owner] 18*8275SEric Cheng * 19*8275SEric Cheng * CDDL HEADER END 20*8275SEric Cheng */ 21*8275SEric Cheng /* 22*8275SEric Cheng * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*8275SEric Cheng * Use is subject to license terms. 24*8275SEric Cheng */ 25*8275SEric Cheng 26*8275SEric Cheng #ifndef _LIBDLSTAT_H 27*8275SEric Cheng #define _LIBDLSTAT_H 28*8275SEric Cheng 29*8275SEric Cheng /* 30*8275SEric Cheng * This file includes structures, macros and common routines shared by all 31*8275SEric Cheng * data-link administration, and routines which are used to retrieve and 32*8275SEric Cheng * display statistics. 33*8275SEric Cheng */ 34*8275SEric Cheng 35*8275SEric Cheng #include <kstat.h> 36*8275SEric Cheng 37*8275SEric Cheng #ifdef __cplusplus 38*8275SEric Cheng extern "C" { 39*8275SEric Cheng #endif 40*8275SEric Cheng 41*8275SEric Cheng #define LINK_REPORT 1 42*8275SEric Cheng #define FLOW_REPORT 2 43*8275SEric Cheng 44*8275SEric Cheng typedef struct pktsum_s { 45*8275SEric Cheng hrtime_t snaptime; 46*8275SEric Cheng uint64_t ipackets; 47*8275SEric Cheng uint64_t opackets; 48*8275SEric Cheng uint64_t rbytes; 49*8275SEric Cheng uint64_t obytes; 50*8275SEric Cheng uint64_t ierrors; 51*8275SEric Cheng uint64_t oerrors; 52*8275SEric Cheng } pktsum_t; 53*8275SEric Cheng 54*8275SEric Cheng extern void dladm_continuous(datalink_id_t, const char *, int, int); 55*8275SEric Cheng 56*8275SEric Cheng extern kstat_t *dladm_kstat_lookup(kstat_ctl_t *, const char *, int, 57*8275SEric Cheng const char *, const char *); 58*8275SEric Cheng extern void dladm_get_stats(kstat_ctl_t *, kstat_t *, pktsum_t *); 59*8275SEric Cheng extern int dladm_kstat_value(kstat_t *, const char *, uint8_t, 60*8275SEric Cheng void *); 61*8275SEric Cheng extern dladm_status_t dladm_get_single_mac_stat(datalink_id_t, const char *, 62*8275SEric Cheng uint8_t, void *); 63*8275SEric Cheng 64*8275SEric Cheng extern void dladm_stats_total(pktsum_t *, pktsum_t *, pktsum_t *); 65*8275SEric Cheng extern void dladm_stats_diff(pktsum_t *, pktsum_t *, pktsum_t *); 66*8275SEric Cheng 67*8275SEric Cheng #ifdef __cplusplus 68*8275SEric Cheng } 69*8275SEric Cheng #endif 70*8275SEric Cheng 71*8275SEric Cheng #endif /* _LIBDLSTAT_H */ 72