1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #ifndef _ALTQ_ALTQ_VAR_H_
30 #define _ALTQ_ALTQ_VAR_H_
31
32 #ifdef _KERNEL
33
34 #include <sys/param.h>
35 #include <sys/kernel.h>
36 #include <sys/queue.h>
37
38 #ifndef ALTQ_RED
39 #define ALTQ_RED
40 #endif
41 #ifndef ALTQ_CBQ
42 #define ALTQ_CBQ
43 #endif
44 #ifndef ALTQ_PRIQ
45 #define ALTQ_PRIQ
46 #endif
47 #ifndef ALTQ_HFSC
48 #define ALTQ_HFSC
49 #endif
50
51
52
53
54
55 extern int machclk_usepcc;
56 extern u_int32_t machclk_freq;
57 extern u_int32_t machclk_per_tick;
58 extern void init_machclk(void);
59 extern u_int64_t read_machclk(void);
60
61
62
63
64 #ifdef ALTQ_DEBUG
65 #ifdef __STDC__
66 #define ASSERT(e) ((e) ? (void)0 : altq_assert(__FILE__, __LINE__, #e))
67 #else
68 #define ASSERT(e) ((e) ? (void)0 : altq_assert(__FILE__, __LINE__, "e"))
69 #endif
70 #else
71 #define ASSERT(e) ((void)0)
72 #endif
73
74
75
76
77
78
79 #include <sys/timeout.h>
80
81 struct callout {
82 struct timeout c_to;
83 };
84 #define CALLOUT_INIT(c) do { bzero((c), sizeof(*(c))); } while (0)
85 #define CALLOUT_RESET(c,t,f,a) do { if (!timeout_initialized(&(c)->c_to)) \
86 timeout_set(&(c)->c_to, (f), (a)); \
87 timeout_add(&(c)->c_to, (t)); } while (0)
88 #define CALLOUT_STOP(c) timeout_del(&(c)->c_to)
89 #define CALLOUT_INITIALIZER { { { NULL }, NULL, NULL, 0, 0 } }
90
91 typedef void (timeout_t)(void *);
92
93 #define m_pktlen(m) ((m)->m_pkthdr.len)
94
95 struct ifnet; struct mbuf;
96 struct pf_altq; struct pf_qstats;
97
98 void *altq_lookup(char *, int);
99 u_int8_t read_dsfield(struct mbuf *, struct altq_pktattr *);
100 void write_dsfield(struct mbuf *, struct altq_pktattr *, u_int8_t);
101 void altq_assert(const char *, int, const char *);
102 int tbr_set(struct ifaltq *, struct tb_profile *);
103 int tbr_get(struct ifaltq *, struct tb_profile *);
104 int altq_pfattach(struct pf_altq *);
105
106 int altq_pfdetach(struct pf_altq *);
107 int altq_add(struct pf_altq *);
108 int altq_remove(struct pf_altq *);
109 int altq_add_queue(struct pf_altq *);
110 int altq_remove_queue(struct pf_altq *);
111 int altq_getqstats(struct pf_altq *, void *, int *);
112
113 int cbq_pfattach(struct pf_altq *);
114 int cbq_add_altq(struct pf_altq *);
115 int cbq_remove_altq(struct pf_altq *);
116 int cbq_add_queue(struct pf_altq *);
117 int cbq_remove_queue(struct pf_altq *);
118 int cbq_getqstats(struct pf_altq *, void *, int *);
119
120 int priq_pfattach(struct pf_altq *);
121 int priq_add_altq(struct pf_altq *);
122 int priq_remove_altq(struct pf_altq *);
123 int priq_add_queue(struct pf_altq *);
124 int priq_remove_queue(struct pf_altq *);
125 int priq_getqstats(struct pf_altq *, void *, int *);
126
127 int hfsc_pfattach(struct pf_altq *);
128 int hfsc_add_altq(struct pf_altq *);
129 int hfsc_remove_altq(struct pf_altq *);
130 int hfsc_add_queue(struct pf_altq *);
131 int hfsc_remove_queue(struct pf_altq *);
132 int hfsc_getqstats(struct pf_altq *, void *, int *);
133
134 #endif
135 #endif