A Discrete-Event Network Simulator
API
vsa-manager.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 VSA_MANAGER_H
20 #define VSA_MANAGER_H
21 #include <vector>
22 #include "wave-net-device.h"
23 
24 namespace ns3 {
25 
35 {
39 };
40 
62 struct VsaInfo
63 {
66  uint8_t managementId;
68  uint32_t channelNumber;
69  uint8_t repeatRate;
71 
82  VsaInfo (Mac48Address peer, OrganizationIdentifier identifier, uint8_t manageId, Ptr<Packet> vscPacket,
83  uint32_t channel, uint8_t repeat, enum VsaTransmitInterval interval)
84  : peer (peer),
85  oi (identifier),
86  managementId (manageId),
87  vsc (vscPacket),
89  repeatRate (repeat),
90  sendInterval (interval)
91  {
92 
93  }
94 };
95 
119 class VsaManager : public Object
120 {
121 public:
126  static TypeId GetTypeId (void);
127  VsaManager (void);
128  virtual ~VsaManager (void);
129 
133  void SetWaveNetDevice (Ptr<WaveNetDevice> device);
134 
136  void SetWaveVsaCallback (Callback<bool, Ptr<const Packet>,const Address &, uint32_t, uint32_t> vsaCallback);
137 
141  void SendVsa (const VsaInfo &vsaInfo);
145  void RemoveAll (void);
149  void RemoveByChannel (uint32_t channelNumber);
154 private:
155  void DoDispose (void);
156  void DoInitialize (void);
157 
165  bool ReceiveVsc (Ptr<WifiMac> mac, const OrganizationIdentifier &oi, Ptr<const Packet> vsc, const Address &src);
166 
168  const static uint32_t VSA_REPEAT_PERIOD = 5;
169 
171  struct VsaWork
172  {
176  uint32_t channelNumber;
180  };
181 
187  void DoRepeat (VsaWork *vsa);
195  void DoSendVsa (enum VsaTransmitInterval interval, uint32_t channel, Ptr<Packet> vsc, OrganizationIdentifier oi, Mac48Address peer);
196 
198  std::vector<VsaWork *> m_vsas;
200 };
201 
202 }
203 #endif /* VSA_MANAGER_H */
Ptr< WaveNetDevice > m_device
the device
Definition: vsa-manager.h:199
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Callback template class.
Definition: callback.h:1176
static const uint32_t VSA_REPEAT_PERIOD
A number of VSA frames will be transmitted repeatedly during the period of 5s.
Definition: vsa-manager.h:168
refer to 1609.4-2010 chapter 6.4 Vendor Specific Action (VSA) frames transmission.
Definition: vsa-manager.h:119
virtual ~VsaManager(void)
Definition: vsa-manager.cc:54
void SendVsa(const VsaInfo &vsaInfo)
Definition: vsa-manager.cc:85
VsaTransmitInterval
indicate which interval the VSA frames will be transmitted in.
Definition: vsa-manager.h:34
void SetWaveVsaCallback(Callback< bool, Ptr< const Packet >, const Address &, uint32_t, uint32_t > vsaCallback)
set wave vsa callback function
Definition: vsa-manager.cc:258
Mac48Address peer
peer
Definition: vsa-manager.h:173
Ptr< Packet > vsc
VSC.
Definition: vsa-manager.h:67
a polymophic address class
Definition: address.h:90
channel
Definition: third.py:85
void DoSendVsa(enum VsaTransmitInterval interval, uint32_t channel, Ptr< Packet > vsc, OrganizationIdentifier oi, Mac48Address peer)
Definition: vsa-manager.cc:127
static TypeId GetTypeId(void)
Get the type ID.
Definition: vsa-manager.cc:38
enum VsaTransmitInterval sentInterval
VSA transmit interval.
Definition: vsa-manager.h:177
uint8_t managementId
management ID
Definition: vsa-manager.h:66
VsaWork structure.
Definition: vsa-manager.h:171
void DoInitialize(void)
Initialize() implementation.
Definition: vsa-manager.cc:68
the organization identifier is a public organizationally unique identifier assigned by the IEEE...
void DoDispose(void)
Destructor implementation.
Definition: vsa-manager.cc:60
mac
Definition: third.py:92
void SetWaveNetDevice(Ptr< WaveNetDevice > device)
Definition: vsa-manager.cc:78
void DoRepeat(VsaWork *vsa)
Definition: vsa-manager.cc:119
std::vector< VsaWork * > m_vsas
VSAs.
Definition: vsa-manager.h:198
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t channelNumber
channel number
Definition: vsa-manager.h:68
Time repeatPeriod
repeat period
Definition: vsa-manager.h:178
an EUI-48 address
Definition: mac48-address.h:43
Mac48Address peer
peer
Definition: vsa-manager.h:64
uint8_t repeatRate
repeat rate
Definition: vsa-manager.h:69
VsaInfo(Mac48Address peer, OrganizationIdentifier identifier, uint8_t manageId, Ptr< Packet > vscPacket, uint32_t channel, uint8_t repeat, enum VsaTransmitInterval interval)
Initializer.
Definition: vsa-manager.h:82
void RemoveByChannel(uint32_t channelNumber)
Definition: vsa-manager.cc:209
An identifier for simulation events.
Definition: event-id.h:53
OrganizationIdentifier oi
OI.
Definition: vsa-manager.h:65
OrganizationIdentifier oi
OI.
Definition: vsa-manager.h:174
uint32_t channelNumber
channel number
Definition: vsa-manager.h:176
A base class which provides memory management and object aggregation.
Definition: object.h:87
Callback< bool, Ptr< const Packet >, const Address &, uint32_t, uint32_t > m_vsaReceived
VSA received callback.
Definition: vsa-manager.h:197
a unique identifier for an interface.
Definition: type-id.h:58
Ptr< Packet > vsc
VSC.
Definition: vsa-manager.h:175
void RemoveAll(void)
cancel all VSA transmissions
Definition: vsa-manager.cc:192
bool ReceiveVsc(Ptr< WifiMac > mac, const OrganizationIdentifier &oi, Ptr< const Packet > vsc, const Address &src)
Definition: vsa-manager.cc:265
EventId repeat
repeat ID
Definition: vsa-manager.h:179
void RemoveByOrganizationIdentifier(const OrganizationIdentifier &oi)
Definition: vsa-manager.cc:234
enum VsaTransmitInterval sendInterval
send interval
Definition: vsa-manager.h:70