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