EMANE  1.2.1
eventscheduler.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 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 EMANETDMARADIOMODELEVENTSCHEDULER_HEADER_
34 #define EMANETDMARADIOMODELEVENTSCHEDULER_HEADER_
35 
37 #include "emane/events/slotinfo.h"
39 #include "emane/statisticnumeric.h"
40 #include "eventtablepublisher.h"
41 #include "slotter.h"
42 
43 namespace EMANE
44 {
45  namespace Models
46  {
47  namespace TDMA
48  {
56  class EventScheduler : public Scheduler
57  {
58  public:
60  PlatformServiceProvider * pPlatformServiceProvider,
61  SchedulerUser * pSchedulerUser);
62 
64 
65  void initialize(Registrar & registrar) override;
66 
67  void configure(const ConfigurationUpdate & update) override;
68 
69  void start() override;
70 
71  void postStart() override;
72 
73  void stop() override;
74 
75  void destroy() throw() override;
76 
77  void processEvent(const EventId & eventId,
78  const Serialization & serialization) override;
79 
80  std::pair<RxSlotInfo,bool> getRxSlotInfo(const TimePoint & timePoint) const override;
81 
82  std::pair<TxSlotInfos,TimePoint> getTxSlotInfo(const TimePoint & timePoint,
83  int multiframes) const override;
84 
85  SlotInfo getSlotInfo(std::uint64_t u64AbsoluteSlotIndex) const override;
86 
87  SlotInfo getSlotInfo(const TimePoint & timePoint) const override;
88 
90  const PacketMetaInfo & packetMetaInfo) override;
91 
92  void processPacketMetaInfo(const PacketMetaInfo & packetMetaInfo) override;
93 
94  private:
95  Events::SlotInfos slotInfos_;
96  Events::SlotStructure structure_;
97  EventTablePublisher eventTablePublisher_;
98  Slotter slotter_;
99  mutable bool bWaitingFirstTxSlotInfoRequest_;
100  Frequencies frequencies_;
101  StatisticNumeric<std::uint64_t> * pNumScheduleRejectSlotIndexOutOfRange_;
102  StatisticNumeric<std::uint64_t> * pNumScheduleRejectFrameIndexOutOfRange_;
103  StatisticNumeric<std::uint64_t> * pNumScheduleRejectUpdateBeforeFull_;
104  StatisticNumeric<std::uint64_t> * pNumScheduleRejectOther_;
105  StatisticNumeric<std::uint64_t> * pNumScheduleFullAccept_;
106  StatisticNumeric<std::uint64_t> * pNumScheduleUpdateAccept_;
107 
108  void flushSchedule();
109  };
110  }
111  }
112 }
113 
114 #endif // EMANETDMARADIOMODELEVENTSCHEDULER_HEADER_
void configure(const ConfigurationUpdate &update) override
std::pair< TxSlotInfos, TimePoint > getTxSlotInfo(const TimePoint &timePoint, int multiframes) const 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...
Helper class used to manipulate slot structure elements.
Definition: slotter.h:49
The Registrar interface provides access to all of the emulator registrars.
Definition: registrar.h:50
std::pair< RxSlotInfo, bool > getRxSlotInfo(const TimePoint &timePoint) const override
SlotInfo getSlotInfo(std::uint64_t u64AbsoluteSlotIndex) const override
void processEvent(const EventId &eventId, const Serialization &serialization) override
void processSchedulerPacket(UpstreamPacket &pkt, const PacketMetaInfo &packetMetaInfo) override
void processPacketMetaInfo(const PacketMetaInfo &packetMetaInfo) override
void initialize(Registrar &registrar) override
std::uint16_t EventId
Definition: types.h:53
The PlatformServiceProvider interface provides access to emulator services.
EventScheduler(NEMId id, PlatformServiceProvider *pPlatformServiceProvider, SchedulerUser *pSchedulerUser)
Current slot information.
std::set< std::uint64_t > Frequencies
std::uint16_t NEMId
Definition: types.h:52
Received over-the-air message information.
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
std::vector< ConfigurationNameAnyValues > ConfigurationUpdate
Reference Scheduler implementation.
std::vector< SlotInfo > SlotInfos
Definition: slotinfo.h:85
Clock::time_point TimePoint
Definition: types.h:50
Publishes information about received TDMA schedule events.
Definition: agent.h:43