OLD | NEW |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2006 INRIA | 3 * Copyright (c) 2006 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as· | 6 * it under the terms of the GNU General Public License version 2 as· |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> | 18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
19 */ | 19 */ |
20 #ifndef SUPPORTED_RATES_H | 20 #ifndef SUPPORTED_RATES_H |
21 #define SUPPORTED_RATES_H | 21 #define SUPPORTED_RATES_H |
22 | 22 |
23 #include <stdint.h> | 23 #include <stdint.h> |
24 #include <ostream> | 24 #include <ostream> |
25 #include "ns3/buffer.h" | 25 #include "ns3/buffer.h" |
| 26 #include "ns3/wifi-information-element.h" |
26 | 27 |
27 namespace ns3 { | 28 namespace ns3 { |
28 | 29 |
29 class SupportedRates { | 30 class SupportedRates : public WifiInformationElement { |
30 public: | 31 public: |
31 SupportedRates (); | 32 SupportedRates (); |
32 | 33 |
33 void AddSupportedRate (uint32_t bs); | 34 void AddSupportedRate (uint32_t bs); |
34 void SetBasicRate (uint32_t bs); | 35 void SetBasicRate (uint32_t bs); |
35 | 36 |
36 bool IsSupportedRate (uint32_t bs) const; | 37 bool IsSupportedRate (uint32_t bs) const; |
37 bool IsBasicRate (uint32_t bs) const; | 38 bool IsBasicRate (uint32_t bs) const; |
38 | 39 |
39 uint8_t GetNRates (void) const; | 40 uint8_t GetNRates (void) const; |
40 uint32_t GetRate (uint8_t i) const; | 41 uint32_t GetRate (uint8_t i) const; |
41 | 42 |
42 uint32_t GetSerializedSize (void) const; | 43 WifiElementId ElementId () const { return IE_SUPPORTED_RATES; } |
43 Buffer::Iterator Serialize (Buffer::Iterator start) const; | 44 uint8_t GetInformationSize () const; |
44 Buffer::Iterator Deserialize (Buffer::Iterator start); | 45 uint8_t SerializeInformation (Buffer::Iterator &i) const; |
| 46 uint8_t DeserializeInformation (Buffer::Iterator &i, |
| 47 uint8_t length); |
45 private: | 48 private: |
46 uint8_t m_nRates; | 49 uint8_t m_nRates; |
47 uint8_t m_rates[8]; | 50 uint8_t m_rates[8]; |
48 }; | 51 }; |
49 | 52 |
50 std::ostream &operator << (std::ostream &os, const SupportedRates &rates); | 53 std::ostream &operator << (std::ostream &os, const SupportedRates &rates); |
51 | 54 |
52 } // namespace ns3 | 55 } // namespace ns3 |
53 | 56 |
54 #endif /* SUPPORTED_RATES_H */ | 57 #endif /* SUPPORTED_RATES_H */ |
OLD | NEW |