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
00019
00026 #ifndef __SIMPLENODEENTRY_H
00027 #define __SIMPLENODEENTRY_H
00028
00029
00030 #include <omnetpp.h>
00031 #include <IPvXAddress.h>
00032
00033 #include "UDPPacket_m.h"
00034 #include "TCPSegment.h"
00035
00036
00037 class NodeRecord
00038 {
00039 public:
00040
00041 NodeRecord();
00042 ~NodeRecord();
00043 NodeRecord(const NodeRecord& nodeRecord);
00044 NodeRecord& operator=(const NodeRecord& nodeRecord);
00045 void debugOutput(int dim);
00046
00047 double* coords;
00048
00049 static uint8_t dim;
00050 static void setDim(uint8_t dimension) { dim = dimension; };
00051 uint8_t getDim() const { return dim; };
00052 };
00053
00059 class SimpleNodeEntry : public cPolymorphic
00060 {
00061 public:
00062
00063 ~SimpleNodeEntry()
00064 {
00065 if (index == -1) delete nodeRecord;
00066 }
00067
00077 SimpleNodeEntry(cModule* node, cChannelType* typeRx, cChannelType* typeTx,
00078 uint32_t sendQueueLength, uint32_t fieldSize);
00079
00090 SimpleNodeEntry(cModule* node, cChannelType* typeRx, cChannelType* typeTx,
00091 uint32_t sendQueueLength, NodeRecord* nodeRecord,
00092 int index);
00093
00099 inline cGate* getUdpIPv4Gate() const
00100 {
00101 return UdpIPv4ingate;
00102 };
00103
00109 inline cGate* getUdpIPv6Gate() const
00110 {
00111 return UdpIPv6ingate;
00112 };
00113
00119 inline cGate* getTcpIPv4Gate() const
00120 {
00121 return TcpIPv4ingate;
00122 };
00123
00129 inline cGate* getTcpIPv6Gate() const
00130 {
00131 return TcpIPv6ingate;
00132 };
00133
00134 typedef std::pair<simtime_t, bool> SimpleDelay;
00135
00144 SimpleDelay calcDelay(cPacket* msg,
00145 const SimpleNodeEntry& dest,
00146 bool faultyDelay = false);
00147
00153 std::string info() const;
00154
00162 friend std::ostream& operator<<(std::ostream& out, const SimpleNodeEntry& entry);
00163
00164 simtime_t getAccessDelay() const { return tx.accessDelay; };
00165
00166 simtime_t getTxAccessDelay() const { return tx.accessDelay; };
00167 simtime_t getRxAccessDelay() const { return rx.accessDelay; };
00168
00169
00170 float getBandwidth() const { return tx.bandwidth; };
00171
00172 float getTxBandwidth() const { return tx.bandwidth; };
00173 float getRxBandwidth() const { return rx.bandwidth; };
00174
00175 float getErrorRate() const { return tx.errorRate; };
00176
00177 inline float getX() const { return nodeRecord->coords[0]; };
00178 inline float getY() const { return nodeRecord->coords[1]; };
00179 inline float getCoords(int dim) const { return nodeRecord->coords[dim]; };
00180 inline uint8_t getDim() const { return nodeRecord->getDim(); };
00181
00182 int getRecordIndex() const { return index; };
00183 NodeRecord* getNodeRecord() const { return nodeRecord; };
00184
00190 static simtime_t getFaultyDelay(simtime_t oldDelay);
00191
00192
00193 protected:
00194
00201 float operator-(const SimpleNodeEntry& entry) const;
00202
00203 cGate* UdpIPv4ingate;
00204 cGate* UdpIPv6ingate;
00205 cGate* TcpIPv4ingate;
00206 cGate* TcpIPv6ingate;
00207
00208 struct Channel {
00209 simtime_t finished;
00210 simtime_t maxQueueTime;
00211 simtime_t accessDelay;
00212 double bandwidth;
00213 double errorRate;
00214 } rx, tx;
00215
00216 NodeRecord* nodeRecord;
00217 int index;
00218 };
00219
00220
00221 #endif // __SIMPLENODEENTRY_H