1.\" $OpenBSD: ieee80211_output.9,v 1.5 2013/07/17 20:21:53 schwarze 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.5 2013/07/17 20:21:53 schwarze Exp $ 30.\" 31.Dd $Mdocdate: July 17 2013 $ 32.Dt IEEE80211_OUTPUT 9 33.Os 34.Sh NAME 35.Nm ieee80211_encap , ieee80211_add_rates , 36.Nm ieee80211_add_xrates , 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_send_mgmt 52.Fa "struct ieee80211com *ic" "struct ieee80211_node *ni" "int type" "int arg" 53.Fc 54.Sh DESCRIPTION 55These functions handle the encapsulation and transmission of 802.11 frames 56within the software 802.11 stack. 57.Pp 58The 59.Fn ieee80211_encap 60function encapsulates an outbound data frame contained within the 61mbuf chain 62.Fa m 63from the interface 64.Fa ifp . 65The argument 66.Fa *pni 67is a reference to the destination node. 68.Pp 69If the function is successful, the mbuf chain is updated with the 70802.11 frame header prepended, and a pointer to the head of the chain 71is returned. 72If an error occurs, 73.Dv NULL 74will be returned, and 75.Fa *pni 76is also set to 77.Dv NULL . 78The caller is responsible for freeing the node reference if 79.Fa *pni 80is 81.Pf non- Dv NULL 82on return. 83The convention is that 84.Va ic_bss 85is not reference counted; the caller is responsible for maintaining this 86reference count. 87.Pp 88.\" 89The 90.Fn ieee80211_add_rates 91utility function is used to add the rate set element 92.Fa *rs 93to the frame 94.Fa frm . 95A pointer to the location in the buffer after the addition of the rate set 96is returned. 97It is typically used when constructing management frames from within the 98software 802.11 stack. 99.Pp 100.\" 101The 102.Fn ieee80211_add_xrates 103utility function is used to add the extended 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 in 802.11g mode. 111.Pp 112.\" 113The 114.Fn ieee80211_send_mgmt 115function transmits a management frame on the interface 116.Fa ic 117to the destination node 118.Fa ni 119of type 120.Fa type . 121.Pp 122The argument 123.Fa arg 124specifies either a sequence number for authentication operations, 125a status code for [re]association operations, 126or a reason for deauthentication and deassociation operations. 127.Pp 128Nodes other than 129.Va ic_bss 130have their reference count incremented to reflect their use for an 131indeterminate amount of time. 132This reference is freed when the function returns. 133.Pp 134The function returns 0 if successful; if temporary buffer space is not 135available, the function returns 136.Er ENOMEM . 137.\" 138.Sh SEE ALSO 139.Xr ieee80211 9 140.Sh HISTORY 141The 142.Nm ieee80211 143series of functions first appeared in 144.Nx 1.5 , 145and were later ported to 146.Fx 4.6 147and 148.Ox 3.6 . 149.Sh AUTHORS 150.An -nosplit 151This man page was written by 152.An Bruce M. Simpson Aq Mt bms@FreeBSD.org 153and 154.An Darron Broad Aq Mt darron@kewl.org . 155