1*33378d91Sjmc.\" $OpenBSD: ieee80211_node.9,v 1.9 2015/11/23 17:53:57 jmc Exp $ 2f903018eSjsg.\" 3f903018eSjsg.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org> 4f903018eSjsg.\" Copyright (c) 2004 Darron Broad <darron@kewl.org> 5f903018eSjsg.\" All rights reserved. 6f903018eSjsg.\" 7f903018eSjsg.\" Redistribution and use in source and binary forms, with or without 8f903018eSjsg.\" modification, are permitted provided that the following conditions 9f903018eSjsg.\" are met: 10f903018eSjsg.\" 1. Redistributions of source code must retain the above copyright 11f903018eSjsg.\" notice, this list of conditions and the following disclaimer. 12f903018eSjsg.\" 2. Redistributions in binary form must reproduce the above copyright 13f903018eSjsg.\" notice, this list of conditions and the following disclaimer in the 14f903018eSjsg.\" documentation and/or other materials provided with the distribution. 15f903018eSjsg.\" 16f903018eSjsg.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17f903018eSjsg.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18f903018eSjsg.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19f903018eSjsg.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20f903018eSjsg.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21f903018eSjsg.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22f903018eSjsg.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23f903018eSjsg.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24f903018eSjsg.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25f903018eSjsg.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26f903018eSjsg.\" SUCH DAMAGE. 27f903018eSjsg.\" 28f903018eSjsg.\" $FreeBSD: src/share/man/man9/ieee80211_node.9,v 1.3 2004/07/07 12:59:39 ru Exp $ 29*33378d91Sjmc.\" $Id: ieee80211_node.9,v 1.9 2015/11/23 17:53:57 jmc Exp $ 30f903018eSjsg.\" 31*33378d91Sjmc.Dd $Mdocdate: November 23 2015 $ 32*33378d91Sjmc.Dt IEEE80211_NODE_ATTACH 9 33f903018eSjsg.Os 34f903018eSjsg.Sh NAME 35f903018eSjsg.Nm ieee80211_node_attach , 36f903018eSjsg.Nm ieee80211_node_lateattach , 37f903018eSjsg.Nm ieee80211_node_detach , 38f903018eSjsg.Nm ieee80211_begin_scan , 39f903018eSjsg.Nm ieee80211_next_scan , 40f903018eSjsg.Nm ieee80211_create_ibss , 41f903018eSjsg.Nm ieee80211_end_scan , 42f903018eSjsg.Nm ieee80211_alloc_node , 43f903018eSjsg.Nm ieee80211_dup_bss , 44f903018eSjsg.Nm ieee80211_find_node , 45f903018eSjsg.Nm ieee80211_release_node , 46f903018eSjsg.Nm ieee80211_free_node , 47f903018eSjsg.Nm ieee80211_free_allnodes , 48f903018eSjsg.Nm ieee80211_iterate_nodes 49f903018eSjsg.Nd software 802.11 stack node management functions 50f903018eSjsg.Sh SYNOPSIS 51f903018eSjsg.In net80211/ieee80211_var.h 52f903018eSjsg.In net80211/ieee80211_proto.h 53f903018eSjsg.In net80211/ieee80211_node.h 54f903018eSjsg.Ft void 55f903018eSjsg.Fn ieee80211_node_attach "struct ifnet *ifp" 56f903018eSjsg.Ft void 57f903018eSjsg.Fn ieee80211_node_lateattach "struct ifnet *ifp" 58f903018eSjsg.Ft void 59f903018eSjsg.Fn ieee80211_node_detach "struct ifnet *ifp" 60f903018eSjsg.Ft void 61f903018eSjsg.Fn ieee80211_begin_scan "struct ifnet *ifp" 62f903018eSjsg.Ft void 63f903018eSjsg.Fn ieee80211_next_scan "struct ifnet *ifp" 64f903018eSjsg.Ft void 65f903018eSjsg.Fo ieee80211_create_ibss 66f903018eSjsg.Fa "struct ieee80211com *ic" "struct ieee80211_channel *chan" 67f903018eSjsg.Fc 68f903018eSjsg.Ft void 69f903018eSjsg.Fn ieee80211_end_scan "struct ifnet *ifp" 70f903018eSjsg.Ft struct ieee80211_node * 71f22d9adcSdamien.Fn ieee80211_alloc_node "struct ieee80211com *ic" "const u_int8_t *macaddr" 72f903018eSjsg.Ft struct ieee80211_node * 73f22d9adcSdamien.Fn ieee80211_dup_bss "struct ieee80211com *ic" "const u_int8_t *macaddr" 74f903018eSjsg.Ft struct ieee80211_node * 75f22d9adcSdamien.Fn ieee80211_find_node "struct ieee80211com *ic" "const u_int8_t *macaddr" 76f903018eSjsg.Ft void 77f903018eSjsg.Fn ieee80211_release_node "struct ieee80211com *ic" "struct ieee80211_node *ni" 78f903018eSjsg.Ft void 79f903018eSjsg.Fn ieee80211_free_node "struct ieee80211com *ic" "struct ieee80211_node *ni" 80f903018eSjsg.Ft void 81f903018eSjsg.Fn ieee80211_free_allnodes "struct ieee80211com *ic" 82f903018eSjsg.Ft void 83f903018eSjsg.Fo ieee80211_iterate_nodes 84f903018eSjsg.Fa "struct ieee80211com *ic" "ieee80211_iter_func *f" "void *arg" 85f903018eSjsg.Fc 86f903018eSjsg.Sh DESCRIPTION 87f903018eSjsgThese functions are used to manage node lists within the software 88f903018eSjsg802.11 stack. 89f903018eSjsgThese lists are typically used for implementing host-mode AP functionality, 90f903018eSjsgor providing signal quality information about neighbouring nodes. 91f903018eSjsg.Pp 92f903018eSjsg.\" 93f903018eSjsgThe 94f903018eSjsg.Fn ieee80211_node_attach 95f903018eSjsgfunction is called from 96f903018eSjsg.Xr ieee80211_ifattach 9 97f903018eSjsgto initialize node database management callbacks for the interface 98f903018eSjsg.Fa ifp 99f903018eSjsg(specifically for memory allocation, node copying and node 100f903018eSjsgsignal inspection). 101f903018eSjsgThese functions may be overridden in special circumstances, 102f903018eSjsgas long as this is done after calling 103f903018eSjsg.Xr ieee80211_ifattach 9 104f903018eSjsgand prior to any other call which may allocate a node. 105f903018eSjsg.Pp 106f903018eSjsg.\" 107f903018eSjsgThe 108f903018eSjsg.Fn ieee80211_node_lateattach 109f903018eSjsgfunction initialises the 110f903018eSjsg.Va ic_bss 111f903018eSjsgnode element of the interface 112f903018eSjsg.Fa ifp 113f903018eSjsgduring 114f903018eSjsg.Xr ieee80211_media_init 9 . 115f903018eSjsgThis late attachment is to account for certain special cases described under 116f903018eSjsg.Fn ieee80211_node_attach . 117f903018eSjsg.Pp 118f903018eSjsg.\" 119f903018eSjsgThe 120f903018eSjsg.Fn ieee80211_node_detach 121f903018eSjsgfunction destroys all node database state associated with the interface 122f903018eSjsg.Fa ifp , 123f903018eSjsgand is usually called during device detach. 124f903018eSjsg.Pp 125f903018eSjsg.\" 126f903018eSjsgThe 127f903018eSjsg.Fn ieee80211_begin_scan 128f903018eSjsgfunction initialises the node database in preparation of an active 129f903018eSjsgscan for an access point on the interface 130f903018eSjsg.Fa ifp . 131f903018eSjsgThe scan begins on the next radio channel by calling 132f903018eSjsg.Fn ieee80211_next_scan 133f903018eSjsginternally. 134f903018eSjsgThe actual scanning for an access point is not automated; 135f903018eSjsgthe device driver itself only handles setting the radio frequency 136f903018eSjsgof the card and stepping through the channels. 137f903018eSjsg.Pp 138f903018eSjsg.\" 139f903018eSjsgThe 140f903018eSjsg.Fn ieee80211_next_scan 141f903018eSjsgfunction is used to inform the 142f903018eSjsg.Xr ieee80211 9 143f903018eSjsglayer that the interface 144f903018eSjsg.Fa ifp 145f903018eSjsgis now scanning for an access point on the next radio channel. 146f903018eSjsgA device driver is expected to first call 147f903018eSjsg.Fn ieee80211_begin_scan , 148f903018eSjsgto initialize the node database, 149f903018eSjsgthen set the radio channel on the device; 150f903018eSjsgthen, after a certain time has elapsed (200ms for example), call 151f903018eSjsg.Fn ieee80211_next_scan 152f903018eSjsgto move to the next channel. 153f903018eSjsgTypically, a timeout is used to automate this process; see 154f903018eSjsg.Xr timeout 9 155f903018eSjsgfor more information on how to use timeouts. 156f903018eSjsg.Pp 157f903018eSjsg.\" 158f903018eSjsgThe 159f903018eSjsg.Fn ieee80211_create_ibss 160f903018eSjsgfunction sets up the net80211-specific portion of an interface's softc, 161f903018eSjsg.Fa ic , 162f903018eSjsgfor use in IBSS mode. 163f903018eSjsg.Pp 164f903018eSjsg.\" 165f903018eSjsgThe 166f903018eSjsg.Fn ieee80211_end_scan 167f903018eSjsgfunction is called by 168f903018eSjsg.Fn ieee80211_next_scan 169d4adb7ffSjmcwhen the state machine has performed a full cycle of scanning on 170f903018eSjsgall available radio channels. 171f903018eSjsgInternally, 172f903018eSjsg.Fn ieee80211_end_scan 173f903018eSjsgwill inspect the node cache associated with the interface 174f903018eSjsg.Fa ifp 175f903018eSjsgfor suitable access points found during scanning, and associate with one, 176f903018eSjsgshould the parameters of the node match those of the configuration 177f903018eSjsgrequested from userland. 178f903018eSjsg.Pp 179f903018eSjsg.\" 180f903018eSjsgThe 181f903018eSjsg.Fn ieee80211_alloc_node 182f903018eSjsgfunction allocates an instance of 183f903018eSjsg.Vt "struct ieee80211_node" 184f903018eSjsgfor a node having the MAC address 185f903018eSjsg.Fa macaddr , 186f903018eSjsgand associates it with the interface 187f903018eSjsg.Fa ic . 188f903018eSjsgIf the allocation is successful, the node structure is initialised by 189f903018eSjsg.Fn ieee80211_setup_node ; 190f903018eSjsgotherwise, 191f903018eSjsg.Dv NULL 192f903018eSjsgis returned. 193f903018eSjsg.Pp 194f903018eSjsg.\" 195f903018eSjsgThe 196f903018eSjsg.Fn ieee80211_dup_bss 197f903018eSjsgfunction is similar to 198f903018eSjsg.Fn ieee80211_alloc_node , 199f903018eSjsgbut is instead used to create a node database entry for the BSSID 200f903018eSjsg.Fa macaddr 201f903018eSjsgassociated with the interface 202f903018eSjsg.Fa ic . 203f903018eSjsgIf the allocation is successful, the node structure is initialised by 204f903018eSjsg.Fn ieee80211_setup_node ; 205f903018eSjsgotherwise, 206f903018eSjsg.Dv NULL 207f903018eSjsgis returned. 208f903018eSjsg.Pp 209f903018eSjsg.\" 210f903018eSjsgThe 211f903018eSjsg.Fn ieee80211_find_node 212f903018eSjsgfunction will iterate through the node list associated with the interface 213f903018eSjsg.Fa ic , 214f903018eSjsgsearching for a node entry which matches 215f903018eSjsg.Fa macaddr . 216f903018eSjsgIf the entry is found, its reference count is incremented, and 217f903018eSjsga pointer to the node is returned; otherwise, 218f903018eSjsg.Dv NULL 219f903018eSjsgwill be returned. 220f903018eSjsg.Pp 221f903018eSjsg.\" 222f903018eSjsgThe 223f903018eSjsg.Fn ieee80211_free_node 224f903018eSjsgfunction will remove the node 225f903018eSjsg.Fa ni 226f903018eSjsgfrom the node database entries associated with the interface 227f903018eSjsg.Fa ic , 228f903018eSjsgand free any memory associated with the node. 229f903018eSjsgThis private method can be overridden in 230f903018eSjsg.Fn ieee80211_node_attach . 231f903018eSjsg.\" 232f903018eSjsg.Pp 233f903018eSjsgThe 234f903018eSjsg.Fn ieee80211_free_allnodes 235f903018eSjsgfunction will iterate through the node list calling 236f903018eSjsg.Fn ieee80211_free_node 237f903018eSjsgfor all nodes associated with the interface 238f903018eSjsg.Fa ic . 239f903018eSjsg.Pp 240f903018eSjsg.\" 241f903018eSjsgThe 242f903018eSjsg.Fn ieee80211_iterate_nodes 243f903018eSjsgfunction will call the user-defined callback function 244f903018eSjsg.Fa f 245f903018eSjsgfor all nodes in the node database associated with the interface 246f903018eSjsg.Fa ic . 247f903018eSjsgThe callback is invoked with the with the user-supplied value 248f903018eSjsg.Fa arg 249f903018eSjsgand a pointer to the current node. 250f903018eSjsg.\" 251f903018eSjsg.Sh SEE ALSO 252f903018eSjsg.Xr ieee80211 9 253f903018eSjsg.Sh HISTORY 254f903018eSjsgThe 255f903018eSjsg.Nm ieee80211 256f903018eSjsgseries of functions first appeared in 257f903018eSjsg.Nx 1.5 , 258f903018eSjsgand were later ported to 259f903018eSjsg.Fx 4.6 260f903018eSjsgand 261f903018eSjsg.Ox 3.6 . 262f903018eSjsg.Sh AUTHORS 263d281945cSjaredy.An -nosplit 264f903018eSjsgThis man page was written by 265f0641c22Sschwarze.An Bruce M. Simpson Aq Mt bms@FreeBSD.org 266f903018eSjsgand 267f0641c22Sschwarze.An Darron Broad Aq Mt darron@kewl.org . 268