1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     socket_Admin.autogen.h
4   Copyright (C)2010 Nintendo Co., Ltd.  All rights reserved.
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   $Rev: 27829 $
11  *---------------------------------------------------------------------------
12 
13 
14 */
15 
16 /* Please see man pages for details
17 
18  */
19 
20 #ifndef NN_SOCKET_SOCKET_ADMIN_AUTOGEN_H_
21 #define NN_SOCKET_SOCKET_ADMIN_AUTOGEN_H_
22 
23 #ifndef NN_SOCKET_NO_DEPEND_HEADER
24 #include <nn/types.h>			/* for NOSxxxx */
25 #include <nn/net/compatible/nnet/nnet.h>			/* for NNETxxxx */
26 #include <nn/socket/socket_User.autogen.h>		/* for InAddr, DnsServerInfo */
27 #endif
28 
29 namespace nn {
30 namespace socket {
31 
32 /*---------------------------------------------------------------------------*
33  * Definitions
34  *---------------------------------------------------------------------------*/
35 
36 #define NN_SOCKET_VENDOR_NINTENDO        0x0000  //
37 #define NN_SOCKET_COMMON_CONF_VERSION    0x3100  //
38 #define NN_SOCKET_INS_CONF_VERSION       0x4100  //
39 
40 /* Please see man pages for details
41 
42  */
43 #define ERROR_BASE                          0xffff8000
44 #define ERROR_CODE(code)                    ((s32)(ERROR_BASE|(code)))
45 
46 enum ErrorCode {
47     ERR_PARAM          = ERROR_CODE(1),       //
48     ERR_INIT           = ERROR_CODE(2),       //
49     ERR_FINISH         = ERROR_CODE(3),       //
50     ERR_CONFVER        = ERROR_CODE(4),       //
51     ERR_STATE          = ERROR_CODE(5),       //
52     ERR_EXIST          = ERROR_CODE(6),       //
53     ERR_NOMEM          = ERROR_CODE(7),       //
54     ERR_NOS            = ERROR_CODE(8),       //
55     ERR_LOWER          = ERROR_CODE(9),       //
56     ERR_TIMEOUT        = ERROR_CODE(10),      //
57     ERR_INS_RESOURCES  = ERROR_CODE(11),      //
58     ERR_MAXSOCKET      = ERROR_CODE(12),      //
59     ERR_ABORT          = ERROR_CODE(13),      //
60 
61     ERR_IP_UNREACHABLE = ERROR_CODE(21),      //
62     ERR_IP_DATASIZE    = ERROR_CODE(22),      //
63     ERR_IP_NETDOWN     = ERROR_CODE(23),      //
64     ERR_IP_INVALID     = ERROR_CODE(24),      //
65     ERR_IP_REFUSED     = ERROR_CODE(25),      //
66     ERR_IP_TIMEOUT     = ERROR_CODE(26),      //
67     ERR_IP_CANCELED    = ERROR_CODE(27),      //
68     ERR_IP_BUSY        = ERROR_CODE(28),      //
69     ERR_IP_CLOSING     = ERROR_CODE(29),      //
70     ERR_IP_EXIST       = ERROR_CODE(30),      //
71     ERR_IP_RESET       = ERROR_CODE(31),      //
72     ERR_IP_NOT_EXIST   = ERROR_CODE(32),      //
73     ERR_IP_INV_SOCKET  = ERROR_CODE(33),      //
74     ERR_IP_AGAIN       = ERROR_CODE(34),      //
75     ERR_IP_SOCKET_UNSPECIFIED = ERROR_CODE(35),   //
76     ERR_IP_SOURCE_QUENCH = ERROR_CODE(36),    //
77     ERR_IP_INV_OPTION  = ERROR_CODE(37),      //
78     ERR_IP_ADDR_COLLISION = ERROR_CODE(38),   //
79     ERR_IP_SHUTDOWN    = ERROR_CODE(39),      //
80     ERR_IP_INV_HEADER  = ERROR_CODE(40),      //
81     ERR_IP_INV_ADDR    = ERROR_CODE(41),      //
82     ERR_IP_INV_DATA    = ERROR_CODE(42),      //
83 
84     ERR_DHCP_EXPIRED   = ERROR_CODE(51),      //
85     ERR_DHCP_TIMEOUT   = ERROR_CODE(52),      //
86     ERR_DHCP_NAK       = ERROR_CODE(53),      //
87 
88     ERR_IP6_ADDR_COLLISION = ERROR_CODE(60),  //
89 
90     ERR_NONE           = 0                         //
91 };
92 
93 /*---------------------------------------------------------------------------*
94  * Types/Declarations
95  *---------------------------------------------------------------------------*/
96 /* Please see man pages for details
97 
98  */
99 struct CommonConfig {
100     u16         vendor;             //
101     u16         version;            //
102 
103     s32         timeWaitBuffer;     //
104 
105     s32         reassembleMtu;      //
106 
107     // TCP
108     s32         rwin;               //
109     s32         r2;                 //
110 
111     // UDP
112     s32         udpRecvBuff;        //
113 
114     // DHCP
115     const char* hostName;           //
116     s32         rdhcp;              //
117 
118 };
119 
120 /*
121  *Flag that sets InstanceConfig flag
122  */
123 enum InstanceConfigFlag {
124 	FLAG_DHCP         =  0x0001, //
125 	FLAG_PPP          =  0x0002, //
126 	FLAG_IP4          =  0x0004, //
127 	FLAG_IP6          =  0x0008, //
128 	FLAG_DHCP6        =  0x0010, //
129 	FLAG_NORA_DHCP6   =  0x0020, //
130 	FLAG_DHCP_REBOOT  =  0x0100, //
131 	FLAG_DHCP_RELEASE =  0x0200, //
132 	FLAG_DNS_AUTO     =  0x1000, //
133 	FLAG_ZEROCONF     =  0x8000  //
134 };
135 
136 /* Please see man pages for details
137 
138  */
139 struct InstanceConfig {
140     u16         vendor;             //
141     u16         version;            //
142 
143     u32         flag;               //
144     InAddr  addr;               //
145     InAddr  netmask;            //
146     InAddr  router;             //
147     s32         mtu;                //
148 
149     DnsServerInfo dnsserver;    //
150 
151 #ifdef NN_SOCKET_IP6_ENABLE
152     u8          curHopLimit;     /* Hop limit */
153     u32         retransTimer;    /* NS retransmission interval (msec) */
154     u32         dadNSTransmits;  /* Number of NS transmissions for duplicate address detection */
155     u8          interfaceId[8];  /* Interface ID */
156 #endif /* NN_SOCKET_IP6_ENABLE */
157 };
158 
159 /* Please see man pages for details
160 
161  */
162 typedef void (* ConfigErrorCallback )(InstancePtr insP, s32 err);
163 
164 #ifndef NN_SOCKET_NO_DEPEND_HEADER
165 /* Please see man pages for details
166 
167  */
168 typedef Bool (* Filter)(InstancePtr insP, NOSMessageBuf *mbuf);
169 
170 /* Please see man pages for details
171 
172  */
GetNNETInstance(InstancePtr insP)173 NN_INLINE NNETInstance *GetNNETInstance(InstancePtr insP)
174 {
175     return (NNETInstance *)insP;
176 }
177 
178 /* Please see man pages for details
179 
180  */
GetInstance(NNETInstance * ins)181 NN_INLINE InstancePtr GetInstance(NNETInstance *ins)
182 {
183     return (InstancePtr)ins;
184 }
185 #endif
186 
187 /*---------------------------------------------------------------------------*
188  * Function Prototypes
189  *---------------------------------------------------------------------------*/
190 /* nsoc_main.c */
191 
192 /* nsoc_socket.c */
193 
194 
195 
196 
197 } // socket
198 } // nn
199 /* NN_SOCKET_SOCKET_ADMIN_AUTOGEN_H_ */
200 #endif
201 
202 
203