1*dd191f37Speter /* $NetBSD: altqstat.h,v 1.5 2006/10/12 19:59:13 peter Exp $ */ 2*dd191f37Speter /* $KAME: altqstat.h,v 1.5 2002/10/26 06:59:54 kjc Exp $ */ 38726857eSthorpej /* 48726857eSthorpej * Copyright (C) 1999-2000 58726857eSthorpej * Sony Computer Science Laboratories, Inc. All rights reserved. 68726857eSthorpej * 78726857eSthorpej * Redistribution and use in source and binary forms, with or without 88726857eSthorpej * modification, are permitted provided that the following conditions 98726857eSthorpej * are met: 108726857eSthorpej * 1. Redistributions of source code must retain the above copyright 118726857eSthorpej * notice, this list of conditions and the following disclaimer. 128726857eSthorpej * 2. Redistributions in binary form must reproduce the above copyright 138726857eSthorpej * notice, this list of conditions and the following disclaimer in the 148726857eSthorpej * documentation and/or other materials provided with the distribution. 158726857eSthorpej * 168726857eSthorpej * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND 178726857eSthorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 188726857eSthorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 198726857eSthorpej * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE 208726857eSthorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 218726857eSthorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 228726857eSthorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 238726857eSthorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 248726857eSthorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 258726857eSthorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 268726857eSthorpej * SUCH DAMAGE. 278726857eSthorpej */ 288726857eSthorpej 298726857eSthorpej typedef void (stat_loop_t)(int fd, const char *ifname, 308726857eSthorpej int count, int interval); 318726857eSthorpej 328726857eSthorpej struct qdisc_conf { 338726857eSthorpej const char *qdisc_name; /* e.g., cbq */ 348726857eSthorpej int altqtype; /* e.g., ALTQT_CBQ */ 358726857eSthorpej stat_loop_t *stat_loop; 368726857eSthorpej }; 378726857eSthorpej 388726857eSthorpej /* 398726857eSthorpej * cast u_int64_t to ull for printf, since type of u_int64_t 408726857eSthorpej * is architecture dependent 418726857eSthorpej */ 428726857eSthorpej typedef unsigned long long ull; 438726857eSthorpej 448726857eSthorpej stat_loop_t cbq_stat_loop; 458726857eSthorpej stat_loop_t hfsc_stat_loop; 468726857eSthorpej stat_loop_t cdnr_stat_loop; 478726857eSthorpej stat_loop_t wfq_stat_loop; 488726857eSthorpej stat_loop_t fifoq_stat_loop; 498726857eSthorpej stat_loop_t red_stat_loop; 508726857eSthorpej stat_loop_t rio_stat_loop; 518726857eSthorpej stat_loop_t blue_stat_loop; 528726857eSthorpej stat_loop_t priq_stat_loop; 53*dd191f37Speter stat_loop_t jobs_stat_loop; 548726857eSthorpej 558726857eSthorpej struct redstats; 568726857eSthorpej 578b8734d2Sitojun void chandle2name(const char *, u_long, char *, size_t); 588b8734d2Sitojun stat_loop_t *qdisc2stat_loop(const char *); 598b8734d2Sitojun int ifname2qdisc(const char *, char *); 608b8734d2Sitojun double calc_interval(struct timeval *, struct timeval *); 618b8734d2Sitojun double calc_rate(u_int64_t, u_int64_t, double); 628b8734d2Sitojun double calc_pps(u_int64_t, u_int64_t, double); 638b8734d2Sitojun char *rate2str(double); 648b8734d2Sitojun int print_redstats(struct redstats *); 658b8734d2Sitojun int print_riostats(struct redstats *); 668726857eSthorpej 678726857eSthorpej 688726857eSthorpej 69