Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00030 #ifndef __SIMPLETCP_H
00031 #define __SIMPLETCP_H
00032
00033
00034
00035 #include <omnetpp.h>
00036 #include "IPvXAddress.h"
00037 #include <TCPConnection.h>
00038 #include <InitStages.h>
00039
00040 class SimpleNodeEntry;
00041
00042
00043 struct StatisticsAndDelay {
00044
00045 public:
00046
00047
00048 std::string delayFaultTypeString;
00049 enum delayFaultTypeNum {
00050 delayFaultUndefined,
00051 delayFaultLiveAll,
00052 delayFaultLivePlanetlab,
00053 delayFaultSimulation
00054 };
00055 std::map<std::string, delayFaultTypeNum> delayFaultTypeMap;
00056
00057
00058 int numSent;
00059 int numQueueLost;
00060 int numPartitionLost;
00061 int numDestUnavailableLost;
00062 simtime_t delay;
00064 simtime_t constantDelay;
00065 bool useCoordinateBasedDelay;
00066 double jitter;
00067 bool faultyDelay;
00068 GlobalNodeList* globalNodeList;
00069 GlobalStatistics* globalStatistics;
00070 SimpleNodeEntry* nodeEntry;
00071 };
00072
00073 class SimpleTCPConnection : public TCPConnection {
00074
00075 public:
00076 SimpleTCPConnection():TCPConnection(){};
00077 SimpleTCPConnection(TCP* mod, int appGateIndex, int connId):TCPConnection(mod, appGateIndex, connId){};
00078
00080 virtual void sendToIP(TCPSegment *tcpseg);
00081
00082 static StatisticsAndDelay sad;
00083
00085 void sendRst(uint32 seq, IPvXAddress src, IPvXAddress dest, int srcPort, int destPort);
00087 void sendRstAck(uint32 seq, uint32 ack, IPvXAddress src, IPvXAddress dest, int srcPort, int destPort);
00088
00089 protected:
00091 virtual void sendToIP(TCPSegment *tcpseg, IPvXAddress src, IPvXAddress dest);
00092
00094 SimpleTCPConnection *cloneListeningConnection();
00095
00096 };
00097
00098 class SimpleTCP : public TCP {
00099
00100 public:
00101 SimpleTCP() { sad.globalStatistics = NULL; };
00102 virtual ~SimpleTCP() {};
00103
00104 void setNodeEntry (SimpleNodeEntry* entry);
00105
00106 StatisticsAndDelay sad;
00107
00108 protected:
00109
00110 void segmentArrivalWhileClosed(TCPSegment *tcpseg, IPvXAddress srcAddr, IPvXAddress destAddr);
00111 SimpleTCPConnection *createConnection(int appGateIndex, int connId);
00112 virtual void initialize(int stage);
00113 virtual void handleMessage(cMessage *msg);
00114
00115 virtual int numInitStages() const
00116 {
00117 return MAX_STAGE_UNDERLAY + 1;
00118 }
00119
00120 void finish();
00121 };
00122
00123 #endif