src/devices/wifi/supported-rates.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 23 Oct 2007 13:11:10 +0200
changeset 2013 4a5335c67eac
parent 1938 f7e9802ea8e3
child 3365 6409d2460601
permissions -rw-r--r--
add printing support
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1936
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2006 INRIA
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as 
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#ifndef SUPPORTED_RATES_H
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#define SUPPORTED_RATES_H
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include <stdint.h>
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include "ns3/buffer.h"
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
namespace ns3 {
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
class SupportedRates {
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
public:
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
  SupportedRates ();
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
  void AddSupportedRate (uint32_t bs);
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
  void SetBasicRate (uint32_t bs);
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
  bool IsSupportedRate (uint32_t bs) const;
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
  bool IsBasicRate (uint32_t bs) const;
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
  uint8_t GetNRates (void) const;
2013
4a5335c67eac add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1938
diff changeset
    39
  uint32_t GetRate (uint8_t i) const;
1936
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
  uint32_t GetSerializedSize (void) const;
1938
f7e9802ea8e3 add serialization/deserialization support to Ssid/SupportedRates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1936
diff changeset
    42
  Buffer::Iterator Serialize (Buffer::Iterator start) const;
f7e9802ea8e3 add serialization/deserialization support to Ssid/SupportedRates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1936
diff changeset
    43
  Buffer::Iterator Deserialize (Buffer::Iterator start);
1936
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
private:
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
  uint8_t m_nRates;
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
  uint8_t m_rates[8];
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
};
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
2013
4a5335c67eac add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1938
diff changeset
    49
std::ostream &operator << (std::ostream &os, const SupportedRates &rates);
4a5335c67eac add printing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1938
diff changeset
    50
1936
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
} // namespace ns3
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
61d6404e66d8 add SupportedRates to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
#endif /* SUPPORTED_RATES_H */