DESERT 3.5.1
Loading...
Searching...
No Matches
uwPosBasedRt.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
39#ifndef UW_POS_BASED_RT_H
40#define UW_POS_BASED_RT_H
41
42#define DROP_NEXT_HOP_NOT_FOUND \
43 "NNF"
44#define DROP_IP_NOT_SET \
45 "INS"
46
47#define pi (4 * atan(1.0))
48
49#include <module.h>
50#include <utility>
51#include "uwip-module.h"
52#include "uwPosBasedRt-hdr.h"
53#include "node-core.h"
54#include "uwsmposition.h"
55#include "uwPosEstimation.h"
56#include <map>
57#include <list>
58#include <tclcl.h>
59
60class UwPosBasedRt : public Module
61{
62public:
67
71 virtual ~UwPosBasedRt();
72
73protected:
84 virtual int command(int, const char *const *);
85
91 virtual void recv(Packet* p);
92
98 virtual void initPkt(Packet* p);
99
100
106 virtual void updatePosInfo(Packet* p);
107
113 virtual uint8_t findNextHop(const Packet* p);
114
122 virtual void addRoute(
123 const uint8_t &dst, const uint8_t &next, const int toFixedNode);
124
130 virtual void setMaxTxRange(double newRange);
131
132private:
139 virtual double nodesDistance(Position& p1, Position& p2);
140
141
142 uint8_t ipAddr;
143
144 double timestamp;
146 double ROV_speed;
147 double maxTxRange;
150 Position node_pos;
152 std::map<uint8_t, uint8_t> static_routing;
155 std::map<uint8_t,UwPosEstimation> ROV_routing;
157 int debug_;
159};
160
161#endif //UW_POS_BASED_RT_H
virtual int command(int, const char *const *)
TCL command interpreter.
double ROV_speed
Last known ROV speed.
virtual ~UwPosBasedRt()
Destructor of UwPosBasedRt class.
virtual void recv(Packet *p)
Performs the reception of packets from upper and lower layers.
virtual void setMaxTxRange(double newRange)
Set maximum transmission range.
virtual void addRoute(const uint8_t &dst, const uint8_t &next, const int toFixedNode)
Add new entry to the routing table.
double maxTxRange
Maximum transmission range, in meters, for this node.
std::map< uint8_t, uint8_t > static_routing
Routing table: destination - next hop.
virtual uint8_t findNextHop(const Packet *p)
Find next hop of a packet passed as input.
virtual void updatePosInfo(Packet *p)
update informations regardin position, if needed
double timestamp
Timestamp for the validity of last received ROV position.
Position node_pos
Position of this node.
UwPosBasedRt()
Constructor of UwPosBasedRt class.
int debug_
Flag to enable or disable dirrefent levels of debug.
std::map< uint8_t, UwPosEstimation > ROV_routing
Rouitng table for ROV.
virtual void initPkt(Packet *p)
Initialize field of hdr_uwpos_based_rt
virtual double nodesDistance(Position &p1, Position &p2)
Compute absoulute distance between 2 nodes.
Provides the header description for UwPosBasedRt packets.
Estimate position given initial point, end point and time.
Provides the UWIP packets header description. Definition of the class that define the network layer.
Provides the definition of the class UWSMPosition.