1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     cec_MessageBox.h
4 
5   Copyright 2009 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   $Date:: 2010-10-27#$
14   $Rev: 29614 $
15   $Author: sato_yoshinobu $
16  *---------------------------------------------------------------------------*/
17 #ifndef __MESSAGE_BOX_SYSTEM_H__
18 #define __MESSAGE_BOX_SYSTEM_H__
19 
20 
21 #include <nn/cec/CTR/cec_Api.h>
22 
23 namespace nn {
24 namespace cec {
25 namespace CTR {
26 
27 
28 /*!
29 :private
30     @brief CEC MessageBox にアクセスするためのクラスです。(特権用)
31 
32 */
33 
34 class MessageBoxSystem : public MessageBox
35 {
36 
37  public:
38 
39     MessageBoxSystem(bool NoInitialize = false);
40     virtual ~MessageBoxSystem();
41 
42 
43     //! @name Boxの作成/削除
44     //@{
45 
46     u32     GetMessageBoxList(MessageBoxList& messageBoxList);
47 
48     /*!
49       @brief        MessageBox のリストを取得します。
50 
51       @param[out]    titleIdList          TitleIdの配列
52       @param[in]    flag       MessageBoxFlag
53       @return       TitleId数
54     */
55     u32     GetMessageBoxTitleIdList(TitleId* titleIdList, MessageBoxFlag flag);
56 
57     /*!
58       @brief        MessageBox を作成します。
59 
60       @param[in]    cecTitleId          Title固有ID
61       @param[in]    privateId       BOXにアクセスするときのキーとなります。
62                                     BOXにアクセスするアプリが保持している値を使用する必要があります。
63       @param[in]    hmacKey         Message を読み出すときに必要なキーを指定します。32文字の文字列で指定します。
64                                     通信相手と共通のキーである必要があります。
65       @param[in]    flag            MessageBoxFlag で BOX種別を指定します。
66       @param[in]    inboxSizeMax    受信ボックスの最大保存サイズを指定します。
67       @param[in]    outboxSizeMax    送信ボックスの最大保存サイズを指定します。
68       @param[in]    inboxMessNumMax    受信ボックスの最大保存Message数を指定します。
69       @param[in]    outboxMessNumMax    送信ボックスの最大保存Message数を指定します。
70       @param[in]    messageSizeMax    Messageの最大サイズを指定します。このサイズを超えるMessageは保存できません。
71       @return       nn::Result
72     */
73     nn::Result  CreateMessageBox_System(
74                 const TitleId cecTitleId, const u32 privateId,
75                 const char* hmacKey,
76                 MessageBoxFlag flag,
77                 size_t  inboxSizeMax = CEC_INBOX_SIZE_DEFAULT,
78                 size_t  outboxSizeMax = CEC_OUTBOX_SIZE_DEFAULT,
79                 size_t  inboxMessNumMax = CEC_INBOX_MESSNUM_DEFAULT,
80                 size_t  outboxMessNumMax = CEC_OUTBOX_MESSNUM_DEFAULT,
81                 size_t  messageSizeMax = CEC_MESSSIZEMAX_DEFAULT
82             );
83 
84 
85     nn::Result      DeleteAllBoxes();
86     void SetLastOpenedDate(const nn::fnd::DateTimeParameters& dateTime);
87     nn::fnd::DateTimeParameters GetLastOpenedDate();
88 
89 
90     /*!
91       @brief        MessageBox を開きます。Box内のMessageにアクセスするために、まずこの関数でBoxを開く必要があります。
92                     privateIdを指定することなくBOXにアクセス可能です。
93       @param[in]   cecTitleId          Title固有ID
94       @return       nn::Result
95     */
96     virtual nn::Result      OpenMessageBoxForce(const TitleId cecTitleId);
97 
98     nn::Result    SetMessageBoxFlag(const MessageBoxFlag flag);
99 
100     nn::Result  SetMessageBodyDirect(const TitleId cecTitleId, const CecBoxType boxType, const MessageId& messageId, const void* dataBody, const size_t dataBodyLen);
101     size_t  GetMessageBodySizeDirect(const TitleId cecTitleId, const CecBoxType boxType, const MessageId& messageId);
102     nn::Result  GetMessageBodyDirect(const TitleId cecTitleId, const CecBoxType boxType, const MessageId& messageId, void* dataBody, const size_t dataBodyLen);
103 };
104 
105 } // namespace CTR
106 } // namespace cec
107 } // namespace nn
108 
109 /*
110 #define CEC_STATE_MFILTER_EXCHANGE  (0x1)
111 #define CEC_STATE_ID_EXCHANGE       (0x2)
112 #define CEC_STATE_LIST_EXCHANGE     (0x4)
113 */
114 
115 #endif  //__MESSAGE_BOX_SYSTEM_H__
116 
117