A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
spectrum-error-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 CTTC
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Nicola Baldo <nbaldo@cttc.es>
7 */
8
9#ifndef SPECTRUM_ERROR_MODEL_H
10#define SPECTRUM_ERROR_MODEL_H
11
12#include "spectrum-value.h"
13
14#include <ns3/nstime.h>
15#include <ns3/object.h>
16#include <ns3/packet.h>
17#include <ns3/ptr.h>
18
19namespace ns3
20{
21
22/**
23 * \ingroup spectrum
24 *
25 */
27{
28 public:
29 /**
30 * Register this type.
31 * \return The TypeId.
32 */
33 static TypeId GetTypeId();
34 ~SpectrumErrorModel() override;
35
36 /**
37 * Start a packet reception
38 * \param p the packet
39 */
40 virtual void StartRx(Ptr<const Packet> p) = 0;
41
42 /**
43 * Evaluates a chunk
44 * \param sinr the SpectrumValue experienced by the Chunk
45 * \param duration the Chunk length
46 */
47 virtual void EvaluateChunk(const SpectrumValue& sinr, Time duration) = 0;
48
49 /**
50 * Checks if the packet being received is correct
51 * \returns true if the packet is correct.
52 */
53 virtual bool IsRxCorrect() = 0;
54};
55
56/**
57 * \ingroup spectrum
58 *
59 * This class implements the error model described in this paper:
60 * N. Baldo and M. Miozzo, "Spectrum-aware Channel and PHY layer modeling
61 * for ns3", in Proceedings of International Workshop on Network
62 * Simulation Tools (NSTOOLS 2009), 19 October 2009, Pisa (Italy).
63 */
65{
66 protected:
67 void DoDispose() override;
68
69 public:
70 /**
71 * Register this type.
72 * \return The TypeId.
73 */
74 static TypeId GetTypeId();
75 // inherited from SpectrumErrorModel
76 void StartRx(Ptr<const Packet> p) override;
77 void EvaluateChunk(const SpectrumValue& sinr, Time duration) override;
78 bool IsRxCorrect() override;
79
80 private:
81 uint32_t m_bytes; //!< Length of the packet being received
82 uint32_t m_deliverableBytes; //!< Bytes that can be received according to the Shnanon's formula
83};
84
85} // namespace ns3
86
87#endif /* SPECTRUM_ERROR_MODEL_H */
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
This class implements the error model described in this paper: N.
void StartRx(Ptr< const Packet > p) override
Start a packet reception.
uint32_t m_bytes
Length of the packet being received.
void EvaluateChunk(const SpectrumValue &sinr, Time duration) override
Evaluates a chunk.
bool IsRxCorrect() override
Checks if the packet being received is correct.
uint32_t m_deliverableBytes
Bytes that can be received according to the Shnanon's formula.
static TypeId GetTypeId()
Register this type.
void DoDispose() override
Destructor implementation.
virtual void StartRx(Ptr< const Packet > p)=0
Start a packet reception.
static TypeId GetTypeId()
Register this type.
virtual bool IsRxCorrect()=0
Checks if the packet being received is correct.
virtual void EvaluateChunk(const SpectrumValue &sinr, Time duration)=0
Evaluates a chunk.
Set of values corresponding to a given SpectrumModel.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.