#include <devPktGen.h>
Inherits DEDevice.
Inheritance diagram for DevPktGen:
Public Member Functions | |
void | Initialize () |
Initialize function. | |
DevPktGen (SysSAloha *_System, DevAP *theAP) | |
Contructor. | |
~DevPktGen () | |
Destructor. | |
virtual const char * | Type () const |
This will allow the events and such to print debugging informations in a meaningful way. | |
void | HEv_PktGen_Generation () |
Handler for the Ev_PktGen_Generation self event. | |
void | RemoveTerminal (DevPkt *dt) |
Remove from the list a successfully sent packet. | |
void | AddBacklogged () |
Called when a packet becomes backlogged (i.e., need a retransmission). | |
Static Public Member Functions | |
void | setup (ParamManager *Param, GlobalProbeManager *Results) |
Setup function, where the parameters are defined. | |
Protected Attributes | |
int | counter |
counter for the packets. | |
SysSAloha * | System |
we have to pass this to the packets too, as DevPkt is a subclass of DEDevice. | |
DevAP * | theAP |
the Access Pointer. To be passed to the packets. | |
list< DevPkt * > | dtList |
list of the various Packets (DevPkt). | |
ProbeSG * | the_SG_Probe |
Probe for the S and G Aloha values. | |
ExponentialDETimeRndGen | MsgInterarrTimeGen |
Interrival time generator. |
This class simply generates packets (DevPkt) randomly. The time between each packet generation follows a ranom distribution (an exponential time here).
Definition at line 29 of file devPktGen.h.
|
Contructor. Remember to clear variables for initialization in Initialize(). Do NOT initialize variables here unless they are constants. Definition at line 17 of file devPktGen.cpp. References the_SG_Probe. 00018 : DEDevice(_System), System(_System), theAP(_theAP), counter(0) 00019 { 00020 the_SG_Probe = 0; 00021 };
|
|
Initialize function. Here is where the parameters are read and the real initialization takes place. Note (again) that this function can be called multiple times; hence, you must clear previous instances. Here is also where the first Self Event should be fired. From now on, this class will be self-clocked. The first packet can be generated here or later, as you want. Reimplemented from DEDevice. Definition at line 38 of file devPktGen.cpp. References counter, dtList, DevPkt::Initialize(), MsgInterarrTimeGen, DEDevice::newEvent(), ProbeSG::Observe_S(), System, the_SG_Probe, and theAP. Referenced by SysSAloha::Initialize(). 00039 { 00040 DETime MsgInterarrTime = get<DETimeParameter,DETime>(Param, "MsgInterarrTime", "Dev_Test_PktGen", ""); 00041 MsgInterarrTimeGen = ExponentialDETimeRndGen(MsgInterarrTime); 00042 00043 if( the_SG_Probe ) 00044 delete( the_SG_Probe ); 00045 the_SG_Probe = new ProbeSG( "the_SG" ); 00046 00047 list<DevPkt*>::iterator dtListIter; 00048 for( dtListIter=dtList.begin(); dtListIter!=dtList.end(); dtListIter++) 00049 delete (*dtListIter); 00050 dtList.clear(); 00051 00052 DevPkt* newPkt = new DevPkt( System, this, theAP, counter++); 00053 the_SG_Probe->Observe_S(1); 00054 newPkt->Initialize(); 00055 dtList.push_back(newPkt); 00056 00057 newEvent(new Ev_PktGen_Generation(this), MsgInterarrTimeGen.get()); 00058 }
|
Here is the call graph for this function: