blob: baf51c33e2c85b18d569b0c7ef598d2789b809c6 [file] [log] [blame]
Wade Guthrie0d438532012-05-18 14:18:50 -07001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Wade Guthrie89e6cb32013-03-07 08:03:45 -08005#ifndef SHILL_NL80211_MESSAGE_H_
6#define SHILL_NL80211_MESSAGE_H_
Wade Guthrie0d438532012-05-18 14:18:50 -07007
Wade Guthrie0d438532012-05-18 14:18:50 -07008#include <map>
Wade Guthrie0d438532012-05-18 14:18:50 -07009#include <string>
Wade Guthrie8343f7f2012-12-04 13:52:32 -080010#include <vector>
Wade Guthrie0d438532012-05-18 14:18:50 -070011
Wade Guthrie0d438532012-05-18 14:18:50 -070012#include <base/lazy_instance.h>
Wade Guthrie89e6cb32013-03-07 08:03:45 -080013
repo sync1538d442012-12-20 15:24:35 -080014#include "shill/byte_string.h"
Wade Guthrie0ae4b8e2013-04-10 16:49:15 -070015#include "shill/generic_netlink_message.h"
Wade Guthrie16196242012-11-20 15:53:52 -080016
Wade Guthrie0d438532012-05-18 14:18:50 -070017struct nlmsghdr;
18
19namespace shill {
20
Wade Guthrief48a1952013-03-04 17:33:47 -080021// Class for messages received from the mac80211 drivers by way of the
22// cfg80211 kernel module.
23class Nl80211Message : public GenericNetlinkMessage {
24 public:
25 static const char kMessageTypeString[];
Wade Guthrief48a1952013-03-04 17:33:47 -080026
Ben Chan7fab8972014-08-10 17:14:46 -070027 Nl80211Message(uint8_t command, const char *command_string)
Wade Guthrief48a1952013-03-04 17:33:47 -080028 : GenericNetlinkMessage(nl80211_message_type_, command, command_string) {}
Ben Chan5ea763b2014-08-13 11:07:54 -070029 ~Nl80211Message() override {}
Wade Guthrief48a1952013-03-04 17:33:47 -080030
Paul Stewart2ddf2c62013-04-16 09:47:34 -070031 // Gets the family_id / message_type for all Nl80211 messages.
32 static uint16_t GetMessageType();
33
Wade Guthriebee87c22013-03-06 11:00:46 -080034 // Sets the family_id / message_type for all Nl80211 messages.
35 static void SetMessageType(uint16_t message_type);
36
Wade Guthrief48a1952013-03-04 17:33:47 -080037 virtual bool InitFromNlmsg(const nlmsghdr *msg);
38
Ben Chan7fab8972014-08-10 17:14:46 -070039 uint8_t command() const { return command_; }
Wade Guthrief48a1952013-03-04 17:33:47 -080040 const char *command_string() const { return command_string_; }
41 uint16_t message_type() const { return message_type_; }
42 uint32_t sequence_number() const { return sequence_number_; }
43 void set_sequence_number(uint32_t seq) { sequence_number_ = seq; }
44
Wade Guthried4977f22012-08-22 12:37:54 -070045 // Returns a string representing the passed-in |status| or |reason|, the
46 // value of which has been acquired from libnl (for example, from the
Wade Guthrie0d438532012-05-18 14:18:50 -070047 // NL80211_ATTR_STATUS_CODE or NL80211_ATTR_REASON_CODE attribute).
Wade Guthried4977f22012-08-22 12:37:54 -070048 static std::string StringFromReason(uint16_t reason);
Wade Guthrie0d438532012-05-18 14:18:50 -070049 static std::string StringFromStatus(uint16_t status);
50
Wade Guthrie12f113a2013-03-12 17:15:46 -070051 // Message factory for all types of Nl80211 message.
52 static NetlinkMessage *CreateMessage(const nlmsghdr *const_msg);
53
Wade Guthrie0d438532012-05-18 14:18:50 -070054 private:
Wade Guthried4977f22012-08-22 12:37:54 -070055 static std::map<uint16_t, std::string> *reason_code_string_;
56 static std::map<uint16_t, std::string> *status_code_string_;
Wade Guthrief48a1952013-03-04 17:33:47 -080057 static uint16_t nl80211_message_type_;
Wade Guthrie0d438532012-05-18 14:18:50 -070058
repo syncdc085c82012-12-28 08:54:41 -080059 DISALLOW_COPY_AND_ASSIGN(Nl80211Message);
Wade Guthrie0d438532012-05-18 14:18:50 -070060};
61
62class Nl80211Frame {
63 public:
64 enum Type {
65 kAssocResponseFrameType = 0x10,
66 kReassocResponseFrameType = 0x30,
67 kAssocRequestFrameType = 0x00,
68 kReassocRequestFrameType = 0x20,
69 kAuthFrameType = 0xb0,
70 kDisassocFrameType = 0xa0,
71 kDeauthFrameType = 0xc0,
72 kIllegalFrameType = 0xff
73 };
74
repo syncd316eb72012-12-10 15:48:47 -080075 explicit Nl80211Frame(const ByteString &init);
Wade Guthried4977f22012-08-22 12:37:54 -070076 bool ToString(std::string *output) const;
77 bool IsEqual(const Nl80211Frame &other) const;
78 uint16_t reason() const { return reason_; }
79 uint16_t status() const { return status_; }
Wade Guthrie0d438532012-05-18 14:18:50 -070080
81 private:
82 static const uint8_t kMinimumFrameByteCount;
83 static const uint8_t kFrameTypeMask;
84
85 std::string mac_from_;
86 std::string mac_to_;
87 uint8_t frame_type_;
Wade Guthried4977f22012-08-22 12:37:54 -070088 uint16_t reason_;
Wade Guthrie0d438532012-05-18 14:18:50 -070089 uint16_t status_;
Wade Guthrie8343f7f2012-12-04 13:52:32 -080090 ByteString frame_;
Wade Guthrie0d438532012-05-18 14:18:50 -070091
92 DISALLOW_COPY_AND_ASSIGN(Nl80211Frame);
93};
94
95//
repo syncdc085c82012-12-28 08:54:41 -080096// Specific Nl80211Message types.
Wade Guthrie0d438532012-05-18 14:18:50 -070097//
98
repo syncdc085c82012-12-28 08:54:41 -080099class AssociateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700100 public:
101 static const uint8_t kCommand;
102 static const char kCommandString[];
103
repo syncdc085c82012-12-28 08:54:41 -0800104 AssociateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700105
Wade Guthrie0d438532012-05-18 14:18:50 -0700106 private:
107 DISALLOW_COPY_AND_ASSIGN(AssociateMessage);
108};
109
110
repo syncdc085c82012-12-28 08:54:41 -0800111class AuthenticateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700112 public:
113 static const uint8_t kCommand;
114 static const char kCommandString[];
115
repo syncdc085c82012-12-28 08:54:41 -0800116 AuthenticateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700117
Wade Guthrie0d438532012-05-18 14:18:50 -0700118 private:
119 DISALLOW_COPY_AND_ASSIGN(AuthenticateMessage);
120};
121
122
repo syncdc085c82012-12-28 08:54:41 -0800123class CancelRemainOnChannelMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700124 public:
125 static const uint8_t kCommand;
126 static const char kCommandString[];
127
Christopher Wiley764538d2012-11-09 10:58:23 -0800128 CancelRemainOnChannelMessage()
repo syncdc085c82012-12-28 08:54:41 -0800129 : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700130
Wade Guthrie0d438532012-05-18 14:18:50 -0700131 private:
132 DISALLOW_COPY_AND_ASSIGN(CancelRemainOnChannelMessage);
133};
134
135
repo syncdc085c82012-12-28 08:54:41 -0800136class ConnectMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700137 public:
138 static const uint8_t kCommand;
139 static const char kCommandString[];
140
repo syncdc085c82012-12-28 08:54:41 -0800141 ConnectMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700142
Wade Guthrie0d438532012-05-18 14:18:50 -0700143 private:
144 DISALLOW_COPY_AND_ASSIGN(ConnectMessage);
145};
146
147
repo syncdc085c82012-12-28 08:54:41 -0800148class DeauthenticateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700149 public:
150 static const uint8_t kCommand;
151 static const char kCommandString[];
152
repo syncdc085c82012-12-28 08:54:41 -0800153 DeauthenticateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700154
Wade Guthrie0d438532012-05-18 14:18:50 -0700155 private:
156 DISALLOW_COPY_AND_ASSIGN(DeauthenticateMessage);
157};
158
159
repo syncdc085c82012-12-28 08:54:41 -0800160class DeleteStationMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700161 public:
162 static const uint8_t kCommand;
163 static const char kCommandString[];
164
repo syncdc085c82012-12-28 08:54:41 -0800165 DeleteStationMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700166
Wade Guthrie0d438532012-05-18 14:18:50 -0700167 private:
168 DISALLOW_COPY_AND_ASSIGN(DeleteStationMessage);
169};
170
171
repo syncdc085c82012-12-28 08:54:41 -0800172class DisassociateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700173 public:
174 static const uint8_t kCommand;
175 static const char kCommandString[];
176
repo syncdc085c82012-12-28 08:54:41 -0800177 DisassociateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700178
Wade Guthrie0d438532012-05-18 14:18:50 -0700179 private:
180 DISALLOW_COPY_AND_ASSIGN(DisassociateMessage);
181};
182
183
repo syncdc085c82012-12-28 08:54:41 -0800184class DisconnectMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700185 public:
186 static const uint8_t kCommand;
187 static const char kCommandString[];
188
repo syncdc085c82012-12-28 08:54:41 -0800189 DisconnectMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700190
Wade Guthrie0d438532012-05-18 14:18:50 -0700191 private:
192 DISALLOW_COPY_AND_ASSIGN(DisconnectMessage);
193};
194
195
repo syncdc085c82012-12-28 08:54:41 -0800196class FrameTxStatusMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700197 public:
198 static const uint8_t kCommand;
199 static const char kCommandString[];
200
repo syncdc085c82012-12-28 08:54:41 -0800201 FrameTxStatusMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700202
Wade Guthrie0d438532012-05-18 14:18:50 -0700203 private:
204 DISALLOW_COPY_AND_ASSIGN(FrameTxStatusMessage);
205};
206
repo sync0efa9f02012-12-28 13:40:20 -0800207class GetRegMessage : public Nl80211Message {
208 public:
209 static const uint8_t kCommand;
210 static const char kCommandString[];
211
212 GetRegMessage() : Nl80211Message(kCommand, kCommandString) {}
213
214 private:
215 DISALLOW_COPY_AND_ASSIGN(GetRegMessage);
216};
217
Paul Stewart7cd45722013-08-12 14:50:14 -0700218class GetStationMessage : public Nl80211Message {
219 public:
220 static const uint8_t kCommand;
221 static const char kCommandString[];
222
223 GetStationMessage();
224
225 private:
226 DISALLOW_COPY_AND_ASSIGN(GetStationMessage);
227};
228
Samuel Tan9aa2fd32014-08-07 14:21:29 -0700229class SetWakeOnPacketConnMessage : public Nl80211Message {
230 public:
231 static const uint8_t kCommand;
232 static const char kCommandString[];
233
234 SetWakeOnPacketConnMessage() : Nl80211Message(kCommand, kCommandString) {}
235
236 private:
237 DISALLOW_COPY_AND_ASSIGN(SetWakeOnPacketConnMessage);
238};
239
Samuel Tan3a9c0982014-08-20 13:01:17 -0700240class GetWakeOnPacketConnMessage : public Nl80211Message {
241 public:
242 static const uint8_t kCommand;
243 static const char kCommandString[];
244
245 GetWakeOnPacketConnMessage() : Nl80211Message(kCommand, kCommandString) {}
246
247 private:
248 DISALLOW_COPY_AND_ASSIGN(GetWakeOnPacketConnMessage);
249};
250
Wade Guthrie1f355e82013-04-11 15:46:12 -0700251class GetWiphyMessage : public Nl80211Message {
252 public:
253 static const uint8_t kCommand;
254 static const char kCommandString[];
255
Wade Guthrie92d06362013-04-25 15:41:30 -0700256 GetWiphyMessage();
Wade Guthrie1f355e82013-04-11 15:46:12 -0700257
258 private:
259 DISALLOW_COPY_AND_ASSIGN(GetWiphyMessage);
260};
261
Wade Guthrie0d438532012-05-18 14:18:50 -0700262
repo syncdc085c82012-12-28 08:54:41 -0800263class JoinIbssMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700264 public:
265 static const uint8_t kCommand;
266 static const char kCommandString[];
267
repo syncdc085c82012-12-28 08:54:41 -0800268 JoinIbssMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700269
Wade Guthrie0d438532012-05-18 14:18:50 -0700270 private:
271 DISALLOW_COPY_AND_ASSIGN(JoinIbssMessage);
272};
273
274
repo syncdc085c82012-12-28 08:54:41 -0800275class MichaelMicFailureMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700276 public:
277 static const uint8_t kCommand;
278 static const char kCommandString[];
279
repo syncdc085c82012-12-28 08:54:41 -0800280 MichaelMicFailureMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700281
Wade Guthrie0d438532012-05-18 14:18:50 -0700282 private:
283 DISALLOW_COPY_AND_ASSIGN(MichaelMicFailureMessage);
284};
285
286
repo syncdc085c82012-12-28 08:54:41 -0800287class NewScanResultsMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700288 public:
289 static const uint8_t kCommand;
290 static const char kCommandString[];
291
repo syncdc085c82012-12-28 08:54:41 -0800292 NewScanResultsMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700293
Wade Guthrie0d438532012-05-18 14:18:50 -0700294 private:
295 DISALLOW_COPY_AND_ASSIGN(NewScanResultsMessage);
296};
297
298
repo syncdc085c82012-12-28 08:54:41 -0800299class NewStationMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700300 public:
301 static const uint8_t kCommand;
302 static const char kCommandString[];
303
repo syncdc085c82012-12-28 08:54:41 -0800304 NewStationMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700305
Wade Guthrie0d438532012-05-18 14:18:50 -0700306 private:
307 DISALLOW_COPY_AND_ASSIGN(NewStationMessage);
308};
309
310
Wade Guthrie1f355e82013-04-11 15:46:12 -0700311class NewWiphyMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700312 public:
313 static const uint8_t kCommand;
314 static const char kCommandString[];
315
Wade Guthrie1f355e82013-04-11 15:46:12 -0700316 NewWiphyMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700317
Wade Guthrie0d438532012-05-18 14:18:50 -0700318 private:
Wade Guthrie1f355e82013-04-11 15:46:12 -0700319 DISALLOW_COPY_AND_ASSIGN(NewWiphyMessage);
Wade Guthrie0d438532012-05-18 14:18:50 -0700320};
321
322
repo syncdc085c82012-12-28 08:54:41 -0800323class NotifyCqmMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700324 public:
325 static const uint8_t kCommand;
326 static const char kCommandString[];
327
repo syncdc085c82012-12-28 08:54:41 -0800328 NotifyCqmMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700329
Wade Guthrie0d438532012-05-18 14:18:50 -0700330 private:
331 DISALLOW_COPY_AND_ASSIGN(NotifyCqmMessage);
332};
333
334
repo syncdc085c82012-12-28 08:54:41 -0800335class PmksaCandidateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700336 public:
337 static const uint8_t kCommand;
338 static const char kCommandString[];
339
repo syncdc085c82012-12-28 08:54:41 -0800340 PmksaCandidateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700341
Wade Guthrie0d438532012-05-18 14:18:50 -0700342 private:
343 DISALLOW_COPY_AND_ASSIGN(PmksaCandidateMessage);
344};
345
346
repo syncdc085c82012-12-28 08:54:41 -0800347class RegBeaconHintMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700348 public:
349 static const uint8_t kCommand;
350 static const char kCommandString[];
351
repo syncdc085c82012-12-28 08:54:41 -0800352 RegBeaconHintMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700353
Wade Guthrie0d438532012-05-18 14:18:50 -0700354 private:
Wade Guthrie0d438532012-05-18 14:18:50 -0700355 DISALLOW_COPY_AND_ASSIGN(RegBeaconHintMessage);
356};
357
358
repo syncdc085c82012-12-28 08:54:41 -0800359class RegChangeMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700360 public:
361 static const uint8_t kCommand;
362 static const char kCommandString[];
363
repo syncdc085c82012-12-28 08:54:41 -0800364 RegChangeMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700365
Wade Guthrie0d438532012-05-18 14:18:50 -0700366 private:
367 DISALLOW_COPY_AND_ASSIGN(RegChangeMessage);
368};
369
370
repo syncdc085c82012-12-28 08:54:41 -0800371class RemainOnChannelMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700372 public:
373 static const uint8_t kCommand;
374 static const char kCommandString[];
375
repo syncdc085c82012-12-28 08:54:41 -0800376 RemainOnChannelMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700377
Wade Guthrie0d438532012-05-18 14:18:50 -0700378 private:
379 DISALLOW_COPY_AND_ASSIGN(RemainOnChannelMessage);
380};
381
382
repo syncdc085c82012-12-28 08:54:41 -0800383class RoamMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700384 public:
385 static const uint8_t kCommand;
386 static const char kCommandString[];
387
repo syncdc085c82012-12-28 08:54:41 -0800388 RoamMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700389
Wade Guthrie0d438532012-05-18 14:18:50 -0700390 private:
391 DISALLOW_COPY_AND_ASSIGN(RoamMessage);
392};
393
394
repo syncdc085c82012-12-28 08:54:41 -0800395class ScanAbortedMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700396 public:
397 static const uint8_t kCommand;
398 static const char kCommandString[];
399
repo syncdc085c82012-12-28 08:54:41 -0800400 ScanAbortedMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700401
Wade Guthrie0d438532012-05-18 14:18:50 -0700402 private:
403 DISALLOW_COPY_AND_ASSIGN(ScanAbortedMessage);
404};
405
406
Wade Guthrie71872472013-03-05 10:33:38 -0800407class GetScanMessage : public Nl80211Message {
408 public:
409 static const uint8_t kCommand;
410 static const char kCommandString[];
411
412 GetScanMessage() : Nl80211Message(kCommand, kCommandString) {}
413
414 private:
415 DISALLOW_COPY_AND_ASSIGN(GetScanMessage);
416};
417
418
repo syncdc085c82012-12-28 08:54:41 -0800419class TriggerScanMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700420 public:
421 static const uint8_t kCommand;
422 static const char kCommandString[];
423
Wade Guthrieb9c3feb2013-04-25 16:31:19 -0700424 TriggerScanMessage();
Wade Guthrie0d438532012-05-18 14:18:50 -0700425
Wade Guthrie0d438532012-05-18 14:18:50 -0700426 private:
427 DISALLOW_COPY_AND_ASSIGN(TriggerScanMessage);
428};
429
430
Wade Guthrie40d992c2013-04-19 11:10:11 -0700431class UnknownNl80211Message : public Nl80211Message {
432 public:
433 explicit UnknownNl80211Message(uint8_t command)
434 : Nl80211Message(command, "<UNKNOWN NL80211 MESSAGE>"),
435 command_(command) {}
436
437 private:
438 uint8_t command_;
439 DISALLOW_COPY_AND_ASSIGN(UnknownNl80211Message);
440};
441
442
repo syncdc085c82012-12-28 08:54:41 -0800443class UnprotDeauthenticateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700444 public:
445 static const uint8_t kCommand;
446 static const char kCommandString[];
447
Christopher Wiley764538d2012-11-09 10:58:23 -0800448 UnprotDeauthenticateMessage()
repo syncdc085c82012-12-28 08:54:41 -0800449 : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700450
Wade Guthrie0d438532012-05-18 14:18:50 -0700451 private:
452 DISALLOW_COPY_AND_ASSIGN(UnprotDeauthenticateMessage);
453};
454
455
repo syncdc085c82012-12-28 08:54:41 -0800456class UnprotDisassociateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700457 public:
458 static const uint8_t kCommand;
459 static const char kCommandString[];
460
repo syncdc085c82012-12-28 08:54:41 -0800461 UnprotDisassociateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700462
Wade Guthrie0d438532012-05-18 14:18:50 -0700463 private:
464 DISALLOW_COPY_AND_ASSIGN(UnprotDisassociateMessage);
465};
466
Paul Stewart2ddf2c62013-04-16 09:47:34 -0700467
468class GetInterfaceMessage : public Nl80211Message {
469 public:
470 static const uint8_t kCommand;
471 static const char kCommandString[];
472
473 GetInterfaceMessage();
474
475 private:
476 DISALLOW_COPY_AND_ASSIGN(GetInterfaceMessage);
477};
478
479class NewInterfaceMessage : public Nl80211Message {
480 public:
481 static const uint8_t kCommand;
482 static const char kCommandString[];
483
484 NewInterfaceMessage() : Nl80211Message(kCommand, kCommandString) {}
485
486 private:
487 DISALLOW_COPY_AND_ASSIGN(NewInterfaceMessage);
488};
489
repo syncdc085c82012-12-28 08:54:41 -0800490// Nl80211MessageDataCollector - this class is used to collect data to be
Wade Guthrie0d438532012-05-18 14:18:50 -0700491// used for unit tests. It is only invoked in this case.
492
repo syncdc085c82012-12-28 08:54:41 -0800493class Nl80211MessageDataCollector {
Wade Guthrie0d438532012-05-18 14:18:50 -0700494 public:
repo syncdc085c82012-12-28 08:54:41 -0800495 static Nl80211MessageDataCollector *GetInstance();
Wade Guthrie0d438532012-05-18 14:18:50 -0700496
repo syncdc085c82012-12-28 08:54:41 -0800497 void CollectDebugData(const Nl80211Message &message, nlmsghdr *msg);
Wade Guthrie0d438532012-05-18 14:18:50 -0700498
499 protected:
500 friend struct
repo syncdc085c82012-12-28 08:54:41 -0800501 base::DefaultLazyInstanceTraits<Nl80211MessageDataCollector>;
Wade Guthrie0d438532012-05-18 14:18:50 -0700502
Alex Vakulenko016fa0e2014-08-11 15:59:58 -0700503 Nl80211MessageDataCollector();
Wade Guthrie0d438532012-05-18 14:18:50 -0700504
505 private:
506 // In order to limit the output from this class, I keep track of types I
507 // haven't yet printed.
508 std::map<uint8_t, bool> need_to_print;
repo syncdc085c82012-12-28 08:54:41 -0800509
510 DISALLOW_COPY_AND_ASSIGN(Nl80211MessageDataCollector);
Wade Guthrie0d438532012-05-18 14:18:50 -0700511};
512
513} // namespace shill
514
Wade Guthrie89e6cb32013-03-07 08:03:45 -0800515#endif // SHILL_NL80211_MESSAGE_H_