#include <EtherAppSrv.h>
Protected Member Functions | |
virtual void | initialize () |
virtual void | handleMessage (cMessage *msg) |
virtual void | finish () |
void | registerDSAP (int dsap) |
void | sendPacket (cMessage *datapacket, const MACAddress &destAddr) |
Protected Attributes | |
int | localSAP |
int | remoteSAP |
long | packetsSent |
long | packetsReceived |
cOutVector | eedVector |
cStdDev | eedStats |
Server-side process EtherAppCli.
Definition at line 30 of file EtherAppSrv.h.
void EtherAppSrv::finish | ( | ) | [protected, virtual] |
Definition at line 109 of file EtherAppSrv.cc.
{ recordScalar("packets sent", packetsSent); recordScalar("packets rcvd", packetsReceived); recordScalar("end-to-end delay mean", eedStats.getMean()); recordScalar("end-to-end delay stddev", eedStats.getStddev()); recordScalar("end-to-end delay min", eedStats.getMin()); recordScalar("end-to-end delay max", eedStats.getMax()); }
void EtherAppSrv::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Definition at line 43 of file EtherAppSrv.cc.
{ EV << "Received packet `" << msg->getName() << "'\n"; packetsReceived++; simtime_t lastEED = simTime() - msg->getCreationTime(); eedVector.record(lastEED); eedStats.collect(lastEED); EtherAppReq *req = check_and_cast<EtherAppReq *>(msg); Ieee802Ctrl *ctrl = check_and_cast<Ieee802Ctrl *>(req->removeControlInfo()); MACAddress srcAddr = ctrl->getSrc(); long requestId = req->getRequestId(); long replyBytes = req->getResponseBytes(); char msgname[30]; strcpy(msgname,msg->getName()); delete msg; delete ctrl; // send back packets asked by EtherAppCli side int k = 0; strcat(msgname,"-resp-"); char *s = msgname+strlen(msgname); while (replyBytes>0) { int l = replyBytes>MAX_REPLY_CHUNK_SIZE ? MAX_REPLY_CHUNK_SIZE : replyBytes; replyBytes -= l; sprintf(s,"%d",k); EV << "Generating packet `" << msgname << "'\n"; EtherAppResp *datapacket = new EtherAppResp(msgname, IEEE802CTRL_DATA); datapacket->setRequestId(requestId); datapacket->setByteLength(l); sendPacket(datapacket, srcAddr); packetsSent++; k++; } }
void EtherAppSrv::initialize | ( | ) | [protected, virtual] |
Definition at line 26 of file EtherAppSrv.cc.
{ localSAP = ETHERAPP_SRV_SAP; remoteSAP = ETHERAPP_CLI_SAP; // statistics packetsSent = packetsReceived = 0; eedVector.setName("end-to-end delay"); eedStats.setName("end-to-end delay"); WATCH(packetsSent); WATCH(packetsReceived); bool registerSAP = par("registerSAP"); if (registerSAP) registerDSAP(localSAP); }
void EtherAppSrv::registerDSAP | ( | int | dsap | ) | [protected] |
Definition at line 97 of file EtherAppSrv.cc.
Referenced by initialize().
{ EV << getFullPath() << " registering DSAP " << dsap << "\n"; Ieee802Ctrl *etherctrl = new Ieee802Ctrl(); etherctrl->setDsap(dsap); cMessage *msg = new cMessage("register_DSAP", IEEE802CTRL_REGISTER_DSAP); msg->setControlInfo(etherctrl); send(msg, "out"); }
void EtherAppSrv::sendPacket | ( | cMessage * | datapacket, | |
const MACAddress & | destAddr | |||
) | [protected] |
Definition at line 87 of file EtherAppSrv.cc.
Referenced by handleMessage().
cStdDev EtherAppSrv::eedStats [protected] |
Definition at line 39 of file EtherAppSrv.h.
Referenced by finish(), handleMessage(), and initialize().
cOutVector EtherAppSrv::eedVector [protected] |
Definition at line 38 of file EtherAppSrv.h.
Referenced by handleMessage(), and initialize().
int EtherAppSrv::localSAP [protected] |
Definition at line 33 of file EtherAppSrv.h.
Referenced by initialize(), and sendPacket().
long EtherAppSrv::packetsReceived [protected] |
Definition at line 37 of file EtherAppSrv.h.
Referenced by finish(), handleMessage(), and initialize().
long EtherAppSrv::packetsSent [protected] |
Definition at line 36 of file EtherAppSrv.h.
Referenced by finish(), handleMessage(), and initialize().
int EtherAppSrv::remoteSAP [protected] |
Definition at line 34 of file EtherAppSrv.h.
Referenced by initialize(), and sendPacket().