1195379Ssam/*-
2195379Ssam * Copyright (c) 2009 Sam Leffler, Errno Consulting
3195379Ssam * All rights reserved.
4195379Ssam *
5195379Ssam * Redistribution and use in source and binary forms, with or without
6195379Ssam * modification, are permitted provided that the following conditions
7195379Ssam * are met:
8195379Ssam * 1. Redistributions of source code must retain the above copyright
9195379Ssam *    notice, this list of conditions and the following disclaimer.
10195379Ssam * 2. Redistributions in binary form must reproduce the above copyright
11195379Ssam *    notice, this list of conditions and the following disclaimer in the
12195379Ssam *    documentation and/or other materials provided with the distribution.
13195379Ssam *
14195379Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15195379Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16195379Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17195379Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18195379Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19195379Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20195379Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21195379Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22195379Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23195379Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24195379Ssam *
25195379Ssam * $FreeBSD$
26195379Ssam */
27195379Ssam#ifndef _NET80211_IEEE80211_STAGEQ_H_
28195379Ssam#define _NET80211_IEEE80211_STAGEQ_H_
29195379Ssam
30195379Ssamstruct ieee80211_node;
31195379Ssamstruct mbuf;
32195379Ssam
33195379Ssamstruct ieee80211_ageq {
34195379Ssam	ieee80211_ageq_lock_t	aq_lock;
35195379Ssam	int			aq_len;		/* # items on queue */
36195379Ssam	int			aq_maxlen;	/* max queue length */
37195379Ssam	int			aq_drops;	/* frames dropped */
38195379Ssam	struct mbuf		*aq_head;	/* frames linked w/ m_nextpkt */
39195379Ssam	struct mbuf		*aq_tail;	/* last frame in queue */
40195379Ssam};
41195379Ssam
42195379Ssamvoid	ieee80211_ageq_init(struct ieee80211_ageq *, int maxlen,
43195379Ssam	    const char *name);
44195379Ssamvoid	ieee80211_ageq_cleanup(struct ieee80211_ageq *);
45195379Ssamvoid	ieee80211_ageq_mfree(struct mbuf *);
46195379Ssamint	ieee80211_ageq_append(struct ieee80211_ageq *, struct mbuf *,
47195379Ssam	    int age);
48195379Ssamvoid	ieee80211_ageq_drain(struct ieee80211_ageq *);
49195379Ssamvoid	ieee80211_ageq_drain_node(struct ieee80211_ageq *,
50195379Ssam	    struct ieee80211_node *);
51195379Ssamstruct mbuf *ieee80211_ageq_age(struct ieee80211_ageq *, int quanta);
52195379Ssamstruct mbuf *ieee80211_ageq_remove(struct ieee80211_ageq *,
53195379Ssam	    struct ieee80211_node *match);
54195379Ssam#endif /* _NET80211_IEEE80211_STAGEQ_H_ */
55