EMANE  1.2.1
libemane/phylayer.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 EMANEPHYLAYER_HEADER_
36 #define EMANEPHYLAYER_HEADER_
37 
38 #include "nemqueuedlayer.h"
39 
40 #include <memory>
41 
42 namespace EMANE
43 {
51  class PHYLayer : public NEMQueuedLayer
52  {
53  public:
54  PHYLayer(NEMId id,
55  NEMLayer * pImplementor,
56  PlatformServiceProvider *pPlatformService);
57 
58  ~PHYLayer();
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 
72  void setUpstreamTransport(UpstreamTransport *) override;
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 doProcessDownstreamControl(const ControlMessages &) override;
84 
85  void doProcessDownstreamPacket(DownstreamPacket &,const ControlMessages &) override;
86 
87  void doProcessUpstreamPacket(UpstreamPacket &,const ControlMessages &) override;
88 
89  void doProcessUpstreamControl(const ControlMessages &) override;
90 
91  void doProcessEvent(const EventId &, const Serialization &) override;
92 
93  void doProcessTimedEvent(TimerEventId eventId,
94  const TimePoint & expireTime,
95  const TimePoint & scheduleTime,
96  const TimePoint & fireTime,
97  const void * arg) override;
98  };
99 }
100 
101 #endif //EMANEPHYLAYER_HEADER_
std::string Serialization
Definition: serializable.h:42
Bridge for the PHY NEM layer. Decouples a PHYLayerImplementor implementation from the NEM to allow fo...
A Packet class that allows upstream processing to strip layer headers as the packet travels up the st...
PHYLayer(NEMId id, NEMLayer *pImplementor, PlatformServiceProvider *pPlatformService)
The Registrar interface provides access to all of the emulator registrars.
Definition: registrar.h:50
std::list< const ControlMessage * > ControlMessages
void postStart() override
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 start() override
Specialized packet the allows downstream processing to add layer specific headers as the packet trave...
void stop() override
void initialize(Registrar &registrar) override
std::uint16_t NEMId
Definition: types.h:52
void destroy() override
void setUpstreamTransport(UpstreamTransport *) override
void configure(const ConfigurationUpdate &update) override
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
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...
void setDownstreamTransport(DownstreamTransport *) override