1 /*---------------------------------------------------------------------------*
2   Project:  Wii Connect 24
3   File:     NWC24FriendList.h
4 
5   Copyright (C)2006 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   $Log: NWC24FriendList.h,v $
14   Revision 1.8  2007/05/31 02:11:53  adachi_hiroaki
15   Added NWC24_FL_NAME_SIZE_LIMIT and NWC24_FL_ADDR_LENGTH_LIMIT.
16 
17   Revision 1.7  2007/03/19 02:41:01  hirose_kazuki
18   Added NWC24SwapFriendInfos() and NWC24GetFriendInfoStatus().
19 
20   Revision 1.6  2006/11/11 15:22:58  seiki_masashi
21   Added CheckPublicMailAddr() and CheckFriendInfo().
22 
23   Revision 1.5  2006/10/17 09:01:30  hirose_kazuki
24   Added prototype declaration of NWC24GetNumEstFriendInfos().
25 
26   Revision 1.4  2006/09/12 08:47:58  hirose_kazuki
27   Updated the format of NWC24FriendAttr.
28 
29   Revision 1.3  2006/09/02 07:45:42  hirose_kazuki
30   Added NWC24SearchFriendInfoByAddr().
31 
32   Revision 1.2  2006/08/25 06:32:36  hirose_kazuki
33   Added NWC24SearchFriendInfoById().
34 
35   Revision 1.1  2006/08/24 02:33:47  hirose_kazuki
36   Initial check in.
37 
38 
39  *---------------------------------------------------------------------------*/
40 
41 /*---------------------------------------------------------------------------*
42     NWC24 Friend List API
43  *---------------------------------------------------------------------------*/
44 #ifndef NWC24FRIENDLIST_H__
45 #define NWC24FRIENDLIST_H__
46 
47 #include <revolution/nwc24/NWC24Types.h>
48 #include <revolution/nwc24/NWC24Err.h>
49 
50 /*---------------------------------------------------------------------------*
51     Type definitions
52  *---------------------------------------------------------------------------*/
53 
54 #define NWC24_FI_TYPE_NONE          0
55 #define NWC24_FI_TYPE_WII           1
56 #define NWC24_FI_TYPE_PUBLIC        2
57 
58 #define NWC24_FI_STAT_NONE          0
59 #define NWC24_FI_STAT_PENDING       1
60 #define NWC24_FI_STAT_ESTABLISHED   2
61 #define NWC24_FI_STAT_DECLINED      3
62 
63 #define NWC24_FL_NAME_SIZE          12
64 #define NWC24_FL_ADDR_LENGTH        256     // RFC2821 defines max=255.
65 
66 #define NWC24_FL_NAME_SIZE_LIMIT    10
67 #define NWC24_FL_ADDR_LENGTH_LIMIT  99
68 
69 typedef struct NWC24FriendAttr
70 {
71     u32     type;                       // Address type [4Bytes]
72     u32     status;                     // Friend relation status [4Bytes]
73     u16     name[NWC24_FL_NAME_SIZE];   // Nickname [24Bytes]
74     u64     fdId;                       // Reserved [8Bytes]
75     u32     reserved[6];                // Reserved [24Bytes]
76 
77     // 64 Bytes
78 } NWC24FriendAttr;
79 
80 typedef union NWC24FriendAddr
81 {
82     NWC24UserId     wiiId;
83     char            mailAddr[NWC24_FL_ADDR_LENGTH];
84 
85     // 256 Bytes
86 } NWC24FriendAddr;
87 
88 typedef struct NWC24FriendInfo
89 {
90     NWC24FriendAttr     attr;
91     NWC24FriendAddr     addr;
92 
93     // 320 Bytes
94 } NWC24FriendInfo;
95 
96 
97 /*---------------------------------------------------------------------------*
98     API Prototypes
99  *---------------------------------------------------------------------------*/
100 #ifdef __cplusplus
101 extern "C" {
102 #endif
103 
104 /*---------------------------------------------------------------------------*/
105 
106 NWC24Err NWC24ReadFriendInfo( NWC24FriendInfo* info, u32 index );
107 NWC24Err NWC24WriteFriendInfo( const NWC24FriendInfo* info, u32 index );
108 NWC24Err NWC24UpdateFriendInfo( const NWC24FriendInfo* info, u32 index );
109 NWC24Err NWC24DeleteFriendInfo( u32 index );
110 NWC24Err NWC24SwapFriendInfos( u32 index0, u32 index1 );
111 NWC24Err NWC24GetFriendInfoStatus( u32* type, u32* status, u32 index );
112 
113 NWC24Err NWC24SearchFriendInfoById( NWC24UserId id, u32* index );
114 NWC24Err NWC24SearchFriendInfoByAddr( const NWC24FriendAddr* addr, u32* index );
115 
116 NWC24Err NWC24GetNumFriendInfos( u32* num );
117 NWC24Err NWC24GetNumRegFriendInfos( u32* num );
118 NWC24Err NWC24GetNumEstFriendInfos( u32* num );
119 int      NWC24IsFriendInfoThere( u32 index );
120 NWC24Err NWC24CheckFriendInfo( const NWC24FriendInfo* info );
121 NWC24Err NWC24CheckPublicMailAddr( const char* addr );
122 
123 
124 // For debug purpose only.
125 void     NWC24DumpFriendInfo( const NWC24FriendInfo* info );
126 
127 /*---------------------------------------------------------------------------*/
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif  // NWC24FRIENDLIST_H__
134 
135