/usr/include/ns3.26/ns3/vsa-manager.h is in libns3-dev 3.26+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2013 Dalian University of Technology
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Junling Bu <linlinjavaer@gmail.com>
*/
#ifndef VSA_MANAGER_H
#define VSA_MANAGER_H
#include <vector>
#include "wave-net-device.h"
namespace ns3 {
/**
* \brief indicate which interval the VSA frames will be transmitted in.
* VSA_TRANSMIT_IN_CCHI will only allow in CCH Interval;
* VSA_TRANSMIT_IN_SCHI will only allow in SCH Interval;
* VSA_TRANSMIT_IN_BOTHI will allow anytime.
*/
enum VsaTransmitInterval
{
VSA_TRANSMIT_IN_CCHI = 1,
VSA_TRANSMIT_IN_SCHI = 2,
VSA_TRANSMIT_IN_BOTHI = 3,
};
/**
* \param peer The address of the peer MAC entity to which the
* VSA is sent.
* \param oi Identifies the source of the data when the source
* is not an IEEE 1609 entity. See IEEE Std 802.11p.
* \param managementId Identifies the source of the data when the source
* is an IEEE 1609 entity. Values are specified in IEEE P1609.0.
* Valid range: 0-15
* \param vsc pointer to Information that will be sent as vendor specific content.
* \param vscLength the length of vendor specific content
* \param channelNumber The channel on which the transmissions are to occur.
* While section 7.2 of the standard specifies that channel identification
* comprises Country String, Operating Class, and Channel Number, the channel
* number is enough for simulation.
* \param repeatRate The number of Vendor Specific Action frames to
* be transmitted per 5 s. A value of 0 indicates a single message is to be sent.
* If Destination MAC Address is an individual address, Repeat Rate is ignored.
* \param channelInterval The channel interval in which the transmissions
* are to occur.
*/
struct VsaInfo
{
Mac48Address peer;
OrganizationIdentifier oi;
uint8_t managementId;
Ptr<Packet> vsc;
uint32_t channelNumber;
uint8_t repeatRate;
enum VsaTransmitInterval sendInterval;
VsaInfo (Mac48Address peer, OrganizationIdentifier identifier, uint8_t manageId, Ptr<Packet> vscPacket,
uint32_t channel, uint8_t repeat, enum VsaTransmitInterval interval)
: peer (peer),
oi (identifier),
managementId (manageId),
vsc (vscPacket),
channelNumber (channel),
repeatRate (repeat),
sendInterval (interval)
{
}
};
/**
* refer to 1609.4-2010 chapter 6.4
* Vendor Specific Action (VSA) frames transmission.
*
* The channel interval and channel number indicating how to transmit VSA frames.
* However making the VSA transmitted strictly in required channel interval and channel number
* is hard to achieve. For example, if current channel is assigned “Alternating Access” and higher layer wants
* VSA transmitted only in CCHI (VSA_TRANSMIT_IN_CCHI), but when packet is dequeued from
* the internal queue of MAC layer in SCHI and can contend for channel access, how to deal with
* this case? Reinserting into the head of the queue and dequeuing the second packet is not a good
* choice, because it will require queue traversal. Reinserting the packet into the tail of the queue is
* worse, because it will make queue not in order. And both solutions may affect many MAC classes
* of Wifi module. Current approach is to guarantee packets can be inserted into the MAC
* internal queue strictly in channel interval and channel number required by higher layers. This solution
* will result in high probability that packets will be sent in channel interval as higher layer wants,
* while some packet may be sent practically in other channel interval that not follows the requirement
* of higher layer request due to queue delay of MAC layer.
* Therefore, we suggest users assign alternating access for sending VSAs in CCH Interval (VSA_TRANSMIT_IN_CCHI)
* or SCH Interval (VSA_TRANSMIT_IN_SCHI), and assign continuous access or extended access for
* sending VSAs in both interval (VSA_TRANSMIT_IN_BOTHI) to avoid the above cases.
*/
class VsaManager : public Object
{
public:
static TypeId GetTypeId (void);
VsaManager (void);
virtual ~VsaManager (void);
/**
* \param device WaveNetDevice associated with VsaManager
*/
void SetWaveNetDevice (Ptr<WaveNetDevice> device);
void SetWaveVsaCallback (Callback<bool, Ptr<const Packet>,const Address &, uint32_t, uint32_t> vsaCallback);
/**
* \param vsaInfo the tx information for VSA transmissions
*/
void SendVsa (const VsaInfo &vsaInfo);
/**
* cancel all VSA transmissions
*/
void RemoveAll (void);
/**
* \param channelNumber cancel VSA transmission specified by channel number
*/
void RemoveByChannel (uint32_t channelNumber);
/**
* \param channelNumber cancel VSA transmission specified by organization identifier
*/
void RemoveByOrganizationIdentifier (const OrganizationIdentifier &oi);
private:
void DoDispose (void);
void DoInitialize (void);
/**
* \param mac the MAC entity which receives VSA frame
* \param oi the Organization Identifier of received VSA frame
* \param vsc the vendor specific content of received VSA frame
* \param src the source address of received VSA frame
*/
bool ReceiveVsc (Ptr<WifiMac> mac, const OrganizationIdentifier &oi, Ptr<const Packet> vsc, const Address &src);
// A number of VSA frames will be transmitted repeatedly during the period of 5s.
const static uint32_t VSA_REPEAT_PERIOD = 5;
struct VsaWork
{
Mac48Address peer;
OrganizationIdentifier oi;
Ptr<Packet> vsc;
uint32_t channelNumber;
enum VsaTransmitInterval sentInterval;
Time repeatPeriod;
EventId repeat;
};
/**
* \param vsa the specific VSA repeat work
*
* Repeat to send VSA frames
*/
void DoRepeat (VsaWork *vsa);
/**
* \param interval the specific channel interval for VSA transmission
* \param channel the specific channel number for VSA transmission
* \param vsc the data field of VSA frame that contains vendor specific content
* \param oi the Organization Identifier for VSA frame
* \param peer the destination address
*/
void DoSendVsa (enum VsaTransmitInterval interval, uint32_t channel, Ptr<Packet> vsc, OrganizationIdentifier oi, Mac48Address peer);
Callback<bool, Ptr<const Packet>,const Address &, uint32_t, uint32_t> m_vsaReceived;
std::vector<VsaWork *> m_vsas;
Ptr<WaveNetDevice> m_device;
};
}
#endif /* VSA_MANAGER_H */
|