17 #include <pia/common/common_RootObject.h> 18 #include <pia/common/common_CallContext.h> 19 #include <pia/common/common_SignatureSetting.h> 21 #include <pia/session/session_definitions.h> 22 #include <pia/session/session_types.h> 24 #include <pia/transport/transport_Station.h> 25 #include <pia/transport/transport_StationLocationContainer.h> 26 #include <pia/transport/transport_StationConnectionInfo.h> 43 class MonitoringDataSender;
54 class StationProtocol;
55 class ConnectStationJob;
56 class DisconnectStationJob;
57 class ProcessConnectionRequestJob;
58 class MissingStationHandler;
60 #if NN_PIA_EXPERIMENT_BAND_WIDTH_CHECK 61 class BandwidthCheckerProtocol;
77 class ProcessJoinRequestJob;
78 class ProcessUpdateMeshJob;
80 class ProcessDestroyMeshJob;
81 class ProcessHostMigrationJob;
82 class LeaveWithHostMigrationJob;
83 class SignatureSettingStorage;
84 #if NN_PIA_EXPERIMENT_RELAY_CONNECTION_TOPOLOGY 85 class RelayRouteManageJob;
87 class KickoutManageJob;
89 class SyncClockProtocol;
90 class MeshEventListener;
92 static const u16 PIA_SESSION_STATION_MAX_DEFAULT = 4;
188 friend class CreateMeshJob;
189 friend class JoinMeshJob;
190 friend class LeaveMeshJob;
191 friend class ProcessJoinRequestJob;
192 friend class ProcessUpdateMeshJob;
193 friend class DestroyMeshJob;
194 friend class ProcessDestroyMeshJob;
195 friend class ProcessHostMigrationJob;
196 friend class LeaveWithHostMigrationJob;
197 friend class KickoutManageJob;
198 friend class MeshProtocol;
199 friend class MeshEventListener;
207 #if NN_PIA_EXPERIMENT_BAND_WIDTH_CHECK 209 : bitRateCheckMode(session::BitRateCheck_Disable)
215 #if NN_PIA_EXPERIMENT_BAND_WIDTH_CHECK 226 : maxSilenceTime(NN_PIA_SESSION_MAX_SILENCE_TIME_DEFAULT),
227 keepAliveSendingInterval(NN_PIA_SESSION_KEEP_ALIVE_INTERVAL_DEFAULT),
228 bUsingHostMigration(
true),
230 pCryptoSetting(NULL),
232 #if NN_PIA_EXPERIMENT_BAND_WIDTH_CHECK 233 uplinkBitRateLowerLimit(NN_PIA_SESSION_INVALID_UPLINK_BIT_RATE_LOWER_LIMIT),
234 bitRateCheckPacketSize(0),
235 bitRateMeasuringSpan(1000),
236 isSkipBitRateCheck(
false),
248 #if NN_PIA_EXPERIMENT_BAND_WIDTH_CHECK 263 DebugSetting(
bool argIsEnableRelayEmulation =
false,
bool argIsDisableCheckMaxSilenceTime =
false)
264 : isEnableRelayEmulation(argIsEnableRelayEmulation),
265 isDisableCheckMaxSilenceTime(argIsDisableCheckMaxSilenceTime)
299 MIGRATION_FATAL_ERROR
310 EMULATION_TYPE_NONE = 0,
358 typedef u8 (*CheckHostCandidateRankingCallback)(
StationIndex targetId,
bool isHost);
362 typedef u32 (*GetSessionIdCallback)();
395 static void DestroyInstance();
428 static nn::Result SetDebugSetting(
const DebugSetting& debugSetting);
679 nn::Result CreateMeshAsync();
690 bool IsCompletedCreateMesh();
702 nn::Result GetCreateMeshResult();
747 nn::Result DestroyMeshAsync();
758 bool IsCompletedDestroyMesh();
771 nn::Result GetDestroyMeshResult();
816 nn::Result LeaveMeshWithHostMigrationAsync();
827 bool IsCompletedLeaveMeshWithHostMigration();
840 nn::Result GetLeaveMeshWithHostMigrationResult();
931 bool IsCompletedJoinMesh();
959 nn::Result GetJoinMeshResult();
974 nn::Result CancelJoinMeshAsync();
1012 nn::Result LeaveMeshAsync();
1023 bool IsCompletedLeaveMesh();
1036 nn::Result GetLeaveMeshResult();
1080 return m_StationCount;
1107 return m_HostStationIndex;
1112 return m_LocalStationIndex;
1130 return m_LocalStationIndex == m_HostStationIndex;
1162 bit32 GetValidStationIndexBitmap()
const 1164 return m_StationIndexUsedFlags;
1178 nn::Result CheckConnectionError()
const;
1197 bool IsCompleteBitRateCheck();
1216 nn::Result GetUplinkBitRate(s32* pBps);
1243 void RegisterMeshEventCallback(MeshEventCallback callback);
1251 void UnregisterMeshEventCallback();
1269 void RegisterJoiningMeshApprovalCallback(JoiningMeshApprovalCallback callback);
1277 void UnregisterJoiningMeshApprovalCallback();
1293 nn::Result RegisterCheckHostCandidateRankingCallback(CheckHostCandidateRankingCallback callback);
1301 void UnregisterCheckHostCandidateRankingCallback();
1306 void RegisterEventListener(MeshEventListener* pEventListener);
1307 void UnregisterEventListener();
1309 void RegisterGetSessionIdCallback(GetSessionIdCallback callback);
1310 void UnregisterGetSessionIdCallback();
1326 MeshProtocol* GetMeshProtocol()
1328 return m_pMeshProtocol;
1338 nn::pia::transport::StationProtocol* GetStationProtocol()
1340 return m_pStationProtocol;
1364 s64 GetTime(
void)
const;
1373 void SetSyncClockPulseInterval(s32 interval);
1382 s32 GetSyncClockPulseInterval(
void)
const;
1410 nn::Result SetMaxNumOfRelayRoutesAssignedToStation(u16 num);
1428 nn::Result SetMaxRtt(u16 rtt);
1490 void ResetRelayEmulation();
1503 void SetHostMigrationStartFlag(
bool val);
1511 bool GetHostMigrationStartFlag();
1515 ProcessHostMigrationJob* GetProcessHostMigrationJobPtr()
1517 return m_pProcessHostMigrationJob;
1520 KickoutManageJob* GetKickoutManageJobPtr()
1522 return m_pKickoutManageJob;
1526 ProcessDestroyMeshJob* GetProcessDestroyMeshJobPtr()
1528 return m_pProcessDestroyMeshJob;
1538 void SetAutoAddRecentPlayRecord(
bool val)
1540 m_AutoAddRecentPlayRecord = val;
1544 #if NN_PIA_EXPERIMENT_SHARE_CONNECTION_INFO_EARLY 1546 ProcessUpdateMeshJob* GetProcessUpdateMeshJobPtr()
1548 return m_pProcessUpdateMeshJob;
1555 return m_NetworkTopologyType;
1562 const SignatureSettingStorage* GetSignatureSettingStorage()
const 1564 return m_pSignatureSettingStorage;
1569 static nn::Result SetDebugSettingForInternal(
const DebugSetting& debugSetting);
1586 void TraceStationConnectionInfoList(u64 flag);
1589 bool IsUsingHostMigration();
1590 int GetJoinMeshSequence();
1591 void SetSkipCleanupReport(
bool isSkip);
1592 void SetSkipReport(
bool isSkip);
1593 void SendReport(u8 type);
1594 bool IsProcessedAtMeshBegin()
const;
1595 bool IsProcessingLeaveMesh()
const;
1596 State GetMeshState()
const;
1597 void IsDenyJoinRequestBySession(
bool isDeny);
1598 void CleanupMonitoringBeginData();
1601 #if NN_PIA_EXPERIMENT_BAND_WIDTH_CHECK 1604 nn::pia::transport::BandwidthCheckerProtocol* GetBandwidthCheckerProtocol();
1609 s32 GetProcessUpdateMeshJobStepSequence()
const;
1617 virtual void Trace(u64 flag)
const;
1625 static Mesh* s_pMesh;
1628 static nn::Result setDebugSettingImpl(
const DebugSetting& debugSetting);
1642 virtual ~
Mesh(
void);
1661 nn::Result SetupProtocols();
1663 void CleanupStatus();
1666 void CleanupStationsJobs();
1674 void ResetStationIndexUsage();
1679 m_MeshStartTime = startTime;
1680 m_MeshStartTimeValidFlag =
true;
1684 bool CheckMeshStartTimeIsValid()
const 1686 return m_MeshStartTimeValidFlag;
1692 return (target - m_MeshStartTime);
1695 void ProcessingAtMeshBegin();
1697 void ProcessingAtEndHM();
1700 enum AsyncProcessingName
1703 ASYNC_CREATE_SESSION,
1704 ASYNC_DESTROY_SESSION,
1705 ASYNC_LEAVE_SESSION_WITH_HM,
1710 void ResetInternalAsyncState();
1711 bool IsCompletedAsyncProcess(AsyncProcessingName processingName);
1712 nn::Result GetAsyncProcessResult(AsyncProcessingName processingName);
1713 nn::Result CancelAsyncProcess(AsyncProcessingName processingName);
1715 nn::Result joinMeshCore(
1719 void SetMeshState(State meshState);
1722 CreateMeshJob* m_pCreateMeshJob;
1723 JoinMeshJob* m_pJoinMeshJob;
1724 LeaveMeshJob* m_pLeaveMeshJob;
1725 ProcessJoinRequestJob* m_pProcessJoinRequestJob;
1726 ProcessUpdateMeshJob* m_pProcessUpdateMeshJob;
1727 DestroyMeshJob* m_pDestroyMeshJob;
1728 ProcessDestroyMeshJob* m_pProcessDestroyMeshJob;
1729 ProcessHostMigrationJob* m_pProcessHostMigrationJob;
1730 LeaveWithHostMigrationJob* m_pLeaveWithHostMigrationJob;
1731 SignatureSettingStorage* m_pSignatureSettingStorage;
1732 #if NN_PIA_EXPERIMENT_RELAY_CONNECTION_TOPOLOGY 1733 RelayRouteManageJob* m_pRelayRouteManageJob;
1735 KickoutManageJob* m_pKickoutManageJob;
1736 nn::pia::transport::MissingStationHandler* m_pMissingStationHandler;
1738 MeshEventCallback m_MeshEventCallback;
1739 JoiningMeshApprovalCallback m_JoiningMeshApprovalCallback;
1740 CheckHostCandidateRankingCallback m_CheckHostCandidateRankingCallback;
1741 GetSessionIdCallback m_GetSessionIdCallback;
1743 u32 m_MeshProtocolHandle;
1744 MeshProtocol* m_pMeshProtocol;
1745 nn::pia::transport::StationProtocol* m_pStationProtocol;
1747 #if NN_PIA_EXPERIMENT_BAND_WIDTH_CHECK 1748 u32 m_BandwidthCheckerHandle;
1749 nn::pia::transport::BandwidthCheckerProtocol* m_pBandwidthCheckerProtocol;
1754 bool m_IsApprovalJoin;
1757 bool m_IsDenyJoinRequestBySession;
1764 HostMigrationMode m_HostMigrationMode;
1766 #if NN_PIA_EXPERIMENT_BAND_WIDTH_CHECK 1770 bool m_IsEnableHostMigration;
1772 bit32 m_StationIndexUsedFlags;
1776 u32 m_SyncClockProtocolHandle;
1779 bool m_MeshStartTimeValidFlag;
1783 bool m_HostMigrationStartFlag;
1785 bool m_AutoAddRecentPlayRecord;
1787 common::MonitoringDataSender* m_pMonitoringDataSender;
1790 AsyncProcessingName m_CurrentAsyncProcessingName;
1792 MeshEventListener* m_pMeshEventListener;
1794 bool m_IsSkipSendingReport;
1795 bool m_IsSkipCleanupReport;
nn::pia::session::BitRateCheckMode bitRateCheckMode
Settings for the bitrate detection feature.
Definition: session_Mesh.h:216
u16 GetStationNum() const
Gets the number of valid stations connected to the current mesh.
Definition: session_Mesh.h:1078
EventType
This enumerated type is passed as a parameter to the callback that sends notifications about changes ...
Definition: session_Mesh.h:320
nn::pia::transport::NetworkFactory * pNetworkFactory
Pointer to an instance of the concrete class that inherits nn::pia::transport::NetworkFactory (factor...
Definition: session_Mesh.h:213
EmulationType
Enumerates connection path emulation settings. (For debugging.)
Definition: session_Mesh.h:308
bool IsHost() const
Gets whether the local device is the mesh host.
Definition: session_Mesh.h:1124
Specifies that the disconnection was caused by a desync. (The mesh information was no longer consiste...
Definition: session_Mesh.h:296
This class maintains signature setting information.
Definition: common_SignatureSetting.h:33
Class that represents time.
Definition: common_Time.h:39
Specifies that the disconnection was caused by something other than the Mesh object. One way to get this value is when the network connection is lost.
Definition: session_Mesh.h:298
StationIndex
Enumerates StationIndex values.
Definition: platformCtr.h:44
Definition of the StationId identifying the station within the session.
Definition: types.h:33
u32 maxSilenceTime
Specifies the maximum allowable time without communication (in milliseconds). The default value is se...
Definition: session_Mesh.h:242
s32 bitRateMeasuringSpan
Sets the time to spend measuring when the bit rate detection feature is used. The value is in millise...
Definition: session_Mesh.h:251
(For debugging.) This structure stores the debug feature settings that are passed to nn::pia::session...
Definition: session_Mesh.h:261
Represents a station. A station refers to a machine participating in a Pia session.
Definition: transport_Station.h:75
u32 keepAliveSendingInterval
Specifies the send interval for keep-alive (in milliseconds). The default value is session::NN_PIA_SE...
Definition: session_Mesh.h:243
This structure stores settings passed to nn::pia::session::Mesh::CreateInstance.
Definition: session_Mesh.h:205
DisconnectReason
This enumerated type represents reasons why a Mesh object cannot communicate.
Definition: session_Mesh.h:288
const nn::pia::transport::Station::PlayerName * pPlayerName
Specifies the name and language code associated with the local station. Other members of the mesh acc...
Definition: session_Mesh.h:245
size_t bitRateCheckPacketSize
Specifies the IP packet size used for testing when using the bitrate detection feature. The value is in bytes. The expected value is the average size of IP packet sent and received by the application. It must be a multiple of 4. The default is 0.
Definition: session_Mesh.h:250
Specifies that the mesh host has migrated. (Only occurs when host migration is enabled.)
Definition: session_Mesh.h:324
bool bUsingHostMigration
Sets the use of the host migration feature. The default is true (enabled).
Definition: session_Mesh.h:244
Stores the player name struct associated with a Station.
Definition: transport_Station.h:692
const nn::pia::common::CryptoSetting * pCryptoSetting
Specifies a pointer that points to a structure for configuring encryption. No encryption is configure...
Definition: session_Mesh.h:246
Specifies that the disconnection from the mesh was caused by the library. One way to get this value i...
Definition: session_Mesh.h:295
NetworkTopology
Enumerated type for configuring the network topology of a mesh created with the Session class or the ...
Definition: session_types.h:43
Represents the calling context.
Definition: common_CallContext.h:43
static const SignatureSetting NO_SIGNATURE
Specifies an instance of the signature setting class that has no signature.
Definition: common_SignatureSetting.h:123
Specifies that the disconnection was caused by the local station. You get this value when the local s...
Definition: session_Mesh.h:292
Class for representing time spans. This class can perform type conversions with numeric values in mil...
Definition: common_TimeSpan.h:41
This structure stores settings passed to nn::pia::session::Mesh::Startup.
Definition: session_Mesh.h:223
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
Contains member functions that manage connections with other devices.
Definition: session_Mesh.h:186
nn::pia::common::SignatureSetting signatureSetting
Specifies a properly configured instance of the class used to specify packet-signature settings...
Definition: session_Mesh.h:247
BitRateCheckMode
Enumerated type for setting the bitrate detection feature.
Definition: session_types.h:56
Stores the ID token associated with a Station.
Definition: transport_Station.h:682
bool isDisableCheckMaxSilenceTime
Does not check the range set for the maximum time without communication.
Definition: session_Mesh.h:269
Specifies that the local station was kicked out from the mesh because of a call to the Mesh::KickoutS...
Definition: session_Mesh.h:294
static Mesh * GetInstance()
Gets an instance of the Mesh object.
Definition: session_Mesh.h:406
nn::pia::session::NetworkTopology networkTopology
Specifies the network topology setting for the mesh.
Definition: session_Mesh.h:214
s32 uplinkBitRateLowerLimit
Specifies the minimum rate required by the application when using the bitrate detection feature...
Definition: session_Mesh.h:249
Specifies that the disconnection was caused by a failed host migration.
Definition: session_Mesh.h:297
Specifies that the disconnection was caused by another station in the mesh. One way to get this value...
Definition: session_Mesh.h:293
Maximum value of StationIndex.
Definition: platformCtr.h:58
Indicates that a station has joined.
Definition: session_Mesh.h:322
bool isEnableRelayEmulation
Settings for the connection route emulation feature for debugging.
Definition: session_Mesh.h:268
bool isSkipBitRateCheck
Set to skip detection processes when using bitrate detection. Specify true to skip. The default is false.
Definition: session_Mesh.h:252
Specifies that no communication has been performed. You get this value if you never build or join a m...
Definition: session_Mesh.h:291
const nn::pia::transport::Station::IdentificationToken * pToken
Specifies a pointer to the identification token indicating the local device. If NULL is specified...
Definition: session_Mesh.h:254
This is the common base class used inside the Pia library.
Definition: common_RootObject.h:40
A station has left.
Definition: session_Mesh.h:323
A structure for encryption settings.
Definition: common_CryptoSetting.h:33