CTR Pia  4.11.3
Game Communication Engine
inet_NexSessionInfo.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: inet_NexSessionInfo.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/session/session_ISessionInfo.h>
18 #include <pia/inet/inet_NexSessionTypes.h>
19 #include <pia/common/common_DateTime.h>
20 
21 namespace nn
22 {
23 namespace pia
24 {
25 namespace inet
26 {
27 
28 /*!
29  @brief Data class for Internet communication sessions.
30 */
32 {
33 public:
35  virtual ~NexSessionInfo();
36 
37 /*!
38  @brief Gets the session's game mode.
39  @return Returns the session's game mode.
40 */
41  virtual u32 GetGameMode() const;
42 
43 /*!
44  @brief Gets the session's ID.
45  @return Returns the session ID.
46 */
47  virtual u32 GetSessionId() const;
48 
49 /*!
50  @brief Gets the number of people participating in a session.
51  @return Returns the number of people participating in a session.
52 */
53  virtual u32 GetCurrentParticipants() const;
54 
55 /*!
56  @brief Gets the minimum number of people who can participate in a session.
57  @return Returns the minimum number of people who can participate in a session.
58 */
59  virtual u32 GetMinParticipants() const;
60 
61 /*!
62  @brief Gets the maximum number of people who can participate in a session.
63  @return Returns the maximum number of people who can participate in a session.
64 */
65  virtual u32 GetMaxParticipants() const;
66 
67 /*!
68  @brief Gets whether a session is open for recruitment.
69  @return Returns <tt>true</tt> if the session is open for recruitment, and returns <tt>false</tt> if it is closed.
70 */
71  virtual bool IsOpened() const;
72 
73 /*!
74  @brief Gets the session's application-defined data.
75  @details Gets the application-defined data configured for the session.
76  @param[out] pBuffer Pointer to the buffer for copying the session's application-defined data.
77  @param[in] size Specifies the size of the buffer required for copying the session's application-defined data.
78  @return Returns a <tt>Result</tt> value indicating success if information was successfully obtained.
79  @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
80  @retval ResultInvalidState Not in a state where data can be retrieved. Programming error. Fix your program so that this error is not returned.
81 */
82  virtual nn::Result GetApplicationDataBuf(void* pBuffer, size_t size);
83 
84 /*!
85  @brief Gets the length of the session's application-defined data.
86  @return Returns the length of the session's application-defined data.
87 */
88  virtual size_t GetApplicationDataSize() const;
89 
90 /*!
91  @brief Gets the session's attributes.
92  @param[out] pAttribute Pointer to the attribute container for the session for the specified index.
93  @param[in] idx Specifies the index for the attribute to get.
94  @return Returns a <tt>Result</tt> value indicating success if information was successfully obtained.
95  @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
96  @retval ResultInvalidState Not in a state where data can be retrieved. Programming error. Fix your program so that this error is not returned.
97 */
98  virtual nn::Result GetAttribute(u32* pAttribute, u8 idx) const;
99 
100 /*!
101  @brief Gets the session's description string.
102  @param[out] pBuffer Pointer to the buffer for copying the session's description string.
103  @param[in] size Size of the buffer for copying the session's description string.
104  @return Returns a <tt>Result</tt> value indicating success if information was successfully obtained.
105  @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
106  @retval ResultInvalidState Not in a state where data can be retrieved. Programming error. Fix your program so that this error is not returned.
107 */
108  virtual nn::Result GetDescription(wchar_t* pBuffer, size_t size) const;
109 
110 /*!
111  @brief Gets the length of the session's description string.
112  @return Returns the length of the session's description string.
113 */
114  virtual size_t GetDescriptionSize() const;
115 
116 /*!
117  @brief Checks whether a user password is set for the session.
118  @return Returns <tt>true</tt> if a user password is set.
119 */
120  virtual bool IsRestrictedByUserPassword() const;
121 
122 /*!
123  @cond PRIVATE
124  @brief Checks whether a system password is set for the session.
125  @return Returns <tt>true</tt> if a system password is set.
126 */
127  virtual bool IsRestrictedBySystemPassword() const;
128  /// @endcond
129 
130 /*!
131  @brief Gets the session type.
132  @return Returns the configured session type.
133 */
134  virtual SessionType GetSessionType() const;
135 
136 /*!
137  @brief Gets the principal ID of the session host.
138  @return Returns the principal ID of the session host.
139 */
140  virtual u32 GetHostPrincipalId() const;
141 
142 /*!
143  @brief Gets the principal ID specified in the session search conditions.
144  @return Returns the principal ID specified in the session search conditions.
145 */
146  virtual u32 GetTargetPrincipalId() const;
147 
148 /*!
149  @brief Gets the matchmaking priority for the session.
150  @return Returns the matchmaking priority for the session.
151 */
152  virtual u8 GetSelectionPriority() const;
153 
154 /*!
155  @brief Gets the clock to use when the session begins.
156  @return Returns the clock to use when the session begins.
157 */
158  virtual const common::DateTime& GetStartedTime() const;
159 
160 /*!
161  @brief Clears session information.
162 */
163  virtual void Clear();
164 
165 /*!
166  @brief Copies session information.
167  @details Use this when you want the application to retain session information.
168  @param[in] rhs Session information to copy.
169 */
170  virtual void Copy(const NexSessionInfo& rhs);
171 
172 /*!
173  @brief Prints information that is useful for debugging.
174  @param[in] flag Specifies the bitwise OR of trace flags. For more information, see the <tt>@ref TraceFlag</tt> API reference.
175  */
176  virtual void Trace(u64 flag);
177 
178 /*!
179  @cond PRIVATE
180 */
181  virtual void SetGameMode(u32 gameMode);
182  virtual void SetSessionId(u32 sessionId);
183  virtual void SetCurrentParticipants(u32 participants);
184  virtual void SetMinParticipants(u32 participants);
185  virtual void SetMaxParticipants(u32 participants);
186  virtual void SetOpen(bool isOpened);
187  virtual void SetAttribute(u32 attribute, u8 index);
188  virtual void SetDescription(const void* pDesc, size_t size);
189  virtual void SetApplicationData(const void* pData, size_t size);
190  virtual void SetUserPasswordEnabled(bool isEnabled);
191  virtual void SetSystemPasswordEnabled(bool isEnabled);
192  virtual void SetSessionType(SessionType sessionType);
193  virtual void SetHostPrincipalId(u32 principalId);
194  virtual void SetTargetPrincipalId(u32 principalId);
195  virtual void SetSelectionPriority(u8 priority);
196  virtual void SetStartedTime(const common::DateTime& time);
197  /// @endcond
198 
199 private:
200  u32 m_GameMode;
201  u32 m_SessionId;
202  u32 m_CurrentParticipants;
203  u32 m_MinParticipants;
204  u32 m_MaxParticipants;
205  bool m_bIsOpened;
206 
207  u32 m_Attribute[ATTRIBUTE_MAX_SIZE];
208  wchar_t m_Description[DESCRIPTION_DATA_BUFFER_MAX_SIZE + 1];
209  size_t m_DescriptionSize;
210  u8 m_ApplicationData[APPLICATION_DATA_BUFFER_MAX_SIZE_INTERNAL];
211  size_t m_ApplicationDataSize;
212  bool m_bUserPasswordEnabled;
213  bool m_bSystemPasswordEnabled;
214 
215  SessionType m_SessionType;
216  u32 m_HostPrincipalId;
217  u32 m_TargetPrincipalId;
218  u8 m_SelectionPriority;
219  common::DateTime m_StartedTime;
220 };
221 }
222 }
223 } // End of namespace nn::pia::inet.
virtual void Copy(const NexSessionInfo &rhs)
Copies session information.
virtual u32 GetMaxParticipants() const
Gets the maximum number of people who can participate in a session.
const size_t ATTRIBUTE_MAX_SIZE
The number of attributes that can be specified in a session.
Definition: inet_NexSessionTypes.h:39
Data class for Internet communication sessions.
Definition: inet_NexSessionInfo.h:31
virtual bool IsRestrictedByUserPassword() const
Checks whether a user password is set for the session.
virtual u32 GetGameMode() const
Gets the session&#39;s game mode.
Definition: assert.h:115
virtual nn::Result GetAttribute(u32 *pAttribute, u8 idx) const
Gets the session&#39;s attributes.
virtual SessionType GetSessionType() const
Gets the session type.
An interface to the session&#39;s information.
Definition: session_ISessionInfo.h:32
virtual void Clear()
Clears session information.
virtual u8 GetSelectionPriority() const
Gets the matchmaking priority for the session.
virtual size_t GetDescriptionSize() const
Gets the length of the session&#39;s description string.
virtual u32 GetHostPrincipalId() const
Gets the principal ID of the session host.
SessionType
Enumerates the session types.
Definition: inet_NexSessionTypes.h:78
virtual size_t GetApplicationDataSize() const
Gets the length of the session&#39;s application-defined data.
virtual void Trace(u64 flag)
Prints information that is useful for debugging.
virtual u32 GetCurrentParticipants() const
Gets the number of people participating in a session.
virtual const common::DateTime & GetStartedTime() const
Gets the clock to use when the session begins.
virtual u32 GetSessionId() const
Gets the session&#39;s ID.
virtual bool IsOpened() const
Gets whether a session is open for recruitment.
virtual u32 GetTargetPrincipalId() const
Gets the principal ID specified in the session search conditions.
virtual u32 GetMinParticipants() const
Gets the minimum number of people who can participate in a session.
virtual nn::Result GetDescription(wchar_t *pBuffer, size_t size) const
Gets the session&#39;s description string.
virtual nn::Result GetApplicationDataBuf(void *pBuffer, size_t size)
Gets the session&#39;s application-defined data.
Class that represents time.
Definition: common_DateTime.h:28