|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2008 Irene Ruengeler 00003 // Copyright (C) 2009 Thomas Dreibholz 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU 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 General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #ifndef __SCTPSERVER_H_ 00020 #define __SCTPSERVER_H_ 00021 00022 #include <omnetpp.h> 00023 #include "SCTPAssociation.h" 00024 #include "SCTPSocket.h" 00025 00026 00027 class INET_API SCTPServer : public cSimpleModule 00028 { 00029 protected: 00030 int32 notifications; 00031 int32 assocId; 00032 SCTPSocket *socket; 00033 double delay; 00034 double echoFactor; 00035 double delayFirstRead; 00036 bool readInt; 00037 bool schedule; 00038 bool firstData; 00039 bool shutdownReceived; 00040 uint64 bytesSent; 00041 uint64 packetsSent; 00042 uint64 packetsRcvd; 00043 int32 numSessions; 00044 uint64 numRequestsToSend; // requests to send in this session 00045 bool finishEndsSimulation; 00046 bool ordered; 00047 bool abortSent; 00048 int32 queueSize; 00049 int32 count; 00050 cMessage *timeoutMsg; 00051 cMessage *delayTimer; 00052 cMessage *delayFirstReadTimer; 00053 //cPacket* abort; 00054 int32 inboundStreams; 00055 int32 outboundStreams; 00056 int32 lastStream; 00057 typedef struct 00058 { 00059 simtime_t start; 00060 simtime_t stop; 00061 uint64 rcvdBytes; 00062 uint64 sentPackets; 00063 uint64 rcvdPackets; 00064 simtime_t lifeTime; 00065 bool abortSent; 00066 bool peerClosed; 00067 }ServerAssocStat; 00068 typedef std::map<int32,ServerAssocStat> ServerAssocStatMap; 00069 ServerAssocStatMap serverAssocStatMap; 00070 typedef std::map<int32,cOutVector*> BytesPerAssoc; 00071 BytesPerAssoc bytesPerAssoc; 00072 typedef std::map<int32,cDoubleHistogram*> HistEndToEndDelay; 00073 HistEndToEndDelay histEndToEndDelay; 00074 typedef std::map<int32,cOutVector*> EndToEndDelay; 00075 EndToEndDelay endToEndDelay; 00076 void sendOrSchedule(cPacket *msg); 00077 cPacket* makeAbortNotification(SCTPCommand* msg); 00078 cPacket* makeReceiveRequest(cPacket* msg); 00079 cPacket* makeDefaultReceive(); 00080 int32 ssn; 00081 public: 00082 ~SCTPServer(); 00083 struct pathStatus { 00084 bool active; 00085 bool primaryPath; 00086 IPAddress pid; 00087 }; 00088 00089 void initialize(); 00090 void handleMessage(cMessage *msg); 00091 void finish(); 00092 void handleTimer(cMessage *msg); 00093 void generateAndSend(); 00094 }; 00095 00096 #endif 00097 00098