| Commit | Line | Data |
|---|---|---|
| 32176cfd RP |
1 | /*- |
| 2 | * Copyright (c) 2009 The FreeBSD Foundation | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * This software was developed by Rui Paulo under sponsorship from the | |
| 6 | * FreeBSD Foundation. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | * | |
| 29 | * $FreeBSD: head/sys/net80211/ieee80211_mesh.h 202178 2010-01-12 22:22:27Z rpaulo $ | |
| 30 | * $DragonFly$ | |
| 31 | */ | |
| 32 | #ifndef _NET80211_IEEE80211_MESH_H_ | |
| 33 | #define _NET80211_IEEE80211_MESH_H_ | |
| 34 | ||
| 35 | #define IEEE80211_MESH_DEFAULT_TTL 31 | |
| 36 | ||
| 37 | /* | |
| 38 | * NB: all structures are __packed so sizeof works on arm, et. al. | |
| 39 | */ | |
| 40 | /* | |
| 41 | * 802.11s Information Elements. | |
| 42 | */ | |
| 43 | /* Mesh Configuration */ | |
| 44 | struct ieee80211_meshconf_ie { | |
| 45 | uint8_t conf_ie; /* IEEE80211_ELEMID_MESHCONF */ | |
| 46 | uint8_t conf_len; | |
| 47 | uint8_t conf_pselid; /* Active Path Sel. Proto. ID */ | |
| 48 | uint8_t conf_pmetid; /* Active Metric Identifier */ | |
| 49 | uint8_t conf_ccid; /* Congestion Control Mode ID */ | |
| 50 | uint8_t conf_syncid; /* Sync. Protocol ID */ | |
| 51 | uint8_t conf_authid; /* Auth. Protocol ID */ | |
| 52 | uint8_t conf_form; /* Formation Information */ | |
| 53 | uint16_t conf_cap; | |
| 54 | } __packed; | |
| 55 | ||
| 56 | /* Hybrid Wireless Mesh Protocol */ | |
| 57 | #define IEEE80211_MESHCONF_PATH_HWMP 0x00 | |
| 58 | /* Airtime Link Metric */ | |
| 59 | #define IEEE80211_MESHCONF_METRIC_AIRTIME 0x00 | |
| 60 | /* Congestion Control */ | |
| 61 | #define IEEE80211_MESHCONF_CC_DISABLED 0x00 | |
| 62 | #define IEEE80211_MESHCONF_CC_SIG 0x01 | |
| 63 | /* Neighbour Offset */ | |
| 64 | #define IEEE80211_MESHCONF_SYNC_NEIGHOFF 0x00 | |
| 65 | #define IEEE80211_MESHCONF_AUTH_DISABLED 0x00 | |
| 66 | /* Simultaneous Authenticaction of Equals */ | |
| 67 | #define IEEE80211_MESHCONF_AUTH_SAE 0x01 | |
| 68 | #define IEEE80211_MESHCONF_FORM_MP 0x01 /* Connected to Portal */ | |
| 69 | #define IEEE80211_MESHCONF_FORM_NNEIGH_MASK 0x04 /* Number of Neighbours */ | |
| 70 | #define IEEE80211_MESHCONF_CAP_AP 0x01 /* Accepting Peers */ | |
| 71 | #define IEEE80211_MESHCONF_CAP_MCCAS 0x02 /* MCCA supported */ | |
| 72 | #define IEEE80211_MESHCONF_CAP_MCCAE 0x04 /* MCCA enabled */ | |
| 73 | #define IEEE80211_MESHCONF_CAP_FWRD 0x08 /* forwarding enabled */ | |
| 74 | #define IEEE80211_MESHCONF_CAP_BTR 0x10 /* Beacon Timing Report Enab */ | |
| 75 | #define IEEE80211_MESHCONF_CAP_TBTTA 0x20 /* TBTT Adj. Enabled */ | |
| 76 | #define IEEE80211_MESHCONF_CAP_TBTT 0x40 /* TBTT Adjusting */ | |
| 77 | #define IEEE80211_MESHCONF_CAP_PSL 0x80 /* Power Save Level */ | |
| 78 | ||
| 79 | /* Mesh Identifier */ | |
| 80 | struct ieee80211_meshid_ie { | |
| 81 | uint8_t id_ie; /* IEEE80211_ELEMID_MESHID */ | |
| 82 | uint8_t id_len; | |
| 83 | } __packed; | |
| 84 | ||
| 85 | /* Link Metric Report */ | |
| 86 | struct ieee80211_meshlmetric_ie { | |
| 87 | uint8_t lm_ie; /* IEEE80211_ELEMID_MESHLINK */ | |
| 88 | uint8_t lm_len; | |
| 89 | uint32_t lm_metric; | |
| 90 | #define IEEE80211_MESHLMETRIC_INITIALVAL 0 | |
| 91 | } __packed; | |
| 92 | ||
| 93 | /* Congestion Notification */ | |
| 94 | struct ieee80211_meshcngst_ie { | |
| 95 | uint8_t cngst_ie; /* IEEE80211_ELEMID_MESHCNGST */ | |
| 96 | uint8_t cngst_len; | |
| 97 | uint16_t cngst_timer[4]; /* Expiration Timers: AC_BK, | |
| 98 | AC_BE, AC_VI, AC_VO */ | |
| 99 | } __packed; | |
| 100 | ||
| 101 | /* Peer Link Management */ | |
| 102 | struct ieee80211_meshpeer_ie { | |
| 103 | uint8_t peer_ie; /* IEEE80211_ELEMID_MESHPEER */ | |
| 104 | uint8_t peer_len; | |
| 105 | uint8_t peer_proto[4]; /* Peer Management Protocol */ | |
| 106 | uint16_t peer_llinkid; /* Local Link ID */ | |
| 107 | uint16_t peer_linkid; /* Peer Link ID */ | |
| 108 | uint16_t peer_rcode; | |
| 109 | } __packed; | |
| 110 | ||
| 111 | enum { | |
| 112 | IEEE80211_MESH_PEER_LINK_OPEN = 0, | |
| 113 | IEEE80211_MESH_PEER_LINK_CONFIRM = 1, | |
| 114 | IEEE80211_MESH_PEER_LINK_CLOSE = 2, | |
| 115 | /* values 3-255 are reserved */ | |
| 116 | }; | |
| 117 | ||
| 118 | /* Mesh Peering Management Protocol */ | |
| 119 | #define IEEE80211_MESH_PEER_PROTO_OUI 0x00, 0x0f, 0xac | |
| 120 | #define IEEE80211_MESH_PEER_PROTO_VALUE 0x2a | |
| 121 | #define IEEE80211_MESH_PEER_PROTO { IEEE80211_MESH_PEER_PROTO_OUI, \ | |
| 122 | IEEE80211_MESH_PEER_PROTO_VALUE } | |
| 123 | /* Abbreviated Handshake Protocol */ | |
| 124 | #define IEEE80211_MESH_PEER_PROTO_AH_OUI 0x00, 0x0f, 0xac | |
| 125 | #define IEEE80211_MESH_PEER_PROTO_AH_VALUE 0x2b | |
| 126 | #define IEEE80211_MESH_PEER_PROTO_AH { IEEE80211_MESH_PEER_PROTO_AH_OUI, \ | |
| 127 | IEEE80211_MESH_PEER_PROTO_AH_VALUE } | |
| 128 | #ifdef notyet | |
| 129 | /* Mesh Channel Switch Annoucement */ | |
| 130 | struct ieee80211_meshcsa_ie { | |
| 131 | uint8_t csa_ie; /* IEEE80211_ELEMID_MESHCSA */ | |
| 132 | uint8_t csa_len; | |
| 133 | uint8_t csa_mode; | |
| 134 | uint8_t csa_newclass; /* New Regulatory Class */ | |
| 135 | uint8_t csa_newchan; | |
| 136 | uint8_t csa_precvalue; /* Precedence Value */ | |
| 137 | uint8_t csa_count; | |
| 138 | } __packed; | |
| 139 | ||
| 140 | /* Mesh TIM */ | |
| 141 | /* Equal to the non Mesh version */ | |
| 142 | ||
| 143 | /* Mesh Awake Window */ | |
| 144 | struct ieee80211_meshawakew_ie { | |
| 145 | uint8_t awakew_ie; /* IEEE80211_ELEMID_MESHAWAKEW */ | |
| 146 | uint8_t awakew_len; | |
| 147 | uint8_t awakew_windowlen; /* in TUs */ | |
| 148 | } __packed; | |
| 149 | ||
| 150 | /* Mesh Beacon Timing */ | |
| 151 | struct ieee80211_meshbeacont_ie { | |
| 152 | uint8_t beacont_ie; /* IEEE80211_ELEMID_MESHBEACONT */ | |
| 153 | uint8_t beacont_len; | |
| 154 | struct { | |
| 155 | uint8_t mp_aid; /* Least Octet of AID */ | |
| 156 | uint16_t mp_btime; /* Beacon Time */ | |
| 157 | uint16_t mp_bint; /* Beacon Interval */ | |
| 158 | } __packed mp[1]; /* NB: variable size */ | |
| 159 | } __packed; | |
| 160 | #endif | |
| 161 | ||
| 162 | /* Portal (MP) Annoucement */ | |
| 163 | struct ieee80211_meshpann_ie { | |
| 164 | uint8_t pann_ie; /* IEEE80211_ELEMID_MESHPANN */ | |
| 165 | uint8_t pann_len; | |
| 166 | uint8_t pann_flags; | |
| 167 | uint8_t pann_hopcount; | |
| 168 | uint8_t pann_ttl; | |
| 169 | uint8_t pann_addr[IEEE80211_ADDR_LEN]; | |
| 170 | uint8_t pann_seq; /* PANN Sequence Number */ | |
| 171 | } __packed; | |
| 172 | ||
| 173 | /* Root (MP) Annoucement */ | |
| 174 | struct ieee80211_meshrann_ie { | |
| 175 | uint8_t rann_ie; /* IEEE80211_ELEMID_MESHRANN */ | |
| 176 | uint8_t rann_len; | |
| 177 | uint8_t rann_flags; | |
| 178 | #define IEEE80211_MESHRANN_FLAGS_PR 0x01 /* Portal Role */ | |
| 179 | uint8_t rann_hopcount; | |
| 180 | uint8_t rann_ttl; | |
| 181 | uint8_t rann_addr[IEEE80211_ADDR_LEN]; | |
| 182 | uint32_t rann_seq; /* HWMP Sequence Number */ | |
| 183 | uint32_t rann_metric; | |
| 184 | } __packed; | |
| 185 | ||
| 186 | /* Mesh Path Request */ | |
| 187 | struct ieee80211_meshpreq_ie { | |
| 188 | uint8_t preq_ie; /* IEEE80211_ELEMID_MESHPREQ */ | |
| 189 | uint8_t preq_len; | |
| 190 | uint8_t preq_flags; | |
| 191 | #define IEEE80211_MESHPREQ_FLAGS_PR 0x01 /* Portal Role */ | |
| 192 | #define IEEE80211_MESHPREQ_FLAGS_AM 0x02 /* 0 = ucast / 1 = bcast */ | |
| 193 | #define IEEE80211_MESHPREQ_FLAGS_PP 0x04 /* Proactive PREP */ | |
| 194 | #define IEEE80211_MESHPREQ_FLAGS_AE 0x40 /* Address Extension */ | |
| 195 | uint8_t preq_hopcount; | |
| 196 | uint8_t preq_ttl; | |
| 197 | uint32_t preq_id; | |
| 198 | uint8_t preq_origaddr[IEEE80211_ADDR_LEN]; | |
| 199 | uint32_t preq_origseq; /* HWMP Sequence Number */ | |
| 200 | /* NB: may have Originator Proxied Address */ | |
| 201 | uint32_t preq_lifetime; | |
| 202 | uint32_t preq_metric; | |
| 203 | uint8_t preq_tcount; /* target count */ | |
| 204 | struct { | |
| 205 | uint8_t target_flags; | |
| 206 | #define IEEE80211_MESHPREQ_TFLAGS_TO 0x01 /* Target Only */ | |
| 207 | #define IEEE80211_MESHPREQ_TFLAGS_RF 0x02 /* Reply and Forward */ | |
| 208 | #define IEEE80211_MESHPREQ_TFLAGS_USN 0x04 /* Unknown HWMP seq number */ | |
| 209 | uint8_t target_addr[IEEE80211_ADDR_LEN]; | |
| 210 | uint32_t target_seq; /* HWMP Sequence Number */ | |
| 211 | } __packed preq_targets[1]; /* NB: variable size */ | |
| 212 | } __packed; | |
| 213 | ||
| 214 | /* Mesh Path Reply */ | |
| 215 | struct ieee80211_meshprep_ie { | |
| 216 | uint8_t prep_ie; /* IEEE80211_ELEMID_MESHPREP */ | |
| 217 | uint8_t prep_len; | |
| 218 | uint8_t prep_flags; | |
| 219 | uint8_t prep_hopcount; | |
| 220 | uint8_t prep_ttl; | |
| 221 | uint8_t prep_targetaddr[IEEE80211_ADDR_LEN]; | |
| 222 | uint32_t prep_targetseq; | |
| 223 | /* NB: May have Target Proxied Address */ | |
| 224 | uint32_t prep_lifetime; | |
| 225 | uint32_t prep_metric; | |
| 226 | uint8_t prep_origaddr[IEEE80211_ADDR_LEN]; | |
| 227 | uint32_t prep_origseq; /* HWMP Sequence Number */ | |
| 228 | } __packed; | |
| 229 | ||
| 230 | /* Mesh Path Error */ | |
| 231 | struct ieee80211_meshperr_ie { | |
| 232 | uint8_t perr_ie; /* IEEE80211_ELEMID_MESHPERR */ | |
| 233 | uint8_t perr_len; | |
| 234 | uint8_t perr_ttl; | |
| 235 | uint8_t perr_ndests; /* Number of Destinations */ | |
| 236 | struct { | |
| 237 | uint8_t dest_flags; | |
| 238 | #define IEEE80211_MESHPERR_DFLAGS_USN 0x01 | |
| 239 | #define IEEE80211_MESHPERR_DFLAGS_RC 0x02 | |
| 240 | uint8_t dest_addr[IEEE80211_ADDR_LEN]; | |
| 241 | uint32_t dest_seq; /* HWMP Sequence Number */ | |
| 242 | uint16_t dest_rcode; | |
| 243 | } __packed perr_dests[1]; /* NB: variable size */ | |
| 244 | } __packed; | |
| 245 | ||
| 246 | #ifdef notyet | |
| 247 | /* Mesh Proxy Update */ | |
| 248 | struct ieee80211_meshpu_ie { | |
| 249 | uint8_t pu_ie; /* IEEE80211_ELEMID_MESHPU */ | |
| 250 | uint8_t pu_len; | |
| 251 | uint8_t pu_flags; | |
| 252 | #define IEEE80211_MESHPU_FLAGS_MASK 0x1 | |
| 253 | #define IEEE80211_MESHPU_FLAGS_DEL 0x0 | |
| 254 | #define IEEE80211_MESHPU_FLAGS_ADD 0x1 | |
| 255 | uint8_t pu_seq; /* PU Sequence Number */ | |
| 256 | uint8_t pu_addr[IEEE80211_ADDR_LEN]; | |
| 257 | uint8_t pu_naddr; /* Number of Proxied Addresses */ | |
| 258 | /* NB: proxied address follows */ | |
| 259 | } __packed; | |
| 260 | ||
| 261 | /* Mesh Proxy Update Confirmation */ | |
| 262 | struct ieee80211_meshpuc_ie { | |
| 263 | uint8_t puc_ie; /* IEEE80211_ELEMID_MESHPUC */ | |
| 264 | uint8_t puc_len; | |
| 265 | uint8_t puc_flags; | |
| 266 | uint8_t puc_seq; /* PU Sequence Number */ | |
| 267 | uint8_t puc_daddr[IEEE80211_ADDR_LEN]; | |
| 268 | } __packed; | |
| 269 | #endif | |
| 270 | ||
| 271 | /* | |
| 272 | * 802.11s Action Frames | |
| 273 | */ | |
| 274 | #define IEEE80211_ACTION_CAT_MESHPEERING 30 /* XXX Linux */ | |
| 275 | #define IEEE80211_ACTION_CAT_MESHLMETRIC 13 | |
| 276 | #define IEEE80211_ACTION_CAT_MESHPATH 32 /* XXX Linux */ | |
| 277 | #define IEEE80211_ACTION_CAT_INTERWORK 15 | |
| 278 | #define IEEE80211_ACTION_CAT_RESOURCE 16 | |
| 279 | #define IEEE80211_ACTION_CAT_PROXY 17 | |
| 280 | ||
| 281 | /* | |
| 282 | * Mesh Peering Action codes. | |
| 283 | */ | |
| 284 | enum { | |
| 285 | IEEE80211_ACTION_MESHPEERING_OPEN = 0, | |
| 286 | IEEE80211_ACTION_MESHPEERING_CONFIRM = 1, | |
| 287 | IEEE80211_ACTION_MESHPEERING_CLOSE = 2, | |
| 288 | /* 3-255 reserved */ | |
| 289 | }; | |
| 290 | ||
| 291 | /* | |
| 292 | * Mesh Path Selection Action code. | |
| 293 | */ | |
| 294 | enum { | |
| 295 | IEEE80211_ACTION_MESHPATH_SEL = 0, | |
| 296 | /* 1-255 reserved */ | |
| 297 | }; | |
| 298 | ||
| 299 | /* | |
| 300 | * Mesh Link Metric Action codes. | |
| 301 | */ | |
| 302 | enum { | |
| 303 | IEEE80211_ACTION_MESHLMETRIC_REQ = 0, /* Link Metric Request */ | |
| 304 | IEEE80211_ACTION_MESHLMETRIC_REP = 1, /* Link Metric Report */ | |
| 305 | /* 2-255 reserved */ | |
| 306 | }; | |
| 307 | ||
| 308 | /* | |
| 309 | * Mesh Portal Annoucement Action codes. | |
| 310 | */ | |
| 311 | enum { | |
| 312 | IEEE80211_ACTION_MESHPANN = 0, | |
| 313 | /* 1-255 reserved */ | |
| 314 | }; | |
| 315 | ||
| 316 | /* | |
| 317 | * Different mesh control structures based on the AE | |
| 318 | * (Address Extension) bits. | |
| 319 | */ | |
| 320 | struct ieee80211_meshcntl { | |
| 321 | uint8_t mc_flags; /* Address Extension 00 */ | |
| 322 | uint8_t mc_ttl; /* TTL */ | |
| 323 | uint8_t mc_seq[4]; /* Sequence No. */ | |
| 324 | /* NB: more addresses may follow */ | |
| 325 | } __packed; | |
| 326 | ||
| 327 | struct ieee80211_meshcntl_ae01 { | |
| 328 | uint8_t mc_flags; /* Address Extension 01 */ | |
| 329 | uint8_t mc_ttl; /* TTL */ | |
| 330 | uint8_t mc_seq[4]; /* Sequence No. */ | |
| 331 | uint8_t mc_addr4[IEEE80211_ADDR_LEN]; | |
| 332 | } __packed; | |
| 333 | ||
| 334 | struct ieee80211_meshcntl_ae10 { | |
| 335 | uint8_t mc_flags; /* Address Extension 10 */ | |
| 336 | uint8_t mc_ttl; /* TTL */ | |
| 337 | uint8_t mc_seq[4]; /* Sequence No. */ | |
| 338 | uint8_t mc_addr4[IEEE80211_ADDR_LEN]; | |
| 339 | uint8_t mc_addr5[IEEE80211_ADDR_LEN]; | |
| 340 | } __packed; | |
| 341 | ||
| 342 | struct ieee80211_meshcntl_ae11 { | |
| 343 | uint8_t mc_flags; /* Address Extension 11 */ | |
| 344 | uint8_t mc_ttl; /* TTL */ | |
| 345 | uint8_t mc_seq[4]; /* Sequence No. */ | |
| 346 | uint8_t mc_addr4[IEEE80211_ADDR_LEN]; | |
| 347 | uint8_t mc_addr5[IEEE80211_ADDR_LEN]; | |
| 348 | uint8_t mc_addr6[IEEE80211_ADDR_LEN]; | |
| 349 | } __packed; | |
| 350 | ||
| 351 | #ifdef _KERNEL | |
| 352 | MALLOC_DECLARE(M_80211_MESH_RT); | |
| 353 | struct ieee80211_mesh_route { | |
| 354 | TAILQ_ENTRY(ieee80211_mesh_route) rt_next; | |
| 355 | int rt_crtime; /* creation time */ | |
| 356 | uint8_t rt_dest[IEEE80211_ADDR_LEN]; | |
| 357 | uint8_t rt_nexthop[IEEE80211_ADDR_LEN]; | |
| 358 | uint32_t rt_metric; /* path metric */ | |
| 359 | uint16_t rt_nhops; /* number of hops */ | |
| 360 | uint16_t rt_flags; | |
| 361 | #define IEEE80211_MESHRT_FLAGS_VALID 0x01 /* patch discovery complete */ | |
| 362 | #define IEEE80211_MESHRT_FLAGS_PROXY 0x02 /* proxy entry */ | |
| 363 | uint32_t rt_lifetime; | |
| 364 | uint32_t rt_lastmseq; /* last seq# seen dest */ | |
| 365 | void *rt_priv; /* private data */ | |
| 366 | }; | |
| 367 | #define IEEE80211_MESH_ROUTE_PRIV(rt, cast) ((cast *)rt->rt_priv) | |
| 368 | ||
| 369 | #define IEEE80211_MESH_PROTO_DSZ 12 /* description size */ | |
| 370 | /* | |
| 371 | * Mesh Path Selection Protocol. | |
| 372 | */ | |
| 373 | enum ieee80211_state; | |
| 374 | struct ieee80211_mesh_proto_path { | |
| 375 | uint8_t mpp_active; | |
| 376 | char mpp_descr[IEEE80211_MESH_PROTO_DSZ]; | |
| 377 | uint8_t mpp_ie; | |
| 378 | struct ieee80211_node * | |
| 379 | (*mpp_discover)(struct ieee80211vap *, | |
| 380 | const uint8_t [IEEE80211_ADDR_LEN], | |
| 381 | struct mbuf *); | |
| 382 | void (*mpp_peerdown)(struct ieee80211_node *); | |
| 383 | void (*mpp_vattach)(struct ieee80211vap *); | |
| 384 | void (*mpp_vdetach)(struct ieee80211vap *); | |
| 385 | int (*mpp_newstate)(struct ieee80211vap *, | |
| 386 | enum ieee80211_state, int); | |
| 387 | const size_t mpp_privlen; /* size required in the routing table | |
| 388 | for private data */ | |
| 389 | int mpp_inact; /* inact. timeout for invalid routes | |
| 390 | (ticks) */ | |
| 391 | }; | |
| 392 | ||
| 393 | /* | |
| 394 | * Mesh Link Metric Report Protocol. | |
| 395 | */ | |
| 396 | struct ieee80211_mesh_proto_metric { | |
| 397 | uint8_t mpm_active; | |
| 398 | char mpm_descr[IEEE80211_MESH_PROTO_DSZ]; | |
| 399 | uint8_t mpm_ie; | |
| 400 | uint32_t (*mpm_metric)(struct ieee80211_node *); | |
| 401 | }; | |
| 402 | ||
| 403 | #ifdef notyet | |
| 404 | /* | |
| 405 | * Mesh Authentication Protocol. | |
| 406 | */ | |
| 407 | struct ieee80211_mesh_proto_auth { | |
| 408 | uint8_t mpa_ie[4]; | |
| 409 | }; | |
| 410 | ||
| 411 | struct ieee80211_mesh_proto_congestion { | |
| 412 | }; | |
| 413 | ||
| 414 | struct ieee80211_mesh_proto_sync { | |
| 415 | }; | |
| 416 | #endif | |
| 417 | ||
| 418 | typedef uint32_t ieee80211_mesh_seq; | |
| 419 | #define IEEE80211_MESH_SEQ_LEQ(a, b) ((int32_t)((a)-(b)) <= 0) | |
| 420 | #define IEEE80211_MESH_SEQ_GEQ(a, b) ((int32_t)((a)-(b)) >= 0) | |
| 421 | ||
| 422 | struct ieee80211_mesh_state { | |
| 423 | int ms_idlen; | |
| 424 | uint8_t ms_id[IEEE80211_MESHID_LEN]; | |
| 425 | ieee80211_mesh_seq ms_seq; /* seq no for meshcntl */ | |
| 426 | uint16_t ms_neighbors; | |
| 427 | uint8_t ms_ttl; /* mesh ttl set in packets */ | |
| 428 | #define IEEE80211_MESHFLAGS_AP 0x01 /* accept peers */ | |
| 429 | #define IEEE80211_MESHFLAGS_PORTAL 0x02 /* mesh portal role */ | |
| 430 | #define IEEE80211_MESHFLAGS_FWD 0x04 /* forward packets */ | |
| 431 | uint8_t ms_flags; | |
| 32176cfd RP |
432 | struct callout ms_cleantimer; |
| 433 | TAILQ_HEAD(, ieee80211_mesh_route) ms_routes; | |
| 434 | struct ieee80211_mesh_proto_metric *ms_pmetric; | |
| 435 | struct ieee80211_mesh_proto_path *ms_ppath; | |
| 436 | }; | |
| 437 | void ieee80211_mesh_attach(struct ieee80211com *); | |
| 438 | void ieee80211_mesh_detach(struct ieee80211com *); | |
| 439 | ||
| 440 | struct ieee80211_mesh_route * | |
| 441 | ieee80211_mesh_rt_find(struct ieee80211vap *, | |
| 442 | const uint8_t [IEEE80211_ADDR_LEN]); | |
| 443 | struct ieee80211_mesh_route * | |
| 444 | ieee80211_mesh_rt_add(struct ieee80211vap *, | |
| 445 | const uint8_t [IEEE80211_ADDR_LEN]); | |
| 446 | void ieee80211_mesh_rt_del(struct ieee80211vap *, | |
| 447 | const uint8_t [IEEE80211_ADDR_LEN]); | |
| 448 | void ieee80211_mesh_rt_flush(struct ieee80211vap *); | |
| 449 | void ieee80211_mesh_rt_flush_peer(struct ieee80211vap *, | |
| 450 | const uint8_t [IEEE80211_ADDR_LEN]); | |
| 451 | void ieee80211_mesh_proxy_check(struct ieee80211vap *, | |
| 452 | const uint8_t [IEEE80211_ADDR_LEN]); | |
| 453 | ||
| 454 | int ieee80211_mesh_register_proto_path(const | |
| 455 | struct ieee80211_mesh_proto_path *); | |
| 456 | int ieee80211_mesh_register_proto_metric(const | |
| 457 | struct ieee80211_mesh_proto_metric *); | |
| 458 | ||
| 459 | uint8_t * ieee80211_add_meshid(uint8_t *, struct ieee80211vap *); | |
| 460 | uint8_t * ieee80211_add_meshconf(uint8_t *, struct ieee80211vap *); | |
| 461 | uint8_t * ieee80211_add_meshpeer(uint8_t *, uint8_t, uint16_t, uint16_t, | |
| 462 | uint16_t); | |
| 463 | uint8_t * ieee80211_add_meshlmetric(uint8_t *, uint32_t); | |
| 464 | ||
| 465 | void ieee80211_mesh_node_init(struct ieee80211vap *, | |
| 466 | struct ieee80211_node *); | |
| 467 | void ieee80211_mesh_node_cleanup(struct ieee80211_node *); | |
| 468 | void ieee80211_parse_meshid(struct ieee80211_node *, | |
| 469 | const uint8_t *); | |
| 470 | struct ieee80211_scanparams; | |
| 471 | void ieee80211_mesh_init_neighbor(struct ieee80211_node *, | |
| 472 | const struct ieee80211_frame *, | |
| 473 | const struct ieee80211_scanparams *); | |
| 474 | void ieee80211_mesh_update_beacon(struct ieee80211vap *, | |
| 475 | struct ieee80211_beacon_offsets *); | |
| 476 | ||
| 477 | /* | |
| 478 | * Return non-zero if proxy operation is enabled. | |
| 479 | */ | |
| 480 | static __inline int | |
| 481 | ieee80211_mesh_isproxyena(struct ieee80211vap *vap) | |
| 482 | { | |
| 483 | struct ieee80211_mesh_state *ms = vap->iv_mesh; | |
| 484 | return (ms->ms_flags & | |
| 485 | (IEEE80211_MESHFLAGS_AP | IEEE80211_MESHFLAGS_PORTAL)) != 0; | |
| 486 | } | |
| 487 | ||
| 488 | /* | |
| 489 | * Process an outbound frame: if a path is known to the | |
| 490 | * destination then return a reference to the next hop | |
| 491 | * for immediate transmission. Otherwise initiate path | |
| 492 | * discovery and, if possible queue the packet to be | |
| 493 | * sent when path discovery completes. | |
| 494 | */ | |
| 495 | static __inline struct ieee80211_node * | |
| 496 | ieee80211_mesh_discover(struct ieee80211vap *vap, | |
| 497 | const uint8_t dest[IEEE80211_ADDR_LEN], struct mbuf *m) | |
| 498 | { | |
| 499 | struct ieee80211_mesh_state *ms = vap->iv_mesh; | |
| 500 | return ms->ms_ppath->mpp_discover(vap, dest, m); | |
| 501 | } | |
| 502 | ||
| 503 | #endif /* _KERNEL */ | |
| 504 | #endif /* !_NET80211_IEEE80211_MESH_H_ */ |