1 /*---------------------------------------------------------------------------*
2 Project: NET Initialize demo
3 File: netconfig.h
4
5 Copyright 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: netconfig.h,v $
14 Revision 1.12 2007/09/07 02:13:31 seiki_masashi
15 Separated the REXDEMOSafeSOFinish function.
16
17 Revision 1.11 2007/09/07 00:41:38 seiki_masashi
18 Improved the safety of network termination processing.
19
20 Revision 1.10 2007/06/23 12:21:28 seiki_masashi
21 Added REXDEMOCreateMEM1Heap, and so on.
22
23 Revision 1.9 2007/05/28 08:37:00 hirose_kazuki
24 Added REXDEMODestroyHeapForSocket().
25
26 Revision 1.8 2007/01/29 07:52:19 terui
27 Following the privatization of major functions in the SO library, function declarations using major functions were moved to netfunc.h.
28
29 Revision 1.7 2006/09/25 07:06:13 seiki_masashi
30 Revised so that the network setting on the NAND will be used for configId 0.
31 Revised so that peerName is also acquired from the command line argument.
32
33 Revision 1.6 2006/08/29 07:19:20 adachi_hiroaki
34 Changed prefix. Cleaned up code elsewhere.
35
36 Revision 1.5 2006/08/25 10:22:54 adachi_hiroaki
37 Changed the name and specification of REXDEMOWaitForInterfaceUp().
38
39 Revision 1.4 2006/08/25 09:33:01 adachi_hiroaki
40 Added terminate flag to various block functions.
41
42 Revision 1.3 2006/08/25 02:14:48 adachi_hiroaki
43 Added a utility function group.
44
45 Revision 1.2 2006/08/21 10:57:43 adachi_hiroaki
46 Added NCD preparation wait process.
47
48 Revision 1.1 2006/08/10 12:09:06 adachi_hiroaki
49 Changed the header file position.
50
51 Revision 1.1 2006/08/09 08:46:58 adachi_hiroaki
52 Tentatively added shared network configuration code.
53
54 Revision 1.1 2006/08/08 10:47:28 adachi_hiroaki
55 Moved the network initialization demo from tests/so.
56
57
58 $NoKeywords: $
59 *---------------------------------------------------------------------------*/
60
61 #ifndef __DEMOS_SHARED_NETCONFIG_H__
62 #define __DEMOS_SHARED_NETCONFIG_H__
63
64 #include <revolution/types.h>
65 #include <revolution/ncd.h>
66 #include <revolution/so.h>
67
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 /*===========================================================================*/
72
73 #include "rexdemo/heap.h"
74
75 #define REXDEMO_OVERRIDE_NETCONFIG
76
77 #define REXDEMO_NETWORK_TERMINATION_RETRY_LIMIT 120
78 #define REXDEMO_NETWORK_TERMINATION_RETRY_WAIT 500 // milliseconds
79
80
81 BOOL REXDEMOStartNetwork( BOOL override );
82 BOOL REXDEMOEndNetwork( void );
83
84 BOOL REXDEMOSafeSOFinish( void );
85
86
87 void REXDEMOParseArgument( int argc, const char* argv[] );
88
89 s32 REXDEMOOverrideNetConfigAuto( void );
90 s32 REXDEMOOverrideNetConfig( const NCDIfConfig* pIfConfig, const NCDIpConfig* pIpConfig );
91 void REXDEMOWaitForNCDReady( void );
92 s32 REXDEMOWaitForInterfaceReady( u32 msecTimeout );
93 s32 REXDEMOWaitForInterfaceReadyEx( u32 msecTimeout, BOOL wantUp, volatile BOOL* flagCancel );
94
95 void REXDEMOSetNetConfigId( u8 configId );
96 u8 REXDEMOGetNetConfigId( void );
97 void REXDEMOSetPeerName( const char* peerName );
98 const char* REXDEMOGetPeerName( void );
99
100 BOOL REXDEMOCreateIfConfig( NCDIfConfig* pIfConfig, u8 configIdSrc );
101 BOOL REXDEMOCreateIpConfig( NCDIpConfig* pIpConfig, u8 configIdSrc );
102
103
104 /*---------------------------------------------------------------------------*/
105 static inline void
REXDEMOSetInAddr(u8 * addr,u8 para0,u8 para1,u8 para2,u8 para3)106 REXDEMOSetInAddr( u8* addr, u8 para0, u8 para1, u8 para2, u8 para3 )
107 {
108 addr[ 0 ] = para0;
109 addr[ 1 ] = para1;
110 addr[ 2 ] = para2;
111 addr[ 3 ] = para3;
112 }
113
114 /*===========================================================================*/
115 #ifdef __cplusplus
116 }
117 #endif
118 #endif /* __DEMOS_SHARED_NETCONFIG_H__ */
119
120 /*---------------------------------------------------------------------------*
121 End of file
122 *---------------------------------------------------------------------------*/
123