diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2005-03-11 20:28:52 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2005-03-11 20:28:52 +0000 |
commit | 3fe20ec045cb57b9be1819fe9e5441d16f7e9af2 (patch) | |
tree | 5d246f699f5485b3f7879521cf1da5591ebcc2c8 /sys/dev/ic/ral.c | |
parent | a083bdf2fc44ceec58cf54b39cf71cfa2d06710c (diff) |
new ral_get_rts() function for building RTS frames.
Diffstat (limited to 'sys/dev/ic/ral.c')
-rw-r--r-- | sys/dev/ic/ral.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/sys/dev/ic/ral.c b/sys/dev/ic/ral.c index eefac96f946..68b6f59367d 100644 --- a/sys/dev/ic/ral.c +++ b/sys/dev/ic/ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ral.c,v 1.27 2005/03/11 20:25:52 damien Exp $ */ +/* $OpenBSD: ral.c,v 1.28 2005/03/11 20:28:51 damien Exp $ */ /*- * Copyright (c) 2005 @@ -108,6 +108,8 @@ int ral_tx_bcn(struct ral_softc *, struct mbuf *, #endif int ral_tx_mgt(struct ral_softc *, struct mbuf *, struct ieee80211_node *); +struct mbuf *ral_get_rts(struct ral_softc *, struct ieee80211_frame *, + uint16_t); int ral_tx_data(struct ral_softc *, struct mbuf *, struct ieee80211_node *); void ral_start(struct ifnet *); @@ -1705,6 +1707,37 @@ ral_tx_mgt(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) return 0; } +/* + * Build a RTS control frame. + */ +struct mbuf * +ral_get_rts(struct ral_softc *sc, struct ieee80211_frame *wh, uint16_t dur) +{ + struct ieee80211_frame_rts *rts; + struct mbuf *m; + + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == NULL) { + sc->sc_ic.ic_stats.is_tx_nombuf++; + printf("%s: could not allocate RTS frame\n", + sc->sc_dev.dv_xname); + return NULL; + } + + rts = mtod(m, struct ieee80211_frame_rts *); + + rts->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_CTL | + IEEE80211_FC0_SUBTYPE_RTS; + rts->i_fc[1] = IEEE80211_FC1_DIR_NODS; + *(uint16_t *)rts->i_dur = htole16(dur); + IEEE80211_ADDR_COPY(rts->i_ra, wh->i_addr1); + IEEE80211_ADDR_COPY(rts->i_ta, wh->i_addr2); + + m->m_pkthdr.len = m->m_len = sizeof (struct ieee80211_frame_rts); + + return m; +} + int ral_tx_data(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) { |