#include <IPTrafGen.h>
Inheritance diagram for IPTrafSink:

Protected Member Functions | |
| virtual void | printPacket (cMessage *msg) |
| virtual void | processPacket (cMessage *msg) |
| virtual void | initialize () |
| virtual void | handleMessage (cMessage *msg) |
Protected Attributes | |
| int | numReceived |
|
|
Reimplemented in IPTrafGen. 00038 {
00039 processPacket(msg);
00040
00041 if (ev.isGUI())
00042 {
00043 char buf[32];
00044 sprintf(buf, "rcvd: %d pks", numReceived);
00045 displayString().setTagArg("t",0,buf);
00046 }
00047
00048 }
|
|
|
00032 {
00033 numReceived = 0;
00034 WATCH(numReceived);
00035 }
|
|
|
00051 {
00052 IPvXAddress src, dest;
00053 int protocol = -1;
00054 if (dynamic_cast<IPControlInfo *>(msg->controlInfo())!=NULL)
00055 {
00056 IPControlInfo *ctrl = (IPControlInfo *)msg->controlInfo();
00057 src = ctrl->srcAddr();
00058 dest = ctrl->destAddr();
00059 protocol = ctrl->protocol();
00060 }
00061 else if (dynamic_cast<IPv6ControlInfo *>(msg->controlInfo())!=NULL)
00062 {
00063 IPv6ControlInfo *ctrl = (IPv6ControlInfo *)msg->controlInfo();
00064 src = ctrl->srcAddr();
00065 dest = ctrl->destAddr();
00066 protocol = ctrl->protocol();
00067 }
00068
00069 ev << msg << endl;
00070 ev << "Payload length: " << msg->byteLength() << " bytes" << endl;
00071 if (protocol!=-1)
00072 ev << "src: " << src << " dest: " << dest << " protocol=" << protocol << "\n";
00073 }
|
|
|
00076 {
00077 EV << "Received packet: ";
00078 printPacket(msg);
00079 delete msg;
00080
00081 numReceived++;
00082 }
|
|
|
|
1.4.1