EMANE  1.2.1
basemodel.cc
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 
34 #include "basemodelimpl.h"
35 
37  PlatformServiceProvider * pPlatformServiceProvider,
38  RadioServiceProvider * pRadioServiceProvider,
39  Scheduler * pScheduler,
40  QueueManager * pQueueManager):
41  MACLayerImplementor{id, pPlatformServiceProvider, pRadioServiceProvider},
42  pImpl_{new Implementation{id,
43  pPlatformServiceProvider,
44  pRadioServiceProvider,
45  pScheduler,
46  pQueueManager,
47  this}}
48 {}
49 
50 
51 
53 {}
54 
55 
56 void
58 {
59  pImpl_->initialize(registrar);
60 }
61 
62 
63 
64 void
66 {
67  pImpl_->configure(update);
68 }
69 
70 void
72 {
73  pImpl_->start();
74 }
75 
76 
77 void
79 {
80  pImpl_->postStart();
81 }
82 
83 
84 void
86 {
87  pImpl_->stop();
88 }
89 
90 
91 
92 void
94  throw()
95 {
96  pImpl_->destroy();
97 }
98 
100 {
101  pImpl_->processUpstreamControl(msgs);
102 }
103 
104 
106  UpstreamPacket & pkt,
107  const ControlMessages & msgs)
108 {
109  pImpl_->processUpstreamPacket(hdr,pkt,msgs);
110 }
111 
113 {
114  pImpl_->processDownstreamControl(msgs);
115 }
116 
117 
119  const ControlMessages & msgs)
120 {
121  pImpl_->processDownstreamPacket(pkt,msgs);
122 }
123 
124 
126  const Serialization & serialization)
127 {
128  pImpl_->processEvent(eventId,serialization);
129 }
130 
131 
133 {
134  pImpl_->processConfiguration(update);
135 }
136 
138  std::uint64_t u64BandwidthHz,
139  const Microseconds & slotDuration,
140  const Microseconds & slotOverhead)
141 {
142  pImpl_->notifyScheduleChange(frequencies,u64BandwidthHz,slotDuration,slotOverhead);
143 }
144 
145 
147 {
148  pImpl_->processSchedulerPacket(pkt);
149 }
150 
151 
153 {
154  pImpl_->processSchedulerControl(msgs);
155 }
156 
157 
159 {
160  return pImpl_->getPacketQueueInfo();
161 }
void initialize(Registrar &registrar) override
Definition: basemodel.cc:57
void processDownstreamControl(const ControlMessages &msgs) override
Definition: basemodel.cc:112
std::string Serialization
Definition: serializable.h:42
QueueInfos getPacketQueueInfo() const override
Definition: basemodel.cc:158
A Packet class that allows upstream processing to strip layer headers as the packet travels up the st...
void processConfiguration(const ConfigurationUpdate &update) override
Definition: basemodel.cc:132
The Registrar interface provides access to all of the emulator registrars.
Definition: registrar.h:50
std::list< const ControlMessage * > ControlMessages
void processUpstreamControl(const ControlMessages &msgs) override
Definition: basemodel.cc:99
std::uint16_t EventId
Definition: types.h:53
The PlatformServiceProvider interface provides access to emulator services.
void processEvent(const EventId &, const Serialization &) override
Definition: basemodel.cc:125
void configure(const ConfigurationUpdate &update) override
Definition: basemodel.cc:65
std::vector< QueueInfo > QueueInfos
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
void notifyScheduleChange(const Frequencies &frequencies, std::uint64_t u64BandwidthHz, const Microseconds &slotDuration, const Microseconds &slotOverhead) override
Definition: basemodel.cc:137
void processSchedulerControl(const ControlMessages &msgs) override
Definition: basemodel.cc:152
The RadioServiceProvider interface provides access to radio (RF) model specific services.
Scheduler interface used by BaseModel to communicate with a scheduler module.
Definition: scheduler.h:56
Queue management interface used by BaseModel
Definition: queuemanager.h:57
std::vector< ConfigurationNameAnyValues > ConfigurationUpdate
void processDownstreamPacket(DownstreamPacket &pkt, const ControlMessages &msgs) override
Definition: basemodel.cc:118
void processUpstreamPacket(const CommonMACHeader &hdr, UpstreamPacket &pkt, const ControlMessages &msgs) override
Definition: basemodel.cc:105
void processSchedulerPacket(DownstreamPacket &pkt) override
Definition: basemodel.cc:146
BaseModel(NEMId id, PlatformServiceProvider *pPlatformServiceProvider, RadioServiceProvider *pRadioServiceProvider, Scheduler *pScheduler, QueueManager *pQueueManager)
Definition: basemodel.cc:36
Interface used to create a MAC layer plugin implementation.
Definition: maclayerimpl.h:48