|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
29 #include "ns3/simple-net-device.h"
30 #include "ns3/simple-channel.h"
31 #include "ns3/address.h"
32 #include "ns3/mac48-address.h"
33 #include "ns3/packet.h"
34 #include "ns3/callback.h"
36 #include "ns3/simulator.h"
37 #include "ns3/error-model.h"
38 #include "ns3/pointer.h"
39 #include "ns3/double.h"
40 #include "ns3/string.h"
41 #include "ns3/rng-seed-manager.h"
42 #include "ns3/queue.h"
48 for (
int i = 0; i < num; i++)
51 device->
Send (pkt, addr, 0);
59 queueFactory.
SetTypeId(
"ns3::DropTailQueue<Packet>");
89 virtual void DoRun (
void);
111 :
TestCase (
"ErrorModel and PhyRxDrop trace for SimpleNetDevice"), m_count (0), m_drops (0)
136 RngSeedManager::SetSeed (7);
137 RngSeedManager::SetRun (2);
165 Simulator::Destroy ();
186 virtual void DoRun (
void);
208 :
TestCase (
"ErrorModel and PhyRxDrop trace for SimpleNetDevice"), m_count (0), m_drops (0)
233 RngSeedManager::SetSeed (5);
234 RngSeedManager::SetRun (8);
264 Simulator::Destroy ();
void SetRandomVariable(Ptr< RandomVariableStream > ranVar)
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
bool Receive(Ptr< NetDevice > nd, Ptr< const Packet > p, uint16_t protocol, const Address &addr)
Receive form a NetDevice.
uint32_t m_drops
The dropped packets counter.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool Receive(Ptr< NetDevice > nd, Ptr< const Packet > p, uint16_t protocol, const Address &addr)
Receive form a NetDevice.
virtual ~BurstErrorModelSimple()
Hold objects of type Ptr<T>.
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void SetAddress(Address address)
Set the address of this interface.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
static void BuildSimpleTopology(Ptr< Node > a, Ptr< Node > b, Ptr< SimpleNetDevice > input, Ptr< SimpleNetDevice > output, Ptr< SimpleChannel > channel)
uint32_t m_count
The received packets counter.
virtual Address GetAddress(void) const
static ErrorModelTestSuite errorModelTestSuite
Static variable for test initialization.
a polymophic address class
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
virtual ~ErrorModelSimple()
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
Instantiate subclasses of ns3::Object.
virtual void DoRun(void)
Implementation to actually run this TestCase.
BurstErrorModel unit tests.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)=0
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
static void SendPacket(int num, Ptr< NetDevice > device, Address &addr)
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
void SetQueue(Ptr< Queue< Packet > > queue)
Attach a queue to the SimpleNetDevice.
void DropEvent(Ptr< const Packet > p)
Register a Drop.
Hold variables of type string.
virtual void SetNode(Ptr< Node > node)
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
void DropEvent(Ptr< const Packet > p)
Register a Drop.
Time Seconds(double value)
Construct a Time in the indicated unit.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
uint32_t m_drops
The dropped packets counter.
uint32_t m_count
The received packets counter.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
void SetRandomVariable(Ptr< RandomVariableStream >)