OverSim
SimpleUDP.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2000 Institut fuer Telematik, Universitaet Karlsruhe
3 // Copyright (C) 2004,2005 Andras Varga
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 
25 //
26 // Author: Jochen Reber
27 // Rewrite: Andras Varga 2004,2005
28 // Modifications: Stephan Krause, Bernhard Mueller
29 //
30 
31 #ifndef __SIMPLEUDP_H__
32 #define __SIMPLEUDP_H__
33 
34 #include <map>
35 #include <list>
36 
37 #include <InitStages.h>
38 #include <UDP.h>
39 
40 #include "UDPControlInfo_m.h"
41 
42 class GlobalNodeList;
43 class SimpleNodeEntry;
44 class GlobalStatistics;
45 
46 class IPControlInfo;
47 class IPv6ControlInfo;
48 class ICMP;
49 class ICMPv6;
50 class UDPPacket;
51 
52 const int IPv6_HEADER_BYTES = 40;
53 
59 class SimpleUDP : public UDP
60 {
61 public:
62 
63  // delay fault type string and corresponding map for switch..case
64  static std::string delayFaultTypeString;
70  };
71  static std::map<std::string, delayFaultTypeNum> delayFaultTypeMap;
72 
73 protected:
74 
75  // statistics
79  simtime_t delay;
81  simtime_t constantDelay;
83  double jitter;
84  bool enableAccessRouterTxQueue; /* model the tx queue of the access router of an destination node */
85  bool faultyDelay;
90 public:
96  void setNodeEntry(SimpleNodeEntry* entry);
97 
98 protected:
102  void updateDisplayString();
103 
109  virtual void processMsgFromApp(cPacket *appData);
110 
111  // process UDP packets coming from IP
112  virtual void processUDPPacket(cPacket *udpPacket);
113 
114  virtual void processUndeliverablePacket(cPacket *udpPacket, cPolymorphic *ctrl);
115  virtual void sendUp(cPacket *payload, UDPControlInfo *ctrl, SockDesc *sd);
116 
117 public:
118  SimpleUDP();
119 
121  virtual ~SimpleUDP();
122 
123 protected:
129  virtual void initialize(int stage);
130 
131  virtual void handleMessage(cMessage *msg);
132 
138  virtual int numInitStages() const
139  {
140  return MAX_STAGE_UNDERLAY + 1;
141  }
142 
143  void finish();
144 };
145 
146 #endif
147