HAMMER 60I/Many: Mirroring
[dragonfly.git] / contrib / hostapd-0.5.8 / mlme.c
blob3d4cf21a45b438b91320bc2a42328274df6ad5ad
1 /*
2 * hostapd / IEEE 802.11 MLME
3 * Copyright 2003-2006, Jouni Malinen <j@w1.fi>
4 * Copyright 2003-2004, Instant802 Networks, Inc.
5 * Copyright 2005-2006, Devicescape Software, Inc.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * Alternatively, this software may be distributed under the terms of BSD
12 * license.
14 * See README and COPYING for more details.
17 #include "includes.h"
19 #include "hostapd.h"
20 #include "ieee802_11.h"
21 #include "sta_info.h"
22 #include "wpa.h"
23 #include "mlme.h"
26 static const char * mlme_auth_alg_str(int alg)
28 switch (alg) {
29 case WLAN_AUTH_OPEN:
30 return "OPEN_SYSTEM";
31 case WLAN_AUTH_SHARED_KEY:
32 return "SHARED_KEY";
35 return "unknown";
39 /**
40 * mlme_authenticate_indication - Report the establishment of an authentication
41 * relationship with a specific peer MAC entity
42 * @hapd: BSS data
43 * @sta: peer STA data
45 * MLME calls this function as a result of the establishment of an
46 * authentication relationship with a specific peer MAC entity that
47 * resulted from an authentication procedure that was initiated by
48 * that specific peer MAC entity.
50 * PeerSTAAddress = sta->addr
51 * AuthenticationType = sta->auth_alg (WLAN_AUTH_OPEN / WLAN_AUTH_SHARED_KEY)
53 void mlme_authenticate_indication(struct hostapd_data *hapd,
54 struct sta_info *sta)
56 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
57 HOSTAPD_LEVEL_DEBUG,
58 "MLME-AUTHENTICATE.indication(" MACSTR ", %s)",
59 MAC2STR(sta->addr), mlme_auth_alg_str(sta->auth_alg));
60 mlme_deletekeys_request(hapd, sta);
64 /**
65 * mlme_deauthenticate_indication - Report the invalidation of an
66 * authentication relationship with a specific peer MAC entity
67 * @hapd: BSS data
68 * @sta: Peer STA data
69 * @reason_code: ReasonCode from Deauthentication frame
71 * MLME calls this function as a result of the invalidation of an
72 * authentication relationship with a specific peer MAC entity.
74 * PeerSTAAddress = sta->addr
76 void mlme_deauthenticate_indication(struct hostapd_data *hapd,
77 struct sta_info *sta, u16 reason_code)
79 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
80 HOSTAPD_LEVEL_DEBUG,
81 "MLME-DEAUTHENTICATE.indication(" MACSTR ", %d)",
82 MAC2STR(sta->addr), reason_code);
83 mlme_deletekeys_request(hapd, sta);
87 /**
88 * mlme_associate_indication - Report the establishment of an association with
89 * a specific peer MAC entity
90 * @hapd: BSS data
91 * @sta: peer STA data
93 * MLME calls this function as a result of the establishment of an
94 * association with a specific peer MAC entity that resulted from an
95 * association procedure that was initiated by that specific peer MAC entity.
97 * PeerSTAAddress = sta->addr
99 void mlme_associate_indication(struct hostapd_data *hapd, struct sta_info *sta)
101 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
102 HOSTAPD_LEVEL_DEBUG,
103 "MLME-ASSOCIATE.indication(" MACSTR ")",
104 MAC2STR(sta->addr));
105 mlme_deletekeys_request(hapd, sta);
110 * mlme_reassociate_indication - Report the establishment of an reassociation
111 * with a specific peer MAC entity
112 * @hapd: BSS data
113 * @sta: peer STA data
115 * MLME calls this function as a result of the establishment of an
116 * reassociation with a specific peer MAC entity that resulted from a
117 * reassociation procedure that was initiated by that specific peer MAC entity.
119 * PeerSTAAddress = sta->addr
121 * sta->previous_ap contains the "Current AP" information from ReassocReq.
123 void mlme_reassociate_indication(struct hostapd_data *hapd,
124 struct sta_info *sta)
126 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
127 HOSTAPD_LEVEL_DEBUG,
128 "MLME-REASSOCIATE.indication(" MACSTR ")",
129 MAC2STR(sta->addr));
130 mlme_deletekeys_request(hapd, sta);
135 * mlme_disassociate_indication - Report disassociation with a specific peer
136 * MAC entity
137 * @hapd: BSS data
138 * @sta: Peer STA data
139 * @reason_code: ReasonCode from Disassociation frame
141 * MLME calls this function as a result of the invalidation of an association
142 * relationship with a specific peer MAC entity.
144 * PeerSTAAddress = sta->addr
146 void mlme_disassociate_indication(struct hostapd_data *hapd,
147 struct sta_info *sta, u16 reason_code)
149 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
150 HOSTAPD_LEVEL_DEBUG,
151 "MLME-DISASSOCIATE.indication(" MACSTR ", %d)",
152 MAC2STR(sta->addr), reason_code);
153 mlme_deletekeys_request(hapd, sta);
157 void mlme_michaelmicfailure_indication(struct hostapd_data *hapd,
158 const u8 *addr)
160 hostapd_logger(hapd, addr, HOSTAPD_MODULE_MLME,
161 HOSTAPD_LEVEL_DEBUG,
162 "MLME-MichaelMICFailure.indication(" MACSTR ")",
163 MAC2STR(addr));
167 void mlme_deletekeys_request(struct hostapd_data *hapd, struct sta_info *sta)
169 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
170 HOSTAPD_LEVEL_DEBUG,
171 "MLME-DELETEKEYS.request(" MACSTR ")",
172 MAC2STR(sta->addr));
174 if (sta->wpa_sm)
175 wpa_remove_ptk(sta->wpa_sm);