DESERT 4.0.0
uwflooding.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29
40#ifndef UWFLOODING_H
41#define UWFLOODING_H
42
43#define TTL_EQUALS_TO_ZERO \
44 "TEZ"
46#include "uwflooding-hdr.h"
47
48#include <uwcbr-module.h>
49#include <uwip-clmsg.h>
50#include <uwip-module.h>
51
52#include "mphy.h"
53#include "packet.h"
54#include <module.h>
55#include <tclcl.h>
56
57#include <cmath>
58#include <ctime>
59#include <fstream>
60#include <iostream>
61#include <limits>
62#include <list>
63#include <map>
64#include <rng.h>
65#include <sstream>
66#include <string>
67#include <vector>
68
72class UwFlooding : public Module
73{
74
75public:
79 UwFlooding();
80
84 virtual ~UwFlooding();
85
86protected:
87 /*****************************
88 | Internal Functions |
89 *****************************/
100 virtual int command(int, const char *const *);
101
107 virtual void recv(Packet *);
108
116 virtual int recvSyncClMsg(ClMessage *);
117
126 virtual int recvAsyncClMsg(ClMessage *);
127
135 static nsaddr_t str2addr(const char *);
136
142 virtual void writePathInTrace(const Packet *, const string &);
143
151 static string printIP(const nsaddr_t &);
152
153private:
154 // Variables
155
156 uint8_t ipAddr_;
157 int ttl_;
169 ostringstream osstream_;
171 typedef std::map<uint16_t, double> map_packets;
174 typedef std::map<uint8_t, map_packets>
180 std::map<uint16_t, uint8_t>
190
198 uint8_t getTTL(Packet *p) const;
199};
200
201#endif // UWFLOODING_H
Definition uwflooding.h:73
std::map< uint16_t, double > map_packets
Definition uwflooding.h:171
static nsaddr_t str2addr(const char *)
UwFlooding()
Definition uwflooding.cpp:78
uint8_t ipAddr_
Definition uwflooding.h:156
long packets_forwarded_
Definition uwflooding.h:161
static string printIP(const nsaddr_t &)
Definition uwflooding.cpp:423
std::map< uint8_t, map_packets > map_forwarded_packets
Definition uwflooding.h:175
virtual int command(int, const char *const *)
Definition uwflooding.cpp:110
std::map< uint16_t, uint8_t > ttl_traffic_map
Definition uwflooding.h:181
virtual int recvAsyncClMsg(ClMessage *)
Definition uwflooding.cpp:104
virtual void recv(Packet *)
Definition uwflooding.cpp:155
ofstream trace_file_path_
Definition uwflooding.h:167
double maximum_cache_time_
Definition uwflooding.h:158
uint8_t getTTL(Packet *p) const
Definition uwflooding.cpp:379
char * trace_file_path_name_
Definition uwflooding.h:164
virtual ~UwFlooding()
Definition uwflooding.cpp:93
UwFlooding(const UwFlooding &)
int optimize_
Definition uwflooding.h:159
bool trace_path_
Definition uwflooding.h:162
virtual int recvSyncClMsg(ClMessage *)
Definition uwflooding.cpp:98
virtual void writePathInTrace(const Packet *, const string &)
Definition uwflooding.cpp:390
ostringstream osstream_
Definition uwflooding.h:169
map_forwarded_packets my_forwarded_packets_
Definition uwflooding.h:178
int ttl_
Definition uwflooding.h:157
Provides the UWCBR packets header description and the definition of the class UWCBR.
Cross layer messages definition for the UWIP Module.
Provides the UWIP packets header description. Definition of the class that define the network layer.