blob: 62c8405fe439905631912cdd54bb2385112250a2 [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
Wade Guthrie1f355e82013-04-11 15:46:12 -0700218class GetWiphyMessage : public Nl80211Message {
219 public:
220 static const uint8_t kCommand;
221 static const char kCommandString[];
222
Wade Guthrie92d06362013-04-25 15:41:30 -0700223 GetWiphyMessage();
Wade Guthrie1f355e82013-04-11 15:46:12 -0700224
225 private:
226 DISALLOW_COPY_AND_ASSIGN(GetWiphyMessage);
227};
228
Wade Guthrie0d438532012-05-18 14:18:50 -0700229
repo syncdc085c82012-12-28 08:54:41 -0800230class JoinIbssMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700231 public:
232 static const uint8_t kCommand;
233 static const char kCommandString[];
234
repo syncdc085c82012-12-28 08:54:41 -0800235 JoinIbssMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700236
Wade Guthrie0d438532012-05-18 14:18:50 -0700237 private:
238 DISALLOW_COPY_AND_ASSIGN(JoinIbssMessage);
239};
240
241
repo syncdc085c82012-12-28 08:54:41 -0800242class MichaelMicFailureMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700243 public:
244 static const uint8_t kCommand;
245 static const char kCommandString[];
246
repo syncdc085c82012-12-28 08:54:41 -0800247 MichaelMicFailureMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700248
Wade Guthrie0d438532012-05-18 14:18:50 -0700249 private:
250 DISALLOW_COPY_AND_ASSIGN(MichaelMicFailureMessage);
251};
252
253
repo syncdc085c82012-12-28 08:54:41 -0800254class NewScanResultsMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700255 public:
256 static const uint8_t kCommand;
257 static const char kCommandString[];
258
repo syncdc085c82012-12-28 08:54:41 -0800259 NewScanResultsMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700260
Wade Guthrie0d438532012-05-18 14:18:50 -0700261 private:
262 DISALLOW_COPY_AND_ASSIGN(NewScanResultsMessage);
263};
264
265
repo syncdc085c82012-12-28 08:54:41 -0800266class NewStationMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700267 public:
268 static const uint8_t kCommand;
269 static const char kCommandString[];
270
repo syncdc085c82012-12-28 08:54:41 -0800271 NewStationMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700272
Wade Guthrie0d438532012-05-18 14:18:50 -0700273 private:
274 DISALLOW_COPY_AND_ASSIGN(NewStationMessage);
275};
276
277
Wade Guthrie1f355e82013-04-11 15:46:12 -0700278class NewWiphyMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700279 public:
280 static const uint8_t kCommand;
281 static const char kCommandString[];
282
Wade Guthrie1f355e82013-04-11 15:46:12 -0700283 NewWiphyMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700284
Wade Guthrie0d438532012-05-18 14:18:50 -0700285 private:
Wade Guthrie1f355e82013-04-11 15:46:12 -0700286 DISALLOW_COPY_AND_ASSIGN(NewWiphyMessage);
Wade Guthrie0d438532012-05-18 14:18:50 -0700287};
288
289
repo syncdc085c82012-12-28 08:54:41 -0800290class NotifyCqmMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700291 public:
292 static const uint8_t kCommand;
293 static const char kCommandString[];
294
repo syncdc085c82012-12-28 08:54:41 -0800295 NotifyCqmMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700296
Wade Guthrie0d438532012-05-18 14:18:50 -0700297 private:
298 DISALLOW_COPY_AND_ASSIGN(NotifyCqmMessage);
299};
300
301
repo syncdc085c82012-12-28 08:54:41 -0800302class PmksaCandidateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700303 public:
304 static const uint8_t kCommand;
305 static const char kCommandString[];
306
repo syncdc085c82012-12-28 08:54:41 -0800307 PmksaCandidateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700308
Wade Guthrie0d438532012-05-18 14:18:50 -0700309 private:
310 DISALLOW_COPY_AND_ASSIGN(PmksaCandidateMessage);
311};
312
313
repo syncdc085c82012-12-28 08:54:41 -0800314class RegBeaconHintMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700315 public:
316 static const uint8_t kCommand;
317 static const char kCommandString[];
318
repo syncdc085c82012-12-28 08:54:41 -0800319 RegBeaconHintMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700320
Wade Guthrie0d438532012-05-18 14:18:50 -0700321 private:
Wade Guthrie0d438532012-05-18 14:18:50 -0700322 DISALLOW_COPY_AND_ASSIGN(RegBeaconHintMessage);
323};
324
325
repo syncdc085c82012-12-28 08:54:41 -0800326class RegChangeMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700327 public:
328 static const uint8_t kCommand;
329 static const char kCommandString[];
330
repo syncdc085c82012-12-28 08:54:41 -0800331 RegChangeMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700332
Wade Guthrie0d438532012-05-18 14:18:50 -0700333 private:
334 DISALLOW_COPY_AND_ASSIGN(RegChangeMessage);
335};
336
337
repo syncdc085c82012-12-28 08:54:41 -0800338class RemainOnChannelMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700339 public:
340 static const uint8_t kCommand;
341 static const char kCommandString[];
342
repo syncdc085c82012-12-28 08:54:41 -0800343 RemainOnChannelMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700344
Wade Guthrie0d438532012-05-18 14:18:50 -0700345 private:
346 DISALLOW_COPY_AND_ASSIGN(RemainOnChannelMessage);
347};
348
349
repo syncdc085c82012-12-28 08:54:41 -0800350class RoamMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700351 public:
352 static const uint8_t kCommand;
353 static const char kCommandString[];
354
repo syncdc085c82012-12-28 08:54:41 -0800355 RoamMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700356
Wade Guthrie0d438532012-05-18 14:18:50 -0700357 private:
358 DISALLOW_COPY_AND_ASSIGN(RoamMessage);
359};
360
361
repo syncdc085c82012-12-28 08:54:41 -0800362class ScanAbortedMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700363 public:
364 static const uint8_t kCommand;
365 static const char kCommandString[];
366
repo syncdc085c82012-12-28 08:54:41 -0800367 ScanAbortedMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700368
Wade Guthrie0d438532012-05-18 14:18:50 -0700369 private:
370 DISALLOW_COPY_AND_ASSIGN(ScanAbortedMessage);
371};
372
373
Wade Guthrie71872472013-03-05 10:33:38 -0800374class GetScanMessage : public Nl80211Message {
375 public:
376 static const uint8_t kCommand;
377 static const char kCommandString[];
378
379 GetScanMessage() : Nl80211Message(kCommand, kCommandString) {}
380
381 private:
382 DISALLOW_COPY_AND_ASSIGN(GetScanMessage);
383};
384
385
repo syncdc085c82012-12-28 08:54:41 -0800386class TriggerScanMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700387 public:
388 static const uint8_t kCommand;
389 static const char kCommandString[];
390
Wade Guthrieb9c3feb2013-04-25 16:31:19 -0700391 TriggerScanMessage();
Wade Guthrie0d438532012-05-18 14:18:50 -0700392
Wade Guthrie0d438532012-05-18 14:18:50 -0700393 private:
394 DISALLOW_COPY_AND_ASSIGN(TriggerScanMessage);
395};
396
397
Wade Guthrie40d992c2013-04-19 11:10:11 -0700398class UnknownNl80211Message : public Nl80211Message {
399 public:
400 explicit UnknownNl80211Message(uint8_t command)
401 : Nl80211Message(command, "<UNKNOWN NL80211 MESSAGE>"),
402 command_(command) {}
403
404 private:
405 uint8_t command_;
406 DISALLOW_COPY_AND_ASSIGN(UnknownNl80211Message);
407};
408
409
repo syncdc085c82012-12-28 08:54:41 -0800410class UnprotDeauthenticateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700411 public:
412 static const uint8_t kCommand;
413 static const char kCommandString[];
414
Christopher Wiley764538d2012-11-09 10:58:23 -0800415 UnprotDeauthenticateMessage()
repo syncdc085c82012-12-28 08:54:41 -0800416 : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700417
Wade Guthrie0d438532012-05-18 14:18:50 -0700418 private:
419 DISALLOW_COPY_AND_ASSIGN(UnprotDeauthenticateMessage);
420};
421
422
repo syncdc085c82012-12-28 08:54:41 -0800423class UnprotDisassociateMessage : public Nl80211Message {
Wade Guthrie0d438532012-05-18 14:18:50 -0700424 public:
425 static const uint8_t kCommand;
426 static const char kCommandString[];
427
repo syncdc085c82012-12-28 08:54:41 -0800428 UnprotDisassociateMessage() : Nl80211Message(kCommand, kCommandString) {}
Wade Guthrie0d438532012-05-18 14:18:50 -0700429
Wade Guthrie0d438532012-05-18 14:18:50 -0700430 private:
431 DISALLOW_COPY_AND_ASSIGN(UnprotDisassociateMessage);
432};
433
Paul Stewart2ddf2c62013-04-16 09:47:34 -0700434
435class GetInterfaceMessage : public Nl80211Message {
436 public:
437 static const uint8_t kCommand;
438 static const char kCommandString[];
439
440 GetInterfaceMessage();
441
442 private:
443 DISALLOW_COPY_AND_ASSIGN(GetInterfaceMessage);
444};
445
446class NewInterfaceMessage : public Nl80211Message {
447 public:
448 static const uint8_t kCommand;
449 static const char kCommandString[];
450
451 NewInterfaceMessage() : Nl80211Message(kCommand, kCommandString) {}
452
453 private:
454 DISALLOW_COPY_AND_ASSIGN(NewInterfaceMessage);
455};
456
repo syncdc085c82012-12-28 08:54:41 -0800457// Nl80211MessageDataCollector - this class is used to collect data to be
Wade Guthrie0d438532012-05-18 14:18:50 -0700458// used for unit tests. It is only invoked in this case.
459
repo syncdc085c82012-12-28 08:54:41 -0800460class Nl80211MessageDataCollector {
Wade Guthrie0d438532012-05-18 14:18:50 -0700461 public:
repo syncdc085c82012-12-28 08:54:41 -0800462 static Nl80211MessageDataCollector *GetInstance();
Wade Guthrie0d438532012-05-18 14:18:50 -0700463
repo syncdc085c82012-12-28 08:54:41 -0800464 void CollectDebugData(const Nl80211Message &message, nlmsghdr *msg);
Wade Guthrie0d438532012-05-18 14:18:50 -0700465
466 protected:
467 friend struct
repo syncdc085c82012-12-28 08:54:41 -0800468 base::DefaultLazyInstanceTraits<Nl80211MessageDataCollector>;
Wade Guthrie0d438532012-05-18 14:18:50 -0700469
repo syncdc085c82012-12-28 08:54:41 -0800470 explicit Nl80211MessageDataCollector();
Wade Guthrie0d438532012-05-18 14:18:50 -0700471
472 private:
473 // In order to limit the output from this class, I keep track of types I
474 // haven't yet printed.
475 std::map<uint8_t, bool> need_to_print;
repo syncdc085c82012-12-28 08:54:41 -0800476
477 DISALLOW_COPY_AND_ASSIGN(Nl80211MessageDataCollector);
Wade Guthrie0d438532012-05-18 14:18:50 -0700478};
479
480} // namespace shill
481
Wade Guthrie89e6cb32013-03-07 08:03:45 -0800482#endif // SHILL_NL80211_MESSAGE_H_