119 lines
2.5 KiB
C
119 lines
2.5 KiB
C
|
|
#ifndef TAS_H
|
||
|
|
#define TAS_H
|
||
|
|
|
||
|
|
#include "ns3/object.h"
|
||
|
|
#include "ns3/nstime.h"
|
||
|
|
#include "ns3/data-rate.h"
|
||
|
|
|
||
|
|
#include "ns3/tsn-net-device.h"
|
||
|
|
#include "ns3/transmission-gate.h"
|
||
|
|
#include "ns3/tsn-transmission-selection-algo.h"
|
||
|
|
|
||
|
|
namespace ns3
|
||
|
|
{
|
||
|
|
|
||
|
|
class TsnNetDevice;
|
||
|
|
class TsnTransmissionSelectionAlgo;
|
||
|
|
|
||
|
|
class Tas: public Object
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
/**
|
||
|
|
* \brief Get the TypeId
|
||
|
|
*
|
||
|
|
* \return The TypeId for this class
|
||
|
|
*/
|
||
|
|
static TypeId GetTypeId();
|
||
|
|
|
||
|
|
/**
|
||
|
|
* \brief Create a Tas
|
||
|
|
*/
|
||
|
|
Tas();
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Destroy a Tas
|
||
|
|
*
|
||
|
|
* This is the destructor for the Tas.
|
||
|
|
*/
|
||
|
|
~Tas();
|
||
|
|
|
||
|
|
// Delete copy constructor and assignment operator to avoid misuse
|
||
|
|
Tas& operator=(const Tas&) = delete;
|
||
|
|
Tas(const Tas&) = delete;
|
||
|
|
|
||
|
|
void SetTsnNetDevice(Ptr<TsnNetDevice> net);
|
||
|
|
|
||
|
|
bool IsEnable();
|
||
|
|
bool IsSendable(Ptr<const Packet> p, DataRate d, uint8_t preambleAndSFDGap, uint8_t interframeGap, uint32_t mtu);
|
||
|
|
|
||
|
|
void AddTsa(Ptr<TsnTransmissionSelectionAlgo> tsa);
|
||
|
|
void AddTransmissionGate();
|
||
|
|
|
||
|
|
void Start();
|
||
|
|
void ClockUpdate();
|
||
|
|
|
||
|
|
bool IsGateOpen(int i);
|
||
|
|
|
||
|
|
void AddGclEntry(Time duration, uint8_t states);
|
||
|
|
|
||
|
|
enum GuardBandModes
|
||
|
|
{
|
||
|
|
NONE,
|
||
|
|
MTU,
|
||
|
|
PKTSIZE,
|
||
|
|
};
|
||
|
|
|
||
|
|
Time GetHardwareLatency();
|
||
|
|
|
||
|
|
protected:
|
||
|
|
|
||
|
|
private:
|
||
|
|
void UpdateGates(bool clockUpdate);
|
||
|
|
int GetCurrentGclEntry();
|
||
|
|
Time GetLastOpeningTime(Time currentTime);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The TransmissionGates which this TsnNetDevice uses
|
||
|
|
*/
|
||
|
|
std::vector<Ptr<TransmissionGate>> m_transmissionGates;
|
||
|
|
|
||
|
|
Ptr<TsnNetDevice> m_net;
|
||
|
|
Callback<void> GateUpdateCallback;
|
||
|
|
/**
|
||
|
|
* \ingroup tsn
|
||
|
|
* Structure holding a gcl entry
|
||
|
|
*/
|
||
|
|
struct GclEntry
|
||
|
|
{
|
||
|
|
Time duration;
|
||
|
|
uint8_t states;
|
||
|
|
};
|
||
|
|
|
||
|
|
std::vector<Ptr<TsnTransmissionSelectionAlgo>> m_transmissionSelectionAlgos;
|
||
|
|
/**
|
||
|
|
* The GateControlList which this TsnNetDevice uses
|
||
|
|
*/
|
||
|
|
std::vector<GclEntry> m_GateControlList;
|
||
|
|
int m_CurrentGclEntry = 0;
|
||
|
|
|
||
|
|
Time m_cycleDuration;
|
||
|
|
Time m_startTime;
|
||
|
|
Time m_lastGateOpeningTime;
|
||
|
|
bool m_start = false;
|
||
|
|
EventId m_NextGatesUpdate;
|
||
|
|
bool m_MultidropMode;
|
||
|
|
|
||
|
|
GuardBandModes m_GuardBandMode;
|
||
|
|
|
||
|
|
TracedCallback<uint8_t> m_gatesUpdate;
|
||
|
|
|
||
|
|
uint16_t m_maxGclEntryNumber;
|
||
|
|
Time m_maxGclTimeInterval;
|
||
|
|
Time m_maxGclCycleDuration;
|
||
|
|
Time m_minLatencyOverhead;
|
||
|
|
Time m_maxLatencyOverhead;
|
||
|
|
};
|
||
|
|
|
||
|
|
}
|
||
|
|
#endif /* TAS_H */
|