A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ie-dot11s-preq.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008,2009 IITP RAS
4  *
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
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
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
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Kirill Andreev <andreev@iitp.ru>
19  */
20 
21 #ifndef WIFI_PREQ_INFORMATION_ELEMENT_H
22 #define WIFI_PREQ_INFORMATION_ELEMENT_H
23 
24 #include <vector>
25 
26 #include "ns3/mac48-address.h"
27 #include "ns3/mesh-information-element-vector.h"
28 
29 namespace ns3 {
30 namespace dot11s {
36 class DestinationAddressUnit : public SimpleRefCount<DestinationAddressUnit>
37 {
38 public:
40  void SetFlags (bool doFlag, bool rfFlag, bool usnFlag);
41  void SetDestinationAddress (Mac48Address dest_address);
42  void SetDestSeqNumber (uint32_t dest_seq_number);
43  bool IsDo ();
44  bool IsRf ();
45  bool IsUsn ();
46  Mac48Address GetDestinationAddress () const;
47  uint32_t GetDestSeqNumber () const;
48 private:
49  bool m_do;
50  bool m_rf;
51  bool m_usn;
52  Mac48Address m_destinationAddress;
53  uint32_t m_destSeqNumber;
54 
55  friend bool operator== (const DestinationAddressUnit & a, const DestinationAddressUnit & b);
56 };
62 {
63 public:
64  IePreq ();
65  ~IePreq ();
71  bool doFlag,
72  bool rfFlag,
73  Mac48Address dest_address,
74  uint32_t dest_seq_number
75  );
77  void DelDestinationAddressElement (Mac48Address dest_address);
81  std::vector<Ptr<DestinationAddressUnit> > GetDestinationList ();
83  void SetUnicastPreq ();
84  /*
85  * \brief In proactive case: need we send PREP
86  */
87  void SetNeedNotPrep ();
90  void SetHopcount (uint8_t hopcount);
91  void SetTTL (uint8_t ttl);
92  void SetPreqID (uint32_t id);
93  void SetOriginatorAddress (Mac48Address originator_address);
94  void SetOriginatorSeqNumber (uint32_t originator_seq_number);
95  void SetLifetime (uint32_t lifetime);
96  void SetMetric (uint32_t metric);
97  void SetDestCount (uint8_t dest_count);
101  bool IsUnicastPreq () const;
102  bool IsNeedNotPrep () const;
103  uint8_t GetHopCount () const;
104  uint8_t GetTtl () const;
105  uint32_t GetPreqID () const;
106  Mac48Address GetOriginatorAddress () const;
107  uint32_t GetOriginatorSeqNumber () const;
108  uint32_t GetLifetime () const;
109  uint32_t GetMetric () const;
110  uint8_t GetDestCount () const;
113  void DecrementTtl ();
114  void IncrementMetric (uint32_t metric);
115  /*
116  * \brief Checks that preq's originator address equals to originator, and
117  * this preq is not proactive
118  */
119  bool MayAddAddress (Mac48Address originator);
120  bool IsFull () const;
125  virtual WifiInformationElementId ElementId () const;
126  virtual void SerializeInformationField (Buffer::Iterator i) const;
127  virtual uint8_t DeserializeInformationField (Buffer::Iterator i, uint8_t length);
128  virtual uint8_t GetInformationFieldSize () const;
129  virtual void Print (std::ostream& os) const;
131 private:
135  uint8_t m_maxSize; //TODO: make as an attribute
139  uint8_t m_flags;
140  uint8_t m_hopCount;
141  uint8_t m_ttl;
142  uint32_t m_preqId;
143  Mac48Address m_originatorAddress;
144  uint32_t m_originatorSeqNumber;
145  uint32_t m_lifetime;
146  uint32_t m_metric;
147  uint8_t m_destCount;
148  std::vector<Ptr<DestinationAddressUnit> > m_destinations;
149 
150  friend bool operator== (const IePreq & a, const IePreq & b);
151 };
152 
153 bool operator== (const DestinationAddressUnit & a, const DestinationAddressUnit & b);
154 bool operator== (const IePreq & a, const IePreq & b);
155 std::ostream &operator << (std::ostream &os, const IePreq &preq);
156 
157 } // namespace dot11s
158 } // namespace ns3
159 #endif
160 
iterator in a Buffer instance
Definition: buffer.h:98
Information element, as defined in 802.11-2007 standardThe IEEE 802.11 standard includes the notion o...
virtual void Print(std::ostream &os) const
In addition, a subclass may optionally override the following...
virtual WifiInformationElementId ElementId() const
Own unique Element ID.
See 7.3.2.96 of 802.11s draft 2.07.
void ClearDestinationAddressElements()
Clear PREQ: remove all destinations.
virtual uint8_t DeserializeInformationField(Buffer::Iterator i, uint8_t length)
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:43
void AddDestinationAddressElement(bool doFlag, bool rfFlag, Mac48Address dest_address, uint32_t dest_seq_number)
void DelDestinationAddressElement(Mac48Address dest_address)
Delete a destination address unit by destination.
virtual void SerializeInformationField(Buffer::Iterator i) const
an EUI-48 address
Definition: mac48-address.h:41
std::vector< Ptr< DestinationAddressUnit > > GetDestinationList()
Get all destinations, which are stored in PREQ:
void SetUnicastPreq()
SetProper flags which indicate that PREQ is unicast.
virtual uint8_t GetInformationFieldSize() const
uint8_t WifiInformationElementId
Describes an address unit in PREQ information element See 7.3.2.96 for more details.
A template-based reference counting class.