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