Q2NS dev
ns-3 module
Loading...
Searching...
No Matches
q2ns::SwapApp Class Referencefinal

#include <q2ns-swap-app.h>

Inheritance diagram for q2ns::SwapApp:
Collaboration diagram for q2ns::SwapApp:

Classes

struct  SessionConfig
 
struct  SessionState
 
struct  TcpKey
 
struct  TcpKeyHash
 

Public Types

enum class  Role : uint8_t { Prev = 0 , Repeater = 1 , Next = 2 }
 

Public Member Functions

void SetPayloadBytes (uint32_t n)
 
void SetUseIpv6 (bool v6)
 
void SetPeerAddress (ns3::Ipv4Address v4)
 
void SetPeerAddress6 (ns3::Ipv6Address v6)
 
 SwapApp ()=default
 
 ~SwapApp () override=default
 
void StartApplication () override
 
void StopApplication () override
 
void SetNetController (NetController *nc)
 
void AddSession (const SessionConfig &cfg)
 

Static Public Member Functions

static ns3::TypeId GetTypeId ()
 

Public Attributes

ns3::TracedCallback< uint64_t, ns3::Time > m_traceRoundStart
 
ns3::TracedCallback< uint64_t, ns3::Time, uint8_t, uint8_t > m_traceBSMDone
 
ns3::TracedCallback< uint64_t, ns3::Time, uint8_t, uint8_t > m_traceCtrlSent
 
ns3::TracedCallback< uint64_t, ns3::Time, uint8_t, uint8_t > m_traceFrameResolved
 
ns3::TracedCallback< uint64_t, ns3::Time > m_traceCorrectionApplied
 
ns3::TracedCallback< uint64_t, ns3::Time, double > m_traceVerifyFidelity
 

Private Member Functions

void ScheduleSession (const SessionState &s)
 
void DoRepeaterRound (SessionState &s)
 
void DoEndpointStart (SessionState &s)
 
void OnCtrlRx (ns3::Ptr< const ns3::Packet > pkt, const ns3::Address &from)
 
void EnsureSink (uint16_t port, const std::string &proto)
 
void MaybeDoBsmAndAnnounce (SessionState &s)
 
void TryApply (SessionState &s)
 
void OnTcpConnected (ns3::Ptr< ns3::Socket > s)
 
void OnTcpConnectFail (ns3::Ptr< ns3::Socket > s)
 
ns3::Ptr< ns3::Socket > GetOrCreateUdpV6Connected (const ns3::Ipv6Address &dst, uint16_t port)
 
ns3::Ptr< ns3::Socket > GetOrCreateUdpSender (uint16_t port, bool v6)
 
ns3::Ptr< ns3::Socket > GetOrCreateTcpSender (const ns3::Address &dst, bool v6, uint16_t port)
 

Private Attributes

NetControllerm_nc {nullptr}
 
std::unordered_map< uint64_t, SessionStatem_sessions
 
std::unordered_map< uint16_t, ns3::Ptr< ns3::PacketSink > > m_sinksByPort
 
uint32_t m_payloadBytes {16}
 
bool m_useIpv6 {false}
 
ns3::Ipv4Address m_peerV4
 
ns3::Ipv6Address m_peerV6
 
std::unordered_map< uint16_t, ns3::Ptr< ns3::Socket > > m_udp4
 
std::unordered_map< uint16_t, ns3::Ptr< ns3::Socket > > m_udp6
 
std::unordered_map< TcpKey, ns3::Ptr< ns3::Socket >, TcpKeyHashm_tcp
 
std::unordered_map< uintptr_t, ns3::Ptr< ns3::Packet > > m_tcpPendingOnce
 
std::unordered_map< uintptr_t, ns3::Ptr< ns3::Packet > > m_tcpPending
 
std::unordered_map< TcpKey, ns3::Ptr< ns3::Socket >, TcpKeyHashm_udp6_conn
 

Detailed Description

Definition at line 40 of file q2ns-swap-app.h.

Member Enumeration Documentation

◆ Role

enum class q2ns::SwapApp::Role : uint8_t
strong
Enumerator
Prev 
Repeater 
Next 

Definition at line 42 of file q2ns-swap-app.h.

Constructor & Destructor Documentation

◆ SwapApp()

q2ns::SwapApp::SwapApp ( )
default

◆ ~SwapApp()

q2ns::SwapApp::~SwapApp ( )
overridedefault

Member Function Documentation

◆ AddSession()

◆ DoEndpointStart()

◆ DoRepeaterRound()

◆ EnsureSink()

void q2ns::SwapApp::EnsureSink ( uint16_t  port,
const std::string &  proto 
)
private

Definition at line 243 of file q2ns-swap-app.cc.

References OnCtrlRx().

Here is the call graph for this function:

◆ GetOrCreateTcpSender()

ns3::Ptr< ns3::Socket > q2ns::SwapApp::GetOrCreateTcpSender ( const ns3::Address &  dst,
bool  v6,
uint16_t  port 
)
private

Definition at line 463 of file q2ns-swap-app.cc.

◆ GetOrCreateUdpSender()

ns3::Ptr< ns3::Socket > q2ns::SwapApp::GetOrCreateUdpSender ( uint16_t  port,
bool  v6 
)
private

Definition at line 446 of file q2ns-swap-app.cc.

◆ GetOrCreateUdpV6Connected()

ns3::Ptr< ns3::Socket > q2ns::SwapApp::GetOrCreateUdpV6Connected ( const ns3::Ipv6Address &  dst,
uint16_t  port 
)
private

Definition at line 491 of file q2ns-swap-app.cc.

◆ GetTypeId()

ns3::TypeId q2ns::SwapApp::GetTypeId ( )
static

◆ MaybeDoBsmAndAnnounce()

◆ OnCtrlRx()

void q2ns::SwapApp::OnCtrlRx ( ns3::Ptr< const ns3::Packet >  pkt,
const ns3::Address &  from 
)
private

Definition at line 268 of file q2ns-swap-app.cc.

Referenced by EnsureSink().

Here is the caller graph for this function:

◆ OnTcpConnected()

void q2ns::SwapApp::OnTcpConnected ( ns3::Ptr< ns3::Socket >  s)
private

Definition at line 428 of file q2ns-swap-app.cc.

◆ OnTcpConnectFail()

void q2ns::SwapApp::OnTcpConnectFail ( ns3::Ptr< ns3::Socket >  s)
private

Definition at line 438 of file q2ns-swap-app.cc.

◆ ScheduleSession()

void q2ns::SwapApp::ScheduleSession ( const SessionState s)
private

◆ SetNetController()

void q2ns::SwapApp::SetNetController ( NetController nc)
inline

Definition at line 93 of file q2ns-swap-app.h.

References m_nc.

◆ SetPayloadBytes()

void q2ns::SwapApp::SetPayloadBytes ( uint32_t  n)
inline

Definition at line 70 of file q2ns-swap-app.h.

References m_payloadBytes.

◆ SetPeerAddress()

void q2ns::SwapApp::SetPeerAddress ( ns3::Ipv4Address  v4)
inline

Definition at line 76 of file q2ns-swap-app.h.

References m_peerV4.

◆ SetPeerAddress6()

void q2ns::SwapApp::SetPeerAddress6 ( ns3::Ipv6Address  v6)
inline

Definition at line 79 of file q2ns-swap-app.h.

References m_peerV6.

◆ SetUseIpv6()

void q2ns::SwapApp::SetUseIpv6 ( bool  v6)
inline

Definition at line 73 of file q2ns-swap-app.h.

References m_useIpv6.

◆ StartApplication()

void q2ns::SwapApp::StartApplication ( )
override

Definition at line 82 of file q2ns-swap-app.cc.

◆ StopApplication()

void q2ns::SwapApp::StopApplication ( )
override

Definition at line 143 of file q2ns-swap-app.cc.

◆ TryApply()

Member Data Documentation

◆ m_nc

NetController* q2ns::SwapApp::m_nc {nullptr}
private

Definition at line 128 of file q2ns-swap-app.h.

Referenced by SetNetController().

◆ m_payloadBytes

uint32_t q2ns::SwapApp::m_payloadBytes {16}
private

Definition at line 136 of file q2ns-swap-app.h.

Referenced by SetPayloadBytes().

◆ m_peerV4

ns3::Ipv4Address q2ns::SwapApp::m_peerV4
private

Definition at line 138 of file q2ns-swap-app.h.

Referenced by SetPeerAddress().

◆ m_peerV6

ns3::Ipv6Address q2ns::SwapApp::m_peerV6
private

Definition at line 139 of file q2ns-swap-app.h.

Referenced by SetPeerAddress6().

◆ m_sessions

std::unordered_map<uint64_t, SessionState> q2ns::SwapApp::m_sessions
private

Definition at line 131 of file q2ns-swap-app.h.

◆ m_sinksByPort

std::unordered_map<uint16_t, ns3::Ptr<ns3::PacketSink> > q2ns::SwapApp::m_sinksByPort
private

Definition at line 134 of file q2ns-swap-app.h.

◆ m_tcp

std::unordered_map<TcpKey, ns3::Ptr<ns3::Socket>, TcpKeyHash> q2ns::SwapApp::m_tcp
private

Definition at line 175 of file q2ns-swap-app.h.

◆ m_tcpPending

std::unordered_map<uintptr_t, ns3::Ptr<ns3::Packet> > q2ns::SwapApp::m_tcpPending
private

Definition at line 181 of file q2ns-swap-app.h.

◆ m_tcpPendingOnce

std::unordered_map<uintptr_t, ns3::Ptr<ns3::Packet> > q2ns::SwapApp::m_tcpPendingOnce
private

Definition at line 178 of file q2ns-swap-app.h.

◆ m_traceBSMDone

ns3::TracedCallback<uint64_t, ns3::Time, uint8_t, uint8_t> q2ns::SwapApp::m_traceBSMDone

Definition at line 102 of file q2ns-swap-app.h.

Referenced by GetTypeId().

◆ m_traceCorrectionApplied

ns3::TracedCallback<uint64_t, ns3::Time> q2ns::SwapApp::m_traceCorrectionApplied

Definition at line 106 of file q2ns-swap-app.h.

Referenced by GetTypeId().

◆ m_traceCtrlSent

ns3::TracedCallback<uint64_t, ns3::Time, uint8_t, uint8_t> q2ns::SwapApp::m_traceCtrlSent

Definition at line 103 of file q2ns-swap-app.h.

Referenced by GetTypeId().

◆ m_traceFrameResolved

ns3::TracedCallback<uint64_t, ns3::Time, uint8_t, uint8_t> q2ns::SwapApp::m_traceFrameResolved

Definition at line 105 of file q2ns-swap-app.h.

Referenced by GetTypeId().

◆ m_traceRoundStart

ns3::TracedCallback<uint64_t, ns3::Time> q2ns::SwapApp::m_traceRoundStart

Definition at line 101 of file q2ns-swap-app.h.

Referenced by GetTypeId().

◆ m_traceVerifyFidelity

ns3::TracedCallback<uint64_t, ns3::Time, double> q2ns::SwapApp::m_traceVerifyFidelity

Definition at line 107 of file q2ns-swap-app.h.

Referenced by GetTypeId().

◆ m_udp4

std::unordered_map<uint16_t, ns3::Ptr<ns3::Socket> > q2ns::SwapApp::m_udp4
private

Definition at line 159 of file q2ns-swap-app.h.

◆ m_udp6

std::unordered_map<uint16_t, ns3::Ptr<ns3::Socket> > q2ns::SwapApp::m_udp6
private

Definition at line 160 of file q2ns-swap-app.h.

◆ m_udp6_conn

std::unordered_map<TcpKey, ns3::Ptr<ns3::Socket>, TcpKeyHash> q2ns::SwapApp::m_udp6_conn
private

Definition at line 183 of file q2ns-swap-app.h.

◆ m_useIpv6

bool q2ns::SwapApp::m_useIpv6 {false}
private

Definition at line 137 of file q2ns-swap-app.h.

Referenced by SetUseIpv6().


The documentation for this class was generated from the following files: