1 /*---------------------------------------------------------------------------* 2 Project: RevolutionDWC public include file 3 File: ./match/dwc_main.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_MAIN_H_ 16 #define DWC_MAIN_H_ 17 18 #include <match/dwc_transport.h> 19 20 #ifdef __cplusplus 21 extern "C" 22 { 23 #endif 24 25 //---------------------------------------------------------------------------- 26 // Define 27 //---------------------------------------------------------------------------- 28 29 /// Maximum length (25 wide characters and "\0\0") of the player name (in-game screen name) 30 #define DWC_MAX_PLAYER_NAME 26 31 32 33 //---------------------------------------------------------------------------- 34 // enum 35 //---------------------------------------------------------------------------- 36 /// DWC network status enumerator 37 typedef enum { 38 DWC_STATE_INIT = 0, ///< Initial state 39 DWC_STATE_AVAILABLE_CHECK, ///< Checking game availability status 40 DWC_STATE_LOGIN, ///< Processing login 41 DWC_STATE_ONLINE, ///< Online status after login completion 42 DWC_STATE_UPDATE_SERVERS, ///< Friend roster synchronization in progress 43 DWC_STATE_MATCHING, ///< Matchmaking in progress 44 DWC_STATE_CONNECTED, ///< A mesh-type network has been constructed after matchmaking was completed 45 DWC_STATE_NUM 46 } DWCState; 47 48 49 //---------------------------------------------------------------------------- 50 // typedef - function 51 //---------------------------------------------------------------------------- 52 /** 53 / Connection close callback type 54 * 55 * Called each time a connection with a communication partner is closed. 56 * 57 * Specified with the DWC_SetConnectionClosedCallback function. 58 * 59 * Param: error: DWC error type 60 * Param: isLocal: TRUE: Closed by the local host 61 * FALSE: Closed by someone else 62 * This is set to TRUE even when an unresponsive host is disconnected during matchmaking. 63 * Param: isServer TRUE: The server-client matchmaking server closed 64 * This is also TRUE when the local host is the server and isLocal is TRUE. 65 * FALSE: Other. 66 * Always FALSE if not in server-client matchmaking. 67 * Param: aid AID for the player that closed 68 * Param: index: Friend roster index for player that closed. 69 * Set to -1 if the closed player is not a friend. 70 * Param: param: Parameters for the callback 71 * 72 * See also: DWC_SetConnectionClosedCallback 73 */ 74 typedef void (*DWCConnectionClosedCallback)(DWCError error, BOOL isLocal, BOOL isServer, u8 aid, int index, void* param); 75 76 77 //---------------------------------------------------------------------------- 78 // struct 79 //---------------------------------------------------------------------------- 80 81 /// FriendsMatch control structure 82 typedef void* DWCFriendsMatchControl; 83 84 85 //---------------------------------------------------------------------------- 86 // Function - external 87 //---------------------------------------------------------------------------- 88 89 void DWC_InitFriendsMatch ( DWCFriendsMatchControl* dwccnt, DWCUserData* userdata, int productID, const char* gameName, const char* secretKey, int sendBufSize, int recvBufSize, DWCFriendData friendList[], int friendListLen ); 90 void DWC_ShutdownFriendsMatch ( void); 91 void DWC_ProcessFriendsMatch ( void); 92 BOOL DWC_LoginAsync ( const u16* ingamesn, const char* reserved, DWCLoginCallback callback, void* param ); 93 BOOL DWC_UpdateServersAsync ( const char* playerName, DWCUpdateServersCallback updateCallback, void* updateParam, DWCFriendStatusCallback statusCallback, void* statusParam, DWCDeleteFriendListCallback deleteCallback, void* deleteParam ); 94 BOOL DWC_ConnectToAnybodyAsync ( DWCTopologyType topology, u8 maxEntry, const char* addFilter, DWCMatchedSCCallback matchedCallback, void* matchedParam, DWCNewClientCallback newClientCallback, void* newClientParam, DWCEvalPlayerCallback evalCallback, void* evalParam, DWCConnectAttemptCallback attemptCallback, u8* connectionUserData, void* attemptParam ); 95 BOOL DWC_ConnectToFriendsAsync ( DWCTopologyType topology, const u8 friendIdxList[], int friendIdxListLen, u8 maxEntry, DWCMatchedSCCallback matchedCallback, void* matchedParam, DWCNewClientCallback newClientCallback, void* newClientParam, DWCEvalPlayerCallback evalCallback, void* evalParam, DWCConnectAttemptCallback attemptCallback, u8* connectionUserData, void* attemptParam ); 96 BOOL DWC_SetupGameServer ( DWCTopologyType topology, u8 maxEntry, DWCMatchedSCCallback matchedCallback, void* matchedParam, DWCNewClientCallback newClientCallback, void* newClientParam, DWCConnectAttemptCallback attemptCallback, u8* connectionUserData, void* attemptParam ); 97 BOOL DWC_ConnectToGameServerAsync( DWCTopologyType topology, int serverIndex, DWCMatchedSCCallback matchedCallback, void* matchedParam, DWCNewClientCallback newClientCallback, void* newClientParam, DWCConnectAttemptCallback attemptCallback, u8* connectionUserData, void* attemptParam ); 98 BOOL DWC_ConnectToGameServerByGroupID( DWCTopologyType topology, u32 groupID, DWCMatchedSCCallback matchedCallback, void* matchedParam, DWCNewClientCallback newClientCallback, void* newClientParam, DWCConnectAttemptCallback attemptCallback, u8* connectionUserData, void* attemptParam); 99 BOOL DWC_SetConnectionClosedCallback( DWCConnectionClosedCallback callback, void* param ); 100 int DWC_CloseAllConnectionsHard ( void ); 101 int DWC_CloseConnectionHard ( u8 aid ); 102 int DWC_CloseConnectionHardBitmap( u32* bitmap ); 103 int DWC_GetNumConnectionHost ( void ); 104 u8 DWC_GetMyAID ( void ); 105 int DWC_GetAIDList ( u8** aidList ); 106 u32 DWC_GetAIDBitmap ( void ); 107 BOOL DWC_IsValidAID ( u8 aid ); 108 DWCState DWC_GetState ( void ); 109 int DWC_GetLastSocketError ( void ); 110 111 u8 DWC_GetServerAID(void); 112 BOOL DWC_IsServerMyself(void); 113 u32 DWC_GetDirectConnectedAIDBitmap(void); 114 115 /** 116 * Value that indicates an invalid AID 117 * 118 * Version: 2.0.0 Added. 119 */ 120 #define DWC_INVALID_AID (0xff) 121 122 123 #ifdef __cplusplus 124 } 125 #endif 126 127 128 #endif // DWC_MAIN_H_ 129