1*62856425Sitojun /* $NetBSD: qop_cdnr.h,v 1.2 2001/08/16 07:48:13 itojun Exp $ */ 295a65560Sthorpej /* $KAME: qop_cdnr.h,v 1.4 2000/10/18 09:15:19 kjc Exp $ */ 395a65560Sthorpej /* 495a65560Sthorpej * Copyright (C) 1999-2000 595a65560Sthorpej * Sony Computer Science Laboratories, Inc. All rights reserved. 695a65560Sthorpej * 795a65560Sthorpej * Redistribution and use in source and binary forms, with or without 895a65560Sthorpej * modification, are permitted provided that the following conditions 995a65560Sthorpej * are met: 1095a65560Sthorpej * 1. Redistributions of source code must retain the above copyright 1195a65560Sthorpej * notice, this list of conditions and the following disclaimer. 1295a65560Sthorpej * 2. Redistributions in binary form must reproduce the above copyright 1395a65560Sthorpej * notice, this list of conditions and the following disclaimer in the 1495a65560Sthorpej * documentation and/or other materials provided with the distribution. 1595a65560Sthorpej * 1695a65560Sthorpej * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND 1795a65560Sthorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1895a65560Sthorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1995a65560Sthorpej * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE 2095a65560Sthorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2195a65560Sthorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2295a65560Sthorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2395a65560Sthorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2495a65560Sthorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2595a65560Sthorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2695a65560Sthorpej * SUCH DAMAGE. 2795a65560Sthorpej */ 2895a65560Sthorpej 2995a65560Sthorpej /* 3095a65560Sthorpej * struct classinfo is used also for traffic conditioners 3195a65560Sthorpej */ 3295a65560Sthorpej 3395a65560Sthorpej /* discipline specific class info */ 3495a65560Sthorpej struct cdnrinfo { 3595a65560Sthorpej int tce_type; 3695a65560Sthorpej union { 3795a65560Sthorpej struct { 3895a65560Sthorpej struct tc_action action; 3995a65560Sthorpej } element; 4095a65560Sthorpej struct { 4195a65560Sthorpej struct tb_profile profile; 4295a65560Sthorpej struct tc_action in_action; 4395a65560Sthorpej struct tc_action out_action; 4495a65560Sthorpej } tbmeter; 4595a65560Sthorpej struct { 4695a65560Sthorpej struct tb_profile cmtd_profile; 4795a65560Sthorpej struct tb_profile peak_profile; 4895a65560Sthorpej struct tc_action green_action; 4995a65560Sthorpej struct tc_action yellow_action; 5095a65560Sthorpej struct tc_action red_action; 5195a65560Sthorpej int coloraware; 5295a65560Sthorpej } trtcm; 5395a65560Sthorpej struct { 5495a65560Sthorpej u_int32_t cmtd_rate; 5595a65560Sthorpej u_int32_t peak_rate; 5695a65560Sthorpej u_int32_t avg_interval; 5795a65560Sthorpej struct tc_action green_action; 5895a65560Sthorpej struct tc_action yellow_action; 5995a65560Sthorpej struct tc_action red_action; 6095a65560Sthorpej } tswtcm; 6195a65560Sthorpej } tce_un; 6295a65560Sthorpej }; 6395a65560Sthorpej 6495a65560Sthorpej u_long cdnr_name2handle(const char *ifname, const char *cdnr_name); 6595a65560Sthorpej 6695a65560Sthorpej int qcmd_cdnr_add_element(struct tc_action *rp, const char *ifname, 6795a65560Sthorpej const char *cdnr_name, struct tc_action *action); 6895a65560Sthorpej int qcmd_cdnr_add_tbmeter(struct tc_action *rp, const char *ifname, 6995a65560Sthorpej const char *cdnr_name, 7095a65560Sthorpej struct tb_profile *profile, 7195a65560Sthorpej struct tc_action *in_action, 7295a65560Sthorpej struct tc_action *out_action); 7395a65560Sthorpej int qcmd_cdnr_add_trtcm(struct tc_action *rp, const char *ifname, 7495a65560Sthorpej const char *cdnr_name, 7595a65560Sthorpej struct tb_profile *cmtd_profile, 7695a65560Sthorpej struct tb_profile *peak_profile, 7795a65560Sthorpej struct tc_action *green_action, 7895a65560Sthorpej struct tc_action *yellow_action, 7995a65560Sthorpej struct tc_action *red_action, int coloraware); 8095a65560Sthorpej int qcmd_cdnr_add_tswtcm(struct tc_action *rp, const char *ifname, 8195a65560Sthorpej const char *cdnr_name, const u_int32_t cmtd_rate, 8295a65560Sthorpej const u_int32_t peak_rate, 8395a65560Sthorpej const u_int32_t avg_interval, 8495a65560Sthorpej struct tc_action *green_action, 8595a65560Sthorpej struct tc_action *yellow_action, 8695a65560Sthorpej struct tc_action *red_action); 8795a65560Sthorpej int qcmd_cdnr_delete(const char *ifname, const char *cdnr_name); 8895a65560Sthorpej int qcmd_nop_add_if(const char *ifname); 8995a65560Sthorpej 9095a65560Sthorpej int qop_add_cdnr(struct classinfo **rp, const char *cdnr_name, 9195a65560Sthorpej struct ifinfo *ifinfo, struct classinfo **childlist, 9295a65560Sthorpej void *cdnr_private); 9395a65560Sthorpej int qop_delete_cdnr(struct classinfo *clinfo); 9495a65560Sthorpej int qop_cdnr_add_element(struct classinfo **rp, const char *cdnr_name, 9595a65560Sthorpej struct ifinfo *ifinfo, struct tc_action *action); 9695a65560Sthorpej int qop_cdnr_add_tbmeter(struct classinfo **rp, const char *cdnr_name, 9795a65560Sthorpej struct ifinfo *ifinfo, struct tb_profile *profile, 9895a65560Sthorpej struct tc_action *in_action, struct tc_action *out_action); 9995a65560Sthorpej int qop_cdnr_add_trtcm(struct classinfo **rp, const char *cdnr_name, 10095a65560Sthorpej struct ifinfo *ifinfo, 10195a65560Sthorpej struct tb_profile *cmtd_profile, struct tb_profile *peak_profile, 10295a65560Sthorpej struct tc_action *green_action, struct tc_action *yellow_action, 10395a65560Sthorpej struct tc_action *red_action, int colorware); 10495a65560Sthorpej int qop_cdnr_add_tswtcm(struct classinfo **rp, const char *cdnr_name, 10595a65560Sthorpej struct ifinfo *ifinfo, const u_int32_t cmtd_rate, 10695a65560Sthorpej const u_int32_t peak_rate, 10795a65560Sthorpej const u_int32_t avg_interval, 10895a65560Sthorpej struct tc_action *green_action, 10995a65560Sthorpej struct tc_action *yellow_action, 11095a65560Sthorpej struct tc_action *red_action); 11195a65560Sthorpej int qop_cdnr_modify_tbmeter(struct classinfo *clinfo, 11295a65560Sthorpej struct tb_profile *profile); 11395a65560Sthorpej int qop_cdnr_modify_trtcm(struct classinfo *clinfo, 11495a65560Sthorpej struct tb_profile *cmtd_profile, 11595a65560Sthorpej struct tb_profile *peak_profile, int coloraware); 11695a65560Sthorpej int qop_cdnr_modify_tswtcm(struct classinfo *clinfo, 11795a65560Sthorpej const u_int32_t cmtd_rate, 11895a65560Sthorpej const u_int32_t peak_rate, 11995a65560Sthorpej const u_int32_t avg_interval); 120