| 1 | {{{#!comment |
| 2 | [[Include(wiki:802.11/beta-note)]] |
| 3 | }}} |
| 4 | |
| 5 | [[TracNav(802.11/TOC)]] |
| 6 | |
| 7 | = 802.11 Reference Design Experiments Framework Basic Service Set (BSS) = |
| 8 | |
| 9 | The 802.11 Reference design uses a structure to record information about a [https://en.wikipedia.org/wiki/Service_set_(802.11_network) basic service set (BSS)]. This information can be for the node's current BSS (i.e. network) or networks that the node has seen by either receiving a beacon or from [http://warpproject.org/docs/mango-wlan-exp-dev/node.html#network-scan scanning for networks]. Each node is either a member of no BSS (colloquially "unassociated") or a member of one BSS. The following fields are recorded in the BSS information structure to describe a BSS: |
| 10 | |
| 11 | ||= Field Name =||= Description =|| |
| 12 | || bssid || BSS ID || |
| 13 | || channel || Primary channel || |
| 14 | || channel_type || Channel Type || |
| 15 | || latest_beacon_rx_time || Value of System Time in microseconds of last beacon Rx || |
| 16 | || ssid || SSID (32 chars max) || |
| 17 | || latest_beacon_rx_power || Last observed Rx Power (dBm) || |
| 18 | || flags || BSS flags || |
| 19 | || capabilities || Supported capabilities of the BSS || |
| 20 | || beacon_interval || Beacon interval - In time units of 1024 us || |
| 21 | |
| 22 | |
| 23 | === Python === |
| 24 | |
| 25 | The 802.11 Reference Design Experiments Framework provides methods to interact with BSS information. In addition to the fields above, the BSS information structures in Python also contain a {{{timestamp}}} field which is the value of the MAC time in microseconds when the structure was created. The following methods are used to interact with BSS information: |
| 26 | |
| 27 | * [http://warpproject.org/docs/mango-wlan-exp-dev/node.html#wlan_exp.node.WlanExpNode.get_bss_info get_bss_info()] |
| 28 | |
| 29 | This method will return the BSS information about the node's current BSS. The value returned can be {{{None}}} if the node is not a member of a BSS. |
| 30 | |
| 31 | * [http://warpproject.org/docs/mango-wlan-exp-dev/node.html#wlan_exp.node.WlanExpNode.get_network_list get_network_list()] |
| 32 | |
| 33 | This method will return a list of BSS information about all the networks that the node has seen. This list can include the node's current BSS if the node is a member of a BSS. This list could be empty. |
| 34 | |
| 35 | * '''{{{configure_bss()}}}''' for [http://warpproject.org/docs/mango-wlan-exp-dev/node_ap.html#wlan_exp.node_ap.WlanExpNodeAp.configure_bss AP], for [http://warpproject.org/docs/mango-wlan-exp-dev/node_sta.html#wlan_exp.node_sta.WlanExpNodeSta.configure_bss STA], for [http://warpproject.org/docs/mango-wlan-exp-dev/node_ibss.html#wlan_exp.node_ibss.WlanExpNodeIBSS.configure_bss IBSS] |
| 36 | |
| 37 | This method will configure the node's current BSS. For each node type, there is a specific implementation of {{{configure_bss}}} that has different argument requirements. See below for more details. |
| 38 | |
| 39 | |
| 40 | |
| 41 | === Configuring the BSS === |
| 42 | |
| 43 | A node requires a minimum set of information to be a member of a BSS. The minimum set of information is: |
| 44 | * BSSID: 48-bit MAC address |
| 45 | * Channel: logical channel for Tx/Rx by BSS members |
| 46 | * SSID: variable length string |
| 47 | * Beacon Interval: time between TBTTs in units of TUs (not required by STA) |
| 48 | |
| 49 | A node's current BSS can be populated by default in C, by active scanning, or by wlan_exp. The DIP switch on the WARP v3 node can be used to control the default BSS at boot (see [http://warpproject.org/trac/wiki/802.11/Usage/UserIO user I/O documentation] for each MAC project). |
| 50 | |
| 51 | '''Arguments:''' |
| 52 | |
| 53 | * {{{bssid}}}: depends on node type; {{{None}}} means wipe BSS state; {{{False}}} means no change |
| 54 | * '''AP''': must be node's wireless MAC address |
| 55 | * '''STA''': must be BSSID of BSS with which to associate |
| 56 | * '''IBSS''': must be valid locally-administered BSSID (use [http://warpproject.org/docs/mango-wlan-exp-dev/wlan_exp_util.html#wlan_exp.util.create_locally_administered_bssid create_locally_administered_bssid()] utility to create locally-administered BSSIDs from MAC addresses) |
| 57 | * {{{ssid}}}: string; {{{None}}} means no change |
| 58 | * {{{beacon_interval}}}: integer in ![10, 65534]; {{{None}}} means no beacon Tx; {{{False}}} means no change |
| 59 | * {{{channel}}}: Integer channel index; {{{None}}} means no change |
| 60 | * {{{ht_capable}}}: Does the node advertise HT processing capabilities; {{{None}}} means no change |
| 61 | |
| 62 | === Changes to code from 802.11 Reference Design v1.4 === |
| 63 | |
| 64 | * '''Replaces:''' |
| 65 | * {{{node.set_channel()}}}: New method [http://warpproject.org/docs/mango-wlan-exp-dev/node.html#wlan_exp.node.WlanExpNode.set_radio_channel set_radio_channel()] only affects hardware, not BSS |
| 66 | * {{{node_ap.get/set_ssid()}}}: Use {{{get_bss_info()}}} as getter |
| 67 | * {{{node_ap.get/set_beacon_interval()}}}: Use {{{get_bss_info()}}} as getter |
| 68 | * {{{node_sta.set_association()}}} |
| 69 | * {{{node_ibss.join()}}} |
| 70 | * {{{util.create_bss_info()}}} |
| 71 | |
| 72 | * '''Affected:''' |
| 73 | * {{{node.reset()}}} has new arguments: |
| 74 | * {{{bss=bool}}}: nullifies the node's BSS state but does not remove any entries from the BSS information list; wipes station_info list |
| 75 | * {{{n.reset(bss=True)}}}, unlike {{{n.configure_bss(bssid=None)}}}, shall produce the following OTA transmission: |
| 76 | * For AP, a deauthentication frame to each associated station |
| 77 | * For STA, a disassociation frame to its AP |
| 78 | * For IBSS, nothing. {{{n_ibss.reset(bss=True)}}} == {{{n_ibss.configure_bss(bssid=None)}}} |
| 79 | * {{{network_list=bool}}}: wipes the node's list of overheard BSS information, excluding the bss_info entry for the node's current network (if any) |
| 80 | * Removed arguments {{{associations=bool}}}, {{{bss_info=bool}}} |
| 81 | * {{{node.reset_all()}}} includes {{{(bss=True, network_list=True)}}} |
| 82 | |
| 83 | |
| 84 | === Example: Configuring BSS === |
| 85 | |
| 86 | |
| 87 | {{{#!python |
| 88 | # Setup a new network with 1 AP, 1 STA |
| 89 | # - Assumes that both nodes started with no default BSS (i.e. |
| 90 | >>> n_ap.configure_bss(ssid='My Network', beacon_interval=100, channel=6, ht_capable=True) |
| 91 | >>> n_ap.get_bss_info() |
| 92 | {'bssid': AP_WLAN_MAC_ADDR, 'ssid': 'My Network', 'beacon_interval': 100, 'channel': 6, 'ht_capable': True, ...} |
| 93 | |
| 94 | >>> n_sta.get_bss_info() |
| 95 | None |
| 96 | |
| 97 | >>> n_ap.add_association(n_sta) |
| 98 | |
| 99 | >>> n_sta.get_bss_info() |
| 100 | {'bssid': AP_WLAN_MAC_ADDR, 'ssid': 'My Network', 'beacon_interval': 100, 'channel': 6, 'ht_capable': True, ...} |
| 101 | |
| 102 | # Update the beacon interval |
| 103 | >>> n_ap.configure_bss(beacon_interval=250) |
| 104 | >>> n_ap.get_bss_info() |
| 105 | {'bssid': AP_WLAN_MAC_ADDR, 'ssid': 'My Network', 'beacon_interval': 250, 'channel': 6, 'ht_capable': True, ...} |
| 106 | |
| 107 | # Query STA before it receives a new beacon |
| 108 | >>> n_sta.get_bss_info() |
| 109 | {'bssid': AP_WLAN_MAC_ADDR, 'ssid': 'My Network', 'beacon_interval': 100, 'channel': 6, 'ht_capable': True, ...} |
| 110 | |
| 111 | # Query STA after it receives a new beacon |
| 112 | >>> time.sleep(250*1024*1e-6) |
| 113 | >>> n_sta.get_bss_info() |
| 114 | {'bssid': AP_WLAN_MAC_ADDR, 'ssid': 'My Network', 'beacon_interval': 250, 'channel': 6, 'ht_capable': True, ...} |
| 115 | |
| 116 | # Retune both nodes by adjusting the BSS channel |
| 117 | for n in [n_ap, n_sta]: |
| 118 | n.configure_bss(channel=7) |
| 119 | |
| 120 | # Disable AP beacon Tx |
| 121 | >>> n_ap.configure_bss(beacon_interval=None) |
| 122 | }}} |
| 123 | |
| 124 | === Example: Changing Channel === |
| 125 | |
| 126 | |
| 127 | |
| 128 | {{{#!python |
| 129 | # No command arguments, no response payload |
| 130 | my_node.send_user_command(CMDID_USER_MYCMD, args=None) |
| 131 | }}} |
| 132 | |
| 133 | |
| 134 | === Example: Adjusting Beacon Interval === |
| 135 | |
| 136 | {{{#!python |
| 137 | # No command arguments, no response payload |
| 138 | my_node.send_user_command(CMDID_USER_MYCMD, args=None) |
| 139 | }}} |
| 140 | |
| 141 | |
| 142 | === Example: Scanning for Networks === |
| 143 | |
| 144 | {{{#!python |
| 145 | # No command arguments, no response payload |
| 146 | my_node.send_user_command(CMDID_USER_MYCMD, args=None) |
| 147 | args=[ARG0 ARG1]) |
| 148 | }}} |
| 149 | |
| 150 | |
| 151 | |