A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vendor-specific-action.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Dalian University of Technology
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Junling Bu <linlinjavaer@gmail.com>
18  */
19 #ifndef Vendor_Specific_Action_H
20 #define Vendor_Specific_Action_H
21 
22 #include <ostream>
23 #include <map>
24 #include "ns3/header.h"
25 #include "ns3/packet.h"
26 #include "ns3/pointer.h"
27 #include "ns3/attribute.h"
28 #include "ns3/attribute-helper.h"
29 #include "ns3/address.h"
30 #include "ns3/wifi-mac.h"
31 
32 namespace ns3 {
33 class VendorSpecificContentManager;
34 
50 {
51 public:
53  OrganizationIdentifier (const uint8_t *str, uint32_t length);
55  virtual ~OrganizationIdentifier (void);
56 
58  {
59  OUI24 = 3, // 3 bytes
60  OUI36 = 5, // 5 bytes
61  Unknown = 0,
62  };
63 
67  uint8_t GetManagementId (void) const;
71  bool IsNull (void) const;
72 
73  void SetType (enum OrganizationIdentifierType type);
74  enum OrganizationIdentifierType GetType () const;
75 
76  // below methods will be called by VendorSpecificActionHeader
77  uint32_t GetSerializedSize (void) const;
78  void Serialize (Buffer::Iterator start) const;
80 
81 private:
82  friend bool operator == (const OrganizationIdentifier& a, const OrganizationIdentifier& b);
83  friend bool operator != (const OrganizationIdentifier& a, const OrganizationIdentifier& b);
84  friend bool operator < (const OrganizationIdentifier& a, const OrganizationIdentifier& b);
85  friend std::ostream& operator << (std::ostream& os, const OrganizationIdentifier& oi);
86  friend std::istream& operator >> (std::istream& is, const OrganizationIdentifier& oi);
87 
89  uint8_t m_oi[5];
90 };
91 
93 
97 
98 std::ostream& operator << (std::ostream& os, const OrganizationIdentifier& oi);
99 std::istream& operator >> (std::istream& is, const OrganizationIdentifier& oi);
100 
105 const static uint8_t CATEGORY_OF_VSA = 127;
106 
126 {
127 public:
129  virtual ~VendorSpecificActionHeader (void);
130 
142  uint8_t GetCategory () const;
143 
144  static TypeId GetTypeId (void);
145  virtual TypeId GetInstanceTypeId (void) const;
146  virtual void Print (std::ostream &os) const;
147  virtual uint32_t GetSerializedSize (void) const;
148  virtual void Serialize (Buffer::Iterator start) const;
149  virtual uint32_t Deserialize (Buffer::Iterator start);
150 
151 private:
153  uint8_t m_category;
154 };
155 
165 
167 {
168 public:
170  virtual ~VendorSpecificContentManager (void);
179 
180 private:
181  typedef std::map<OrganizationIdentifier,VscCallback> VscCallbacks;
182  typedef std::map<OrganizationIdentifier,VscCallback>::iterator VscCallbacksI;
183 
186 };
187 
188 static std::vector<OrganizationIdentifier> OrganizationIdentifiers;
189 }
190 
191 #endif /* Vendor_Specific_Action_H */
Protocol header serialization and deserialization.
Definition: header.h:42
ATTRIBUTE_HELPER_HEADER(ObjectFactory)
void Serialize(Buffer::Iterator start) const
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Definition: angles.cc:49
uint32_t GetSerializedSize(void) const
Callback template class.
Definition: callback.h:920
void RegisterVscCallback(OrganizationIdentifier oi, VscCallback cb)
virtual TypeId GetInstanceTypeId(void) const
friend std::istream & operator>>(std::istream &is, const OrganizationIdentifier &oi)
virtual void Serialize(Buffer::Iterator start) const
friend bool operator<(const OrganizationIdentifier &a, const OrganizationIdentifier &b)
uint32_t Deserialize(Buffer::Iterator start)
std::map< OrganizationIdentifier, VscCallback > VscCallbacks
See IEEE 802.11-2007 chapter 7.3.1.11 and 7.4.5 also IEEE 802.11p-2010 chapter 7.4.5 Although WifiActionHeader has been defined in wifi mgt-header.h/.cc, it is not a good way to inherit from it or add vendor specific action support.
bool operator<(const Room &a, const Room &b)
void SetType(enum OrganizationIdentifierType type)
iterator in a Buffer instance
Definition: buffer.h:98
a polymophic address class
Definition: address.h:86
void DeregisterVscCallback(OrganizationIdentifier &oi)
enum OrganizationIdentifierType GetType() const
friend bool operator==(const OrganizationIdentifier &a, const OrganizationIdentifier &b)
void SetOrganizationIdentifier(OrganizationIdentifier oi)
the organization identifier is a public organizationally unique identifier assigned by the IEEE...
virtual uint32_t GetSerializedSize(void) const
virtual void Print(std::ostream &os) const
uint8_t GetCategory() const
the category field shall be CATEGORY_OF_VSA
friend std::ostream & operator<<(std::ostream &os, const OrganizationIdentifier &oi)
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:43
bool operator!=(Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > a, Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > b)
Inequality test.
Definition: callback.h:1213
Callback< bool, Ptr< WifiMac >, const OrganizationIdentifier &, Ptr< const Packet >, const Address & > VscCallback
OrganizationIdentifier & operator=(const OrganizationIdentifier &oi)
VscCallback FindVscCallback(OrganizationIdentifier &oi)
static const uint8_t CATEGORY_OF_VSA
see IEEE 802.11-2007 chapter 7.3.1.11 Table 7-24—Category values
static std::vector< OrganizationIdentifier > OrganizationIdentifiers
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.cc:89
friend bool operator!=(const OrganizationIdentifier &a, const OrganizationIdentifier &b)
OrganizationIdentifier GetOrganizationIdentifier(void) const
uint8_t GetManagementId(void) const
a unique identifier for an interface.
Definition: type-id.h:49
enum OrganizationIdentifierType m_type
std::map< OrganizationIdentifier, VscCallback >::iterator VscCallbacksI
virtual uint32_t Deserialize(Buffer::Iterator start)