1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     boss_Types.h
4 
5   Copyright (C)2009-2011 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: 38576 $
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/http/http_Types.h>
23 #include <nn/fs/fs_Parameters.h>
24 #include <nn/boss/boss_Const.h>
25 #include <nn/boss/boss_Result.h>
26 
27 /*=======================================================================*
28     Type Definitions
29  *=======================================================================*/
30 
31 #ifdef __cplusplus
32 
33 namespace nn {
34 namespace boss {
35 
36 typedef nn::fs::TitleId         AppIdType;
37 typedef nn::fs::ExtSaveDataId   BossStorageId;
38 
39 /* Please see man pages for details
40 
41 */
42 typedef struct TaskPolicyConfig {
43     u8                  priority;               //
44     SchedulingPolicy    schedulingPolicy;       //
45     TaskPermission      taskPermission;         //
46     NN_PADDING1;
47     u32                 targetDuration;         //
48     u32                 execInterval;           //
49     u32                 execCount;              //
50 } TaskPolicyConfig;
51 
52 
53 /* Please see man pages for details
54 
55 */
56 typedef struct TaskOptionConfig {
57     ExecOption      option;               //
58     u8              step;                 //
59     u8              targetStep;           //
60     NN_PADDING1;
61     u32             param1;               //
62     u32             param2;               //
63 } TaskOptionConfig;
64 
65 //------------------------------------------------------------
66 //  TASK ACTION   Cautions for 1st BOSS version
67 //      (1) ACTION supports Download and NsaDownload, parameters are provisionally defined although Upload and Signal are not implemented
68 //
69 //
70 //      (2) Regarding "nn::os::Event* event;" used with SIGNAL ACTION, must consider whether to develop after 2nd BOSS.
71 //
72 //          Event* is held in a structure, and using it by registering it in the BOSS database is a problem.
73 //
74 //
75 /* Please see man pages for details
76 
77 */
78 typedef struct TaskActionConfig {
79     Action              action;                                 //
80     u8                  privateRootCA;                          //
81     u8                  privateClientCert;                      //
82     ApInfoType          infoAP;                                 //
83     FileDescriptor      fDsec;                                  //
84     NN_PADDING3;
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     } file;
93     char                url[MAX_URL_LENGTH];                    //
94 
95     struct HhttpRequestHeader{
96         char            label[MAX_HTTP_HEADER_LABEL];           //
97         char            value[MAX_HTTP_HEADER_VALUE];           //
98     } httpRequestHeader[MAX_HTTP_HEADER];                       //
99 
100     nn::http::InternalCaCertId      rootCA[MAX_ROOT_CA];        //
101     nn::http::InternalClientCertId  clientCert[MAX_CLIENT_CERT];//
102     u32                             rootCANum;                  //
103     u32                             clientCertNum;              //
104 
105     NN_PADDING4;
106     char lastModified[MAX_LASTMODIFIED_LENGTH];                 //
107 
108 } TaskActionConfig;
109 
110 /* Please see man pages for details
111 
112 */
113 typedef TaskActionConfig TaskActionUploadConfig;
114 
115 /* Please see man pages for details
116 
117 */
118 typedef TaskActionConfig TaskActionDownloadConfig;
119 
120 /* Please see man pages for details
121 
122 */
123 typedef TaskActionConfig TaskActionSignalConfig;
124 
125 /* Please see man pages for details
126 
127 */
128 typedef TaskActionConfig TaskActionNsaDownloadConfig;
129 
130 
131 /* Please see man pages for details
132 
133 */
134 typedef struct TaskConfig {
135     u32                 execInterval;           //
136     u32                 execCount;              //
137     u8                  taskId[TASK_ID_LENGTH]; //
138 } TaskConfig;
139 
140 
141 /* Please see man pages for details
142 
143 */
144 typedef struct TaskStatusInfo {
145     s64                 taskStartTime;        //
146     s64                 stepStartTime;        //
147     TaskStateCode       state;                //
148     TaskStateCode       taskState;            //
149     TaskStateCode       stateResume;          //
150     TaskServiceStatus   serviceStatus;        //
151     bool                serviceTerminated;    //
152     TaskResultCode      resultCode;           //
153     NN_PADDING2;
154 
155     u32                 commErrorCode;        //
156     u32                 execCount;            //
157     u32                 pendingTime;          //
158     u32                 remainTime;           //
159     u32                 progress;             //
160     u32                 dataSize;             //
161     u16                 activeRate;           //
162     u16                 requestRate;          //
163     u8                  activeStep;           //
164     u8                  priority;             //
165     NN_PADDING2;
166     char lastModified[MAX_LASTMODIFIED_LENGTH];  //
167 } TaskStatusInfo;
168 
169 
170 /* Please see man pages for details
171 
172 */
173 typedef TaskStatusInfo TaskStepStatusInfo ;
174 
175 /* Please see man pages for details
176 
177 */
178 typedef struct TaskErrorInfo {
179     TaskResultCode  errorResultCode;            //
180     NN_PADDING3;
181     u32        errorCode;                       //
182     char       message[MAX_ERROR_MESSAGE];      //
183 } TaskErrorInfo;
184 
185 /* Please see man pages for details
186 
187 */
188 typedef struct ApplicationIdInfoList {
189     u16       size;                             //
190     NN_PADDING2;
191     NN_PADDING4;
192     AppIdType appId[MAX_APPLICATION_ID];        //
193 } ApplicationIdInfoList;
194 
195 /* Please see man pages for details
196 
197 */
198 typedef struct TaskIdInfoList {
199     u16     size;                               //
200     NN_PADDING2;
201     NN_PADDING4;
202     u8      taskId[MAX_TASK_ID][TASK_ID_LENGTH];//
203 } TaskIdInfoList;
204 
205 /* Please see man pages for details
206 
207 */
208 typedef struct StepIdInfoList {
209     u16       size;                     //
210     NN_PADDING2;
211     u8        StepID[MAX_TASK_ID];      //
212 } StepIdInfoList;
213 
214 /* Please see man pages for details
215 
216 */
217 typedef struct NsDataIdInfoList {
218     u16       size;                     //
219     u16       lastIndex;                //
220     u32       lastSerial;               //
221     u32*      pSerial;                  //
222     size_t    serialSize;               //
223 } NsDataIdInfoList;
224 
225 /* Please see man pages for details
226 
227 */
228 typedef struct NsDataHeaderInfo {
229     s64       titleId;                  //
230     bit32     flags;                    //
231     bit32     dataType;                 //
232     s32       length;                   //
233     u32       serialId;                 //
234     u32       version;                  //
235     NN_PADDING4;
236 } NsDataHeaderInfo;
237 
238 } // end of namespace boss
239 } // end of namespace nn
240 
241 
242 #endif /*__cplusplus*/
243 
244 #endif /* NN_BOSS_BOSS_TYPES_H_ */
245