pf_altq.h revision 263086
1/*
2 * Copyright (c) 2001 Daniel Hartmeier
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 *    - Redistributions of source code must retain the above copyright
10 *      notice, this list of conditions and the following disclaimer.
11 *    - Redistributions in binary form must reproduce the above
12 *      copyright notice, this list of conditions and the following
13 *      disclaimer in the documentation and/or other materials provided
14 *      with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 *	$OpenBSD: pfvar.h,v 1.282 2009/01/29 15:12:28 pyr Exp $
30 *	$FreeBSD: stable/10/sys/netpfil/pf/pf_altq.h 263086 2014-03-12 10:45:58Z glebius $
31 */
32
33#ifndef	_NET_PF_ALTQ_H_
34#define	_NET_PF_ALTQ_H_
35
36struct cbq_opts {
37	u_int		minburst;
38	u_int		maxburst;
39	u_int		pktsize;
40	u_int		maxpktsize;
41	u_int		ns_per_byte;
42	u_int		maxidle;
43	int		minidle;
44	u_int		offtime;
45	int		flags;
46};
47
48struct priq_opts {
49	int		flags;
50};
51
52struct hfsc_opts {
53	/* real-time service curve */
54	u_int		rtsc_m1;	/* slope of the 1st segment in bps */
55	u_int		rtsc_d;		/* the x-projection of m1 in msec */
56	u_int		rtsc_m2;	/* slope of the 2nd segment in bps */
57	/* link-sharing service curve */
58	u_int		lssc_m1;
59	u_int		lssc_d;
60	u_int		lssc_m2;
61	/* upper-limit service curve */
62	u_int		ulsc_m1;
63	u_int		ulsc_d;
64	u_int		ulsc_m2;
65	int		flags;
66};
67
68struct pf_altq {
69	char			 ifname[IFNAMSIZ];
70
71	void			*altq_disc;	/* discipline-specific state */
72	TAILQ_ENTRY(pf_altq)	 entries;
73
74	/* scheduler spec */
75	uint8_t			 scheduler;	/* scheduler type */
76	uint16_t		 tbrsize;	/* tokenbucket regulator size */
77	uint32_t		 ifbandwidth;	/* interface bandwidth */
78
79	/* queue spec */
80	char			 qname[PF_QNAME_SIZE];	/* queue name */
81	char			 parent[PF_QNAME_SIZE];	/* parent name */
82	uint32_t		 parent_qid;	/* parent queue id */
83	uint32_t		 bandwidth;	/* queue bandwidth */
84	uint8_t			 priority;	/* priority */
85	uint8_t			 local_flags;	/* dynamic interface */
86#define	PFALTQ_FLAG_IF_REMOVED		0x01
87
88	uint16_t		 qlimit;	/* queue size limit */
89	uint16_t		 flags;		/* misc flags */
90	union {
91		struct cbq_opts		 cbq_opts;
92		struct priq_opts	 priq_opts;
93		struct hfsc_opts	 hfsc_opts;
94	} pq_u;
95
96	uint32_t		 qid;		/* return value */
97};
98
99#endif	/* _NET_PF_ALTQ_H_ */
100