2 * Copyright (C) 1998-2003
3 * Sony Computer Science Laboratories Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * $KAME: altq.h,v 1.10 2003/07/10 12:07:47 kjc Exp $
34 * allow altq-3 (altqd(8) and /dev/altq) to coexist with the new pf-based altq.
35 * altq3 is mainly for research experiments. pf-based altq is for daily use.
37 #define ALTQ3_COMPAT /* for compatibility with altq-3 */
38 #define ALTQ3_CLFIER_COMPAT /* for compatibility with altq-3 classifier */
42 #include <sys/param.h>
43 #include <sys/ioccom.h>
44 #include <sys/queue.h>
45 #include <netinet/in.h>
50 #endif /* ALTQ3_COMPAT */
52 /* altq discipline type */
53 #define ALTQT_NONE 0 /* reserved */
54 #define ALTQT_CBQ 1 /* cbq */
55 #define ALTQT_WFQ 2 /* wfq */
56 #define ALTQT_AFMAP 3 /* afmap */
57 #define ALTQT_FIFOQ 4 /* fifoq */
58 #define ALTQT_RED 5 /* red */
59 #define ALTQT_RIO 6 /* rio */
60 #define ALTQT_LOCALQ 7 /* local use */
61 #define ALTQT_HFSC 8 /* hfsc */
62 #define ALTQT_CDNR 9 /* traffic conditioner */
63 #define ALTQT_BLUE 10 /* blue */
64 #define ALTQT_PRIQ 11 /* priority queue */
65 #define ALTQT_JOBS 12 /* JoBS */
66 #define ALTQT_FAIRQ 13 /* fairq */
67 #define ALTQT_CODEL 14 /* CoDel */
68 #define ALTQT_MAX 15 /* should be max discipline type + 1 */
72 char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
73 u_long arg; /* request-specific argument */
77 /* simple token backet meter profile */
79 u_int rate; /* rate in bit-per-sec */
80 u_int depth; /* depth in bytes */
85 char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
86 struct tb_profile tb_prof; /* token bucket profile */
89 #ifdef ALTQ3_CLFIER_COMPAT
91 * common network flow info structure
94 u_char fi_len; /* total length */
95 u_char fi_family; /* address family */
96 u_int8_t fi_data[46]; /* actually longer; address family
97 specific flow info. */
101 * flow info structure for internet protocol family.
102 * (currently this is the only protocol family supported)
105 u_char fi_len; /* sizeof(struct flowinfo_in) */
106 u_char fi_family; /* AF_INET */
107 u_int8_t fi_proto; /* IPPROTO_XXX */
108 u_int8_t fi_tos; /* type-of-service */
109 struct in_addr fi_dst; /* dest address */
110 struct in_addr fi_src; /* src address */
111 u_int16_t fi_dport; /* dest port */
112 u_int16_t fi_sport; /* src port */
113 u_int32_t fi_gpi; /* generalized port id for ipsec */
114 u_int8_t _pad[28]; /* make the size equal to
119 struct flowinfo_in6 {
120 u_char fi6_len; /* sizeof(struct flowinfo_in6) */
121 u_char fi6_family; /* AF_INET6 */
122 u_int8_t fi6_proto; /* IPPROTO_XXX */
123 u_int8_t fi6_tclass; /* traffic class */
124 u_int32_t fi6_flowlabel; /* ipv6 flowlabel */
125 u_int16_t fi6_dport; /* dest port */
126 u_int16_t fi6_sport; /* src port */
127 u_int32_t fi6_gpi; /* generalized port id */
128 struct in6_addr fi6_dst; /* dest address */
129 struct in6_addr fi6_src; /* src address */
134 * flow filters for AF_INET and AF_INET6
138 struct flowinfo_in ff_flow;
140 struct in_addr mask_dst;
141 struct in_addr mask_src;
145 u_int8_t _pad2[24]; /* make the size equal to flow_filter6 */
149 struct flow_filter6 {
151 struct flowinfo_in6 ff_flow6;
153 struct in6_addr mask6_dst;
154 struct in6_addr mask6_src;
155 u_int8_t mask6_tclass;
160 #endif /* ALTQ3_CLFIER_COMPAT */
161 #endif /* ALTQ3_COMPAT */
164 * generic packet counter
171 #define PKTCNTR_ADD(cntr, len) \
172 do { (cntr)->packets++; (cntr)->bytes += len; } while (/*CONSTCOND*/ 0)
176 * altq related ioctls
178 #define ALTQGTYPE _IOWR('q', 0, struct altqreq) /* get queue type */
181 * these ioctls are currently discipline-specific but could be shared
184 #define ALTQATTACH _IOW('q', 1, struct altqreq) /* attach discipline */
185 #define ALTQDETACH _IOW('q', 2, struct altqreq) /* detach discipline */
186 #define ALTQENABLE _IOW('q', 3, struct altqreq) /* enable discipline */
187 #define ALTQDISABLE _IOW('q', 4, struct altqreq) /* disable discipline*/
188 #define ALTQCLEAR _IOW('q', 5, struct altqreq) /* (re)initialize */
189 #define ALTQCONFIG _IOWR('q', 6, struct altqreq) /* set config params */
190 #define ALTQADDCLASS _IOWR('q', 7, struct altqreq) /* add a class */
191 #define ALTQMODCLASS _IOWR('q', 8, struct altqreq) /* modify a class */
192 #define ALTQDELCLASS _IOWR('q', 9, struct altqreq) /* delete a class */
193 #define ALTQADDFILTER _IOWR('q', 10, struct altqreq) /* add a filter */
194 #define ALTQDELFILTER _IOWR('q', 11, struct altqreq) /* delete a filter */
195 #define ALTQGETSTATS _IOWR('q', 12, struct altqreq) /* get statistics */
196 #define ALTQGETCNTR _IOWR('q', 13, struct altqreq) /* get a pkt counter */
198 #define ALTQTBRSET _IOW('q', 14, struct tbrreq) /* set tb regulator */
199 #define ALTQTBRGET _IOWR('q', 15, struct tbrreq) /* get tb regulator */
200 #endif /* ALTQ3_COMPAT */
203 #include <net/altq/altq_var.h>
206 #endif /* _ALTQ_ALTQ_H_ */