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_ACT_TYPES_H_ 14 #define NN_ACT_TYPES_H_ 15 16 17 #include <nn/ffl/fflStandard.h> 18 #include <nn/act/act_Result.h> 19 20 21 #define ACT_INVALID_SLOT_NO (0) 22 #define ACT_SLOT_NO_CURRENT (254U) 23 #define ACT_SLOT_NO_COMMON (255U) 24 25 #define ACT_INVALID_PERSISTENT_ID (0U) 26 #define ACT_INVALID_TRANSFERBALE_ID (0ULL) 27 #define ACT_INVALID_SIMPLE_ADDRESS_ID (0U) 28 #define ACT_INVALID_PRINCIPAL_ID (0U) 29 30 #define ACT_MII_NAME_LENGTH_MAX (10) 31 #define ACT_ACCOUNT_ID_LENGTH_MIN (6) 32 #define ACT_ACCOUNT_ID_LENGTH_MAX (16) 33 #define ACT_COUNTRY_LENGTH (2) 34 #define ACT_LANGUAGE_LENGTH (2) 35 36 #define ACT_MII_NAME_SIZE (ACT_MII_NAME_LENGTH_MAX + 1) 37 #define ACT_ACCOUNT_ID_SIZE (ACT_ACCOUNT_ID_LENGTH_MAX + 1) 38 #define ACT_COUNTRY_SIZE (ACT_COUNTRY_LENGTH + 1) 39 #define ACT_LANGUAGE_SIZE (ACT_LANGUAGE_LENGTH + 1) 40 41 #define ACT_CLIENT_ID_LENGTH (32) 42 #define ACT_CLIENT_ID_SIZE (ACT_CLIENT_ID_LENGTH + 1) 43 44 #define ACT_INDEPENDENT_SERVICE_TOKEN_LENGTH (512) 45 #define ACT_INDEPENDENT_SERVICE_TOKEN_SIZE (ACT_INDEPENDENT_SERVICE_TOKEN_LENGTH + 1) 46 47 #define ACT_SLOT_NUM (12) 48 49 #define ACT_ERROR_CODE_BASE (1020000U) 50 #define ACT_ERROR_CODE_UNKNOWN (ACT_ERROR_CODE_BASE + 9999U) 51 52 #define ACT_SIMPLE_ADDRESS_COUNTRY_SHIFT (24) 53 #define ACT_SIMPLE_ADDRESS_AREA_SHIFT (16) 54 55 #define ACT_SIMPLE_ADDRESS_COUNTRY_MASK (0xFF000000U) 56 #define ACT_SIMPLE_ADDRESS_AREA_MASK (0x00FF0000U) 57 58 #define ACT_SIMPLE_ADDRESS_COUNTRY( id ) ((u8)(((u32)id & ACT_SIMPLE_ADDRESS_COUNTRY_MASK) >> ACT_SIMPLE_ADDRESS_COUNTRY_SHIFT)) 59 #define ACT_SIMPLE_ADDRESS_AREA( id ) ((u8)(((u32)id & ACT_SIMPLE_ADDRESS_AREA_MASK) >> ACT_SIMPLE_ADDRESS_AREA_SHIFT)) 60 #define ACT_SIMPLE_ADDRESS_ID( country, area ) ((((u32)country << ACT_SIMPLE_ADDRESS_COUNTRY_SHIFT) & ACT_SIMPLE_ADDRESS_COUNTRY_MASK) | (((u32)area << ACT_SIMPLE_ADDRESS_AREA_SHIFT) & ACT_SIMPLE_ADDRESS_AREA_MASK)) 61 62 63 /*! 64 @brief Stores a Universally Unique Identifier (UUID). 65 66 A UUID is an identifier that can be used with an expectation of global uniqueness. 67 68 Currently, the UUID retrieved from the account library complies with the Version 1 specifications defined in RFC 4122, but the ID format could change to the extent that it does not impair the uniqueness of the ID. 69 Be sure to handle the ID in its entirety as a single value. Do not use any individual parts of the ID as a timestamp or device identifier. 70 71 */ 72 typedef struct ACTUuid 73 { 74 u8 data[16]; 75 76 #ifdef __cplusplus 77 /*! 78 @brief Equivalence operator for an <tt>@ref ACTUuid</tt> object. 79 80 If the UUID values are identical, the objects are determined to be equivalent. 81 82 @param[in] uuid Specifies the UUID to compare. 83 84 @return Returns <tt>true</tt> if the objects are equivalent, or <tt>false</tt> if they are non-equivalent. 85 */ 86 inline bool operator==( const ACTUuid& uuid ) const 87 { 88 return data[0] == uuid.data[0] && data[1] == uuid.data[1] && data[2] == uuid.data[2] && data[3] == uuid.data[3] && 89 data[4] == uuid.data[4] && data[5] == uuid.data[5] && data[6] == uuid.data[6] && data[7] == uuid.data[7] && 90 data[8] == uuid.data[8] && data[9] == uuid.data[9] && data[10] == uuid.data[10] && data[11] == uuid.data[11] && 91 data[12] == uuid.data[12] && data[13] == uuid.data[13] && data[14] == uuid.data[14] && data[15] == uuid.data[15]; 92 } 93 94 /*! 95 @brief Non-equivalence operator for an <tt>@ref ACTUuid</tt> object. 96 97 If the UUID values are different, the objects are determined to be non-equivalent. 98 99 @param[in] uuid Specifies the UUID to compare. 100 101 @return Returns <tt>true</tt> if the objects are non-equivalent, or <tt>false</tt> if they are equivalent. 102 */ 103 inline bool operator!=( const ACTUuid& uuid ) const 104 { 105 return !(*this == uuid); 106 } 107 #endif 108 } ACTUuid; 109 110 111 #endif // NN_ACT_TYPES_H_ 112