1.\" $OpenBSD: ieee80211_output.9,v 1.2 2005/09/30 20:34:25 jaredy Exp $ 2.\" 3.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org> 4.\" Copyright (c) 2004 Darron Broad <darron@kewl.org> 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" $FreeBSD: src/share/man/man9/ieee80211_output.9,v 1.2 2004/07/07 12:59:39 ru Exp $ 29.\" $Id: ieee80211_output.9,v 1.2 2005/09/30 20:34:25 jaredy Exp $ 30.\" 31.Dd March 2, 2004 32.Dt IEEE80211_OUTPUT 9 33.Os 34.Sh NAME 35.Nm ieee80211_encap , ieee80211_add_rates , 36.Nm ieee80211_add_xrates , ieee80211_compute_duration 37.Nm ieee80211_send_mgmt 38.Nd software 802.11 stack output functions 39.Sh SYNOPSIS 40.In net80211/ieee80211_var.h 41.In net80211/ieee80211_proto.h 42.Ft struct mbuf * 43.Fo ieee80211_encap 44.Fa "struct ifnet *ifp" "struct mbuf *m" "struct ieee80211_node **pni" 45.Fc 46.Ft u_int8_t * 47.Fn ieee80211_add_rates "u_int8_t *frm" "const struct ieee80211_rateset *rs" 48.Ft u_int8_t * 49.Fn ieee80211_add_xrates "u_int8_t *frm" "const struct ieee80211_rateset *rs" 50.Ft int 51.Fo ieee80211_compute_duration 52.Fa "struct ieee80211_frame *wh" 53.Fa "int len" 54.Fa "uint32_t flags" 55.Fa "int fraglen" 56.Fa "int rate" 57.Fa "struct ieee80211_duration *d0" 58.Fa "struct ieee80211_duration *dn" 59.Fa "int *npktp" 60.Fa "int debug" 61.Fc 62.Ft int 63.Fo ieee80211_send_mgmt 64.Fa "struct ieee80211com *ic" "struct ieee80211_node *ni" "int type" "int arg" 65.Fc 66.Sh DESCRIPTION 67These functions handle the encapsulation and transmission of 802.11 frames 68within the software 802.11 stack. 69.Pp 70The 71.Fn ieee80211_encap 72function encapsulates an outbound data frame contained within the 73mbuf chain 74.Fa m 75from the interface 76.Fa ifp . 77The argument 78.Fa *pni 79is a reference to the destination node. 80.Pp 81If the function is successful, the mbuf chain is updated with the 82802.11 frame header prepended, and a pointer to the head of the chain 83is returned. 84If an error occurs, 85.Dv NULL 86will be returned, and 87.Fa *pni 88is also set to 89.Dv NULL . 90The caller is responsible for freeing the node reference if 91.Fa *pni 92is 93.Pf non- Dv NULL 94on return. 95The convention is that 96.Va ic_bss 97is not reference counted; the caller is responsible for maintaining this 98reference count. 99.Pp 100.\" 101The 102.Fn ieee80211_add_rates 103utility function is used to add the rate set element 104.Fa *rs 105to the frame 106.Fa frm . 107A pointer to the location in the buffer after the addition of the rate set 108is returned. 109It is typically used when constructing management frames from within the 110software 802.11 stack. 111.Pp 112.\" 113The 114.Fn ieee80211_add_xrates 115utility function is used to add the extended rate set element 116.Fa *rs 117to the frame 118.Fa frm . 119A pointer to the location in the buffer after the addition of the rate set 120is returned. 121It is typically used when constructing management frames from within the 122software 802.11 stack in 802.11g mode. 123.Pp 124.\" 125The 126.Fn ieee80211_compute_duration 127function computes for any packet the appropriate 802.11 Duration field, 128the PLCP Length field, as well as the Duration and Length fields for an RTS frame. 129.Pp 130.\" 131The 132.Fn ieee80211_send_mgmt 133function transmits a management frame on the interface 134.Fa ic 135to the destination node 136.Fa ni 137of type 138.Fa type . 139.Pp 140The argument 141.Fa arg 142specifies either a sequence number for authentication operations, 143a status code for [re]association operations, 144or a reason for deauthentication and deassociation operations. 145.Pp 146Nodes other than 147.Va ic_bss 148have their reference count incremented to reflect their use for an 149indeterminate amount of time. 150This reference is freed when the function returns. 151.Pp 152The function returns 0 if successful; if temporary buffer space is not 153available, the function returns 154.Er ENOMEM . 155.\" 156.Sh SEE ALSO 157.Xr ieee80211 9 158.Sh HISTORY 159The 160.Nm ieee80211 161series of functions first appeared in 162.Nx 1.5 , 163and were later ported to 164.Fx 4.6 165and 166.Ox 3.6 . 167.Sh AUTHORS 168.An -nosplit 169This man page was written by 170.An Bruce M. Simpson Aq bms@FreeBSD.org 171and 172.An Darron Broad Aq darron@kewl.org . 173