blob: c6bbbee1b7a3f48e06e5c264357c74decf5fa6d6 [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
27 Nl80211Message(uint8 command, const char *command_string)
28 : GenericNetlinkMessage(nl80211_message_type_, command, command_string) {}
29 virtual ~Nl80211Message() {}
30
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
39 uint8 command() const { return command_; }
40 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
Wade Guthrie1f355e82013-04-11 15:46:12 -0700240class GetWiphyMessage : public Nl80211Message {
241 public:
242 static const uint8_t kCommand;
243 static const char kCommandString[];
244
Wade Guthrie92d06362013-04-25 15:41:30 -0700245 GetWiphyMessage();
Wade Guthrie1f355e82013-04-11 15:46:12 -0700246
247 private:
248 DISALLOW_COPY_AND_ASSIGN(GetWiphyMessage);
249};
250
Wade Guthrie0d438532012-05-18 14:18:50 -0700251
repo syncdc085c82012-12-28 08:54:41 -0800252class JoinIbssMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700253 public:
254 static const uint8_t kCommand;
255 static const char kCommandString[];
256
repo syncdc085c82012-12-28 08:54:41 -0800257 JoinIbssMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700258
Wade Guthrie0d438532012-05-18 14:18:50 -0700259 private:
260 DISALLOW_COPY_AND_ASSIGN(JoinIbssMessage);
261};
262
263
repo syncdc085c82012-12-28 08:54:41 -0800264class MichaelMicFailureMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700265 public:
266 static const uint8_t kCommand;
267 static const char kCommandString[];
268
repo syncdc085c82012-12-28 08:54:41 -0800269 MichaelMicFailureMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700270
Wade Guthrie0d438532012-05-18 14:18:50 -0700271 private:
272 DISALLOW_COPY_AND_ASSIGN(MichaelMicFailureMessage);
273};
274
275
repo syncdc085c82012-12-28 08:54:41 -0800276class NewScanResultsMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700277 public:
278 static const uint8_t kCommand;
279 static const char kCommandString[];
280
repo syncdc085c82012-12-28 08:54:41 -0800281 NewScanResultsMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700282
Wade Guthrie0d438532012-05-18 14:18:50 -0700283 private:
284 DISALLOW_COPY_AND_ASSIGN(NewScanResultsMessage);
285};
286
287
repo syncdc085c82012-12-28 08:54:41 -0800288class NewStationMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700289 public:
290 static const uint8_t kCommand;
291 static const char kCommandString[];
292
repo syncdc085c82012-12-28 08:54:41 -0800293 NewStationMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700294
Wade Guthrie0d438532012-05-18 14:18:50 -0700295 private:
296 DISALLOW_COPY_AND_ASSIGN(NewStationMessage);
297};
298
299
Wade Guthrie1f355e82013-04-11 15:46:12 -0700300class NewWiphyMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700301 public:
302 static const uint8_t kCommand;
303 static const char kCommandString[];
304
Wade Guthrie1f355e82013-04-11 15:46:12 -0700305 NewWiphyMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700306
Wade Guthrie0d438532012-05-18 14:18:50 -0700307 private:
Wade Guthrie1f355e82013-04-11 15:46:12 -0700308 DISALLOW_COPY_AND_ASSIGN(NewWiphyMessage);
Wade Guthrie0d438532012-05-18 14:18:50 -0700309};
310
311
repo syncdc085c82012-12-28 08:54:41 -0800312class NotifyCqmMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700313 public:
314 static const uint8_t kCommand;
315 static const char kCommandString[];
316
repo syncdc085c82012-12-28 08:54:41 -0800317 NotifyCqmMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700318
Wade Guthrie0d438532012-05-18 14:18:50 -0700319 private:
320 DISALLOW_COPY_AND_ASSIGN(NotifyCqmMessage);
321};
322
323
repo syncdc085c82012-12-28 08:54:41 -0800324class PmksaCandidateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700325 public:
326 static const uint8_t kCommand;
327 static const char kCommandString[];
328
repo syncdc085c82012-12-28 08:54:41 -0800329 PmksaCandidateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700330
Wade Guthrie0d438532012-05-18 14:18:50 -0700331 private:
332 DISALLOW_COPY_AND_ASSIGN(PmksaCandidateMessage);
333};
334
335
repo syncdc085c82012-12-28 08:54:41 -0800336class RegBeaconHintMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700337 public:
338 static const uint8_t kCommand;
339 static const char kCommandString[];
340
repo syncdc085c82012-12-28 08:54:41 -0800341 RegBeaconHintMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700342
Wade Guthrie0d438532012-05-18 14:18:50 -0700343 private:
Wade Guthrie0d438532012-05-18 14:18:50 -0700344 DISALLOW_COPY_AND_ASSIGN(RegBeaconHintMessage);
345};
346
347
repo syncdc085c82012-12-28 08:54:41 -0800348class RegChangeMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700349 public:
350 static const uint8_t kCommand;
351 static const char kCommandString[];
352
repo syncdc085c82012-12-28 08:54:41 -0800353 RegChangeMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700354
Wade Guthrie0d438532012-05-18 14:18:50 -0700355 private:
356 DISALLOW_COPY_AND_ASSIGN(RegChangeMessage);
357};
358
359
repo syncdc085c82012-12-28 08:54:41 -0800360class RemainOnChannelMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700361 public:
362 static const uint8_t kCommand;
363 static const char kCommandString[];
364
repo syncdc085c82012-12-28 08:54:41 -0800365 RemainOnChannelMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700366
Wade Guthrie0d438532012-05-18 14:18:50 -0700367 private:
368 DISALLOW_COPY_AND_ASSIGN(RemainOnChannelMessage);
369};
370
371
repo syncdc085c82012-12-28 08:54:41 -0800372class RoamMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700373 public:
374 static const uint8_t kCommand;
375 static const char kCommandString[];
376
repo syncdc085c82012-12-28 08:54:41 -0800377 RoamMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700378
Wade Guthrie0d438532012-05-18 14:18:50 -0700379 private:
380 DISALLOW_COPY_AND_ASSIGN(RoamMessage);
381};
382
383
repo syncdc085c82012-12-28 08:54:41 -0800384class ScanAbortedMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700385 public:
386 static const uint8_t kCommand;
387 static const char kCommandString[];
388
repo syncdc085c82012-12-28 08:54:41 -0800389 ScanAbortedMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700390
Wade Guthrie0d438532012-05-18 14:18:50 -0700391 private:
392 DISALLOW_COPY_AND_ASSIGN(ScanAbortedMessage);
393};
394
395
Wade Guthrie71872472013-03-05 10:33:38 -0800396class GetScanMessage : public Nl80211Message {
397 public:
398 static const uint8_t kCommand;
399 static const char kCommandString[];
400
401 GetScanMessage() : Nl80211Message(kCommand, kCommandString) {}
402
403 private:
404 DISALLOW_COPY_AND_ASSIGN(GetScanMessage);
405};
406
407
repo syncdc085c82012-12-28 08:54:41 -0800408class TriggerScanMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700409 public:
410 static const uint8_t kCommand;
411 static const char kCommandString[];
412
Wade Guthrieb9c3feb2013-04-25 16:31:19 -0700413 TriggerScanMessage();
Wade Guthrie0d438532012-05-18 14:18:50 -0700414
Wade Guthrie0d438532012-05-18 14:18:50 -0700415 private:
416 DISALLOW_COPY_AND_ASSIGN(TriggerScanMessage);
417};
418
419
Wade Guthrie40d992c2013-04-19 11:10:11 -0700420class UnknownNl80211Message : public Nl80211Message {
421 public:
422 explicit UnknownNl80211Message(uint8_t command)
423 : Nl80211Message(command, "<UNKNOWN NL80211 MESSAGE>"),
424 command_(command) {}
425
426 private:
427 uint8_t command_;
428 DISALLOW_COPY_AND_ASSIGN(UnknownNl80211Message);
429};
430
431
repo syncdc085c82012-12-28 08:54:41 -0800432class UnprotDeauthenticateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700433 public:
434 static const uint8_t kCommand;
435 static const char kCommandString[];
436
Christopher Wiley764538d2012-11-09 10:58:23 -0800437 UnprotDeauthenticateMessage()
repo syncdc085c82012-12-28 08:54:41 -0800438 : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700439
Wade Guthrie0d438532012-05-18 14:18:50 -0700440 private:
441 DISALLOW_COPY_AND_ASSIGN(UnprotDeauthenticateMessage);
442};
443
444
repo syncdc085c82012-12-28 08:54:41 -0800445class UnprotDisassociateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700446 public:
447 static const uint8_t kCommand;
448 static const char kCommandString[];
449
repo syncdc085c82012-12-28 08:54:41 -0800450 UnprotDisassociateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700451
Wade Guthrie0d438532012-05-18 14:18:50 -0700452 private:
453 DISALLOW_COPY_AND_ASSIGN(UnprotDisassociateMessage);
454};
455
Paul Stewart2ddf2c62013-04-16 09:47:34 -0700456
457class GetInterfaceMessage : public Nl80211Message {
458 public:
459 static const uint8_t kCommand;
460 static const char kCommandString[];
461
462 GetInterfaceMessage();
463
464 private:
465 DISALLOW_COPY_AND_ASSIGN(GetInterfaceMessage);
466};
467
468class NewInterfaceMessage : public Nl80211Message {
469 public:
470 static const uint8_t kCommand;
471 static const char kCommandString[];
472
473 NewInterfaceMessage() : Nl80211Message(kCommand, kCommandString) {}
474
475 private:
476 DISALLOW_COPY_AND_ASSIGN(NewInterfaceMessage);
477};
478
repo syncdc085c82012-12-28 08:54:41 -0800479// Nl80211MessageDataCollector - this class is used to collect data to be
Wade Guthrie0d438532012-05-18 14:18:50 -0700480// used for unit tests. It is only invoked in this case.
481
repo syncdc085c82012-12-28 08:54:41 -0800482class Nl80211MessageDataCollector {
Wade Guthrie0d438532012-05-18 14:18:50 -0700483 public:
repo syncdc085c82012-12-28 08:54:41 -0800484 static Nl80211MessageDataCollector *GetInstance();
Wade Guthrie0d438532012-05-18 14:18:50 -0700485
repo syncdc085c82012-12-28 08:54:41 -0800486 void CollectDebugData(const Nl80211Message &message, nlmsghdr *msg);
Wade Guthrie0d438532012-05-18 14:18:50 -0700487
488 protected:
489 friend struct
repo syncdc085c82012-12-28 08:54:41 -0800490 base::DefaultLazyInstanceTraits<Nl80211MessageDataCollector>;
Wade Guthrie0d438532012-05-18 14:18:50 -0700491
repo syncdc085c82012-12-28 08:54:41 -0800492 explicit Nl80211MessageDataCollector();
Wade Guthrie0d438532012-05-18 14:18:50 -0700493
494 private:
495 // In order to limit the output from this class, I keep track of types I
496 // haven't yet printed.
497 std::map<uint8_t, bool> need_to_print;
repo syncdc085c82012-12-28 08:54:41 -0800498
499 DISALLOW_COPY_AND_ASSIGN(Nl80211MessageDataCollector);
Wade Guthrie0d438532012-05-18 14:18:50 -0700500};
501
502} // namespace shill
503
Wade Guthrie89e6cb32013-03-07 08:03:45 -0800504#endif // SHILL_NL80211_MESSAGE_H_