A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ie-dot11s-preq.h
Go to the documentation of this file.
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 ();
47  uint32_t GetDestSeqNumber () const;
48 private:
49  bool m_do;
50  bool m_rf;
51  bool m_usn;
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;
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;
136 
139  uint8_t m_flags;
140  uint8_t m_hopCount;
141  uint8_t m_ttl;
142  uint32_t m_preqId;
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 
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 
void SetPreqID(uint32_t id)
void SetFlags(bool doFlag, bool rfFlag, bool usnFlag)
friend bool operator==(const DestinationAddressUnit &a, const DestinationAddressUnit &b)
void SetTTL(uint8_t ttl)
uint8_t GetHopCount() const
std::vector< Ptr< DestinationAddressUnit > > m_destinations
uint32_t GetLifetime() const
uint32_t m_originatorSeqNumber
bool operator==(const MeshHeader &a, const MeshHeader &b)
void SetDestSeqNumber(uint32_t dest_seq_number)
iterator in a Buffer instance
Definition: buffer.h:98
void SetLifetime(uint32_t lifetime)
Mac48Address m_originatorAddress
Information element, as defined in 802.11-2007 standardThe IEEE 802.11 standard includes the notion o...
Mac48Address GetOriginatorAddress() const
uint8_t GetTtl() const
void DecrementTtl()
Handle TTL and Metric:
virtual void Print(std::ostream &os) const
In addition, a subclass may optionally override the following...
void IncrementMetric(uint32_t metric)
void SetDestCount(uint8_t dest_count)
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)
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets) ...
uint32_t GetOriginatorSeqNumber() const
void SetOriginatorAddress(Mac48Address originator_address)
void SetOriginatorSeqNumber(uint32_t originator_seq_number)
void SetMetric(uint32_t metric)
void AddDestinationAddressElement(bool doFlag, bool rfFlag, Mac48Address dest_address, uint32_t dest_seq_number)
Add a destination address unit: flags, destination and sequence number.
void DelDestinationAddressElement(Mac48Address dest_address)
Delete a destination address unit by destination.
virtual void SerializeInformationField(Buffer::Iterator i) const
Serialize information (i.e., the body of the IE, not including the Element ID and length octets) ...
bool IsNeedNotPrep() const
an EUI-48 address
Definition: mac48-address.h:41
uint8_t GetDestCount() const
std::vector< Ptr< DestinationAddressUnit > > GetDestinationList()
Get all destinations, which are stored in PREQ:
void SetUnicastPreq()
SetProper flags which indicate that PREQ is unicast.
bool MayAddAddress(Mac48Address originator)
uint8_t m_maxSize
how many destinations we support
bool IsUnicastPreq() const
virtual uint8_t GetInformationFieldSize() const
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
uint32_t GetPreqID() const
Mac48Address GetDestinationAddress() const
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
uint8_t m_flags
Fields of information element:
uint32_t GetMetric() const
bool IsFull() const
Describes an address unit in PREQ information element See 7.3.2.96 for more details.
void SetDestinationAddress(Mac48Address dest_address)
A template-based reference counting class.
friend bool operator==(const IePreq &a, const IePreq &b)
std::ostream & operator<<(std::ostream &os, const IeBeaconTiming &a)
void SetHopcount(uint8_t hopcount)