1 /*---------------------------------------------------------------------------*
2 
3 Copyright (C) 2012 Nintendo. All rights reserved.
4 
5 These coded instructions, statements, and computer programs contain
6 proprietary information of Nintendo of America Inc. and/or Nintendo
7 Company Ltd., and are protected by Federal copyright law.  They may
8 not be disclosed to third parties or copied or duplicated in any form,
9 in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 
13 #ifndef NN_BOSS_BOSS_LIB_H_
14 #define NN_BOSS_BOSS_LIB_H_
15 
16 
17 #include <nn/boss/boss_Const.h>
18 #include <nn/boss/boss_Result.h>
19 #include <nn/boss/boss_Types.h>
20 
21 
22 #ifdef __cplusplus
23 
24 namespace nn {
25 namespace boss {
26 
27 /*!
28 @addtogroup nn_boss
29   @{
30 
31 @defgroup nn_boss_api  SpotPass (BOSS) API
32   @brief Members of the SpotPass (BOSS) library API. (Includes only C++ API members.)
33   @{
34 */
35 
36 /*!
37 @brief Initializes the SpotPass (BOSS) library. You must call this function once before using the BOSS library.
38 
39 @return Returns the execution result of the function. Returns one of the following <tt>Result</tt> values.
40 @retval Result::IsSuccess  Indicates that initialization succeeded.
41 @retval Other  Indicates an unexpected error. (For more information, see <tt>@ref nn_boss_result</tt>.)
42 */
43     nn::Result Initialize( void );
44 
45 /*!
46 @brief Finalizes the SpotPass (BOSS) library. Call this function once when you are finished using the BOSS library.
47 */
48     void Finalize(void);
49 
50 /*!
51 @brief Determines whether the library has been initialized.
52 
53 @return Returns <tt>true</tt> if it is already initialized and <tt>false</tt> if it is not yet initialized.
54 */
55     bool IsInitialized(void);
56 
57 /*!
58 @brief Gets a list of registered task IDs.
59 
60 Gets a list of the registered task IDs for the account in the specified slot that were registered by the calling application.
61 (Set <tt>0</tt> for <span class="argument">slotNo</span> to target the account that is logged in at the time of the call.)
62 If a buffer with a size equal to or greater than the number of tasks registered by applications is set for the <span class="argument">taskIdList</span> parameter, you can retrieve a list of all registered tasks at one time.
63 If you specify a small buffer for the <span class="argument">taskIdList</span> parameter, you can get a partial task ID list by specifying the number of the task from which to start retrieving IDs for the <span class="argument">startPos</span> parameter.
64 To get all of the registered task IDs, run the API function multiple times and change the value specified for the <span class="argument">startPos</span> parameter.
65 
66 @param[in]    slotNo     Specifies a slot in the target account.
67 @param[out] taskIdList  Specifies a <tt>TaskID</tt> array for storing a list of task IDs. The number of array elements must match the value of <span class="argument">elementCount</span>.
68 @param[in] elementCount  Specifies the number of elements in <span class="argument">taskIdList</span>.
69 @param[out] getIdCount  Stores the obtained number of task IDs.
70 @param[in] startPos  Specifies the position, among all task IDs, of the first task ID to get. You can call this function repeatedly, using a <span class="argument">taskIdList</span> with a small number of elements, to get all of the task IDs. If omitted, elements are obtained starting with the first task ID in the list.
71 @return Returns the execution result of the function. Returns one of the following <tt>Result</tt> values.
72 @retval Result::IsSuccess  Indicates successful retrieval.
73 @retval ResultNotCompleted  Could not get all of the task IDs.
74 @retval ResultNotExist  The specified task ID does not exist.
75 @retval ResultInvalidParameter  Invalid argument.
76 @retval ResultLibraryNotInitialized  Indicates that the session is not initialized. <br />
77 The function returns this <tt>Result</tt> if it is called before <tt>@ref Initialize</tt> is called. <br />
78 Always call the <tt>@ref Initialize</tt> function before you use the BOSS library.
79 */
80     nn::Result GetTaskIdList(u8 slotNo, TaskID taskIdList[], u32 elementCount, u32* getIdCount, u32 startPos = 0);
81 
82 /*!
83 @brief Gets the BOSS state.
84 
85 @return Returns the state of BOSS. For the definitions of each value, see the descriptions of the <tt>@ref BossState</tt> enumerators.
86 */
87     BossState GetBossState(void);
88 
89 /*!
90 @brief Returns the error code for the execution result of an API function.
91 
92 If a BOSS API function returns a <tt>nn::Result</tt> type representing an error, you can use this function to convert the result into an error code.
93 This function returns <tt>0</tt> if passed a <span class="argument">result</span> representing success (<tt>result.IsSuccess()</tt> returns <tt>true</tt>).
94 
95 @param[in] result  The <tt>nn::Result</tt> instance to convert.
96 @return Returns the error code.
97 */
98     u32 GetErrorCode( nn::Result result );
99 
100 
101 /*!
102 @deprecated This API function is not supported. Do not use it.
103 */
104     nn::Result RegisterRootCa(const char* pName, const u8* pCertData, size_t certDataSize, AccountID accountId = 0);
105 
106 /*!
107 @deprecated This API function is not supported. Do not use it.
108 */
109     nn::Result RegisterClientCert(const char* pCertName, const u8* pCertData, size_t certDataSize, const char* pKeyName, const u8* pPrivateKeyData, size_t privateKeyDataSize, AccountID accountId = 0);
110 
111 /*!
112 @deprecated This API function is outdated. Do not use it.
113 */
114     nn::Result GetTaskIdList(TaskID taskIdList[], u32 elementCount, u32* getIdCount, AccountID accountId = 0, u32 startPos = 0);
115 
116 /*!
117   @}
118   @}
119 */
120 
121 } // end of namespace boss
122 } // end of namespace nn
123 
124 #endif // __cplusplus
125 
126 #endif /* NN_BOSS_BOSS_LIB_H_ */
127