qop_cdnr.h revision 1.1 1 /* $KAME: qop_cdnr.h,v 1.4 2000/10/18 09:15:19 kjc Exp $ */
2 /*
3 * Copyright (C) 1999-2000
4 * Sony Computer Science Laboratories, Inc. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28 /*
29 * struct classinfo is used also for traffic conditioners
30 */
31
32 /* discipline specific class info */
33 struct cdnrinfo {
34 int tce_type;
35 union {
36 struct {
37 struct tc_action action;
38 } element;
39 struct {
40 struct tb_profile profile;
41 struct tc_action in_action;
42 struct tc_action out_action;
43 } tbmeter;
44 struct {
45 struct tb_profile cmtd_profile;
46 struct tb_profile peak_profile;
47 struct tc_action green_action;
48 struct tc_action yellow_action;
49 struct tc_action red_action;
50 int coloraware;
51 } trtcm;
52 struct {
53 u_int32_t cmtd_rate;
54 u_int32_t peak_rate;
55 u_int32_t avg_interval;
56 struct tc_action green_action;
57 struct tc_action yellow_action;
58 struct tc_action red_action;
59 } tswtcm;
60 } tce_un;
61 };
62
63 u_long cdnr_name2handle(const char *ifname, const char *cdnr_name);
64
65 int qcmd_cdnr_add_element(struct tc_action *rp, const char *ifname,
66 const char *cdnr_name, struct tc_action *action);
67 int qcmd_cdnr_add_tbmeter(struct tc_action *rp, const char *ifname,
68 const char *cdnr_name,
69 struct tb_profile *profile,
70 struct tc_action *in_action,
71 struct tc_action *out_action);
72 int qcmd_cdnr_add_trtcm(struct tc_action *rp, const char *ifname,
73 const char *cdnr_name,
74 struct tb_profile *cmtd_profile,
75 struct tb_profile *peak_profile,
76 struct tc_action *green_action,
77 struct tc_action *yellow_action,
78 struct tc_action *red_action, int coloraware);
79 int qcmd_cdnr_add_tswtcm(struct tc_action *rp, const char *ifname,
80 const char *cdnr_name, const u_int32_t cmtd_rate,
81 const u_int32_t peak_rate,
82 const u_int32_t avg_interval,
83 struct tc_action *green_action,
84 struct tc_action *yellow_action,
85 struct tc_action *red_action);
86 int qcmd_cdnr_delete(const char *ifname, const char *cdnr_name);
87 int qcmd_nop_add_if(const char *ifname);
88
89 int qop_add_cdnr(struct classinfo **rp, const char *cdnr_name,
90 struct ifinfo *ifinfo, struct classinfo **childlist,
91 void *cdnr_private);
92 int qop_delete_cdnr(struct classinfo *clinfo);
93 int qop_cdnr_add_element(struct classinfo **rp, const char *cdnr_name,
94 struct ifinfo *ifinfo, struct tc_action *action);
95 int qop_cdnr_add_tbmeter(struct classinfo **rp, const char *cdnr_name,
96 struct ifinfo *ifinfo, struct tb_profile *profile,
97 struct tc_action *in_action, struct tc_action *out_action);
98 int qop_cdnr_add_trtcm(struct classinfo **rp, const char *cdnr_name,
99 struct ifinfo *ifinfo,
100 struct tb_profile *cmtd_profile, struct tb_profile *peak_profile,
101 struct tc_action *green_action, struct tc_action *yellow_action,
102 struct tc_action *red_action, int colorware);
103 int qop_cdnr_add_tswtcm(struct classinfo **rp, const char *cdnr_name,
104 struct ifinfo *ifinfo, const u_int32_t cmtd_rate,
105 const u_int32_t peak_rate,
106 const u_int32_t avg_interval,
107 struct tc_action *green_action,
108 struct tc_action *yellow_action,
109 struct tc_action *red_action);
110 int qop_cdnr_modify_tbmeter(struct classinfo *clinfo,
111 struct tb_profile *profile);
112 int qop_cdnr_modify_trtcm(struct classinfo *clinfo,
113 struct tb_profile *cmtd_profile,
114 struct tb_profile *peak_profile, int coloraware);
115 int qop_cdnr_modify_tswtcm(struct classinfo *clinfo,
116 const u_int32_t cmtd_rate,
117 const u_int32_t peak_rate,
118 const u_int32_t avg_interval);
119