17 #include <pia/transport/transport_definitions.h> 19 #include <pia/transport/transport_Singleton.h> 20 #include <pia/transport/transport_ProtocolManager.h> 22 #include <pia/common/common_Time.h> 23 #include <pia/common/common_Job.h> 25 #if NN_PIA_ENABLE_FEEDBACK 26 #include <pia/common/common_Feedback.h> 56 class StationConnectionInfo;
57 class KeepAliveSender;
58 class KeepAliveReceiver;
59 class ThreadStreamManager;
60 class IRelayAddressTable;
61 class RelayRouteManager;
62 class StationPacketHandler;
66 #if NN_PIA_ENABLE_FEEDBACK 67 #define NN_PIA_SEND_FEEDBACKDATA \ 68 if (nn::pia::transport::Transport::GetInstance()) \ 71 nn::pia::transport::Transport::GetInstance()->SendFeedback(); \ 73 nn::pia::common::Feedback::Dummy 153 size_t maxStationNum = 0,
154 size_t maxSendThreadBufferNum = 0,
155 size_t maxReceiveThreadBufferNum = 0,
156 s32 analysisInterval = 0);
204 static void DestroyInstance(
void);
264 template <
typename T>
267 return m_ProtocolManager.CreateProtocol<T>(port);
279 m_ProtocolManager.DestroyProtocol(protocolHandle);
292 template <
typename T>
295 return m_ProtocolManager.GetProtocol<T>(protocolHandle);
328 return m_ConnectionError;
341 return m_DispatchedTime;
356 return m_MaxStationNum;
366 ProtocolManager* GetProtocolManager()
368 return &m_ProtocolManager;
382 nn::Result SetKeepAliveInterval(s32 msec);
394 s32 GetKeepAliveInterval(
void)
const;
402 void EnableKeepAlive(
void);
410 void DisableKeepAlive(
void);
421 bool IsKeepAliveEnabled(
void)
const;
454 IRelayAddressTable* GetRelayAddressTable(
void)
456 return m_pRelayAddressTable;
465 RelayRouteManager* GetRelayRouteManagerPtr(
void)
467 return m_pRelayRouteManager;
473 void SetRelayRouteManagerPtr(RelayRouteManager* ptr)
475 m_pRelayRouteManager = ptr;
480 #if NN_PIA_ENABLE_FEEDBACK 488 nn::Result SendFeedback(
void);
493 void SetFeedbackNetworkRtt();
495 #endif // end of NN_PIA_ENABLE_FEEDBACK 498 void SetMonitoringNetworkRtt(
bool isBegin);
502 StationPacketHandler* GetStationPacketHandler(
void)
504 return m_pPacketHandler;
590 PIA_ASSERT((m_TransportStatus.IsSuccess())
591 || (ResultInvalidState::Includes(m_TransportStatus))
592 || (ResultTemporaryUnavailable::Includes(m_TransportStatus)));
593 return m_TransportStatus;
609 nn::Result SetTransportStatus(nn::Result state);
614 void EnableStationIdTable()
616 m_bEnableStationIdTable =
true;
618 void DisableStationIdTable()
620 m_bEnableStationIdTable =
false;
622 bool IsEnableStationIdTable()
const 624 return m_bEnableStationIdTable;
629 const StationIdTable* GetStationIdTable()
const 631 return m_pStationIdTable;
633 StationIdTable* GetStationIdTable()
635 return m_pStationIdTable;
644 : sendThreadLatencyEmulationPacketNum(0),
645 receiveThreadLatencyEmulationPacketNum(0),
646 bPacketLossEmulation(false)
667 static nn::Result SetDebugSetting(
const struct DebugSetting& setting);
675 virtual void Trace(u64 flag)
const;
678 common::IPacketInput* GetInputStream(
void);
679 common::IPacketOutput* GetOutputStream(
void);
681 void OutputStreamUpdateEvent(
void);
684 enum DisconnectionEventType
691 typedef DisconnectionEventType (*DisconnectionEventListener)(
void* pStationIdTableEntry);
693 void RegisterEventListener(DisconnectionEventListener func)
695 m_EventListener = func;
697 DisconnectionEventListener GetEventListener()
699 return m_EventListener;
718 nn::Result dispatch(
void);
765 void updateDispatchedTime(
void)
771 void updateTransportAnalyzer(
void);
775 class DispatchJob :
public common::Job
778 virtual ExecuteResult ExecuteCore()
780 Transport::GetInstance()->dispatch();
781 return Job::EXECUTE_STATE_WAIT_NEXT;
787 ProtocolManager m_ProtocolManager;
788 StationPacketHandler* m_pPacketHandler;
790 size_t m_MaxStationNum;
794 nn::Result m_ConnectionError;
795 DispatchJob m_DispatchJob;
797 IRelayAddressTable* m_pRelayAddressTable;
798 RelayRouteManager* m_pRelayRouteManager;
800 #if NN_PIA_ENABLE_FEEDBACK 801 u32 m_FeedbackSenderProtocolHandle;
804 s32 m_AnalysisInterval;
807 DisconnectionEventListener m_EventListener;
809 StationIdTable* m_pStationIdTable;
810 bool m_bEnableStationIdTable;
812 nn::Result m_TransportStatus;
size_t receiveThreadLatencyEmulationPacketNum
The number of buffers used by the receive-latency emulation feature (about 1.5 KB per buffer)...
Definition: transport_Transport.h:651
static Transport * GetInstance(void)
Gets the Transport class instance (singleton pattern). This function returns a NULL pointer if the in...
Definition: transport_Transport.h:216
Class that represents time.
Definition: common_Time.h:39
StationIndex
Enumerates StationIndex values.
Definition: platformCtr.h:44
Definition of the StationId identifying the station within the session.
Definition: types.h:33
size_t maxSendThreadBufferNum
The number of buffers that the sending thread of the Pia library uses to send packets (about 1...
Definition: transport_Transport.h:160
size_t sendThreadLatencyEmulationPacketNum
The number of buffers used by the receive-latency emulation feature (about 1.5 KB per buffer)...
Definition: transport_Transport.h:650
T * GetProtocol(u32 protocolHandle)
Gets an instance of a protocol of type T.
Definition: transport_Transport.h:293
s32 analysisInterval
The interval at which measurement results from the TransportAnalyzer feature are automatically output...
Definition: transport_Transport.h:162
u32 CreateProtocol(u16 port=0)
Generates an instance of a protocol of type T.
Definition: transport_Transport.h:265
size_t maxReceiveThreadBufferNum
The number of buffers that the receiving thread of the Pia library uses to receive packets (about 1...
Definition: transport_Transport.h:161
void DestroyProtocol(u32 protocolHandle)
Destroys the protocol instance.
Definition: transport_Transport.h:277
Provides core functionality of the transport module.
Definition: transport_Transport.h:116
DebugSetting()
Default constructor. Initializes all of the member variables.
Definition: transport_Transport.h:643
nn::Result CheckConnectionError(void) const
Gets the connection status of the transport module.
Definition: transport_Transport.h:326
Represents an address used to uniquely identify stations. .
Definition: common_StationAddress.h:43
An interface (factory pattern) for generating the classes needed by the network.
Definition: transport_NetworkFactory.h:89
Represents an address used to uniquely identify stations.
Definition: transport_StationConnectionInfo.h:35
bool bPacketLossEmulation
Set to true when using the packet loss emulation feature.
Definition: transport_Transport.h:652
Stores parameters passed to the CreateInstance function.
Definition: transport_Transport.h:134
nn::Result CheckTransportStatus() const
Checks the state of Transport, and determines whether sending and receiving processes can be executed...
Definition: transport_Transport.h:588
NetworkFactory * pFactory
Pointer to an instance of the concrete class that inherits NetworkFactory (factory pattern)...
Definition: transport_Transport.h:158
size_t maxStationNum
Specifies the maximum number of Stations that can join a single network.
Definition: transport_Transport.h:159
This is the common base class used inside the Pia library.
Definition: common_RootObject.h:40
Structure that collects the parameters to pass to the SetDebugSetting function.
Definition: transport_Transport.h:641
size_t GetMaxStationNum(void) const
Gets the maximum number of connections (Station instances) set when CreateInstance was called...
Definition: transport_Transport.h:354
static Time GetTime()
Gets a Time instance representing the current time.
Definition: common_Time.h:78
A structure for encryption settings.
Definition: common_CryptoSetting.h:33