EMANE  1.2.1
libemane/maclayer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2014,2016 - Adjacent Link LLC, Bridgewater,
3  * New Jersey
4  * Copyright (c) 2008 - DRS CenGen, LLC, Columbia, Maryland
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of DRS CenGen, LLC nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef EMANEMACLAYER_HEADER_
36 #define EMANEMACLAYER_HEADER_
37 
38 #include "nemqueuedlayer.h"
39 
40 #include <memory>
41 
42 namespace EMANE
43 {
51  class MACLayer : public NEMQueuedLayer
52  {
53  public:
54  MACLayer(NEMId id,
55  NEMLayer * pImplementor,
56  PlatformServiceProvider *pPlatformService);
57 
58  ~MACLayer();
59 
60  void initialize(Registrar & registrar) override;
61 
62  void configure(const ConfigurationUpdate & update) override;
63 
64  void start() override;
65 
66  void postStart() override;
67 
68  void stop() override;
69 
70  void destroy() throw() override;
71 
73 
75 
76  private:
77  std::unique_ptr<NEMLayer> pImplementor_;
78 
79  std::unique_ptr<PlatformServiceProvider> pPlatformService_;
80 
81  void doProcessConfiguration(const ConfigurationUpdate &) override;
82 
83  void doProcessUpstreamControl(const ControlMessages &) override;
84 
85  void doProcessUpstreamPacket(UpstreamPacket &,
86  const ControlMessages &) override;
87 
88  void doProcessDownstreamControl(const ControlMessages &) override;
89 
90  void doProcessDownstreamPacket(DownstreamPacket &,
91  const ControlMessages &) override;
92 
93  void doProcessEvent(const EventId &, const Serialization &) override;
94 
95  void doProcessTimedEvent(TimerEventId eventId,
96  const TimePoint & expireTime,
97  const TimePoint & scheduleTime,
98  const TimePoint & fireTime,
99  const void * arg) override;
100  };
101 }
102 
103 #endif //EMANEMACLAYER_HEADER_
void initialize(Registrar &registrar) override
std::string Serialization
Definition: serializable.h:42
void postStart() override
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
void setDownstreamTransport(DownstreamTransport *) override
MACLayer(NEMId id, NEMLayer *pImplementor, PlatformServiceProvider *pPlatformService)
std::list< const ControlMessage * > ControlMessages
Base class for NEMLayer containers. Builders construct NEMLayer objects to contain derived instances ...
Definition: nemlayer.h:57
std::uint16_t EventId
Definition: types.h:53
The PlatformServiceProvider interface provides access to emulator services.
void setUpstreamTransport(UpstreamTransport *) override
Bridge for the MAC NEM layer. Decouples a MACLayerImplementor implementation from the NEM to allow fo...
Specialized packet the allows downstream processing to add layer specific headers as the packet trave...
void destroy() override
void configure(const ConfigurationUpdate &update) override
std::uint16_t NEMId
Definition: types.h:52
std::vector< ConfigurationNameAnyValues > ConfigurationUpdate
UpstreamTransport allows for processing upstream data and control messages. Upstream packets and cont...
std::size_t TimerEventId
Definition: types.h:54
Clock::time_point TimePoint
Definition: types.h:50
void stop() override
void start() override
DownstreamTransport allows for processing downstream data and control messages.
Definition: agent.h:43
A layer stack with a porcessing queue between each layer to decouple to intra queue processing...