aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_rx.c
diff options
context:
space:
mode:
authorJames Ketrenos <jketreno@linux.intel.com>2005-09-21 12:54:47 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-21 23:02:31 -0400
commit3f552bbf8614d2d26f488ca0d3e188bdec484bf4 (patch)
tree9721d4dc2d53579d7c324fa0b98eddc964149ab4 /net/ieee80211/ieee80211_rx.c
parent3cdd00c5827621cd0b1bb0665aa62ef9a724297d (diff)
[PATCH] ieee82011: Added ieee80211_tx_frame to convert generic 802.11 data frames, and callbacks
tree 40adc78b623ae70d56074934ec6334eb4f0ae6a5 parent db43d847bcebaa3df6414e26d0008eb21690e8cf author James Ketrenos <jketreno@linux.intel.com> 1124445938 -0500 committer James Ketrenos <jketreno@linux.intel.com> 1127313102 -0500 Added ieee80211_tx_frame to convert generic 802.11 data frames into txbs for transmission. Added several purpose specific callbacks (handle_assoc, handle_auth, etc.) which the driver can register with for being notified on reception of variouf frame elements. Signed-off-by: James Ketrenos <jketreno@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'net/ieee80211/ieee80211_rx.c')
-rw-r--r--net/ieee80211/ieee80211_rx.c58
1 files changed, 43 insertions, 15 deletions
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index 71d14c7d915c..d1ae28280d7e 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -1029,12 +1029,18 @@ static inline void update_network(struct ieee80211_network *dst,
1029 /* dst->last_associate is not overwritten */ 1029 /* dst->last_associate is not overwritten */
1030} 1030}
1031 1031
1032static inline int is_beacon(int fc)
1033{
1034 return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == IEEE80211_STYPE_BEACON);
1035}
1036
1032static inline void ieee80211_process_probe_response(struct ieee80211_device 1037static inline void ieee80211_process_probe_response(struct ieee80211_device
1033 *ieee, struct 1038 *ieee, struct
1034 ieee80211_probe_response 1039 ieee80211_probe_response
1035 *beacon, struct ieee80211_rx_stats 1040 *beacon, struct ieee80211_rx_stats
1036 *stats) 1041 *stats)
1037{ 1042{
1043 struct net_device *dev = ieee->dev;
1038 struct ieee80211_network network; 1044 struct ieee80211_network network;
1039 struct ieee80211_network *target; 1045 struct ieee80211_network *target;
1040 struct ieee80211_network *oldest = NULL; 1046 struct ieee80211_network *oldest = NULL;
@@ -1070,11 +1076,10 @@ static inline void ieee80211_process_probe_response(struct ieee80211_device
1070 escape_essid(info_element->data, 1076 escape_essid(info_element->data,
1071 info_element->len), 1077 info_element->len),
1072 MAC_ARG(beacon->header.addr3), 1078 MAC_ARG(beacon->header.addr3),
1073 WLAN_FC_GET_STYPE(le16_to_cpu 1079 is_beacon(le16_to_cpu
1074 (beacon->header. 1080 (beacon->header.
1075 frame_ctl)) == 1081 frame_ctl)) ?
1076 IEEE80211_STYPE_PROBE_RESP ? 1082 "BEACON" : "PROBE RESPONSE");
1077 "PROBE RESPONSE" : "BEACON");
1078 return; 1083 return;
1079 } 1084 }
1080 1085
@@ -1123,11 +1128,10 @@ static inline void ieee80211_process_probe_response(struct ieee80211_device
1123 escape_essid(network.ssid, 1128 escape_essid(network.ssid,
1124 network.ssid_len), 1129 network.ssid_len),
1125 MAC_ARG(network.bssid), 1130 MAC_ARG(network.bssid),
1126 WLAN_FC_GET_STYPE(le16_to_cpu 1131 is_beacon(le16_to_cpu
1127 (beacon->header. 1132 (beacon->header.
1128 frame_ctl)) == 1133 frame_ctl)) ?
1129 IEEE80211_STYPE_PROBE_RESP ? 1134 "BEACON" : "PROBE RESPONSE");
1130 "PROBE RESPONSE" : "BEACON");
1131#endif 1135#endif
1132 memcpy(target, &network, sizeof(*target)); 1136 memcpy(target, &network, sizeof(*target));
1133 list_add_tail(&target->list, &ieee->network_list); 1137 list_add_tail(&target->list, &ieee->network_list);
@@ -1136,15 +1140,22 @@ static inline void ieee80211_process_probe_response(struct ieee80211_device
1136 escape_essid(target->ssid, 1140 escape_essid(target->ssid,
1137 target->ssid_len), 1141 target->ssid_len),
1138 MAC_ARG(target->bssid), 1142 MAC_ARG(target->bssid),
1139 WLAN_FC_GET_STYPE(le16_to_cpu 1143 is_beacon(le16_to_cpu
1140 (beacon->header. 1144 (beacon->header.
1141 frame_ctl)) == 1145 frame_ctl)) ?
1142 IEEE80211_STYPE_PROBE_RESP ? 1146 "BEACON" : "PROBE RESPONSE");
1143 "PROBE RESPONSE" : "BEACON");
1144 update_network(target, &network); 1147 update_network(target, &network);
1145 } 1148 }
1146 1149
1147 spin_unlock_irqrestore(&ieee->lock, flags); 1150 spin_unlock_irqrestore(&ieee->lock, flags);
1151
1152 if (is_beacon(le16_to_cpu(beacon->header.frame_ctl))) {
1153 if (ieee->handle_beacon != NULL)
1154 ieee->handle_beacon(dev, beacon, &network);
1155 } else {
1156 if (ieee->handle_probe_response != NULL)
1157 ieee->handle_probe_response(dev, beacon, &network);
1158 }
1148} 1159}
1149 1160
1150void ieee80211_rx_mgt(struct ieee80211_device *ieee, 1161void ieee80211_rx_mgt(struct ieee80211_device *ieee,
@@ -1185,6 +1196,23 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1185 ieee80211_probe_response *) 1196 ieee80211_probe_response *)
1186 header, stats); 1197 header, stats);
1187 break; 1198 break;
1199 case IEEE80211_STYPE_AUTH:
1200
1201 IEEE80211_DEBUG_MGMT("recieved auth (%d)\n",
1202 WLAN_FC_GET_STYPE(le16_to_cpu
1203 (header->frame_ctl)));
1204
1205 if (ieee->handle_auth != NULL)
1206 ieee->handle_auth(ieee->dev,
1207 (struct ieee80211_auth *)header);
1208 break;
1209
1210 case IEEE80211_STYPE_DISASSOC:
1211 if (ieee->handle_disassoc != NULL)
1212 ieee->handle_disassoc(ieee->dev,
1213 (struct ieee80211_disassoc *)
1214 header);
1215 break;
1188 1216
1189 default: 1217 default:
1190 IEEE80211_DEBUG_MGMT("received UNKNOWN (%d)\n", 1218 IEEE80211_DEBUG_MGMT("received UNKNOWN (%d)\n",