DESERT 4.0.0
uwrov-module.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
44#ifndef UWROV_MODULE_H
45#define UWROV_MODULE_H
46
47#include "uwcbr-module.h"
48#include "uwrov-packet.h"
49#include "uwsmposition.h"
50
51#include <fstream>
52
53#define UWROV_DROP_REASON_UNKNOWN_TYPE \
54 "UKT"
55#define UWROV_DROP_REASON_OUT_OF_SEQUENCE \
56 "OOS"
57#define UWROV_DROP_REASON_DUPLICATED_PACKET \
58 "DPK"
59#define HDR_UWROV_MONITORING(p) (hdr_uwROV_monitoring::access(p))
60#define HDR_UWROV_CTR(p) (hdr_uwROV_ctr::access(p))
61
62class UwROVModule;
63
68class UwROVSendAckTimer : public TimerHandler
69{
70public:
72 : TimerHandler()
73 {
74 module = m;
75 }
76
77protected:
78 virtual void expire(Event *e);
79 UwROVModule *module;
80};
81
87{
88 friend class UwROVSendAckTimer;
89
90public:
95
99 virtual ~UwROVModule() = default;
100
111 virtual int command(int argc, const char *const *argv) override;
112
120 virtual void initPkt(Packet *p) override;
121
127 virtual void recv(Packet *) override;
128
135 virtual void recv(Packet *p, Handler *h) override;
136
142 static int
144 {
145 return sizeof(hdr_uwROV_monitoring);
146 }
147
153 static int
155 {
156 return sizeof(hdr_uwROV_ctr);
157 }
158
162 virtual void sendAck();
163
164protected:
166
169 int ack;
187
189 std::ofstream
191};
192
193#endif // UWROV_MODULE_H
Definition uwsmposition.h:57
Definition uwcbr-module.h:162
Definition uwrov-module.h:87
int drop_old_waypoints
Definition uwrov-module.h:174
int ackNotPgbk
Definition uwrov-module.h:172
int ack
Definition uwrov-module.h:169
virtual void sendAck()
Definition uwrov-module.cc:290
UwROVModule()
Definition uwrov-module.cc:77
static int getROVMonHeaderSize()
Definition uwrov-module.h:143
virtual ~UwROVModule()=default
int ackTimeout
Definition uwrov-module.h:176
UWSMPosition * posit
Definition uwrov-module.h:178
UWROV_ACK_POLICY ackPolicy
Definition uwrov-module.h:186
std::ofstream out_file_stats
Definition uwrov-module.h:190
virtual void recv(Packet *) override
Definition uwrov-module.cc:228
UwROVSendAckTimer ackTimer_
Definition uwrov-module.h:179
int ackPriority
Definition uwrov-module.h:171
virtual void initPkt(Packet *p) override
Definition uwrov-module.cc:192
int last_sn_confirmed
Definition uwrov-module.h:167
virtual int command(int argc, const char *const *argv) override
Definition uwrov-module.cc:104
UWROV_ACK_POLICY
Definition uwrov-module.h:165
@ ACK_PIGGYBACK
Definition uwrov-module.h:165
@ ACK_IMMEDIATELY
Definition uwrov-module.h:165
@ ACK_PGBK_OR_TO
Definition uwrov-module.h:165
int log_flag
Definition uwrov-module.h:188
static int getROVCTRHeaderSize()
Definition uwrov-module.h:154
Definition uwrov-module.h:69
virtual void expire(Event *e)
Definition uwrov-module.cc:72
UwROVSendAckTimer(UwROVModule *m)
Definition uwrov-module.h:71
Definition uwrov-packet.h:51
Definition uwrov-packet.h:109
Provides the UWCBR packets header description and the definition of the class UWCBR.
Provides both UWROV monitoring and control packets header description.
Provides the definition of the class UWSMPosition.