TTEthernet Model for INET Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TTEthernetModel::TrafficSourceAppBase Class Reference

Simple Test-Application. More...

#include <TrafficSourceAppBase.h>

Inheritance diagram for TTEthernetModel::TrafficSourceAppBase:
TTEthernetModel::TTEApplicationBase TTEthernetModel::RCTrafficSourceApp TTEthernetModel::TTTrafficSourceApp

Protected Member Functions

virtual void initialize ()
 Initialization of the module. More...
 
virtual void sendMessage ()
 Generates and sends a new Message. More...
 

Additional Inherited Members

- Public Member Functions inherited from TTEthernetModel::TTEApplicationBase
virtual void executeCallback (Callback *cb)
 executes the given Callback in the context of the Application More...
 
virtual void handleParameterChange (const char *parname)
 Indicates a parameter has changed. More...
 
- Protected Attributes inherited from TTEthernetModel::TTEApplicationBase
std::map< uint16_t, std::list
< Buffer * > > 
buffers
 Map of critical traffic identifies with their corresponding Buffers. More...
 

Detailed Description

Simple Test-Application.

See Also
TTEApplicationBase

Definition at line 31 of file TrafficSourceAppBase.h.

Member Function Documentation

void TTEthernetModel::TrafficSourceAppBase::initialize ( )
protectedvirtual

Initialization of the module.

Sends activator message

Reimplemented in TTEthernetModel::TTTrafficSourceApp, and TTEthernetModel::RCTrafficSourceApp.

Definition at line 26 of file TrafficSourceAppBase.cc.

Referenced by TTEthernetModel::RCTrafficSourceApp::initialize(), and TTEthernetModel::TTTrafficSourceApp::initialize().

27 {
28  scheduleAt(simTime(), new cMessage("ACTIVATOR!"));
29 }
void TTEthernetModel::TrafficSourceAppBase::sendMessage ( )
protectedvirtual

Generates and sends a new Message.

The message is sent to the buffer with the ct_id defined in parameter ct_id of the module. The message kind is defined by the buffer-type (RC/TT) of the buffer the message is sent to. The size is defined by the payload parameter of the module.

Definition at line 31 of file TrafficSourceAppBase.cc.

Referenced by TTEthernetModel::RCTrafficSourceApp::handleMessage(), and TTEthernetModel::TTTrafficSourceApp::handleMessage().

31  {
32  int ctID = par("ct_id").longValue();
33  if(ctID == -1){
34 
35  }
36  else{
37  std::list<Buffer*> buffer = buffers[ctID];
38  if(buffer.size()==0){
39  ev.printf("No buffer with such CT \n");
40  bubble("No buffer with such CT");
41  getDisplayString().setTagArg("i2", 0, "status/excl3");
42  getDisplayString().setTagArg("tt", 0, "WARNING: No buffer with such CT");
43  getParentModule()->getDisplayString().setTagArg("i2", 0, "status/excl3");
44  getParentModule()->getDisplayString().setTagArg("tt", 0, "No buffer with such CT");
45  }
46  else{
47  for(std::list<Buffer*>::iterator buf = buffer.begin();
48  buf!=buffer.end();buf++){
49  CTFrame *frame;
50  if(dynamic_cast<TTBuffer*>(*buf)){
51  frame = new TTFrame("");
52  }
53  else if(dynamic_cast<RCBuffer*>(*buf)){
54  frame = new RCFrame("");
55  }
56  else{
57  continue;
58  }
59  frame->setByteLength(par("payload").longValue()+ETHER_MAC_FRAME_BYTES);
60  //Padding
61  if(frame->getByteLength()<MIN_ETHERNET_FRAME_BYTES){
62  frame->setByteLength(MIN_ETHERNET_FRAME_BYTES);
63  }
64  frame->setCtID(ctID);
65  //TODO Error check
66  Incoming* in = (Incoming *)(*buf)->gate("in")->getPathStartGate()->getOwner();
67  //TODO Better name for Frame
68  frame->setName((*buf)->getName());
69  sendDirect(frame, in->gate("in"));
70  }
71  }
72  }
73 }

The documentation for this class was generated from the following files: