1 /*---------------------------------------------------------------------------* 2 Project: RevolutionDWC public include file 3 File: ./common/dwc_error.h 4 5 Copyright 2005-2008 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 *---------------------------------------------------------------------------*/ 14 15 #ifndef DWC_ERROR_H_ 16 #define DWC_ERROR_H_ 17 18 #ifdef __cplusplus 19 extern "C" 20 { 21 #endif 22 23 24 //---------------------------------------------------------------------------- 25 // enum 26 //---------------------------------------------------------------------------- 27 28 // 29 // No description of the doxycomment enumerator below is given here because it is described under DWC_GetLastError. 30 // 31 // 32 33 /** 34 * Error enumerator 35 * 36 * Version: 1.4.0 Added descriptions of the ND and SVL errors, because those descriptions were missing. 37 */ 38 typedef enum { 39 40 DWC_ERROR_NONE = 0, ///< No error 41 DWC_ERROR_DS_MEMORY_ANY, ///< Errors related to system save data 42 DWC_ERROR_AUTH_ANY, ///< Errors related to authentication 43 DWC_ERROR_AUTH_OUT_OF_SERVICE, ///< Service has been terminated 44 DWC_ERROR_AUTH_STOP_SERVICE, ///< Temporary service interruption 45 DWC_ERROR_AC_ANY, ///< Errors related to automatic connection 46 DWC_ERROR_NETWORK, ///< Other network errors 47 DWC_ERROR_GHTTP_ANY, ///< GHTTP (HTTP communication)-related errors 48 DWC_ERROR_DISCONNECTED, ///< Disconnected 49 DWC_ERROR_FATAL, ///< Fatal error 50 51 // Minor error on sequence (DWCErrorType = DWC_ETYPE_LIGHT) 52 DWC_ERROR_FRIENDS_SHORTAGE, ///< Attempted to start peer matchmaking with friend specified even though there was an insufficient number of valid friends 53 DWC_ERROR_NOT_FRIEND_SERVER, ///< During server-client matchmaking, either the friend specified as the server is not a mutual friend, or the server is down 54 DWC_ERROR_SERVER_FULL, ///< The server-client matchmaking server is full 55 56 // Added error types for the Nd library 57 DWC_ERROR_ND_ANY, ///< Download library error 58 DWC_ERROR_ND_HTTP, ///< Download library HTTP error 59 60 // Added error types for the SVL library 61 DWC_ERROR_SVL_ANY, ///< Service locator error 62 DWC_ERROR_SVL_HTTP, ///< Service locator HTTP error 63 64 // Added error types for the SVL library 65 DWC_ERROR_PROF_PARSEERR, ///< Illegal string check error 66 DWC_ERROR_PROF_HTTP, ///< Illegal string check HTTP error 67 68 // DB library 69 DWC_ERROR_DB_ANY, ///< DB library error 70 71 // Parts added in the new standard version 72 // 73 DWC_ERROR_SC_CONNECT_BLOCK, ///< The client connection was denied by the server during server-client matchmaking 74 DWC_ERROR_NETWORK_LIGHT, ///< Network-related error that is treated as being minor 75 76 DWC_ERROR_NUM 77 } DWCError; 78 79 /** 80 * Error type indicating the processing required when an error is detected 81 * 82 * Version: 1.4.0 Added an option, Return to the Wii Menu, when a fatal error occurs. 83 * Version: 1.4.15: Removed descriptions related to DWC_ShutdownGHTTP in accordance with DWC_GHTTP being made private. 84 * Version: 1.4.17 Added a description related to calling SOCleanup() and SOFinish(). 85 * Version: 2.0.1 Removed descriptions related to calling SOFinish(). 86 */ 87 typedef enum { 88 89 DWC_ETYPE_NO_ERROR = 0, ///< No error 90 DWC_ETYPE_LIGHT, ///< Game-specific displays only; the error code does not need to be displayed. 91 ///< It is possible to recover if the DWC_ClearError function is called. 92 DWC_ETYPE_SHOW_ERROR, ///< Display an error code. 93 ///< It is possible to recover if the DWC_ClearError function is called. 94 DWC_ETYPE_SHUTDOWN_FM, ///< It is necessary to call the DWC_ShutdownFriendsMatch function to terminate the FriendsMatch library. 95 ///< Display an error code. 96 DWC_ETYPE_SHUTDOWN_GHTTP, ///< Call each of the following library release functions as necessary. 97 ///< DWC_RnkShutdown function (general-purpose ranking library) 98 ///< Display an error code. 99 DWC_ETYPE_SHUTDOWN_ND, ///< It is necessary to call the DWC_NdCleanupAsync function to terminate the download library. 100 ///< Display an error code. 101 DWC_ETYPE_DISCONNECT, ///< Call each of the following library release functions as necessary. 102 ///< DWC_ShutdownFriendsMatch function (FriendsMatch library) 103 ///< DWC_NdCleanupAsync function (download library) 104 ///< DWC_RnkShutdown function (general-purpose ranking library) *See NOTE. 105 ///< Afterwards, you must call SOCleanup() to disconnect communications, as well. 106 ///< Display an error code. 107 ///< *NOTE: The general-purpose ranking library uses the HTTP communications library, and therefore calls the DWC_InitGHTTP and DWC_ShutdownGHTTP functions internally from its initialization and shutdown processing. 108 ///< *NOTE: In the current version, applications cannot directly use DWC_GHTTP. 109 DWC_ETYPE_FATAL, ///< This is equivalent to a fatal error, so you must prompt the user to either Turn the Power OFF, or Return to the Wii Menu. Display an error code. 110 111 DWC_ETYPE_NUM 112 113 } DWCErrorType; 114 115 /// Individual elements of dwc_base error codes for debugging 116 enum { 117 // Which sequence did this error occur in? 118 DWC_ECODE_SEQ_LOGIN = (-60000), ///< Error during login 119 DWC_ECODE_SEQ_FRIEND = (-70000), ///< Error while managing friends 120 DWC_ECODE_SEQ_MATCH = (-80000), ///< Error during matchmaking 121 DWC_ECODE_SEQ_ETC = (-90000), ///< Error during any operation other than those mentioned above 122 123 // If this is a GameSpy error, which SDK caused the error? 124 DWC_ECODE_GS_GP = (-1000), ///< GameSpy GP error 125 DWC_ECODE_GS_PERS = (-2000), ///< GameSpy Persistent error 126 DWC_ECODE_GS_STATS = (-3000), ///< GameSpy Stats error 127 DWC_ECODE_GS_QR2 = (-4000), ///< GameSpy QR2 error 128 DWC_ECODE_GS_SB = (-5000), ///< GameSpy Server browsing error 129 DWC_ECODE_GS_NN = (-6000), ///< GameSpy Nat negotiation error 130 DWC_ECODE_GS_GT2 = (-7000), ///< GameSpy gt2 error 131 DWC_ECODE_GS_HTTP = (-8000), ///< GameSpy HTTP error 132 DWC_ECODE_GS_ETC = (-9000), ///< Miscellaneous GameSpy SDK errors 133 134 // Standard error types 135 DWC_ECODE_TYPE_NETWORK = ( -10), ///< Network failure 136 DWC_ECODE_TYPE_SERVER = ( -20), ///< GameSpy server failure 137 DWC_ECODE_TYPE_DNS = ( -30), ///< DNS failure 138 DWC_ECODE_TYPE_DATA = ( -40), ///< Received invalid data 139 DWC_ECODE_TYPE_SOCKET = ( -50), ///< Socket communication error 140 DWC_ECODE_TYPE_BIND = ( -60), ///< Socket bind error 141 DWC_ECODE_TYPE_TIMEOUT = ( -70), ///< Timeout occurred 142 DWC_ECODE_TYPE_PEER = ( -80), ///< Problem with 1-to-1 communications 143 DWC_ECODE_TYPE_CONN_OVER = (-100), ///< Maximum number of connections exceeded 144 DWC_ECODE_TYPE_STATS_AUTH = (-200), ///< STATS server login error 145 DWC_ECODE_TYPE_STATS_LOAD = (-210), ///< STATS server data load error 146 DWC_ECODE_TYPE_STATS_SAVE = (-220), ///< STATS server data save error 147 DWC_ECODE_TYPE_NOT_FRIEND = (-400), ///< The other party specified is not mutually registered as a friend 148 DWC_ECODE_TYPE_OTHER = (-410), ///< The other party has terminated the connection (mainly during server-client matchmaking) 149 DWC_ECODE_TYPE_MUCH_FAILURE = (-420), ///< NAT negotiations have failed the designated number of times or more 150 DWC_ECODE_TYPE_SC_CL_FAIL = (-430), ///< Client failed to connect during server-client matchmaking 151 DWC_ECODE_TYPE_CLOSE = (-600), ///< Error occurring when the connection is closed 152 DWC_ECODE_TYPE_TRANS_HEADER = (-610), ///< Reliable data was received in an invalid receive state 153 DWC_ECODE_TYPE_TRANS_BODY = (-620), ///< Receive buffer overflow 154 DWC_ECODE_TYPE_TRANS_SEND = (-630), ///< Reliable transmission failure 155 DWC_ECODE_TYPE_TRANS_UNKNOWN_PEER = (-640), ///< Reception from a gt2 connection unrecognized by the local host 156 DWC_ECODE_TYPE_AC_FATAL = (-700), ///< Error group used by AC during AC processing. In this case, the low order digits represent the dedicated state value. 157 DWC_ECODE_TYPE_OPEN_FILE = (-800), ///< GHTTP file open failure 158 DWC_ECODE_TYPE_INVALID_POST = (-810), ///< Invalid GHTTP transfer 159 DWC_ECODE_TYPE_REQ_INVALID = (-820), ///< Invalid GHTTP file name, or other invalid information 160 DWC_ECODE_TYPE_UNSPECIFIED = (-830), ///< Unspecified GHTTP error 161 DWC_ECODE_TYPE_BUFF_OVER = (-840), ///< GHTTP buffer overflow 162 DWC_ECODE_TYPE_PARSE_URL = (-850), ///< GHTTP URL parsing error 163 DWC_ECODE_TYPE_BAD_RESPONSE = (-860), ///< Error parsing response from GHTTP server 164 DWC_ECODE_TYPE_REJECTED = (-870), ///< Requests from the GHTTP server were rejected 165 DWC_ECODE_TYPE_FILE_RW = (-880), ///< GHTTP local file read/write error 166 DWC_ECODE_TYPE_INCOMPLETE = (-890), ///< GHTTP download interruption 167 DWC_ECODE_TYPE_TO_BIG = (-900), ///< The GHTTP file size is too big and cannot be downloaded 168 DWC_ECODE_TYPE_ENCRYPTION = (-910), ///< GHTTP encryption error 169 170 // Specialized categories of Fatal Error 171 DWC_ECODE_TYPE_ALLOC = (-1), ///< Memory allocation failure 172 DWC_ECODE_TYPE_PARAM = (-2), ///< Parameter error 173 DWC_ECODE_TYPE_SO_SOCKET = (-3), ///< GameSpy gt2 socket error caused by an SO error 174 DWC_ECODE_TYPE_NOT_INIT = (-4), ///< Library not initialized. 175 DWC_ECODE_TYPE_DUP_INIT = (-5), ///< Library initialized twice. 176 DWC_ECODE_TYPE_WM_INIT = (-6), ///< WM initialization failed. 177 DWC_ECODE_TYPE_UNEXPECTED = (-9), ///< Unexpected state, or an unknown GameSpy error 178 179 // 30000s error code definition (for extended features) 180 DWC_ECODE_SEQ_ADDINS = (-30000),///< Extended feature error 181 DWC_ECODE_FUNC_PROF = (-3000), ///< Region for the name check feature 182 183 DWC_ECODE_FUNC_ND = (-1000), ///< Region for DWC_Nd 184 185 DWC_ECODE_TYPE_ND_ALLOC = ( -1), ///< Memory allocation failure 186 DWC_ECODE_TYPE_ND_FATAL = ( -9), ///< Miscellaneous fatal error 187 DWC_ECODE_TYPE_ND_STATE = (-10), ///< A function was called from a state in which it cannot be called 188 DWC_ECODE_TYPE_ND_HTTP = (-20), ///< HTTP communication failed 189 DWC_ECODE_TYPE_ND_PARAM = (-30), ///< Invalid parameters passed to a function 190 DWC_ECODE_TYPE_ND_CANCEL = (-40), ///< Cancelled asynchronous processing 191 192 DWC_ECODE_TYPE_ND_SERVER_PARAM = (-101), ///< Invalid parameters sent to the server 193 DWC_ECODE_TYPE_ND_SERVER_SERVICE = (-102), ///< Service not registered 194 DWC_ECODE_TYPE_ND_SERVER_INVALIDTOKEN = (-103), ///< Illegal token (service locator information) 195 DWC_ECODE_TYPE_ND_SERVER_TOKENEXPIRED = (-104), ///< Expired token (service locator information) 196 DWC_ECODE_TYPE_ND_SERVER_NOCONTENTS = (-105), ///< No content present 197 DWC_ECODE_TYPE_ND_SERVER_ATTR = (-106), ///< Attribute does not match 198 DWC_ECODE_TYPE_ND_SERVER_CONTENTSEXPIRED = (-107), ///< Expired content 199 DWC_ECODE_TYPE_ND_SERVER_INVALIDAP = (-108), ///< Access from an access point for which service is not supported 200 DWC_ECODE_TYPE_ND_SERVER_DATABASE = (-109), ///< Cannot connect to database (problem with Download server) 201 DWC_ECODE_TYPE_ND_SERVER_PASSWORD = (-110), ///< Password does not match 202 203 DWC_ECODE_TYPE_PROF_CONNERR = ( -10), ///< Abnormal communication with the illegal string check server 204 DWC_ECODE_TYPE_PROF_PARSEERR = ( -20), ///< Could not properly parse the string received from the illegal string check server 205 DWC_ECODE_TYPE_PROF_OTHERERR = ( -30) ///< Some other error occurred while communicating with the illegal string check server 206 }; 207 208 209 //---------------------------------------------------------------------------- 210 // Function - external 211 //---------------------------------------------------------------------------- 212 213 DWCError DWC_GetLastError ( int* errorCode ); 214 DWCError DWC_GetLastErrorEx ( int* errorCode, DWCErrorType* errorType ); 215 void DWC_ClearError ( void ); 216 217 218 #ifdef __cplusplus 219 } 220 #endif 221 222 223 #endif // DWC_ERROR_H_ 224