EMANE  1.2.1
basemodelimpl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016,2018 - Adjacent Link LLC, Bridgewater,
3  * New Jersey
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of Adjacent Link LLC nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef EMANETDMABASEMODELIMPL_HEADER_
35 #define EMANETDMABASEMODELIMPL_HEADER_
36 
37 #include "emane/maclayerimpl.h"
43 
45 #include "receivemanager.h"
48 
49 namespace EMANE
50 {
51  namespace Models
52  {
53  namespace TDMA
54  {
61  public SchedulerUser
62  {
63  public:
65  PlatformServiceProvider *pPlatformServiceProvider,
66  RadioServiceProvider * pRadioServiceProvider,
67  Scheduler * pScheduler,
68  QueueManager * pQueueManager,
69  MACLayerImplementor * pRadioModel);
70 
72 
73  void initialize(Registrar & registrar) override;
74 
75  void configure(const ConfigurationUpdate & update) override;
76 
77  void start() override;
78 
79  void postStart() override;
80 
81  void stop() override;
82 
83  void destroy() throw() override;
84 
85  void processUpstreamControl(const ControlMessages & msgs) override;
86 
87 
88  void processUpstreamPacket(const CommonMACHeader & hdr,
89  UpstreamPacket & pkt,
90  const ControlMessages & msgs) override;
91 
92  void processDownstreamControl(const ControlMessages & msgs) override;
93 
94 
96  const ControlMessages & msgs) override;
97 
98 
99  void processEvent(const EventId &, const Serialization &) override;
100 
101  void processConfiguration(const ConfigurationUpdate & update) override;
102 
103  void notifyScheduleChange(const Frequencies & frequencies,
104  std::uint64_t u64BandwidthHz,
105  const Microseconds & slotDuration,
106  const Microseconds & slotOverhead) override;
107 
108 
109  void processSchedulerPacket(DownstreamPacket & pkt) override;
110 
111  void processSchedulerControl(const ControlMessages & msgs) override;
112 
113  QueueInfos getPacketQueueInfo() const override;
114 
115  private:
116  std::unique_ptr<Scheduler> pScheduler_;
117  std::unique_ptr<QueueManager> pQueueManager_;
118  MACLayerImplementor * pRadioModel_;
119 
120  bool bFlowControlEnable_;
121  std::uint16_t u16FlowControlTokens_;
122  std::string sPCRCurveURI_;
123  TimerEventId transmitTimedEventId_;
124  TxSlotInfo pendingTxSlotInfo_;
125  TimePoint nextMultiFrameTime_;
126  TxSlotInfos txSlotInfos_;
127  Microseconds slotDuration_;
128  Microseconds slotOverhead_;
129  SlotStatusTablePublisher slotStatusTablePublisher_;
130  std::uint64_t u64SequenceNumber_;
131  Frequencies frequencies_;
132  std::uint64_t u64BandwidthHz_;
133  Microseconds neighborMetricUpdateInterval_;
134  PacketStatusPublisherImpl packetStatusPublisher_;
135  NeighborMetricManager neighborMetricManager_;
136  ReceiveManager receiveManager_;
137  FlowControlManager flowControlManager_;
138  std::uint64_t u64ScheduleIndex_;
139  AggregationStatusPublisher aggregationStatusPublisher_;
140 
141  void sendDownstreamPacket(double dSlotRemainingRatio);
142 
143  void processTxOpportunity(std::uint64_t u64ScheduleIndex);
144 
145  double slotPortionRatio(const TimePoint & current,
146  const TimePoint & slotTime);
147  };
148  }
149  }
150 }
151 
152 #endif // EMANETDMABASEMODELIMPL_HEADER_
void processSchedulerPacket(DownstreamPacket &pkt) override
std::string Serialization
Definition: serializable.h:42
A Packet class that allows upstream processing to strip layer headers as the packet travels up the st...
The Registrar interface provides access to all of the emulator registrars.
Definition: registrar.h:50
Implementation(NEMId id, PlatformServiceProvider *pPlatformServiceProvider, RadioServiceProvider *pRadioServiceProvider, Scheduler *pScheduler, QueueManager *pQueueManager, MACLayerImplementor *pRadioModel)
Flow Control Manager (token producer) side.
std::list< const ControlMessage * > ControlMessages
void initialize(Registrar &registrar) override
std::uint16_t EventId
Definition: types.h:53
The PlatformServiceProvider interface provides access to emulator services.
void processConfiguration(const ConfigurationUpdate &update) override
std::vector< QueueInfo > QueueInfos
void processDownstreamPacket(DownstreamPacket &pkt, const ControlMessages &msgs) override
Specialized packet the allows downstream processing to add layer specific headers as the packet trave...
std::set< std::uint64_t > Frequencies
std::chrono::microseconds Microseconds
Definition: types.h:45
std::uint16_t NEMId
Definition: types.h:52
Transmit slot information.
The RadioServiceProvider interface provides access to radio (RF) model specific services.
Aggregation statistic and statistic table status publisher.
void processDownstreamControl(const ControlMessages &msgs) override
Interface used by a scheduler module to communicate information with BaseModel.
Definition: scheduleruser.h:52
Scheduler interface used by BaseModel to communicate with a scheduler module.
Definition: scheduler.h:56
void configure(const ConfigurationUpdate &update) override
Queue management interface used by BaseModel
Definition: queuemanager.h:57
Manages all receive side message processing.
std::vector< ConfigurationNameAnyValues > ConfigurationUpdate
void notifyScheduleChange(const Frequencies &frequencies, std::uint64_t u64BandwidthHz, const Microseconds &slotDuration, const Microseconds &slotOverhead) override
Implementation of PacketStatusPublisher.
std::size_t TimerEventId
Definition: types.h:54
void processSchedulerControl(const ControlMessages &msgs) override
QueueInfos getPacketQueueInfo() const override
Clock::time_point TimePoint
Definition: types.h:50
std::list< TxSlotInfo > TxSlotInfos
Definition: agent.h:43
void processUpstreamPacket(const CommonMACHeader &hdr, UpstreamPacket &pkt, const ControlMessages &msgs) override
Slot statistic and statistic table status publisher.
void processUpstreamControl(const ControlMessages &msgs) override
Manages neighbor metrics and sends neighbor metric control message upstream.
void processEvent(const EventId &, const Serialization &) override
Interface used to create a MAC layer plugin implementation.
Definition: maclayerimpl.h:48