1 /*---------------------------------------------------------------------------*
2   Project:  RevolutionDWC public include file
3   File:     ./lanmatch/dwc_lanmatch.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_LAN_H_
16 #define	DWC_LAN_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #define DWC_MAX_HOSTS		(16)							///< Maximum number of connections
24 #define DWC_TIMEOUT_COUNT	(10000)							///< Duration until timeout
25 
26 
27 ///	Status variables
28     typedef enum
29     {
30         DWC_INIT_CALLED,
31         DWC_TEMP_CLIENT,
32         DWC_TEMP_SERVER,
33         DWC_CLIENT,
34         DWC_SERVER,
35         DWC_WAIT_CONNECT2SERVER,
36         DWC_WAIT_CONNECT2CLIENT,
37         DWC_WAIT_COMPLETE,
38         DWC_COMPLETE
39 
40     } DWCLanMatchState;
41 
42 
43 ///	Send data type
44     typedef enum
45     {
46         DWC_MESH_CONSTRUCT,
47         DWC_MESH_COMPLETE,
48         DWC_MATCHING_COMPLETE
49 
50     } DWCPacketType;
51 
52 
53 /// Structure managing the LAN match status
54     typedef void*   DWCLanMatchControl;
55 
56 
57     /* ---------------------------------------------------------------------------
58        Function Type Definitions
59       -----------------------------------------------------------------------------*/
60 
61     /**
62      * Callback function invoked when LAN matching has completed.
63      *
64      * The LAN matching feature is provided for experimental use; it is prohibited in the retail version specifications.
65      *
66      * Param:  result:	Matching results
67      *
68      * Version:  1.4.10:  Made a note to the effect that this cannot be used in products.
69      * Version:  0.0.5:   Changed to the DWCError type.
70      */
71     typedef void			(*DWCLanMatchedCallback)( DWCError result );
72 
73     /**
74      * Callback function invoked when data is received in LAN matching communications.
75      *
76      * The LAN matching feature is provided for experimental use; it is prohibited in the retail version specifications.
77      *
78      * Param:  aid	The client AID from which the data was sent.
79      * Param:  buf	Pointer to the receive buffer.
80      * Param:  len	Data length
81      *
82      * Version:  1.4.10:  Made a note to the effect that this cannot be used in products.
83      */
84     typedef void			(*DWCRecvLanMatchCallback)		( s32 aid, u8* buf, int len );
85 
86     /**
87      * Callback function invoked when data is sent in LAN matching communications.
88      *
89      * The LAN matching feature is provided for experimental use; it is prohibited in the retail version specifications.
90      *
91      * Param:  len	Data length
92      * Param:  aid	The client AID to which the data was sent.
93      *
94      * Version:  1.4.10:  Made a note to the effect that this cannot be used in products.
95      * Version:  0.0.5:   Changed the argument order.
96      */
97     typedef void			(*DWCSendLanMatchCallback)		( int len, s32 aid );
98 
99     /* ---------------------------------------------------------------------------
100       External definitions for functions
101       -----------------------------------------------------------------------------*/
102     void				DWC_InitLanMatch	( DWCLanMatchControl* cnt );
103     void				DWC_InitLanMatchEx	( DWCLanMatchControl* cnt, u32 addr, u32 mask, u32 router, u32 dns1, u32 dns2 );
104     void				DWC_SetRecvLanMatchCallback	( DWCRecvLanMatchCallback callback );
105     void				DWC_SetSendLanMatchCallback	( DWCSendLanMatchCallback callback );
106     void				DWC_ProcessLanMatch	( void );
107     BOOL				DWC_SendLanMatch	( s32 aid, const u8* buf, s32 len, BOOL reliable );
108     BOOL				DWC_StartLanMatch	( s32 num, DWCLanMatchedCallback matched );
109     void				DWC_ShutdownLanMatch( void );
110     s32					DWC_GetMyAIDLanMatch( void );
111     s32					DWC_GetConnectNumLanMatch	( void );
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 
118 #endif	// DWC_LAN_H_
119