EMANE  1.0.1
basemodelimpl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016 - Adjacent Link LLC, Bridgewater, New Jersey
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  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  * * Neither the name of Adjacent Link LLC nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef EMANETDMABASEMODELIMPL_HEADER_
34 #define EMANETDMABASEMODELIMPL_HEADER_
35 
36 #include "emane/maclayerimpl.h"
42 
44 #include "receivemanager.h"
47 
48 namespace EMANE
49 {
50  namespace Models
51  {
52  namespace TDMA
53  {
60  public SchedulerUser
61  {
62  public:
64  PlatformServiceProvider *pPlatformServiceProvider,
65  RadioServiceProvider * pRadioServiceProvider,
66  Scheduler * pScheduler,
67  QueueManager * pQueueManager,
68  MACLayerImplementor * pRadioModel);
69 
71 
72  void initialize(Registrar & registrar) override;
73 
74  void configure(const ConfigurationUpdate & update) override;
75 
76  void start() override;
77 
78  void postStart() override;
79 
80  void stop() override;
81 
82  void destroy() throw() override;
83 
84  void processUpstreamControl(const ControlMessages & msgs) override;
85 
86 
87  void processUpstreamPacket(const CommonMACHeader & hdr,
88  UpstreamPacket & pkt,
89  const ControlMessages & msgs) override;
90 
91  void processDownstreamControl(const ControlMessages & msgs) override;
92 
93 
95  const ControlMessages & msgs) override;
96 
97 
98  void processEvent(const EventId &, const Serialization &) override;
99 
100  void processConfiguration(const ConfigurationUpdate & update) override;
101 
102  void notifyScheduleChange(const Frequencies & frequencies,
103  std::uint64_t u64BandwidthHz,
104  const Microseconds & slotDuration,
105  const Microseconds & slotOverhead) override;
106 
107 
108  void processSchedulerPacket(DownstreamPacket & pkt) override;
109 
110  void processSchedulerControl(const ControlMessages & msgs) override;
111 
112  QueueInfos getPacketQueueInfo() const override;
113 
114  private:
115  std::unique_ptr<Scheduler> pScheduler_;
116  std::unique_ptr<QueueManager> pQueueManager_;
117  MACLayerImplementor * pRadioModel_;
118 
119  bool bFlowControlEnable_;
120  std::uint16_t u16FlowControlTokens_;
121  std::string sPCRCurveURI_;
122  TimerEventId transmitTimedEventId_;
123  TxSlotInfo pendingTxSlotInfo_;
124  TimePoint nextMultiFrameTime_;
125  TxSlotInfos txSlotInfos_;
126  Microseconds slotDuration_;
127  Microseconds slotOverhead_;
128  SlotStatusTablePublisher slotStatusTablePublisher_;
129  std::uint64_t u64SequenceNumber_;
130  Frequencies frequencies_;
131  std::uint64_t u64BandwidthHz_;
132  Microseconds neighborMetricUpdateInterval_;
133  PacketStatusPublisherImpl packetStatusPublisher_;
134  NeighborMetricManager neighborMetricManager_;
135  ReceiveManager receiveManager_;
136  FlowControlManager flowControlManager_;
137  std::uint64_t u64ScheduleIndex_;
138  AggregationStatusPublisher aggregationStatusPublisher_;
139 
140  void sendDownstreamPacket(double dSlotRemainingRatio);
141 
142  void processTxOpportunity(std::uint64_t u64ScheduleIndex);
143  };
144  }
145  }
146 }
147 
148 #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