ieee80211_proto.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* $OpenBSD: ieee80211_proto.h,v 1.39 2009/11/21 18:09:31 damien Exp $ */
  2. /* $NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 dyoung Exp $ */
  3. /*-
  4. * Copyright (c) 2001 Atsushi Onoe
  5. * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
  6. * All rights reserved.
  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. * 3. The name of the author may not be used to endorse or promote products
  17. * derived from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  20. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  21. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  22. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  23. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  24. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  28. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. * $FreeBSD: src/sys/net80211/ieee80211_proto.h,v 1.4 2003/08/19 22:17:03 sam Exp $
  31. */
  32. #ifndef _NET80211_IEEE80211_PROTO_H_
  33. #define _NET80211_IEEE80211_PROTO_H_
  34. /*
  35. * 802.11 protocol implementation definitions.
  36. */
  37. enum ieee80211_state {
  38. IEEE80211_S_INIT = 0, /* default state */
  39. IEEE80211_S_SCAN = 1, /* scanning */
  40. IEEE80211_S_AUTH = 2, /* try to authenticate */
  41. IEEE80211_S_ASSOC = 3, /* try to assoc */
  42. IEEE80211_S_RUN = 4 /* associated */
  43. };
  44. #define IEEE80211_S_MAX (IEEE80211_S_RUN+1)
  45. #define IEEE80211_SEND_MGMT(_ic,_ni,_type,_arg) \
  46. ((*(_ic)->ic_send_mgmt)(_ic, _ni, _type, _arg, 0))
  47. /* shortcut */
  48. #define IEEE80211_SEND_ACTION(_ic,_ni,_categ,_action,_arg) \
  49. ((*(_ic)->ic_send_mgmt)(_ic, _ni, IEEE80211_FC0_SUBTYPE_ACTION, \
  50. (_categ) << 16 | (_action), _arg))
  51. extern const char * const ieee80211_mgt_subtype_name[];
  52. extern const char * const ieee80211_state_name[IEEE80211_S_MAX];
  53. extern const char * const ieee80211_phymode_name[];
  54. extern void ieee80211_proto_attach(struct ifnet *);
  55. extern void ieee80211_proto_detach(struct ifnet *);
  56. struct ieee80211_node;
  57. struct ieee80211_rxinfo;
  58. struct ieee80211_rsnparams;
  59. extern void ieee80211_set_link_state(struct ieee80211com *, int);
  60. extern u_int ieee80211_get_hdrlen(const struct ieee80211_frame *);
  61. extern void ieee80211_input(struct ifnet *, struct mbuf *,
  62. struct ieee80211_node *, struct ieee80211_rxinfo *);
  63. extern int ieee80211_output(struct ifnet *, struct mbuf *, struct sockaddr *,
  64. struct rtentry *);
  65. extern void ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *,
  66. struct ieee80211_node *, struct ieee80211_rxinfo *, int);
  67. extern int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *,
  68. int, int, int);
  69. extern void ieee80211_eapol_key_input(struct ieee80211com *, struct mbuf *,
  70. struct ieee80211_node *);
  71. extern struct mbuf *ieee80211_encap(struct ifnet *, struct mbuf *,
  72. struct ieee80211_node **);
  73. extern struct mbuf *ieee80211_get_rts(struct ieee80211com *,
  74. const struct ieee80211_frame *, u_int16_t);
  75. extern struct mbuf *ieee80211_get_cts_to_self(struct ieee80211com *,
  76. u_int16_t);
  77. extern struct mbuf *ieee80211_beacon_alloc(struct ieee80211com *,
  78. struct ieee80211_node *);
  79. extern int ieee80211_save_ie(const u_int8_t *, u_int8_t **);
  80. extern void ieee80211_eapol_timeout(void *);
  81. extern int ieee80211_send_4way_msg1(struct ieee80211com *,
  82. struct ieee80211_node *);
  83. extern int ieee80211_send_4way_msg2(struct ieee80211com *,
  84. struct ieee80211_node *, const u_int8_t *,
  85. const struct ieee80211_ptk *);
  86. extern int ieee80211_send_4way_msg3(struct ieee80211com *,
  87. struct ieee80211_node *);
  88. extern int ieee80211_send_4way_msg4(struct ieee80211com *,
  89. struct ieee80211_node *);
  90. extern int ieee80211_send_group_msg1(struct ieee80211com *,
  91. struct ieee80211_node *);
  92. extern int ieee80211_send_group_msg2(struct ieee80211com *,
  93. struct ieee80211_node *, const struct ieee80211_key *);
  94. extern int ieee80211_send_eapol_key_req(struct ieee80211com *,
  95. struct ieee80211_node *, u_int16_t, u_int64_t);
  96. extern int ieee80211_pwrsave(struct ieee80211com *, struct mbuf *,
  97. struct ieee80211_node *);
  98. #define ieee80211_new_state(_ic, _nstate, _arg) \
  99. (((_ic)->ic_newstate)((_ic), (_nstate), (_arg)))
  100. extern enum ieee80211_edca_ac ieee80211_up_to_ac(struct ieee80211com *, int);
  101. extern u_int8_t *ieee80211_add_capinfo(u_int8_t *, struct ieee80211com *,
  102. const struct ieee80211_node *);
  103. extern u_int8_t *ieee80211_add_ssid(u_int8_t *, const u_int8_t *, u_int);
  104. extern u_int8_t *ieee80211_add_rates(u_int8_t *,
  105. const struct ieee80211_rateset *);
  106. extern u_int8_t *ieee80211_add_fh_params(u_int8_t *, struct ieee80211com *,
  107. const struct ieee80211_node *);
  108. extern u_int8_t *ieee80211_add_ds_params(u_int8_t *, struct ieee80211com *,
  109. const struct ieee80211_node *);
  110. extern u_int8_t *ieee80211_add_tim(u_int8_t *, struct ieee80211com *);
  111. extern u_int8_t *ieee80211_add_ibss_params(u_int8_t *,
  112. const struct ieee80211_node *);
  113. extern u_int8_t *ieee80211_add_edca_params(u_int8_t *, struct ieee80211com *);
  114. extern u_int8_t *ieee80211_add_erp(u_int8_t *, struct ieee80211com *);
  115. extern u_int8_t *ieee80211_add_qos_capability(u_int8_t *,
  116. struct ieee80211com *);
  117. extern u_int8_t *ieee80211_add_rsn(u_int8_t *, struct ieee80211com *,
  118. const struct ieee80211_node *);
  119. extern u_int8_t *ieee80211_add_wpa(u_int8_t *, struct ieee80211com *,
  120. const struct ieee80211_node *);
  121. extern u_int8_t *ieee80211_add_xrates(u_int8_t *,
  122. const struct ieee80211_rateset *);
  123. extern u_int8_t *ieee80211_add_htcaps(u_int8_t *, struct ieee80211com *);
  124. extern u_int8_t *ieee80211_add_htop(u_int8_t *, struct ieee80211com *);
  125. extern u_int8_t *ieee80211_add_tie(u_int8_t *, u_int8_t, u_int32_t);
  126. extern int ieee80211_parse_rsn(struct ieee80211com *, const u_int8_t *,
  127. struct ieee80211_rsnparams *);
  128. extern int ieee80211_parse_wpa(struct ieee80211com *, const u_int8_t *,
  129. struct ieee80211_rsnparams *);
  130. extern void ieee80211_print_essid(const u_int8_t *, int);
  131. #ifdef IEEE80211_DEBUG
  132. extern void ieee80211_dump_pkt(const u_int8_t *, int, int, int);
  133. #endif
  134. extern int ieee80211_ibss_merge(struct ieee80211com *,
  135. struct ieee80211_node *, u_int64_t);
  136. extern void ieee80211_reset_erp(struct ieee80211com *);
  137. extern void ieee80211_set_shortslottime(struct ieee80211com *, int);
  138. extern void ieee80211_auth_open(struct ieee80211com *,
  139. const struct ieee80211_frame *, struct ieee80211_node *,
  140. struct ieee80211_rxinfo *rs, u_int16_t, u_int16_t);
  141. extern void ieee80211_gtk_rekey_timeout(void *);
  142. extern int ieee80211_keyrun(struct ieee80211com *, u_int8_t *);
  143. extern void ieee80211_setkeys(struct ieee80211com *);
  144. extern void ieee80211_setkeysdone(struct ieee80211com *);
  145. extern void ieee80211_sa_query_timeout(void *);
  146. extern void ieee80211_sa_query_request(struct ieee80211com *,
  147. struct ieee80211_node *);
  148. #ifndef IEEE80211_NO_HT
  149. extern void ieee80211_tx_ba_timeout(void *);
  150. extern void ieee80211_rx_ba_timeout(void *);
  151. extern int ieee80211_addba_request(struct ieee80211com *,
  152. struct ieee80211_node *, u_int16_t, u_int8_t);
  153. extern void ieee80211_delba_request(struct ieee80211com *,
  154. struct ieee80211_node *, u_int16_t, u_int8_t, u_int8_t);
  155. #endif
  156. #endif /* _NET80211_IEEE80211_PROTO_H_ */