DESERT 4.0.0
uw-cs-burst.h
Go to the documentation of this file.
1//
2// Copyright (c) 2025 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
45#ifndef UWCSBURST_H
46#define UWCSBURST_H
47
48#include <deque>
49#include <mmac.h>
50
51class UwCsBurst;
52
58class UwSensingTimer : public TimerHandler
59{
60
61public:
67 : TimerHandler()
68 {
69 assert(m != NULL);
70 module_ = m;
71 }
72
73 ~UwSensingTimer() = default;
74
75protected:
80 virtual void expire(Event *e);
81
83};
84
88class UwCsBurst : public MMac
89{
90
91 friend class UwSensingTimer;
92
93public:
97 UwCsBurst();
98
102 virtual ~UwCsBurst() = default;
103
104protected:
108 virtual void txData();
109
113 virtual void sensingExpired();
114
118 virtual void sensing();
119
125 virtual void recvFromUpperLayers(Packet *p) override;
126
132 virtual void Phy2MacEndRx(Packet *p) override;
133
139 virtual void Phy2MacStartRx(const Packet *p) override;
140
146 virtual void Mac2PhyStartTx(Packet *p);
147
153 virtual void Phy2MacEndTx(const Packet *p) override;
154
160 virtual void rxPacketNotForMe(Packet *p);
161
167 virtual void initPkt(Packet *p);
168
178 virtual int command(int argc, const char *const *argv) override;
179
184
189 std::deque<Packet *> buffer_;
195 uint n_rx_while_sensing_; /*< Number of rx packets while channel sensing. */
196};
197
198#endif
Definition uw-cs-burst.h:89
virtual void sensingExpired()
Definition uw-cs-burst.cpp:159
uint n_rx_while_sensing_
Definition uw-cs-burst.h:195
UWCS_STATUS
Definition uw-cs-burst.h:183
double rv_sens_time_
Definition uw-cs-burst.h:187
virtual void initPkt(Packet *p)
Definition uw-cs-burst.cpp:287
virtual void recvFromUpperLayers(Packet *p) override
Definition uw-cs-burst.cpp:113
double fix_sens_time_
Definition uw-cs-burst.h:186
UwCsBurst()
Definition uw-cs-burst.cpp:75
virtual void Phy2MacStartRx(const Packet *p) override
Definition uw-cs-burst.cpp:240
uint packet_sent_curr_burst_
Definition uw-cs-burst.h:193
UwSensingTimer sensing_timer_
Definition uw-cs-burst.h:188
virtual ~UwCsBurst()=default
uint max_packet_per_burst_
Definition uw-cs-burst.h:191
std::deque< Packet * > buffer_
Definition uw-cs-burst.h:189
virtual int command(int argc, const char *const *argv) override
Definition uw-cs-burst.cpp:301
UWCS_STATUS tx_status_
Definition uw-cs-burst.h:185
virtual void txData()
Definition uw-cs-burst.cpp:186
virtual void Mac2PhyStartTx(Packet *p)
Definition uw-cs-burst.cpp:218
virtual void rxPacketNotForMe(Packet *p)
Definition uw-cs-burst.cpp:294
virtual void Phy2MacEndRx(Packet *p) override
Definition uw-cs-burst.cpp:250
uint max_queue_size_
Definition uw-cs-burst.h:190
virtual void Phy2MacEndTx(const Packet *p) override
Definition uw-cs-burst.cpp:228
virtual void sensing()
Definition uw-cs-burst.cpp:135
Definition uw-cs-burst.h:59
UwCsBurst * module_
Definition uw-cs-burst.h:82
UwSensingTimer(UwCsBurst *m)
Definition uw-cs-burst.h:66
virtual void expire(Event *e)
Definition uw-cs-burst.cpp:44
~UwSensingTimer()=default