satellite-ut-mac-state.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd
4  * Copyright (c) 2018 CNES
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Bastien Tauran <bastien.tauran@viveris.fr>
20  */
21 
22 #ifndef SATELLITE_UT_MAC_STATE_H
23 #define SATELLITE_UT_MAC_STATE_H
24 
25 #include <ns3/nstime.h>
26 #include <ns3/object.h>
27 #include <ns3/simulator.h>
28 
29 namespace ns3
30 {
31 
37 class SatUtMacState : public Object
38 {
39  public:
40  typedef enum
41  {
48  } RcstState_t;
49 
53  static TypeId GetTypeId(void);
57  virtual TypeId GetInstanceTypeId(void) const;
58 
62  SatUtMacState();
63 
70 
74  typedef Callback<void> LogOffCallback;
75 
80 
86  RcstState_t GetState() const;
87 
92  void SwitchToHoldStandby();
93 
98  void SwitchToOffStandby();
99 
104  void SwitchToReadyForLogon();
105 
111 
115  void SwitchToTdmaSync();
116 
121  void SwitchToNcrRecovery();
122 
127 
132  bool IsNcrTimeout() const;
133 
134  private:
135  RcstState_t m_rcstState; // Current state
136 
137  Time m_lastNcrDateReceived; // Last time a NCR control message was received
138  Time m_checkNcrRecoveryScheduled; // Last time state switched to NCR_RECOVERY
139 
140  Time m_ncrSyncTimeout; // Timeout to switch from TDMA_SYNC to NCR_RECOVERY
141  Time m_ncrRecoveryTimeout; // Timeout to switch from NCR_RECOVERY to OFF_STANDBY
142 
143  LogOffCallback m_logOffCallback; // Callback to call LogOff of SatUtMac
144 
149  void CheckNcrTimeout();
150 
156 };
157 
158 } // namespace ns3
159 
160 #endif /* SATELLITE_UT_MAC_STATE_H */
Class handling UT Mac states and transitions.
void SwitchToReadyForTdmaSync()
Change state to READY_FOR_TDMA_SYNC.
void SwitchToNcrRecovery()
Change state to NCR_RECOVERY.
void SetLogOffCallback(LogOffCallback cb)
Set logOff callback.
LogOffCallback m_logOffCallback
void SwitchToOffStandby()
Change state to OFF_STANDBY.
void NcrControlMessageReceived()
Inform the state diagram that a NCR message has been received.
void SwitchToReadyForLogon()
Change state to READY_FOR_LOGON.
RcstState_t GetState() const
Get the current state.
~SatUtMacState()
Destroy a SatUtMacState.
void SwitchToTdmaSync()
Change state to TDMA_SYNC.
SatUtMacState()
Default constructor, which is not used.
virtual TypeId GetInstanceTypeId(void) const
Derived from Object.
void SwitchToHoldStandby()
Change state to HOLD_STANDBY.
Callback< void > LogOffCallback
LogOff callback.
void CheckNcrTimeout()
Check if NCR has been received before sending a timeout.
void CheckNcrRecoveryTimeout()
Check if timeout reached in NCR_RECOVERY state.
bool IsNcrTimeout() const
Check if NCR m_ncrSyncTimeout has been reached.
static TypeId GetTypeId(void)
Derived from Object.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.