|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2001, 2003, 2004 Johnny Lai, Monash University, Melbourne, Australia 00003 // Copyright (C) 2005 Andras Varga 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #include <omnetpp.h> 00020 #include "IPvXAddress.h" 00021 00022 class PingPayload; 00023 00024 00031 class INET_API PingApp : public cSimpleModule 00032 { 00033 protected: 00034 virtual void initialize(); 00035 virtual void handleMessage(cMessage *msg); 00036 virtual void finish(); 00037 00038 protected: 00039 virtual void sendPing(); 00040 virtual void scheduleNextPing(cMessage *timer); 00041 virtual void sendToICMP(cMessage *payload, const IPvXAddress& destAddr, const IPvXAddress& srcAddr, int hopLimit); 00042 virtual void processPingResponse(PingPayload *msg); 00043 virtual void countPingResponse(int bytes, long seqNo, simtime_t rtt); 00044 00045 protected: 00046 // configuration 00047 IPvXAddress destAddr; 00048 IPvXAddress srcAddr; 00049 int packetSize; 00050 cPar *intervalp; 00051 int hopLimit; 00052 int count; 00053 simtime_t startTime; 00054 simtime_t stopTime; 00055 bool printPing; 00056 00057 // state 00058 long sendSeqNo; 00059 long expectedReplySeqNo; 00060 00061 // statistics 00062 cStdDev delayStat; 00063 cOutVector delayVector; 00064 cOutVector dropVector; 00065 long dropCount; 00066 long outOfOrderArrivalCount; 00067 long numPongs; 00068 }; 00069 00070