1126258Smlaier/*
2126258Smlaier * Copyright (c) 2001 Daniel Hartmeier
3126258Smlaier * All rights reserved.
4126258Smlaier *
5126258Smlaier * Redistribution and use in source and binary forms, with or without
6126258Smlaier * modification, are permitted provided that the following conditions
7126258Smlaier * are met:
8126258Smlaier *
9126258Smlaier *    - Redistributions of source code must retain the above copyright
10126258Smlaier *      notice, this list of conditions and the following disclaimer.
11126258Smlaier *    - Redistributions in binary form must reproduce the above
12126258Smlaier *      copyright notice, this list of conditions and the following
13126258Smlaier *      disclaimer in the documentation and/or other materials provided
14126258Smlaier *      with the distribution.
15126258Smlaier *
16126258Smlaier * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17126258Smlaier * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18126258Smlaier * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19126258Smlaier * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20126258Smlaier * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21126258Smlaier * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22126258Smlaier * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23126258Smlaier * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24126258Smlaier * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25126258Smlaier * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26126258Smlaier * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27126258Smlaier * POSSIBILITY OF SUCH DAMAGE.
28126258Smlaier *
29240644Sglebius *	$OpenBSD: pfvar.h,v 1.282 2009/01/29 15:12:28 pyr Exp $
30240640Sglebius *	$FreeBSD: releng/10.3/sys/netpfil/pf/pf_altq.h 263086 2014-03-12 10:45:58Z glebius $
31126258Smlaier */
32126258Smlaier
33257186Sglebius#ifndef	_NET_PF_ALTQ_H_
34257186Sglebius#define	_NET_PF_ALTQ_H_
35126258Smlaier
36126258Smlaierstruct cbq_opts {
37126258Smlaier	u_int		minburst;
38126258Smlaier	u_int		maxburst;
39126258Smlaier	u_int		pktsize;
40126258Smlaier	u_int		maxpktsize;
41126258Smlaier	u_int		ns_per_byte;
42126258Smlaier	u_int		maxidle;
43126258Smlaier	int		minidle;
44126258Smlaier	u_int		offtime;
45126258Smlaier	int		flags;
46126258Smlaier};
47126258Smlaier
48126258Smlaierstruct priq_opts {
49126258Smlaier	int		flags;
50126258Smlaier};
51126258Smlaier
52126258Smlaierstruct hfsc_opts {
53126258Smlaier	/* real-time service curve */
54126258Smlaier	u_int		rtsc_m1;	/* slope of the 1st segment in bps */
55126258Smlaier	u_int		rtsc_d;		/* the x-projection of m1 in msec */
56126258Smlaier	u_int		rtsc_m2;	/* slope of the 2nd segment in bps */
57126258Smlaier	/* link-sharing service curve */
58126258Smlaier	u_int		lssc_m1;
59126258Smlaier	u_int		lssc_d;
60126258Smlaier	u_int		lssc_m2;
61126258Smlaier	/* upper-limit service curve */
62126258Smlaier	u_int		ulsc_m1;
63126258Smlaier	u_int		ulsc_d;
64126258Smlaier	u_int		ulsc_m2;
65126258Smlaier	int		flags;
66126258Smlaier};
67126258Smlaier
68126258Smlaierstruct pf_altq {
69126258Smlaier	char			 ifname[IFNAMSIZ];
70126258Smlaier
71126258Smlaier	void			*altq_disc;	/* discipline-specific state */
72126258Smlaier	TAILQ_ENTRY(pf_altq)	 entries;
73126258Smlaier
74126258Smlaier	/* scheduler spec */
75257186Sglebius	uint8_t			 scheduler;	/* scheduler type */
76257186Sglebius	uint16_t		 tbrsize;	/* tokenbucket regulator size */
77257186Sglebius	uint32_t		 ifbandwidth;	/* interface bandwidth */
78126258Smlaier
79126258Smlaier	/* queue spec */
80126258Smlaier	char			 qname[PF_QNAME_SIZE];	/* queue name */
81126258Smlaier	char			 parent[PF_QNAME_SIZE];	/* parent name */
82257186Sglebius	uint32_t		 parent_qid;	/* parent queue id */
83257186Sglebius	uint32_t		 bandwidth;	/* queue bandwidth */
84257186Sglebius	uint8_t			 priority;	/* priority */
85257186Sglebius	uint8_t			 local_flags;	/* dynamic interface */
86177700Smlaier#define	PFALTQ_FLAG_IF_REMOVED		0x01
87240233Sglebius
88257186Sglebius	uint16_t		 qlimit;	/* queue size limit */
89257186Sglebius	uint16_t		 flags;		/* misc flags */
90126258Smlaier	union {
91126258Smlaier		struct cbq_opts		 cbq_opts;
92126258Smlaier		struct priq_opts	 priq_opts;
93126258Smlaier		struct hfsc_opts	 hfsc_opts;
94126258Smlaier	} pq_u;
95126258Smlaier
96257186Sglebius	uint32_t		 qid;		/* return value */
97126258Smlaier};
98126258Smlaier
99257186Sglebius#endif	/* _NET_PF_ALTQ_H_ */
100