1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     boss_Types.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  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   $Rev: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_BOSS_BOSS_TYPES_H_
17 #define NN_BOSS_BOSS_TYPES_H_
18 
19 #include <nn/types.h>
20 #include <nn/os/os_Event.h>
21 #include <nn/Handle.h>
22 #include <nn/fs/fs_Parameters.h>
23 #include <nn/boss/boss_Const.h>
24 #include <nn/boss/boss_Result.h>
25 
26 /*=======================================================================*
27     Type Definitions
28  *=======================================================================*/
29 
30 #ifdef __cplusplus
31 
32 namespace nn {
33 namespace boss {
34 
35 typedef nn::fs::TitleId         AppIdType;
36 typedef nn::fs::ExtSaveDataId   BossStorageId;
37 
38 /* Please see man pages for details
39 
40 */
41 typedef struct TaskPolicyConfig {
42     u8                  priority;               //
43     SchedulingPolicy    schedulingPolicy;       //
44     TaskPermission      taskPermission;         //
45     NN_PADDING1;
46     u32                 targetDuration;         //
47     u32                 execInterval;           //
48     u32                 execCount;              //
49 } TaskPolicyConfig;
50 
51 
52 /* Please see man pages for details
53 
54 */
55 typedef struct TaskOptionConfig {
56     ExecOption      option;               //
57     u8              step;                 //
58     u8              targetStep;           //
59     NN_PADDING1;
60     u32             param1;               //
61     u32             param2;               //
62 } TaskOptionConfig;
63 
64 //------------------------------------------------------------
65 //  TASK ACTION   Cautions for 1st BOSS version
66 //      (1) ACTION supports "Download" and "NsaDownload"
67 //                    Although "Upload" and "Signal" are not implemented, parameters are provisionally defined
68 //
69 //      (2) Consideration regarding "nn::os::Event* event;" used with SIGNAL ACTION is required for development after 2nd BOSS.
70 //
71 //          Event* is held in a structure, and using it by registering it in the BOSS database is a problem.
72 //
73 //
74 /* Please see man pages for details
75 
76 */
77 typedef struct TaskActionConfig {
78     Action              action;                                 //
79     u8                  privateRootCA;                          //
80     u8                  privateClientCert;                      //
81     ApInfoType          infoAP;                                 //
82     FileDescriptor      fDesc;                                  //
83     CfgInfoType         infoCfg;                                //
84     NN_PADDING2;
85     u32                 execSerialId;                           //
86     u32                 offset;                                 //
87     nn::os::Event*      event;                                  //
88     nn::Handle          fileHandle;                             //
89     union File {
90         char            filePath[MAX_FILEPATH_LENGTH];          //
91         wchar_t         filePathW[MAX_FILEPATH_LENGTH];         //
92         u8              param[MAX_TASK_FILE_PARAM];             //
93     } file;
94     char                url[MAX_URL_LENGTH];                    //
95 
96     struct HhttpRequestHeader{
97         char            label[MAX_HTTP_HEADER_LABEL];           //
98         char            value[MAX_HTTP_HEADER_VALUE];           //
99     } httpRequestHeader[MAX_HTTP_HEADER];                       //
100 
101     u32                             rootCA[MAX_ROOT_CA];        //
102     u32                             clientCert[MAX_CLIENT_CERT];//
103     u32                             rootCANum;                  //
104     u32                             clientCertNum;              //
105 
106     NN_PADDING4;
107     char lastModified[MAX_LASTMODIFIED_LENGTH];                 //
108 
109 } TaskActionConfig;
110 
111 /* Please see man pages for details
112 
113 */
114 typedef TaskActionConfig TaskActionUploadConfig;
115 
116 /* Please see man pages for details
117 
118 */
119 typedef TaskActionConfig TaskActionDownloadConfig;
120 
121 /* Please see man pages for details
122 
123 */
124 typedef TaskActionConfig TaskActionSignalConfig;
125 
126 /* Please see man pages for details
127 
128 */
129 typedef TaskActionConfig TaskActionNsaDownloadConfig;
130 
131 
132 /* Please see man pages for details
133 
134 */
135 typedef struct TaskConfig {
136     u32                 execInterval;           //
137     u32                 execCount;              //
138     u8                  taskId[TASK_ID_LENGTH]; //
139 } TaskConfig;
140 
141 
142 /* Please see man pages for details
143 
144 */
145 typedef struct TaskStatusInfo {
146     s64                 taskStartTime;        //
147     s64                 stepStartTime;        //
148     TaskStateCode       state;                //
149     TaskStateCode       taskState;            //
150     TaskStateCode       stateResume;          //
151     TaskServiceStatus   serviceStatus;        //
152     bool                serviceTerminated;    //
153     TaskResultCode      resultCode;           //
154     NN_PADDING2;
155 
156     u32                 commErrorCode;        //
157     u32                 execCount;            //
158     u32                 pendingTime;          //
159     u32                 remainTime;           //
160     u32                 progress;             //
161     u32                 dataSize;             //
162     u16                 activeRate;           //
163     u16                 requestRate;          //
164     u8                  activeStep;           //
165     u8                  priority;             //
166     NN_PADDING2;
167     char lastModified[MAX_LASTMODIFIED_LENGTH];  //
168 } TaskStatusInfo;
169 
170 
171 /* Please see man pages for details
172 
173 */
174 typedef TaskStatusInfo TaskStepStatusInfo ;
175 
176 /* Please see man pages for details
177 
178 */
179 typedef struct TaskErrorInfo {
180     TaskResultCode errorResultCode;             //
181     NN_PADDING3;
182     u32         errorCode;                      //
183     char        message[MAX_ERROR_MESSAGE];     //
184 } TaskErrorInfo;
185 
186 /* Please see man pages for details
187 
188 */
189 typedef struct HttpQuery {
190     QueryType   type;                           //
191     char        name[MAX_HTTP_QUERY_NAME];      //
192     char        value[MAX_HTTP_QUERY_VALUE];    //
193 } HttpQuery;
194 
195 /* Please see man pages for details
196 
197 */
198 typedef struct TaskQueryConfig {
199     HttpQuery   query[MAX_HTTP_QUERY];          //
200 } TaskQueryConfig;
201 
202 /* Please see man pages for details
203 
204 */
205 typedef struct DataStoreDownloadConfig
206 {
207     u32         gameId;                                     //
208     wchar_t     accessKey[MAX_ACCESS_KEY_LENGTH];           //
209     wchar_t     newsSubject[MAX_NEWS_SUBJECT_LENGTH];       //
210     wchar_t     newsMessage[MAX_NEWS_MESSAGE_LENGTH];       //
211     u8          newsJumpParam[MAX_NEWS_JUMP_PARAM];         //
212     NewsMode    newsMode;                                   //
213     NN_PADDING1;
214     bit32       newsSerialId;                               //
215 } DataStoreDownloadConfig;
216 
217 /* Please see man pages for details
218 
219 */
220 typedef struct DataStoreUploadConfig
221 {
222     u32         gameId;                                     //
223     wchar_t     accessKey[MAX_ACCESS_KEY_LENGTH];           //
224     u16         period;                                     //
225     u16         dataType;                                   //
226     u16         dstPrincipalIdNum;                          //
227     DstKind     dstKind;                                    //
228     u32         dstPrincipalId[MAX_DST_PRINCIPAL_ID];       //
229 } DataStoreUploadConfig;
230 
231 /* Please see man pages for details
232 
233 */
234 typedef struct ApplicationIdInfoList {
235     u16       size;                             //
236     NN_PADDING2;
237     NN_PADDING4;
238     AppIdType appId[MAX_APPLICATION_ID];        //
239 } ApplicationIdInfoList;
240 
241 /* Please see man pages for details
242 
243 */
244 typedef struct TaskIdInfoList {
245     u16     size;                               //
246     NN_PADDING2;
247     NN_PADDING4;
248     u8      taskId[MAX_TASK_ID][TASK_ID_LENGTH];//
249 } TaskIdInfoList;
250 
251 /* Please see man pages for details
252 
253 */
254 typedef struct StepIdInfoList {
255     u16       size;                     //
256     NN_PADDING2;
257     u8        stepId[MAX_TASK_ID];      //
258 } StepIdInfoList;
259 
260 /* Please see man pages for details
261 
262 */
263 typedef struct NsDataIdInfoList {
264     u16       size;                     //
265     u16       lastIndex;                //
266     u32       lastSerial;               //
267     u32*      pSerial;                  //
268     size_t    serialSize;               //
269 } NsDataIdInfoList;
270 
271 /* Please see man pages for details
272 
273 */
274 typedef struct NsDataHeaderInfo {
275     s64       titleId;                  //
276     bit32     flags;                    //
277     bit32     dataType;                 //
278     s32       length;                   //
279     u32       serialId;                 //
280     u32       version;                  //
281     NN_PADDING4;
282 } NsDataHeaderInfo;
283 
284 } // end of namespace boss
285 } // end of namespace nn
286 
287 
288 #endif /*__cplusplus*/
289 
290 #endif /* NN_BOSS_BOSS_TYPES_H_ */
291