src/wifi/model/wifi-information-element-vector.h
author Daniel Lertpratchya <nikkipui@gmail.com>
Mon, 18 Feb 2013 10:35:03 -0500
changeset 9238 e6c89f14f09b
parent 7600 57ba46094a0d
child 10483 e3a02ed14587
permissions -rw-r--r--
Prevent EndTxNoAck after sending a Block ACK response
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
     2
/*
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
     3
 * Copyright (c) 2009 IITP RAS
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
     4
 *
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
     8
 *
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    13
 *
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    17
 *
5161
1c685e8be8d1 Restructured files, removed unneeded includes
Kirill Andreev <andreev@iitp.ru>
parents: 5159
diff changeset
    18
 * Authors: Kirill Andreev <andreev@iitp.ru>
1c685e8be8d1 Restructured files, removed unneeded includes
Kirill Andreev <andreev@iitp.ru>
parents: 5159
diff changeset
    19
 *          Pavel Boyko <boyko.iitp.ru>
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    20
 */
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    21
6378
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    22
#ifndef WIFI_INFORMATION_ELEMENT_VECTOR_H
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    23
#define WIFI_INFORMATION_ELEMENT_VECTOR_H
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    24
5158
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    25
#include "ns3/header.h"
5505
c0ac392289c3 replace RefCountBase with SimpleRefCount<> to avoid duplicate refcounting implementations.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5184
diff changeset
    26
#include "ns3/simple-ref-count.h"
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    27
6378
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    28
#include "ns3/wifi-information-element.h"
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    29
5161
1c685e8be8d1 Restructured files, removed unneeded includes
Kirill Andreev <andreev@iitp.ru>
parents: 5159
diff changeset
    30
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    31
namespace ns3 {
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    32
5161
1c685e8be8d1 Restructured files, removed unneeded includes
Kirill Andreev <andreev@iitp.ru>
parents: 5159
diff changeset
    33
/**
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    34
 * \brief Information element vector
6378
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    35
 * \ingroup wifi
5161
1c685e8be8d1 Restructured files, removed unneeded includes
Kirill Andreev <andreev@iitp.ru>
parents: 5159
diff changeset
    36
 *
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    37
 * Implements a vector of WifiInformationElements.
6378
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    38
 * Information elements typically come in groups, and the
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    39
 * WifiInformationElementVector class provides a representation of a
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    40
 * series of IEs, and the facility for serialisation to and
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    41
 * deserialisation from the over-the-air format.
5161
1c685e8be8d1 Restructured files, removed unneeded includes
Kirill Andreev <andreev@iitp.ru>
parents: 5159
diff changeset
    42
 */
5158
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    43
class WifiInformationElementVector : public Header
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    44
{
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    45
public:
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    46
  WifiInformationElementVector ();
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    47
  ~WifiInformationElementVector ();
5158
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    48
  ///\name Inherited from Header
7600
57ba46094a0d fix various doxygen errors
Vedran Miletić <rivanvx@gmail.com>
parents: 7141
diff changeset
    49
  // \{
5158
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    50
  static TypeId GetTypeId ();
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    51
  TypeId GetInstanceTypeId () const;
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    52
  virtual uint32_t GetSerializedSize () const;
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    53
  virtual void Serialize (Buffer::Iterator start) const;
5167
a3ede758b713 Doxygen: fixed warnings
Kirill Andreev <andreev@iitp.ru>
parents: 5162
diff changeset
    54
  /**
a3ede758b713 Doxygen: fixed warnings
Kirill Andreev <andreev@iitp.ru>
parents: 5162
diff changeset
    55
   * \attention When you use RemoveHeader, WifiInformationElementVector supposes, that
a3ede758b713 Doxygen: fixed warnings
Kirill Andreev <andreev@iitp.ru>
parents: 5162
diff changeset
    56
   * all buffer consists of information elements
a3ede758b713 Doxygen: fixed warnings
Kirill Andreev <andreev@iitp.ru>
parents: 5162
diff changeset
    57
   * @param start
a3ede758b713 Doxygen: fixed warnings
Kirill Andreev <andreev@iitp.ru>
parents: 5162
diff changeset
    58
   * @return
a3ede758b713 Doxygen: fixed warnings
Kirill Andreev <andreev@iitp.ru>
parents: 5162
diff changeset
    59
   */
5158
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    60
  virtual uint32_t Deserialize (Buffer::Iterator start);
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    61
  virtual void Print (std::ostream &os) const;
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    62
  //\}
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    63
  /**
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    64
   * \brief Needed when you try to deserialize a lonely IE inside other header
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    65
   * \param start is the start of the buffer
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    66
   * \return deserialized bytes
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    67
   */
0baed7827260 Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents: 5140
diff changeset
    68
  virtual uint32_t DeserializeSingleIe (Buffer::Iterator start);
6378
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    69
  ///Set maximum size to control overflow of the max packet length
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    70
  void SetMaxSize (uint16_t size);
5827
ed0b2d9301a1 Mesh: added doxygen comments
Kirill Andreev <andreev@iitp.ru>
parents: 5505
diff changeset
    71
  /// As soon as this is a vector, we define an Iterator
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    72
  typedef std::vector<Ptr<WifiInformationElement> >::iterator Iterator;
5827
ed0b2d9301a1 Mesh: added doxygen comments
Kirill Andreev <andreev@iitp.ru>
parents: 5505
diff changeset
    73
  /// Returns Begin of the vector
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    74
  Iterator Begin ();
5827
ed0b2d9301a1 Mesh: added doxygen comments
Kirill Andreev <andreev@iitp.ru>
parents: 5505
diff changeset
    75
  /// Returns End of the vector
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    76
  Iterator End ();
5827
ed0b2d9301a1 Mesh: added doxygen comments
Kirill Andreev <andreev@iitp.ru>
parents: 5505
diff changeset
    77
  /// add an IE, if maxSize has exceeded, returns false
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    78
  bool AddInformationElement (Ptr<WifiInformationElement> element);
5827
ed0b2d9301a1 Mesh: added doxygen comments
Kirill Andreev <andreev@iitp.ru>
parents: 5505
diff changeset
    79
  /// vector of pointers to information elements is the body of IeVector
6379
f1031f074dbd Bug 881: Change WifiElementId to WifiInformationElementId
Dean Armstrong <deanarm@gmail.com>
parents: 6378
diff changeset
    80
  Ptr<WifiInformationElement> FindFirst (WifiInformationElementId id) const;
6378
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    81
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    82
  virtual bool operator== (const WifiInformationElementVector & a) const;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    83
protected:
5177
2d82457e44dc Headers: structured
Kirill Andreev <andreev@iitp.ru>
parents: 5167
diff changeset
    84
  typedef std::vector<Ptr<WifiInformationElement> > IE_VECTOR;
5827
ed0b2d9301a1 Mesh: added doxygen comments
Kirill Andreev <andreev@iitp.ru>
parents: 5505
diff changeset
    85
  /// Current number of bytes
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    86
  uint32_t GetSize () const;
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    87
  IE_VECTOR m_elements;
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    88
  /// Size in bytes (actually, max packet length)
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    89
  uint16_t m_maxSize;
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    90
};
6378
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    91
5139
87eb2f77f661 Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
diff changeset
    92
}
6378
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents: 5827
diff changeset
    93
#endif /* WIFI_INFORMATION_ELEMENT_VECTOR_H */