wave: Doxygen updates

This commit is contained in:
Robert Ammon
2017-04-17 12:01:14 -07:00
parent 223061f24e
commit bcddf0cc8b
26 changed files with 798 additions and 290 deletions

View File

@@ -202,7 +202,6 @@ public:
/**
* \brief Returns the cumulative number of bytes transmitted
* \param socket the receiving socket
* \return none
*/
uint32_t GetCumulativeTxBytes ();
@@ -247,14 +246,14 @@ public:
void SetTxPkts (uint32_t txPkts);
private:
uint32_t m_RxBytes;
uint32_t m_cumulativeRxBytes;
uint32_t m_RxPkts;
uint32_t m_cumulativeRxPkts;
uint32_t m_TxBytes;
uint32_t m_cumulativeTxBytes;
uint32_t m_TxPkts;
uint32_t m_cumulativeTxPkts;
uint32_t m_RxBytes; ///< reeive bytes
uint32_t m_cumulativeRxBytes; ///< cumulative receive bytes
uint32_t m_RxPkts; ///< receive packets
uint32_t m_cumulativeRxPkts; ///< cumulative receive packets
uint32_t m_TxBytes; ///< transmit bytes
uint32_t m_cumulativeTxBytes; ///< cumulative transmit bytes
uint32_t m_TxPkts; ///< transmit packets
uint32_t m_cumulativeTxPkts; ///< cumulative transmit packets
};
RoutingStats::RoutingStats ()
@@ -471,7 +470,7 @@ private:
/**
* \brief Sets up a routing packet for tranmission
* \param addr destination address
* \parm node source node
* \param node source node
* \return Socket to be used for sending/receiving a routed data packet
*/
Ptr<Socket> SetupRoutingPacketReceive (Ipv4Address addr, Ptr<Node> node);
@@ -483,14 +482,14 @@ private:
*/
void ReceiveRoutingPacket (Ptr<Socket> socket);
double m_TotalSimTime; // seconds
uint32_t m_protocol; // routing protocol; 0=NONE, 1=OLSR, 2=AODV, 3=DSDV, 4=DSR
uint32_t m_port;
uint32_t m_nSinks; // number of sink nodes (< all nodes)
int m_routingTables; // dump routing table (at t=5 sec). 0=No, 1=Yes
RoutingStats routingStats;
std::string m_protocolName;
int m_log;
double m_TotalSimTime; ///< seconds
uint32_t m_protocol; ///< routing protocol; 0=NONE, 1=OLSR, 2=AODV, 3=DSDV, 4=DSR
uint32_t m_port; ///< port
uint32_t m_nSinks; ///< number of sink nodes (< all nodes)
int m_routingTables; ///< dump routing table (at t=5 sec). 0=No, 1=Yes
RoutingStats routingStats; ///< routing statistics
std::string m_protocolName; ///< protocol name
int m_log; ///< log
};
NS_OBJECT_ENSURE_REGISTERED (RoutingHelper);
@@ -777,8 +776,8 @@ public:
void PhyRxDrop (std::string context, Ptr<const Packet> packet);
private:
uint32_t m_phyTxPkts;
uint32_t m_phyTxBytes;
uint32_t m_phyTxPkts; ///< phy transmit packets
uint32_t m_phyTxBytes; ///< phy transmit bytes
};
NS_OBJECT_ENSURE_REGISTERED (WifiPhyStats);
@@ -1159,6 +1158,8 @@ private:
/**
* \brief Run the simulation
* \param argc command line argument count
* \param argv command line parameters
* \return none
*/
void CommandSetup (int argc, char **argv);
@@ -1240,70 +1241,76 @@ private:
*/
void SetGlobalsFromConfig ();
/**
* Course change function
* \param os the output stream
* \param context trace source context (unused)
* \param mobility the mobility model
*/
static void
CourseChange (std::ostream *os, std::string foo, Ptr<const MobilityModel> mobility);
CourseChange (std::ostream *os, std::string context, Ptr<const MobilityModel> mobility);
uint32_t m_port;
std::string m_CSVfileName;
std::string m_CSVfileName2;
uint32_t m_nSinks;
std::string m_protocolName;
double m_txp;
bool m_traceMobility;
uint32_t m_protocol;
uint32_t m_port; ///< port
std::string m_CSVfileName; ///< CSV file name
std::string m_CSVfileName2; ///< CSV file name
uint32_t m_nSinks; ///< number of sinks
std::string m_protocolName; ///< protocol name
double m_txp; ///< distance
bool m_traceMobility; ///< trace mobility
uint32_t m_protocol; ///< protocol
uint32_t m_lossModel;
uint32_t m_fading;
std::string m_lossModelName;
uint32_t m_lossModel; ///< loss model
uint32_t m_fading; ///< fading
std::string m_lossModelName; ///< loss model name
std::string m_phyMode;
uint32_t m_80211mode;
std::string m_phyMode; ///< phy mode
uint32_t m_80211mode; ///< 80211 mode
std::string m_traceFile;
std::string m_logFile;
uint32_t m_mobility;
uint32_t m_nNodes;
double m_TotalSimTime;
std::string m_rate;
std::string m_phyModeB;
std::string m_trName;
int m_nodeSpeed; //in m/s
int m_nodePause; //in s
uint32_t m_wavePacketSize; // bytes
double m_waveInterval; // seconds
int m_verbose;
std::ofstream m_os;
NetDeviceContainer m_adhocTxDevices;
Ipv4InterfaceContainer m_adhocTxInterfaces;
uint32_t m_scenario;
double m_gpsAccuracyNs;
double m_txMaxDelayMs;
int m_routingTables;
int m_asciiTrace;
int m_pcap;
std::string m_loadConfigFilename;
std::string m_saveConfigFilename;
std::string m_traceFile; ///< trace file
std::string m_logFile; ///< log file
uint32_t m_mobility; ///< mobility
uint32_t m_nNodes; ///< number of nodes
double m_TotalSimTime; ///< total sim time
std::string m_rate; ///< rate
std::string m_phyModeB; ///< phy mode
std::string m_trName; ///< trace file name
int m_nodeSpeed; ///< in m/s
int m_nodePause; ///< in s
uint32_t m_wavePacketSize; ///< bytes
double m_waveInterval; ///< seconds
int m_verbose; ///< verbose
std::ofstream m_os; ///< output stream
NetDeviceContainer m_adhocTxDevices; ///< adhoc transmit devices
Ipv4InterfaceContainer m_adhocTxInterfaces; ///< adhoc transmit interfaces
uint32_t m_scenario; ///< scenario
double m_gpsAccuracyNs; ///< GPS accuracy
double m_txMaxDelayMs; ///< transmit maximum delay
int m_routingTables; ///< routing tables
int m_asciiTrace; ///< ascii trace
int m_pcap; ///< PCAP
std::string m_loadConfigFilename; ///< load config file name
std::string m_saveConfigFilename; ///< save configi file name
WaveBsmHelper m_waveBsmHelper;
Ptr<RoutingHelper> m_routingHelper;
Ptr<WifiPhyStats> m_wifiPhyStats;
int m_log;
// used to get consistent random numbers across scenarios
WaveBsmHelper m_waveBsmHelper; ///< helper
Ptr<RoutingHelper> m_routingHelper; ///< routing helper
Ptr<WifiPhyStats> m_wifiPhyStats; ///< wifi phy statistics
int m_log; ///< log
/// used to get consistent random numbers across scenarios
int64_t m_streamIndex;
NodeContainer m_adhocTxNodes;
double m_txSafetyRange1;
double m_txSafetyRange2;
double m_txSafetyRange3;
double m_txSafetyRange4;
double m_txSafetyRange5;
double m_txSafetyRange6;
double m_txSafetyRange7;
double m_txSafetyRange8;
double m_txSafetyRange9;
double m_txSafetyRange10;
std::vector <double> m_txSafetyRanges;
std::string m_exp;
int m_cumulativeBsmCaptureStart;
NodeContainer m_adhocTxNodes; ///< adhoc transmit nodes
double m_txSafetyRange1; ///< range 1
double m_txSafetyRange2; ///< range 2
double m_txSafetyRange3; ///< range 3
double m_txSafetyRange4; ///< range 4
double m_txSafetyRange5; ///< range 5
double m_txSafetyRange6; ///< range 6
double m_txSafetyRange7; ///< range 7
double m_txSafetyRange8; ///< range 8
double m_txSafetyRange9; ///< range 9
double m_txSafetyRange10; ///< range 10
std::vector <double> m_txSafetyRanges; ///< list of ranges
std::string m_exp; ///< exp
int m_cumulativeBsmCaptureStart; ///< capture start
};
VanetRoutingExperiment::VanetRoutingExperiment ()
@@ -1724,7 +1731,7 @@ VanetRoutingExperiment::Run ()
// Prints actual position and velocity when a course change event occurs
void
VanetRoutingExperiment::
CourseChange (std::ostream *os, std::string foo, Ptr<const MobilityModel> mobility)
CourseChange (std::ostream *os, std::string context, Ptr<const MobilityModel> mobility)
{
Vector pos = mobility->GetPosition (); // Get position
Vector vel = mobility->GetVelocity (); // Get velocity

View File

@@ -40,21 +40,49 @@ using namespace ns3;
class WaveNetDeviceExample
{
public:
/// Send WSMP example function
void SendWsmpExample (void);
/// Send IP example function
void SendIpExample (void);
/// Send WSA example
void SendWsaExample (void);
private:
/**
* Send one WSMP packet function
* \param channel the channel to use
* \param seq the sequence
*/
void SendOneWsmpPacket (uint32_t channel, uint32_t seq);
/**
* Send IP packet function
* \param seq the sequence
* \param ipv6 true if IPV6
*/
void SendIpPacket (uint32_t seq, bool ipv6);
/**
* Receive function
* \param dev the device
* \param pkt the packet
* \param mode the mode
* \param sender the sender address
* \returns true if successful
*/
bool Receive (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint16_t mode, const Address &sender);
bool ReceiveVsa (Ptr<const Packet>,const Address &, uint32_t, uint32_t);
/**
* Receive VSA functon
* \param pkt the packet
* \param address the address
* \returns true if successful
*/
bool ReceiveVsa (Ptr<const Packet> pkt,const Address & address, uint32_t, uint32_t);
/// Create WAVE nodes function
void CreateWaveNodes (void);
NodeContainer nodes;
NetDeviceContainer devices;
NodeContainer nodes; ///< the nodes
NetDeviceContainer devices; ///< the devices
};
void
WaveNetDeviceExample::CreateWaveNodes (void)

View File

@@ -85,11 +85,13 @@ public:
* \param wavePacketSize the size, in bytes, of a WAVE BSM
* \param waveInterval the time, in seconds, between each WAVE BSM transmission,
* typically 10 Hz (0.1 second)
* \param gpsAccuracy the timing synchronization accuracy of GPS time, in seconds.
* \param gpsAccuracyNs the timing synchronization accuracy of GPS time, in nanoseconds.
* GPS time-sync is ~40-100 ns. Universally synchronized time among all vehicles
* will result in all vehicles transmitting safety messages simultaneously, leading
* to excessive wireless collisions.
* \param range the expected transmission range, in m.
* \param ranges the expected transmission range, in m.
* \param chAccessMode channel access mode (0=continuous; 1=switching)
* \param txMaxDelay max delay prior to transmit
* \return none
*/
void Install (Ipv4InterfaceContainer & i,
@@ -136,10 +138,10 @@ private:
Ptr<Application> InstallPriv (Ptr<Node> node) const;
ObjectFactory m_factory; //!< Object factory.
WaveBsmStats m_waveBsmStats;
// tx safety range squared, for optimization
WaveBsmStats m_waveBsmStats; ///< wave BSM stats
/// tx safety range squared, for optimization
std::vector <double> m_txSafetyRangesSq;
static std::vector<int> nodesMoving;
static std::vector<int> nodesMoving; ///< nodes moving
};
} // namespace ns3

View File

@@ -106,7 +106,8 @@ public:
* are expected to be received within the coverage area, even
* though they may not be physically received (due to collisions
* or receiver power thresholds).
* \return none
* \param index index for statistics
* \return none
*/
void IncExpectedRxPktCount (int index);
@@ -123,6 +124,7 @@ public:
* (i.e. WAVE Basic Safety Messages) are not ACK'd. For packet
* delivery ratio (PDR), we need to count only those received packets
* that are actually received within the (circular) coverage area.
* \param index index for statistics
* \return none
*/
void IncRxPktInRangeCount (int index);
@@ -135,19 +137,21 @@ public:
/**
* \brief Returns the count of expected packets received within range(index)
* \param index index for statistics
* \return the count of expected packets received within range(index)
*/
int GetExpectedRxPktCount (int index);
/**
* \brief Increments the count of actual packets recevied within range(index)
* \param index index for statistics
* \return the count of actual packets received within range(index)
*/
int GetRxPktInRangeCount (int index);
/**
* \brief Sets the count of packets expected to received
* \param range index
* \param index index for statistics
* \param count the count of packets
* \return none
*/
@@ -155,7 +159,7 @@ public:
/**
* \brief Sets the count of packets within range that are received
* \param range index
* \param index index for statistics
* \param count the count of packets
* \return none
*/
@@ -164,6 +168,7 @@ public:
/**
* \brief Resets the count of total packets
* expected and/or within range(index) that are received
* \param index index for statistics
* \return none
*/
void ResetTotalRxPktCounts (int index);
@@ -201,6 +206,7 @@ public:
* \brief Returns the BSM Packet Delivery Ratio (PDR)
* which is the percent of expected packets within range(index) that
* are actually received
* \param index index for statistics
* \return the packet delivery ratio (PDR) of BSMs.
*/
double GetBsmPdr (int index);
@@ -209,12 +215,14 @@ public:
* \brief Returns the cumulative BSM Packet Delivery Ratio (PDR)
* which is the percent of cumulative expected packets within range(index)
* that are actually received
* \param index index for statistics
* \return the packet delivery ratio (PDR) of BSMs.
*/
double GetCumulativeBsmPdr (int index);
/**
* \brief Enables/disables logging
* \param log
* \return none
*/
void SetLogging (int log);
@@ -226,14 +234,14 @@ public:
int GetLogging ();
private:
int m_wavePktSendCount;
int m_waveByteSendCount;
int m_wavePktReceiveCount;
std::vector <int> m_wavePktInCoverageReceiveCounts;
std::vector <int> m_wavePktExpectedReceiveCounts;
std::vector <int> m_waveTotalPktInCoverageReceiveCounts;
std::vector <int> m_waveTotalPktExpectedReceiveCounts;
int m_log;
int m_wavePktSendCount; ///< packet sent count
int m_waveByteSendCount; ///< byte sent count
int m_wavePktReceiveCount; ///< packet receive count
std::vector <int> m_wavePktInCoverageReceiveCounts; ///< packet in ceoverage receive counts
std::vector <int> m_wavePktExpectedReceiveCounts; ///< packet expected receive counts
std::vector <int> m_waveTotalPktInCoverageReceiveCounts; ///< total packet in coverage receive counts
std::vector <int> m_waveTotalPktExpectedReceiveCounts; ///< total packet expected receive counts
int m_log; ///< log
};
} // namespace ns3

View File

@@ -36,6 +36,15 @@ NS_LOG_COMPONENT_DEFINE ("WaveHelper");
namespace ns3 {
/**
* ASCII Phy transmit sink with context
* \param stream the output stream
* \param context the context
* \param p the packet
* \param mode the mode
* \param preamble the preamble
* \param txLevel transmit level
*/
static void
AsciiPhyTransmitSinkWithContext (
Ptr<OutputStreamWrapper> stream,
@@ -49,6 +58,14 @@ AsciiPhyTransmitSinkWithContext (
*stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
}
/**
* ASCII Phy transmit sink without context
* \param stream the output stream
* \param p the packet
* \param mode the mode
* \param preamble the preamble
* \param txLevel transmit level
*/
static void
AsciiPhyTransmitSinkWithoutContext (
Ptr<OutputStreamWrapper> stream,
@@ -61,6 +78,15 @@ AsciiPhyTransmitSinkWithoutContext (
*stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
}
/**
* ASCII Phy receive sink with context
* \param stream the output stream
* \param context the context
* \param p the packet
* \param snr the SNR
* \param mode the mode
* \param preamble the preamble
*/
static void
AsciiPhyReceiveSinkWithContext (
Ptr<OutputStreamWrapper> stream,
@@ -74,6 +100,14 @@ AsciiPhyReceiveSinkWithContext (
*stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
}
/**
* ASCII Phy receive sink without context
* \param stream the output stream
* \param p the packet
* \param snr the SNR
* \param mode the mode
* \param preamble the preamble
*/
static void
AsciiPhyReceiveSinkWithoutContext (
Ptr<OutputStreamWrapper> stream,

View File

@@ -242,10 +242,10 @@ public:
int64_t AssignStreams (NetDeviceContainer c, int64_t stream);
protected:
ObjectFactory m_stationManager;
ObjectFactory m_channelScheduler;
std::vector<uint32_t> m_macsForChannelNumber;
uint32_t m_physNumber;
ObjectFactory m_stationManager; ///< station manager
ObjectFactory m_channelScheduler; ///< channel scheduler
std::vector<uint32_t> m_macsForChannelNumber; ///< MACs for channel number
uint32_t m_physNumber; ///< Phy number
};
}
#endif /* WAVE_HELPER_H */

View File

@@ -27,6 +27,10 @@
namespace ns3 {
/**
* \ingroup wave
* \brief Nqos Wave Mac Helper class
*/
class NqosWaveMacHelper : public WifiMacHelper
{
public:
@@ -43,6 +47,7 @@ public:
/**
* Create a mac helper in a default working state.
* i.e., this is an ocb mac by default.
* \returns NqosWaveMacHelper
*/
static NqosWaveMacHelper Default (void);
/**
@@ -90,6 +95,10 @@ public:
std::string n10 = "", const AttributeValue &v10 = EmptyAttributeValue ());
};
/**
* \ingroup wave
* \brief Qos Wave Mac Helper class
*/
class QosWaveMacHelper : public WifiMacHelper
{
public:

View File

@@ -62,7 +62,7 @@ public:
/**
* \param phy the PHY helper to create PHY objects
* \param mac the MAC helper to create MAC objects
* \param macHelper the MAC helper to create MAC objects
* \param c the set of nodes on which a wifi device must be created
* \returns a device container which contains all the devices created by this method.
*/

View File

@@ -40,6 +40,10 @@ namespace ns3 {
class BsmApplication : public Application
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
/**
@@ -57,13 +61,15 @@ public:
* \param wavePacketSize the size, in bytes, of a WAVE BSM
* \param waveInterval the time, in seconds, between each WAVE BSM transmission,
* typically 10 Hz (0.1 second)
* \param gpsAccuracy the timing synchronization accuracy of GPS time, in seconds.
* \param gpsAccuracyNs the timing synchronization accuracy of GPS time, in nanoseconds.
* GPS time-sync is ~40-100 ns. Universally synchronized time among all vehicles
* will result in all vehicles transmitting safety messages simultaneously, leading
* to excessive wireless collisions.
* \param range the expected transmission range, in m ^ 2.
* \param collection class for WAVE BSM statistics
* \param indicators of whether or not node(s) are moving
* \param rangesSq the expected transmission range, in m ^ 2.
* \param waveBsmStats class for WAVE BSM statistics
* \param nodesMoving of whether or not node(s) are moving
* \param mode
* \param txDelay
* \return none
*/
void Setup (Ipv4InterfaceContainer & i,
@@ -84,7 +90,7 @@ public:
* have been assigned. The Install() method should have previously been
* called by the user.
*
* \param stream first stream index to use
* \param streamIndex first stream index to use
* \return the number of stream indices assigned by this helper
*/
int64_t AssignStreams (int64_t streamIndex);
@@ -99,8 +105,8 @@ protected:
private:
// inherited from Application base class.
virtual void StartApplication (void); // Called at time specified by Start
virtual void StopApplication (void); // Called at time specified by Stop
virtual void StartApplication (void); ///< Called at time specified by Start
virtual void StopApplication (void); ///< Called at time specified by Stop
/**
* \brief Creates and transmits a WAVE BSM packet
@@ -109,6 +115,7 @@ private:
* \param pktCount the number of remaining WAVE BSM packets to be transmitted
* \param pktInterval the interval, in seconds, until the next packet
* should be transmitted
* \param sendingNodeId
* \return none
*/
void GenerateWaveTraffic (Ptr<Socket> socket, uint32_t pktSize,
@@ -145,29 +152,30 @@ private:
*/
Ptr<NetDevice> GetNetDevice (int id);
Ptr<WaveBsmStats> m_waveBsmStats;
// tx safety range squared, for optimization
Ptr<WaveBsmStats> m_waveBsmStats; ///< BSM stats
/// tx safety range squared, for optimization
std::vector <double> m_txSafetyRangesSq;
Time m_TotalSimTime;
uint32_t m_wavePacketSize; // bytes
uint32_t m_numWavePackets;
Time m_waveInterval;
double m_gpsAccuracyNs;
Ipv4InterfaceContainer * m_adhocTxInterfaces;
std::vector<int> * m_nodesMoving;
Ptr<UniformRandomVariable> m_unirv;
int m_nodeId;
// WAVE channel access mode. 0=continuous PHY; 1=channel-switching
Time m_TotalSimTime; ///< total sim time
uint32_t m_wavePacketSize; ///< bytes
uint32_t m_numWavePackets; ///< number of wave packets
Time m_waveInterval; ///< wave interval
double m_gpsAccuracyNs; ///< GPS accuracy
Ipv4InterfaceContainer * m_adhocTxInterfaces; ///< transmit interfaces
std::vector<int> * m_nodesMoving; ///< nodes moving
Ptr<UniformRandomVariable> m_unirv; ///< random variable
int m_nodeId; ///< node ID
/// WAVE channel access mode. 0=continuous PHY; 1=channel-switching
int m_chAccessMode;
// When transmitting at a default rate of 10 Hz,
// the subsystem shall transmit every 100 ms +/-
// a random value between 0 and 5 ms. [MPR-BSMTX-TXTIM-002]
// Source: CAMP Vehicle Safety Communications 4 Consortium
// On-board Minimum Performance Requirements
// for V2V Safety Systems Version 1.0, December 17, 2014
// max transmit delay (default 10ms)
/**
* When transmitting at a default rate of 10 Hz,
* the subsystem shall transmit every 100 ms +/-
* a random value between 0 and 5 ms. [MPR-BSMTX-TXTIM-002]
* Source: CAMP Vehicle Safety Communications 4 Consortium
* On-board Minimum Performance Requirements
* for V2V Safety Systems Version 1.0, December 17, 2014
* max transmit delay (default 10ms) */
Time m_txMaxDelay;
Time m_prevTxDelay;
Time m_prevTxDelay; ///< prevous transmit delay
};
} // namespace ns3

View File

@@ -70,6 +70,10 @@ public:
class ChannelCoordinator : public Object
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
ChannelCoordinator ();
virtual ~ChannelCoordinator ();
@@ -210,9 +214,17 @@ private:
* stop channel coordination events
*/
void StopChannelCoordination (void);
/**
* notify listeners of a SCH slot start
*/
void NotifySchSlot (void);
/**
* notify listeners of a CCH slot start
*/
void NotifyCchSlot (void);
/**
* notify listeners of a guard slot start
*/
void NotifyGuardSlot (void);
/**
* \return SCH channel access time which is SchInterval - GuardInterval, default 46ms
@@ -223,16 +235,18 @@ private:
*/
Time GetCchSlot (void) const;
Time m_cchi; // CchInterval
Time m_schi; // SchInterval
Time m_gi; // GuardInterval
Time m_cchi; ///< CchInterval
Time m_schi; ///< SchInterval
Time m_gi; ///< GuardInterval
/// Listeners typdef
typedef std::vector<Ptr<ChannelCoordinationListener> > Listeners;
/// Listeners iterator typedef
typedef std::vector<Ptr<ChannelCoordinationListener> >::iterator ListenersI;
Listeners m_listeners;
Listeners m_listeners; ///< listeners
uint32_t m_guardCount;
EventId m_coordination;
uint32_t m_guardCount; ///< guard count
EventId m_coordination; ///< coordination event
};
}

View File

@@ -60,6 +60,10 @@ namespace ns3 {
class ChannelManager : public Object
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
ChannelManager ();
virtual ~ChannelManager ();
@@ -127,18 +131,23 @@ public:
uint32_t GetManagementPowerLevel (uint32_t channelNumber);
private:
// 1609.4-2010 Annex H
/// 1609.4-2010 Annex H
static const uint32_t DEFAULT_OPERATING_CLASS = 17;
/// WaveChannel structure
struct WaveChannel
{
uint32_t channelNumber;
uint32_t operatingClass;
bool adaptable;
WifiMode dataRate;
WifiPreamble preamble;
uint32_t txPowerLevel;
uint32_t channelNumber; ///< channel number
uint32_t operatingClass; ///< operating class
bool adaptable; ///< adaptable?
WifiMode dataRate; ///< data rate
WifiPreamble preamble; ///< preamble
uint32_t txPowerLevel; ///< transmit power level
/**
* initializor
* \param channel the channel number
*/
WaveChannel (uint32_t channel)
: channelNumber (channel),
operatingClass (DEFAULT_OPERATING_CLASS),
@@ -149,7 +158,7 @@ private:
{
}
};
std::map<uint32_t, WaveChannel *> m_channels;
std::map<uint32_t, WaveChannel *> m_channels; ///< list of channels
};
}

View File

@@ -25,6 +25,10 @@ NS_LOG_COMPONENT_DEFINE ("ChannelScheduler");
NS_OBJECT_ENSURE_REGISTERED (ChannelScheduler);
/**
* \brief Get the type ID.
* \return the object TypeId
*/
TypeId
ChannelScheduler::GetTypeId (void)
{

View File

@@ -23,13 +23,16 @@
namespace ns3 {
class WaveNetDevice;
/// EdcaParameter structure
struct EdcaParameter
{
uint32_t cwmin;
uint32_t cwmax;
uint32_t aifsn;
uint32_t cwmin; ///< minimum
uint32_t cwmax; ///< maximum
uint32_t aifsn; ///< AIFSN
};
/// EDCA parameters typedef
typedef std::map<AcIndex,EdcaParameter> EdcaParameters;
/// EDCA parameters iterator typedef
typedef std::map<AcIndex,EdcaParameter>::const_iterator EdcaParametersI;
#define EXTENDED_ALTERNATING 0x00
@@ -48,11 +51,12 @@ typedef std::map<AcIndex,EdcaParameter>::const_iterator EdcaParametersI;
*/
struct SchInfo
{
uint32_t channelNumber;
uint32_t channelNumber; ///< channel number
//OperationalRateSet operationalRateSet; // not supported
bool immediateAccess;
uint8_t extendedAccess;
EdcaParameters edcaParameters;
bool immediateAccess; ///< immediate access
uint8_t extendedAccess; ///< extended access
EdcaParameters edcaParameters; ///< EDCA parameters
/// Initializer
SchInfo ()
: channelNumber (SCH1),
immediateAccess (false),
@@ -60,6 +64,12 @@ struct SchInfo
{
}
/**
* Initializer
* \param channel the channel number
* \param immediate true if immediate access
* \param channelAccess
*/
SchInfo (uint32_t channel, bool immediate, uint32_t channelAccess)
: channelNumber (channel),
immediateAccess (immediate),
@@ -67,6 +77,13 @@ struct SchInfo
{
}
/**
* Initializer
* \param channel the channel number
* \param immediate true if immediate access
* \param channelAccess
* \param edca the EDCA parameters
*/
SchInfo (uint32_t channel, bool immediate, uint32_t channelAccess, EdcaParameters edca)
: channelNumber (channel),
immediateAccess (immediate),
@@ -77,6 +94,7 @@ struct SchInfo
}
};
/// ChannelAccess enumeration
enum ChannelAccess
{
ContinuousAccess, // continuous access for SCHs
@@ -98,6 +116,10 @@ enum ChannelAccess
class ChannelScheduler : public Object
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
ChannelScheduler ();
virtual ~ChannelScheduler ();
@@ -108,11 +130,11 @@ public:
virtual void SetWaveNetDevice (Ptr<WaveNetDevice> device);
/**
* \return whether CCH channel access is assigned.
. */
*/
bool IsCchAccessAssigned (void) const;
/**
* \return whether SCH channel access is assigned.
. */
*/
bool IsSchAccessAssigned (void) const;
/**
* \param channelNumber the specified channel number
@@ -141,11 +163,11 @@ public:
/**
* \param channelNumber the specified channel number
* \return the type of current assigned channel access for the specific channel.
. */
*/
virtual enum ChannelAccess GetAssignedAccessType (uint32_t channelNumber) const = 0;
/**
* \param sch_info the request information for assigning SCH access.
* \param schInfo the request information for assigning SCH access.
* \return whether the channel access is assigned successfully.
*
* This method is called to assign channel access for sending packets.
@@ -154,6 +176,7 @@ public:
/**
* \param channelNumber indicating which channel should release
* the assigned channel access resource.
* \return true if successful.
*/
bool StopSch (uint32_t channelNumber);
@@ -184,17 +207,19 @@ protected:
* This method will assign extended access for SCHs.
*/
virtual bool AssignExtendedAccess (uint32_t channelNumber, uint32_t extends, bool immediate) = 0;
/*
/**
* This method will assign default CCH access for CCH.
* \return whether the channel access is assigned successfully
*/
virtual bool AssignDefaultCchAccess (void) = 0;
/**
* \param channelNumber indicating for which channel should release
* the assigned channel access resource.
* \return whether the channel access is released successfully
*/
virtual bool ReleaseAccess (uint32_t channelNumber) = 0;
Ptr<WaveNetDevice> m_device;
Ptr<WaveNetDevice> m_device; ///< the device
};
}

View File

@@ -26,9 +26,18 @@ NS_LOG_COMPONENT_DEFINE ("DefaultChannelScheduler");
NS_OBJECT_ENSURE_REGISTERED (DefaultChannelScheduler);
/**
* \ingroup wave
* \brief CoordinationListener class
*/
class CoordinationListener : public ChannelCoordinationListener
{
public:
/**
* Constructor
*
* \param scheduler channel scheduler
*/
CoordinationListener (DefaultChannelScheduler * scheduler)
: m_scheduler (scheduler)
{
@@ -49,7 +58,7 @@ public:
m_scheduler->NotifyGuardSlotStart (duration, cchi);
}
private:
DefaultChannelScheduler * m_scheduler;
DefaultChannelScheduler * m_scheduler; ///< the scheduler
};
TypeId

View File

@@ -32,6 +32,10 @@ class WaveNetDevice;
class DefaultChannelScheduler : public ChannelScheduler
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
DefaultChannelScheduler ();
virtual ~DefaultChannelScheduler ();
@@ -43,11 +47,24 @@ public:
/**
* \param channelNumber the specified channel number
* \return the type of current assigned channel access for the specific channel.
. */
*/
virtual enum ChannelAccess GetAssignedAccessType (uint32_t channelNumber) const;
/**
* Notify CCH slot start
* \param duration the CCH slot duration
*/
void NotifyCchSlotStart (Time duration);
/**
* Notify SCH slot start
* \param duration the SCH slot duration
*/
void NotifySchSlotStart (Time duration);
/**
* Notify guard slot start
* \param duration the CCH slot duration
* \param cchi if true, switch to next channel
*/
void NotifyGuardSlotStart (Time duration, bool cchi);
private:
virtual void DoInitialize (void);
@@ -78,11 +95,13 @@ private:
virtual bool AssignExtendedAccess (uint32_t channelNumber, uint32_t extends, bool immediate);
/**
* This method will assign default CCH access for CCH.
* \return whether the channel access is assigned successfully
*/
virtual bool AssignDefaultCchAccess (void);
/**
* \param channelNumber indicating for which channel should release
* the assigned channel access resource.
* \return whether the channel access is released successfully
*/
virtual bool ReleaseAccess (uint32_t channelNumber);
/**
@@ -91,9 +110,9 @@ private:
*/
void SwitchToNextChannel (uint32_t curChannelNumber, uint32_t nextChannelNumber);
Ptr<ChannelManager> m_manager;
Ptr<ChannelCoordinator> m_coordinator;
Ptr<WifiPhy> m_phy;
Ptr<ChannelManager> m_manager; ///< channel manager
Ptr<ChannelCoordinator> m_coordinator; ///< channel coordinator
Ptr<WifiPhy> m_phy; ///< Phy
/**
* when m_channelAccess is ContinuousAccess, m_channelNumber
@@ -104,16 +123,16 @@ private:
* is extended access, extends is the number of extends access.
* when m_channelAccess is DefaultCchAccess, m_channelNumber is CCH.
*/
uint32_t m_channelNumber;
uint32_t m_extend;
EventId m_extendEvent;
enum ChannelAccess m_channelAccess;
uint32_t m_channelNumber; ///< channel number
uint32_t m_extend; ///< extend
EventId m_extendEvent; ///< extend event
enum ChannelAccess m_channelAccess; ///< channel access
EventId m_waitEvent;
uint32_t m_waitChannelNumber;
uint32_t m_waitExtend;
EventId m_waitEvent; ///< wait event
uint32_t m_waitChannelNumber; ///< wait channel number
uint32_t m_waitExtend; ///< wait extend
Ptr<ChannelCoordinationListener> m_coordinationListener;
Ptr<ChannelCoordinationListener> m_coordinationListener; ///< coordination listener
};
}

View File

@@ -45,10 +45,20 @@ class TypeId;
class HigherLayerTxVectorTag : public Tag
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
HigherLayerTxVectorTag (void);
/**
* Constructor
*
* \param txVector wifi transmit vector
* \param adaptable is adaptable?
*/
HigherLayerTxVectorTag (WifiTxVector txVector, bool adaptable);
/**
* \returns the tx vector for transmission
@@ -65,8 +75,8 @@ public:
virtual void Print (std::ostream &os) const;
private:
WifiTxVector m_txVector;
bool m_adaptable;
WifiTxVector m_txVector; ///< transmit vector
bool m_adaptable; ///< adaptable
};
} // namespace ns3

View File

@@ -37,6 +37,7 @@ NS_LOG_COMPONENT_DEFINE ("OcbWifiMac");
NS_OBJECT_ENSURE_REGISTERED (OcbWifiMac);
/// Wildcard BSSID
const static Mac48Address WILDCARD_BSSID = Mac48Address::GetBroadcast ();
TypeId

View File

@@ -48,6 +48,10 @@ class WaveNetDevice;
class OcbWifiMac : public RegularWifiMac
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
OcbWifiMac (void);
virtual ~OcbWifiMac (void);
@@ -94,8 +98,6 @@ public:
*/
virtual void SetBssid (Mac48Address bssid);
/**
* \param bssid the BSSID of the network that this device belongs to.
*
* This method shall not be used in WAVE environment and
* here it will overloaded to log warn message
*/
@@ -175,7 +177,7 @@ protected:
private:
virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
VendorSpecificContentManager m_vscManager;
VendorSpecificContentManager m_vscManager; ///< VSC manager
};
}

View File

@@ -167,6 +167,12 @@ OrganizationIdentifier::Deserialize (Buffer::Iterator start)
return 0;
}
/**
* equality operator
* \param a left side object
* \param b right side object
* \returns true if equal
*/
bool operator == (const OrganizationIdentifier& a, const OrganizationIdentifier& b)
{
if (a.m_type != b.m_type)
@@ -188,16 +194,34 @@ bool operator == (const OrganizationIdentifier& a, const OrganizationIdentifier&
return false;
}
/**
* inequality operator
* \param a left side object
* \param b right side object
* \returns true if not equal
*/
bool operator != (const OrganizationIdentifier& a, const OrganizationIdentifier& b)
{
return !(a == b);
}
/**
* less than operator
* \param a left side object
* \param b right side object
* \returns true if a < b
*/
bool operator < (const OrganizationIdentifier& a, const OrganizationIdentifier& b)
{
return memcmp (a.m_oi, b.m_oi, std::min (a.m_type, b.m_type)) < 0;
}
/**
* output operator
* \param os output stream
* \param oi organization identifier
* \returns output stream
*/
std::ostream& operator << (std::ostream& os, const OrganizationIdentifier& oi)
{
for (int i = 0; i < oi.m_type; i++)
@@ -208,6 +232,12 @@ std::ostream& operator << (std::ostream& os, const OrganizationIdentifier& oi)
return os;
}
/**
* input operator
* \param is input stream
* \param oi organization identifier
* \returns input stream
*/
std::istream& operator >> (std::istream& is, const OrganizationIdentifier& oi)
{
return is;
@@ -348,6 +378,7 @@ VendorSpecificContentManager::IsVscCallbackRegistered (OrganizationIdentifier &o
return true;
}
///VSC callback function
static VscCallback null_callback = MakeNullCallback<bool, Ptr<WifiMac>, const OrganizationIdentifier &,Ptr<const Packet>,const Address &> ();
VscCallback

View File

@@ -52,10 +52,18 @@ class OrganizationIdentifier
{
public:
OrganizationIdentifier (void);
/**
* Constructor
*
* \param str identifier name
* \param length identifier length
*/
OrganizationIdentifier (const uint8_t *str, uint32_t length);
/// assignment operator
OrganizationIdentifier& operator= (const OrganizationIdentifier& oi);
virtual ~OrganizationIdentifier (void);
/// OrganizationIdentifierType enumeration
enum OrganizationIdentifierType
{
OUI24 = 3, // 3 bytes
@@ -81,8 +89,21 @@ public:
enum OrganizationIdentifierType GetType (void) const;
// below methods will be called by VendorSpecificActionHeader
/**
* Get serialized size
* \returns the serialized size
*/
uint32_t GetSerializedSize (void) const;
/**
* Serialize to buffer
* \param start the iterator
*/
void Serialize (Buffer::Iterator start) const;
/**
* Deserialize from buffer
* \param start the iterator
* \returns the deserialize size
*/
uint32_t Deserialize (Buffer::Iterator start);
private:
@@ -92,8 +113,8 @@ private:
friend std::ostream& operator << (std::ostream& os, const OrganizationIdentifier& oi);
friend std::istream& operator >> (std::istream& is, const OrganizationIdentifier& oi);
enum OrganizationIdentifierType m_type;
uint8_t m_oi[5];
enum OrganizationIdentifierType m_type; ///< OI type
uint8_t m_oi[5]; ///< organization identifier
};
ATTRIBUTE_HELPER_HEADER (OrganizationIdentifier);
@@ -148,6 +169,10 @@ public:
*/
uint8_t GetCategory (void) const;
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
@@ -156,8 +181,8 @@ public:
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
OrganizationIdentifier m_oi;
uint8_t m_category;
OrganizationIdentifier m_oi; ///< OI
uint8_t m_category; ///< category
};
/**
@@ -170,6 +195,9 @@ private:
*/
typedef Callback<bool, Ptr<WifiMac>, const OrganizationIdentifier &, Ptr<const Packet>,const Address &> VscCallback;
/**
* VendorSpecificContentManager class
*/
class VendorSpecificContentManager
{
public:
@@ -189,22 +217,26 @@ public:
/**
* \param oi the specific OrganizationIdentifier when receive management information
* by VendorSpecificAction management frame.
* \return true if registered
*/
bool IsVscCallbackRegistered (OrganizationIdentifier &oi);
/**
* \param oi the specific OrganizationIdentifier when receive management information
* by VendorSpecificAction management frame.
* \return VscCallback
*/
VscCallback FindVscCallback (OrganizationIdentifier &oi);
private:
/// VSC callback typedef
typedef std::map<OrganizationIdentifier,VscCallback> VscCallbacks;
/// VSC callback iterator typedef
typedef std::map<OrganizationIdentifier,VscCallback>::iterator VscCallbacksI;
VscCallbacks m_callbacks;
VscCallbacks m_callbacks; ///< VSC callbacks
};
static std::vector<OrganizationIdentifier> OrganizationIdentifiers;
static std::vector<OrganizationIdentifier> OrganizationIdentifiers; ///< the OIs
}
#endif /* Vendor_Specific_Action_H */

View File

@@ -29,7 +29,9 @@ NS_LOG_COMPONENT_DEFINE ("VsaManager");
NS_OBJECT_ENSURE_REGISTERED (VsaManager);
/// OI bytes for use in organization identifier
const static uint8_t oi_bytes_1609[5] = {0x00, 0x50, 0xC2, 0x4A, 0x40};
/// OI for IEEE standard 1609
const static OrganizationIdentifier oi_1609 = OrganizationIdentifier (oi_bytes_1609, 5);
TypeId

View File

@@ -45,7 +45,6 @@ enum VsaTransmitInterval
* 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
@@ -53,19 +52,29 @@ enum VsaTransmitInterval
* \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
* \param sendInterval 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;
Mac48Address peer; ///< peer
OrganizationIdentifier oi; ///< OI
uint8_t managementId; ///< management ID
Ptr<Packet> vsc; ///< VSC
uint32_t channelNumber; ///< channel number
uint8_t repeatRate; ///< repeat rate
enum VsaTransmitInterval sendInterval; ///< send interval
/**
* Initializer
* \param peer the peer MAC address
* \param identifier the organization identifier
* \param manageId the manage ID
* \param vscPacket the VSC packet
* \param channel the channel
* \param repeat the repeat value
* \param interval the transmit interval
*/
VsaInfo (Mac48Address peer, OrganizationIdentifier identifier, uint8_t manageId, Ptr<Packet> vscPacket,
uint32_t channel, uint8_t repeat, enum VsaTransmitInterval interval)
: peer (peer),
@@ -104,6 +113,10 @@ struct VsaInfo
class VsaManager : public Object
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
VsaManager (void);
virtual ~VsaManager (void);
@@ -113,6 +126,7 @@ public:
*/
void SetWaveNetDevice (Ptr<WaveNetDevice> device);
/// set wave vsa callback function
void SetWaveVsaCallback (Callback<bool, Ptr<const Packet>,const Address &, uint32_t, uint32_t> vsaCallback);
/**
@@ -128,7 +142,7 @@ public:
*/
void RemoveByChannel (uint32_t channelNumber);
/**
* \param channelNumber cancel VSA transmission specified by organization identifier
* \param oi cancel VSA transmission specified by organization identifier
*/
void RemoveByOrganizationIdentifier (const OrganizationIdentifier &oi);
private:
@@ -140,21 +154,23 @@ private:
* \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
* \return true if successful
*/
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.
/// A number of VSA frames will be transmitted repeatedly during the period of 5s.
const static uint32_t VSA_REPEAT_PERIOD = 5;
/// VsaWork structure
struct VsaWork
{
Mac48Address peer;
OrganizationIdentifier oi;
Ptr<Packet> vsc;
uint32_t channelNumber;
enum VsaTransmitInterval sentInterval;
Time repeatPeriod;
EventId repeat;
Mac48Address peer; ///< peer
OrganizationIdentifier oi; ///< OI
Ptr<Packet> vsc; ///< VSC
uint32_t channelNumber; ///< channel number
enum VsaTransmitInterval sentInterval; ///< VSA transmit interval
Time repeatPeriod; ///< repeat period
EventId repeat; ///< repeat ID
};
/**
@@ -172,9 +188,9 @@ private:
*/
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;
Callback<bool, Ptr<const Packet>,const Address &, uint32_t, uint32_t> m_vsaReceived; ///< VSA received callback
std::vector<VsaWork *> m_vsas; ///< VSAs
Ptr<WaveNetDevice> m_device; ///< the device
};
}

View File

@@ -45,6 +45,10 @@ class WaveNetDevice;
class WaveMacLow : public MacLow
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
WaveMacLow ();
virtual ~WaveMacLow ();
@@ -79,8 +83,8 @@ private:
*/
virtual WifiTxVector GetDataTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
Ptr<ChannelScheduler> m_scheduler;
Ptr<ChannelCoordinator> m_coordinator;
Ptr<ChannelScheduler> m_scheduler; ///< the channel scheduler
Ptr<ChannelCoordinator> m_coordinator; ///< the channel coordinator
};
} // namespace ns3

View File

@@ -55,12 +55,13 @@ class OcbWifiMac;
*/
struct TxInfo
{
uint32_t channelNumber;
uint32_t priority;
WifiMode dataRate;
WifiPreamble preamble;
uint32_t txPowerLevel;
uint32_t channelNumber; ///< channel number
uint32_t priority; ///< priority
WifiMode dataRate; ///< data rate
WifiPreamble preamble; ///< preamble
uint32_t txPowerLevel; ///< transmit power level
// Time expiryTime; // unsupported
/// Initializer
TxInfo ()
: channelNumber (CCH),
priority (7),
@@ -68,6 +69,14 @@ struct TxInfo
{
}
/**
* Initializer
* \param channel the channel
* \param prio the priority
* \param rate the wifi mode
* \param preamble the preamble
* \param powerLevel the power level
*/
TxInfo (uint32_t channel, uint32_t prio = 7, WifiMode rate = WifiMode (), WifiPreamble preamble = WIFI_PREAMBLE_NONE, uint32_t powerLevel = 8)
: channelNumber (channel),
priority (prio),
@@ -93,11 +102,12 @@ struct TxInfo
*/
struct TxProfile
{
uint32_t channelNumber;
bool adaptable;
uint32_t txPowerLevel;
WifiMode dataRate;
WifiPreamble preamble;
uint32_t channelNumber; ///< channel number
bool adaptable; ///< adaptable
uint32_t txPowerLevel; ///< transmit power level
WifiMode dataRate; ///< data rate
WifiPreamble preamble; ///< preamble
/// Initializer
TxProfile (void)
: channelNumber (SCH1),
adaptable (false),
@@ -106,6 +116,12 @@ struct TxProfile
{
dataRate = WifiMode ("OfdmRate6MbpsBW10MHz");
}
/**
* Initializer
* \param channel the channel number
* \param adapt true to adapt
* \param powerLevel the power level
*/
TxProfile (uint32_t channel, bool adapt = true, uint32_t powerLevel = 4)
: channelNumber (channel),
adaptable (adapt),
@@ -133,6 +149,10 @@ struct TxProfile
class WaveNetDevice : public NetDevice
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
WaveNetDevice (void);
virtual ~WaveNetDevice (void);
@@ -199,7 +219,7 @@ public:
Ptr<VsaManager> GetVsaManager (void) const;
/**
* \param sch_info the parameters about how to start SCH service
* \param schInfo the parameters about how to start SCH service
* \return whether channel access is assigned successfully
*/
bool StartSch (const SchInfo & schInfo);
@@ -210,7 +230,7 @@ public:
bool StopSch (uint32_t channelNumber);
/**
* \param vsa_info the parameters about how to send VSA frame
* \param vsaInfo the parameters about how to send VSA frame
* \return whether the request for VSA transmission is completed
*/
bool StartVsa (const VsaInfo & vsaInfo);
@@ -284,16 +304,16 @@ public:
/**
* \param packet packet sent from above down to Network Device
* \param dest mac address of the destination (already resolved)
* \param protocolNumber identifies the type of payload contained in
* this packet. Used to call the right L3Protocol when the packet
* is received.
* \return whether the Send operation succeeded
*
* Normally this method is called by 1609.3 standard to
* send IP-based packets, however high layers can also send packets
* in other types except IP-based packets in CCH.
*/
* \param dest mac address of the destination (already resolved)
* \param protocolNumber identifies the type of payload contained in
* this packet. Used to call the right L3Protocol when the packet
* is received.
* \return whether the Send operation succeeded
*
* Normally this method is called by 1609.3 standard to
* send IP-based packets, however high layers can also send packets
* in other types except IP-based packets in CCH.
*/
virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
// inherited from NetDevice base class.
@@ -322,10 +342,12 @@ public:
virtual bool SupportsSendFrom (void) const;
private:
// This value conforms to the 802.11 specification
/// This value conforms to the 802.11 specification
static const uint16_t MAX_MSDU_SIZE = 2304;
/// IP v4 Protocol number
static const uint16_t IPv4_PROT_NUMBER = 0x0800;
/// IP v6 Protocol number
static const uint16_t IPv6_PROT_NUMBER = 0x86DD;
virtual void DoDispose (void);
@@ -345,18 +367,22 @@ private:
*/
void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
/// MacEntities typedef
typedef std::map<uint32_t, Ptr<OcbWifiMac> > MacEntities;
/// MacEntities iterator typedef
typedef std::map<uint32_t, Ptr<OcbWifiMac> >::const_iterator MacEntitiesI;
MacEntities m_macEntities;
typedef std::vector<Ptr<WifiPhy> > PhyEntities;
MacEntities m_macEntities; ///< MAC entities
/// PhyEntities typedef
typedef std::vector<Ptr<WifiPhy> > PhyEntities;
/// PhyEntities iterator typedef
typedef std::vector<Ptr<WifiPhy> >::const_iterator PhyEntitiesI;
PhyEntities m_phyEntities;
PhyEntities m_phyEntities; ///< Phy entities
Ptr<ChannelManager> m_channelManager;
Ptr<ChannelScheduler> m_channelScheduler;
Ptr<ChannelCoordinator> m_channelCoordinator;
Ptr<VsaManager> m_vsaManager;
TxProfile *m_txProfile;
Ptr<ChannelManager> m_channelManager; ///< the channel manager
Ptr<ChannelScheduler> m_channelScheduler; ///< the channel scheduler
Ptr<ChannelCoordinator> m_channelCoordinator; ///< the channel coordinator
Ptr<VsaManager> m_vsaManager; ///< the VSA manager
TxProfile *m_txProfile; ///< transmit profile
/**
* \todo The Address arguments should be passed
* by const reference, since they are large.
@@ -364,11 +390,11 @@ private:
TracedCallback<Address, Address> m_addressChange;
// copy from WifiNetDevice
Ptr<Node> m_node;
NetDevice::ReceiveCallback m_forwardUp;
NetDevice::PromiscReceiveCallback m_promiscRx;
uint32_t m_ifIndex;
mutable uint16_t m_mtu;
Ptr<Node> m_node; ///< the node
NetDevice::ReceiveCallback m_forwardUp; ///< forward up receive callback
NetDevice::PromiscReceiveCallback m_promiscRx; ///< promiscious receive callback
uint32_t m_ifIndex; ///< IF index
mutable uint16_t m_mtu; ///< MTU
};
} // namespace ns3

View File

@@ -29,12 +29,23 @@
using namespace ns3;
// This test case tests the channel coordination.
// In particular, it checks the following:
// - channel interval calculation including CCH Interval, SCH Interval,
// Guard Interval and Sync Interval
// - current interval state for current time and future time
// - channel coordination events notified at the correct time.
/**
* \ingroup wave-test
* \defgroup wave-test wave module tests
*/
/**
* \ingroup wave-test
* \ingroup tests
*
* \brief This test case tests the channel coordination.
* In particular, it checks the following:
* - channel interval calculation including CCH Interval, SCH Interval,
* Guard Interval and Sync Interval
* - current interval state for current time and future time
* - channel coordination events notified at the correct time.
*/
class ChannelCoordinationTestCase : public TestCase
{
public:
@@ -42,20 +53,49 @@ public:
virtual ~ChannelCoordinationTestCase (void);
// below three methods are used in CoordinationTestListener
/**
* Notify CCS start now function
* \param duration the duration
*/
void NotifyCchStartNow (Time duration);
/**
* Notify SCH start now function
* \param duration the duration
*/
void NotifySchStartNow (Time duration);
/**
* Notify guard start now function
* \param duration the duration
* \param inCchInterval the CCH interval
*/
void NotifyGuardStartNow (Time duration, bool inCchInterval);
private:
/**
* Test interval after function
* \param cchi the CCHI
* \param schi the SCHI
* \param guardi the guard
*/
void TestIntervalAfter (bool cchi, bool schi, bool guardi);
virtual void DoRun (void);
Ptr<ChannelCoordinator> m_coordinator;
Ptr<ChannelCoordinator> m_coordinator; ///< coordinator
};
// CoordinationTestListener is used to test channel coordination events
/**
* \ingroup wave-test
* \ingroup tests
*
* \brief CoordinationTestListener is used to test channel coordination events
*/
class CoordinationTestListener : public ChannelCoordinationListener
{
public:
/**
* Constructor
*
* \param coordinatorTest channel coordination test case
*/
CoordinationTestListener (ChannelCoordinationTestCase *coordinatorTest)
: m_coordinatorTest (coordinatorTest)
{
@@ -75,7 +115,7 @@ public:
{
m_coordinatorTest->NotifyGuardStartNow (duration, cchi);
}
ChannelCoordinationTestCase *m_coordinatorTest;
ChannelCoordinationTestCase *m_coordinatorTest; ///< coordinator test
};
ChannelCoordinationTestCase::ChannelCoordinationTestCase (void)
@@ -216,9 +256,20 @@ ChannelCoordinationTestCase::DoRun ()
Simulator::Destroy ();
}
/**
* \ingroup wave-test
* \ingroup tests
*
* \brief Test Case Helper
*/
class TestCaseHelper
{
public:
/**
* Create WAVE device function
* \param nodesNumber the number of nodes
* \returns the collection of nodes
*/
static NetDeviceContainer CreatWaveDevice (uint32_t nodesNumber = 2);
};
@@ -264,22 +315,46 @@ public:
ChannelRoutingTestCase (void);
virtual ~ChannelRoutingTestCase (void);
// send IP-based packets
// shouldSuccess is used to check whether packet sent should be successful.
/**
* Send IP-based packets
*
* \param shouldSucceed is used to check whether packet sent should be successful.
* \param ipv6 is IPv6?
*/
void SendIp (bool shouldSucceed, bool ipv6);
// send WSMP or other packets
// shouldSuccess is used to check whether packet sent should be successful.
/**
* Send WSMP or other packets
* \param shouldSucceed is used to check whether packet sent should be successful.
* \param txInfo transmit info
*/
void SendWsmp (bool shouldSucceed, const TxInfo &txInfo);
// send VSA management frames
// shouldSuccess is used to check whether packet sent should be successful.
/**
* Send VSA management frames
* \param shouldSucceed is used to check whether packet sent should be successful.
* \param vsaInfo VSA info
*/
void SendWsa (bool shouldSucceed, const VsaInfo &vsaInfo);
private:
virtual void DoRun (void);
/**
* Receive function
* \param dev the device
* \param pkt the packet
* \param mode the mode
* \param sender the sender address
* \returns true if successful
*/
bool Receive (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint16_t mode, const Address &sender);
bool ReceiveVsa (Ptr<const Packet>,const Address &, uint32_t, uint32_t);
/**
* Receive VSA functon
* \param pkt the packet
* \param address the address
* \returns true if successful
*/
bool ReceiveVsa (Ptr<const Packet> pkt,const Address & address, uint32_t, uint32_t);
Ptr<WaveNetDevice> m_sender;
Ptr<WaveNetDevice> m_sender; ///< sender
};
ChannelRoutingTestCase::ChannelRoutingTestCase (void)
@@ -448,33 +523,78 @@ ChannelRoutingTestCase::DoRun ()
}
}
// This test case tests channel access assignments which is done by
// StartSch and StopSch method of WaveNetDevice.
// channel access assignments include ContinuousAccess, ExtendedAccess,
// and AlternatingAccess.
// The results of this test case depend on the implementation of ChannelScheduler
// In this case, the results depend on class "DefaultChannelScheduler".
/**
* This test case tests channel access assignments which is done by
* StartSch and StopSch method of WaveNetDevice.
* channel access assignments include ContinuousAccess, ExtendedAccess,
* and AlternatingAccess.
* The results of this test case depend on the implementation of ChannelScheduler
* In this case, the results depend on class "DefaultChannelScheduler".
*/
class ChannelAccessTestCase : public TestCase
{
public:
ChannelAccessTestCase (void);
virtual ~ChannelAccessTestCase (void);
private:
void TestContinuous (SchInfo &info, bool shouldSuccceed);
/**
* Test continuous function
* \param info the schedule info
* \param shouldSucceed true if it should succeed
*/
void TestContinuous (SchInfo &info, bool shouldSucceed);
/**
* Test continuous after function
* \param channelNumber the channel number
* \param isAccessAssigned true if access assigned
*/
void TestContinuousAfter (uint32_t channelNumber, bool isAccessAssigned);
void TestExtended (SchInfo &info, bool shouldSuccceed);
/**
* Test extended function
* \param info the schedule info
* \param shouldSucceed true if it should succeed
*/
void TestExtended (SchInfo &info, bool shouldSucceed);
/**
* Test extended after function
* \param channelNumber the channel number
* \param isAccessAssigned true if access assigned
*/
void TestExtendedAfter (uint32_t channelNumber, bool isAccessAssigned);
void TestAlternating (SchInfo &info, bool shouldSuccceed);
/**
* Test aternating function
* \param info the schedule info
* \param shouldSucceed true if it should succeed
*/
void TestAlternating (SchInfo &info, bool shouldSucceed);
/**
* Test alternating after function
* \param channelNumber the channel number
* \param isAccessAssigned true if access assigned
*/
void TestAlternatingAfter (uint32_t channelNumber, bool isAccessAssigned);
/**
* Send X function
* \param channel the channel number
* \param receiverId
*/
void SendX (uint32_t channel, uint32_t receiverId);
/**
* Receive function
* \param dev the device
* \param pkt the packet
* \param mode the mode
* \param sender the sender address
* \returns true if successful
*/
bool Receive (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint16_t mode, const Address &sender);
virtual void DoRun (void);
NetDeviceContainer m_devices;
Ptr<WaveNetDevice> m_sender;
uint32_t m_received;
NetDeviceContainer m_devices; ///< the devices
Ptr<WaveNetDevice> m_sender; ///< sender
uint32_t m_received; ///< received
};
ChannelAccessTestCase::ChannelAccessTestCase (void)
@@ -486,10 +606,10 @@ ChannelAccessTestCase::~ChannelAccessTestCase (void)
}
void
ChannelAccessTestCase::TestContinuous (SchInfo &info, bool shouldSuccceed)
ChannelAccessTestCase::TestContinuous (SchInfo &info, bool shouldSucceed)
{
bool result = m_sender->StartSch (info);
NS_TEST_EXPECT_MSG_EQ (result, shouldSuccceed, "TestContinuous fail at " << Now ().GetSeconds ());
NS_TEST_EXPECT_MSG_EQ (result, shouldSucceed, "TestContinuous fail at " << Now ().GetSeconds ());
}
void
ChannelAccessTestCase::TestContinuousAfter (uint32_t channelNumber, bool isAccessAssigned)
@@ -498,10 +618,10 @@ ChannelAccessTestCase::TestContinuousAfter (uint32_t channelNumber, bool isAcces
NS_TEST_EXPECT_MSG_EQ (result, isAccessAssigned, "TestContinuousAfter fail at " << Now ().GetSeconds ());
}
void
ChannelAccessTestCase::TestExtended (SchInfo &info, bool shouldSuccceed)
ChannelAccessTestCase::TestExtended (SchInfo &info, bool shouldSucceed)
{
bool result = m_sender->StartSch (info);
NS_TEST_EXPECT_MSG_EQ (result, shouldSuccceed, "TestExtended fail at " << Now ().GetSeconds ());
NS_TEST_EXPECT_MSG_EQ (result, shouldSucceed, "TestExtended fail at " << Now ().GetSeconds ());
}
void
ChannelAccessTestCase::TestExtendedAfter (uint32_t channelNumber, bool isAccessAssigned)
@@ -511,10 +631,10 @@ ChannelAccessTestCase::TestExtendedAfter (uint32_t channelNumber, bool isAccessA
}
void
ChannelAccessTestCase::TestAlternating (SchInfo &info, bool shouldSuccceed)
ChannelAccessTestCase::TestAlternating (SchInfo &info, bool shouldSucceed)
{
bool result = m_sender->StartSch (info);
NS_TEST_EXPECT_MSG_EQ (result, shouldSuccceed, "TestAlternating fail at " << Now ().GetSeconds ());
NS_TEST_EXPECT_MSG_EQ (result, shouldSucceed, "TestAlternating fail at " << Now ().GetSeconds ());
}
void
ChannelAccessTestCase::TestAlternatingAfter (uint32_t channelNumber, bool isAccessAssigned)
@@ -892,8 +1012,13 @@ ChannelAccessTestCase::DoRun ()
}
}
// The Annex C of IEEE 1609.4 : "Avoiding transmission at scheduled guard intervals"
// This feature is implemented in WaveMacLow::StartTransmission method
/**
* \ingroup wave-test
* \ingroup tests
*
* \brief The Annex C of IEEE 1609.4 : "Avoiding transmission at scheduled guard intervals"
* This feature is implemented in WaveMacLow::StartTransmission method
*/
class AnnexC_TestCase : public TestCase
{
public:
@@ -902,12 +1027,26 @@ public:
private:
virtual void DoRun (void);
/**
* Send packet function
* \param packetSize the packet size
* \param txInfo the transmit info
* \param sequence the sequence
*/
void SendPacket (uint32_t packetSize, const TxInfo & txInfo, uint32_t sequence);
/**
* Receive function
* \param dev the device
* \param pkt the packet
* \param mode the mode
* \param sender the sender address
* \returns true if successful
*/
bool Receive (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint16_t mode, const Address &sender);
NetDeviceContainer m_devices;
Ptr<WaveNetDevice> m_sender;
Ptr<WaveNetDevice> m_receiver;
NetDeviceContainer m_devices; ///< devices
Ptr<WaveNetDevice> m_sender; ///< sender
Ptr<WaveNetDevice> m_receiver; ///< receiver
};
AnnexC_TestCase::AnnexC_TestCase (void)
@@ -1042,6 +1181,12 @@ AnnexC_TestCase::DoRun (void)
Simulator::Destroy ();
}
/**
* \ingroup wave-test
* \ingroup tests
*
* \brief Wave Mac Test Suite
*/
class WaveMacTestSuite : public TestSuite
{
public:
@@ -1059,4 +1204,4 @@ WaveMacTestSuite::WaveMacTestSuite ()
}
// Do not forget to allocate an instance of this TestSuite
static WaveMacTestSuite waveMacTestSuite;
static WaveMacTestSuite waveMacTestSuite; ///< the test suite

View File

@@ -72,6 +72,12 @@ AssignWifiRandomStreams (Ptr<WifiMac> mac, int64_t stream)
}
}
/**
* \ingroup wave-test
* \ingroup tests
*
* \brief Ocb Wifi Mac Test Case
*/
class OcbWifiMacTestCase : public TestCase
{
public:
@@ -80,30 +86,81 @@ public:
private:
virtual void DoRun (void);
void MacAssoc (std::string context,Mac48Address bssid);
/**
* MAC associate function
* \param context the context
* \param bssid the BSSID
*/
void MacAssoc (std::string context, Mac48Address bssid);
/**
* Phy receive ok trace function
* \param context the context
* \param packet the packet
* \param snr the SNR
* \param mode the mode
* \param preamble the preamble
*/
void PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
/**
* Phy transmit trace function
* \param context the context
* \param packet the packet
* \param mode the mode
* \param preamble the preamble
* \param txPower the transmit power
*/
void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
/**
* Get current position function
* \param i the current position index
* \returns the current position vector
*/
Vector GetCurrentPosition (uint32_t i);
/**
* Advance position function
* \param node the node
*/
void AdvancePosition (Ptr<Node> node);
/// Pre random configuration function
void PreRandomConfiguration (void);
/**
* Configure AP STA mode function
* \param static_node the static node
* \param mobile_node the mobile node
*/
void ConfigureApStaMode (Ptr<Node> static_node, Ptr<Node> mobile_node);
/**
* Configure adhoc mode function
* \param static_node the static node
* \param mobile_node the mobile node
*/
void ConfigureAdhocMode (Ptr<Node> static_node, Ptr<Node> mobile_node);
/**
* Configure OCB mode function
* \param static_node the static node
* \param mobile_node the mobile node
*/
void ConfigureOcbMode (Ptr<Node> static_node, Ptr<Node> mobile_node);
/**
* Post device configuration function
* \param static_node the static node
* \param mobile_node the mobile node
*/
void PostDeviceConfiguration (Ptr<Node> static_node, Ptr<Node> mobile_node);
Time phytx_time;
Vector phytx_pos;
Time phytx_time; ///< Phy transmit time
Vector phytx_pos; ///< Phy transmit position
Time macassoc_time;
Vector macassoc_pos;
Time macassoc_time; ///< MAC associate time
Vector macassoc_pos; ///< MAC associate position
Time phyrx_time;
Vector phyrx_pos;
Time phyrx_time; ///< Phy receive time
Vector phyrx_pos; ///< Phy receive position
// nodes.Get (0) is static node
// nodes.Get (1) is mobile node
NodeContainer nodes;
NodeContainer nodes; ///< the nodes
};
OcbWifiMacTestCase::OcbWifiMacTestCase (void)
@@ -384,6 +441,12 @@ OcbWifiMacTestCase::PreRandomConfiguration ()
// the WiFi random variables is set in PostDeviceConfiguration method.
}
/**
* \ingroup wave-test
* \ingroup tests
*
* \brief Ocb Test Suite
*/
class OcbTestSuite : public TestSuite
{
public:
@@ -398,5 +461,5 @@ OcbTestSuite::OcbTestSuite ()
}
// Do not forget to allocate an instance of this TestSuite
static OcbTestSuite ocbTestSuite;
static OcbTestSuite ocbTestSuite; ///< the test suite