wut  v1.5.0
Wii U Toolchain
netconfig.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <wut.h>
4 #include <wut_rplwrap.h>
5 #include <stdint.h>
6 #include <sys/time.h>
7 #include <sys/types.h>
8 #include <sys/socket.h>
9 #include <netinet/in.h>
10 #include <arpa/inet.h>
11 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 typedef uint16_t NetConfEthCfgSpeed;
22 typedef uint16_t NetConfEthCfgDuplex;
23 typedef uint16_t NetConfEthCfgNegotiation;
24 typedef uint16_t NetConfWifiPrivacyMode;
25 typedef uint16_t NetConfProxyAuthType;
26 typedef uint16_t NetConfProxyStatus;
27 typedef uint16_t NetConfInterfaceType;
28 typedef uint16_t NetConfLinkState;
29 typedef uint16_t NetConfOperState;
30 typedef uint16_t NetConfAdminState;
31 
33 typedef struct NetConfEthCfg NetConfEthCfg;
37 typedef struct NetConfOpt NetConfOpt;
38 typedef struct NetConfIPv4Info NetConfIPv4Info;
39 typedef struct NetConfMACAddr NetConfMACAddr;
40 typedef struct NetConfCfg NetConfCfg;
44 typedef struct NetConfInterface NetConfInterface;
45 typedef struct NetConfIfState NetConfIfState;
46 
51 
52 typedef enum NetConfEthCfgSpeedEnum {
56 
61 
66 
67 typedef enum NetConfIPv4Mode {
71 
80 
85 
86 typedef enum NetConfProxyStatusEnum {
90 
91 typedef enum NetConfLinkStateEnum {
96 
97 typedef enum NetConfOperStateEnum {
101 
102 typedef enum NetConfAdminStateEnum {
106 
107 typedef enum NetConfProfile {
115 
117  WUT_UNKNOWN_BYTES(0x18);
118 };
119 WUT_CHECK_SIZE(NetConfAllProfileState, 0x18);
120 
121 struct WUT_PACKED NetConfEthCfg {
125  WUT_PADDING_BYTES(2);
126 };
127 WUT_CHECK_OFFSET(NetConfEthCfg, 0x00, speed);
128 WUT_CHECK_OFFSET(NetConfEthCfg, 0x02, duplex);
129 WUT_CHECK_OFFSET(NetConfEthCfg, 0x04, negotiation);
130 WUT_CHECK_SIZE(NetConfEthCfg, 0x8);
131 
134  uint32_t addr;
135  uint32_t netmask;
136  uint32_t nexthop; // gateway
137  uint32_t ns1; // dns 1
138  uint32_t ns2; // dns 2
139 };
140 WUT_CHECK_SIZE(NetConfIPv4Info, 0x18);
141 
143  uint8_t MACAddr[0x6];
144 };
145 WUT_CHECK_SIZE(NetConfMACAddr, 0x6);
146 
149  uint16_t port;
150  WUT_UNKNOWN_BYTES(0x02);
152  char host[0x80];
153  char username[0x80]; // only 0x20 bytes usable
154  char password[0x40]; // only 0x20 bytes usable
155  char noproxy_hosts[0x80]; // not used
156 };
157 WUT_CHECK_SIZE(NetConfProxyConfig, 0x1c8);
158 
160  WUT_UNKNOWN_BYTES(0x18);
161 };
162 WUT_CHECK_SIZE(NetConfValidFlags, 0x18);
163 
164 struct WUT_PACKED NetConfWifiConfigDataPrivacy {
166  WUT_PADDING_BYTES(2);
167  uint16_t aes_key_len;
168  uint8_t aes_key[0x40];
169  WUT_PADDING_BYTES(2);
170 };
171 WUT_CHECK_OFFSET(NetConfWifiConfigDataPrivacy, 0x00, mode);
172 WUT_CHECK_OFFSET(NetConfWifiConfigDataPrivacy, 0x04, aes_key_len);
173 WUT_CHECK_OFFSET(NetConfWifiConfigDataPrivacy, 0x06, aes_key);
174 WUT_CHECK_SIZE(NetConfWifiConfigDataPrivacy, 0x48);
175 
176 struct WUT_PACKED NetConfWifiConfigData {
177  uint8_t ssid[0x20];
178  uint16_t ssidlength;
179  WUT_PADDING_BYTES(2);
181 };
182 WUT_CHECK_OFFSET(NetConfWifiConfigData, 0x00, ssid);
183 WUT_CHECK_OFFSET(NetConfWifiConfigData, 0x20, ssidlength);
184 WUT_CHECK_OFFSET(NetConfWifiConfigData, 0x24, privacy);
185 WUT_CHECK_SIZE(NetConfWifiConfigData, 0x6C);
186 
188  uint16_t config_method;
189  WUT_PADDING_BYTES(2);
191 };
192 WUT_CHECK_SIZE(NetConfWifiConfig, 0x70);
193 
194 struct NetConfOpt {
195  WUT_UNKNOWN_BYTES(0x2c1);
196 };
197 WUT_CHECK_SIZE(NetConfOpt, 0x2c1);
198 
199 struct WUT_PACKED NetConfInterface {
200  uint16_t if_index;
201  uint16_t if_sate;
202  uint32_t if_mtu;
204 };
205 WUT_CHECK_OFFSET(NetConfInterface, 0x00, if_index);
206 WUT_CHECK_OFFSET(NetConfInterface, 0x02, if_sate);
207 WUT_CHECK_OFFSET(NetConfInterface, 0x04, if_mtu);
208 WUT_CHECK_OFFSET(NetConfInterface, 0x08, ipv4Info);
209 WUT_CHECK_SIZE(NetConfInterface, 0x20);
210 
211 struct NetConfCfg {
217 };
218 WUT_CHECK_OFFSET(NetConfCfg, 0x0, wl0);
219 WUT_CHECK_OFFSET(NetConfCfg, 0x20, wifi);
220 WUT_CHECK_OFFSET(NetConfCfg, 0x90, eth0);
221 WUT_CHECK_OFFSET(NetConfCfg, 0xB0, ethCfg);
222 WUT_CHECK_OFFSET(NetConfCfg, 0xB8, proxy);
223 WUT_CHECK_SIZE(NetConfCfg, 0x280);
224 
225 struct WUT_PACKED NetConfAOSSConfig {
227 };
228 WUT_CHECK_SIZE(NetConfAOSSConfig, 0x1b0);
229 
231  uint16_t if_state;
234  WUT_PADDING_BYTES(2);
235 };
236 WUT_CHECK_SIZE(NetConfIfState, 0x8);
237 
238 int
240 
241 int
243 
244 int
246 
247 int
249 
254 int
256  uint32_t *assignedAddress);
257 
262 int
264  uint32_t *dns1,
265  uint32_t *dns2);
266 
271 int
273  uint32_t *gateway);
274 
279 int
281  uint32_t *subnet);
282 
287 int
289  uint32_t *dns1,
290  uint32_t *dns2);
291 
292 int
294 
297 
301 int
303 
307 int
309 
312 
313 int
315  NetConfMACAddr *info);
316 
319 
320 int
322 
323 int
325 
326 int
327 netconf_get_last_wifi_link_error(uint32_t *lastError);
328 
329 int
331  uint32_t *profileState);
332 
333 int
335 
339 int
341 
345 int
347 
348 int
350 
351 int
353 
357 int
358 netconf_getopt(uint16_t unk1,
359  NetConfOpt *buffer,
360  uint32_t *bufferSize);
361 
365 int
367  NetConfCfg *data);
368 
372 int
374  NetConfCfg *data);
375 
379 int
381 
385 int
387 
388 int
390  NetConfAOSSConfig *data);
391 
392 int
394  NetConfAOSSConfig *data);
395 
396 int
397 netconf_read_compat_profile_id(uint32_t *outProfileId);
398 
399 
400 int
402  uint32_t *dns1,
403  uint32_t *dns2);
404 
405 int
407 
408 int
410  NetConfAdminStateEnum unk2);
411 
412 int
414 
415 int
417  NetConfIPv4Info *info);
418 
419 int
421  uint32_t mtu);
422 
423 int
425 
426 int
428 
432 int
433 netconf_set_startup_profile_id(uint32_t profileId);
434 
435 int
437  uint32_t unk2);
438 
439 int
441 
442 
446 int
447 netconf_setopt(uint16_t unk1,
448  NetConfOpt *buffer,
449  uint32_t *bufferSize);
450 
451 int
453 
454 #ifdef __cplusplus
455 }
456 #endif
457 
uint32_t if_mtu
Definition: netconfig.h:202
uint32_t netmask
Definition: netconfig.h:135
char username[0x80]
Definition: netconfig.h:153
NetConfEthCfgNegotiation negotiation
Definition: netconfig.h:124
NetConfInterface wl0
Definition: netconfig.h:212
NetConfWifiConfigData config
Definition: netconfig.h:189
uint16_t config_method
Definition: netconfig.h:188
NetConfWifiConfigDataPrivacy privacy
Definition: netconfig.h:179
NetConfOperState operstate
Definition: netconfig.h:233
NetConfInterface eth0
Definition: netconfig.h:214
NetConfWifiPrivacyMode mode
Definition: netconfig.h:165
NetConfIPv4Mode mode
Definition: netconfig.h:133
NetConfEthCfg ethCfg
Definition: netconfig.h:215
NetConfWifiConfig wifi
Definition: netconfig.h:213
uint16_t if_sate
Definition: netconfig.h:201
NetConfProxyConfig proxy
Definition: netconfig.h:216
uint8_t MACAddr[0x6]
Definition: netconfig.h:143
NetConfProxyAuthType auth_type
Definition: netconfig.h:150
char password[0x40]
Definition: netconfig.h:154
uint32_t ns2
Definition: netconfig.h:138
uint32_t ns1
Definition: netconfig.h:137
uint32_t addr
Definition: netconfig.h:134
NetConfLinkState linkstate
Definition: netconfig.h:232
char noproxy_hosts[0x80]
Definition: netconfig.h:155
NetConfEthCfgDuplex duplex
Definition: netconfig.h:123
uint32_t nexthop
Definition: netconfig.h:136
NetConfIPv4Info ipv4Info
Definition: netconfig.h:203
uint16_t if_index
Definition: netconfig.h:200
NetConfProxyStatus use_proxy
Definition: netconfig.h:148
char host[0x80]
Definition: netconfig.h:152
uint16_t if_state
Definition: netconfig.h:231
NetConfEthCfgSpeed speed
Definition: netconfig.h:122
int netconf_set_interface_mtu(NetConfInterfaceType interface, uint32_t mtu)
int netconf_get_assigned_dns(NetConfInterfaceType interface, uint32_t *dns1, uint32_t *dns2)
Returns the currently used DNS of the console if the given interface matches the used interface.
uint16_t NetConfEthCfgDuplex
Definition: netconfig.h:22
int netconf_get_running(NetConfCfg *running)
Return the current NetConfCfg.
NetConfAdminState netconf_get_if_adminstate(NetConfInterfaceType interface)
int netconf_read_compat_profile_id(uint32_t *outProfileId)
int netconf_getopt(uint16_t unk1, NetConfOpt *buffer, uint32_t *bufferSize)
Not implemented on IOSU side.
uint16_t NetConfLinkState
Definition: netconfig.h:28
int netconf_set_wifi_cfg(NetConfWifiConfig *config)
NetConfProxyAuthTypeEnum
Definition: netconfig.h:81
NetConfProfile
Definition: netconfig.h:107
uint16_t NetConfAdminState
Definition: netconfig.h:30
int netconf_get_assigned_gateway(NetConfInterfaceType unk1, uint32_t *gateway)
Returns the currently used gateway of the console if the given interface matches the used interface.
int netconf_nv_load(NetConfProfile profileId)
Load a profile into memory and use it.
int netconf_nv_read(NetConfProfile profileId, NetConfCfg *data)
Read a profile into memory without using it.
uint16_t NetConfEthCfgSpeed
Definition: netconfig.h:21
int netconf_get_last_wifi_link_error(uint32_t *lastError)
int netconf_setopt(uint16_t unk1, NetConfOpt *buffer, uint32_t *bufferSize)
DEBUG mode only.
NetConfAdminStateEnum
Definition: netconfig.h:102
NetConfIPv4Mode
Definition: netconfig.h:67
int netconf_init()
int netconf_set_eth_cfg(NetConfEthCfg *config)
int netconf_get_ifstate(NetConfInterfaceType interface, NetConfIfState *ifState)
int netconf_nv_write(NetConfProfile profileId, NetConfCfg *data)
Write a profile from buffer.
NetConfEthCfgSpeedEnum
Definition: netconfig.h:52
int netconf_read_aoss_config(NetConfProfile profileId, NetConfAOSSConfig *data)
NetConfWifiPrivacyModeEnum
Definition: netconfig.h:72
int netconf_set_dns(NetConfInterfaceType interface, uint32_t *dns1, uint32_t *dns2)
NetConfOperStateEnum
Definition: netconfig.h:97
uint16_t NetConfEthCfgNegotiation
Definition: netconfig.h:23
int netconf_get_valid_flags(NetConfValidFlags *validFlags)
int netconf_set_valid_flag(uint32_t unk1, uint32_t unk2)
int netconf_nv_store(NetConfProfile profileId)
Save the loaded profile from memory into a profile.
int netconf_write_compat_profile_id(uint32_t unk1)
int netconf_get_interface_mtu(NetConfInterfaceType NetConfInterfaceType, uint32_t *mtu)
int netconf_write_aoss_config(NetConfProfile profileId, NetConfAOSSConfig *data)
NetConfLinkStateEnum
Definition: netconfig.h:91
int netconf_get_dns(NetConfInterfaceType unk1, uint32_t *dns1, uint32_t *dns2)
Returns the manually set DNS servers of the loaded config if the given interface matches the used int...
int netconf_close()
int netconf_set_if_ipv4_info(NetConfIPv4Info *info)
uint16_t NetConfProxyAuthType
Definition: netconfig.h:25
int netconf_set_startup_profile_id(uint32_t profileId)
Sets the default profileId.
NetConfProxyStatusEnum
Definition: netconfig.h:86
NetConfLinkState netconf_get_if_linkstate(NetConfInterfaceType interface)
int netconf_delete_profile(NetConfProfile id)
int netconf_set_if_ipv4_info_ex(NetConfInterfaceType interface, NetConfIPv4Info *info)
int netconf_get_assigned_address(NetConfInterfaceType interface, uint32_t *assignedAddress)
Returns the currently used IP address of the console if the given interface matches the used interfac...
uint16_t NetConfProxyStatus
Definition: netconfig.h:26
uint16_t NetConfWifiPrivacyMode
Definition: netconfig.h:24
int netconf_get_if_macaddr(NetConfInterfaceType interface, NetConfMACAddr *info)
int netconf_get_proxy_config(NetConfProxyConfig *proxyConfig)
int netconf_set_running(NetConfCfg *config)
NetConfEthCfgNegotiationEnum
Definition: netconfig.h:62
int netconf_set_if_admin_state(NetConfInterfaceType interface, NetConfAdminStateEnum unk2)
uint16_t NetConfOperState
Definition: netconfig.h:29
uint16_t NetConfInterfaceType
Definition: netconfig.h:27
NetConfInterfaceTypeEnum
Definition: netconfig.h:47
int netconf_get_startup_profile_id()
Gets the default profileId.
int netconf_get_eth_cfg(NetConfEthCfg *outCfg)
int netconf_set_proxy_config(NetConfProxyConfig *config)
int netconf_get_wifi_cfg(NetConfWifiConfig *wifiConfig)
int netconf_get_if_ipv4_info(NetConfIPv4Info *info)
Returns the WIFI IPv4 Info of the loaded config.
int netconf_get_profile_state(NetConfInterfaceType interface, uint32_t *profileState)
int netconf_get_if_ipv4_info_ex(NetConfInterfaceType interface, NetConfIPv4Info *info)
Returns the IPv4 Info of the loaded config for the given interface.
int netconf_get_assigned_subnet(NetConfInterfaceType unk1, uint32_t *subnet)
Returns the currently used subnet of the console if the given interface matches the used interface.
NetConfEthCfgDuplexEnum
Definition: netconfig.h:57
int netconf_get_all_profile_state(NetConfAllProfileState *state)
NetConfOperState netconf_get_if_operstate(NetConfInterfaceType interface)
@ NET_CONF_PROXY_AUTH_TYPE_BASIC_AUTHENTICATION
Definition: netconfig.h:83
@ NET_CONF_PROXY_AUTH_TYPE_NONE
Definition: netconfig.h:82
@ NET_CONF_PROFILE_0
Definition: netconfig.h:108
@ NET_CONF_PROFILE_2
Definition: netconfig.h:110
@ NET_CONF_PROFILE_1
Definition: netconfig.h:109
@ NET_CONF_PROFILE_3
Definition: netconfig.h:111
@ NET_CONF_PROFILE_4
Definition: netconfig.h:112
@ NET_CONF_PROFILE_5
Definition: netconfig.h:113
@ NET_CONF_ADMIN_STATE_DOWN
Definition: netconfig.h:104
@ NET_CONF_ADMIN_STATE_UP
Definition: netconfig.h:103
@ NET_CONF_IPV4_MODE_MANUAL
Definition: netconfig.h:69
@ NET_CONF_IPV4_MODE_DHCP
Definition: netconfig.h:68
@ NET_CONF_ETH_CFG_SPEED_10M
Definition: netconfig.h:53
@ NET_CONF_ETH_CFG_SPEED_100M
Definition: netconfig.h:54
@ NET_CONF_WIFI_PRIVACY_MODE_WPA_PSK_AES
Definition: netconfig.h:78
@ NET_CONF_WIFI_PRIVACY_MODE_NONE
Definition: netconfig.h:73
@ NET_CONF_WIFI_PRIVACY_MODE_WEP
Definition: netconfig.h:74
@ NET_CONF_WIFI_PRIVACY_MODE_WPA_PSK_TKIP
Definition: netconfig.h:76
@ NET_CONF_WIFI_PRIVACY_MODE_WPA2_PSK_AES
Definition: netconfig.h:77
@ NET_CONF_WIFI_PRIVACY_MODE_WPA2_PSK_TKIP
Definition: netconfig.h:75
@ NET_CONF_OPER_STATE_UP
Definition: netconfig.h:98
@ NET_CONF_OPER_STATE_DOWN
Definition: netconfig.h:99
@ NET_CONF_LINK_STATE_UP
Definition: netconfig.h:92
@ NET_CONF_LINK_STATE_DOWN
Definition: netconfig.h:93
@ NET_CONF_LINK_STATE_NEGOTIATE
Definition: netconfig.h:94
@ NET_CONF_PROXY_ENABLED
Definition: netconfig.h:88
@ NET_CONF_PROXY_DISABLED
Definition: netconfig.h:87
@ NET_CONF_ETH_CFG_NEGOTIATION_AUTO
Definition: netconfig.h:64
@ NET_CONF_ETH_CFG_NEGOTIATION_MANUAL
Definition: netconfig.h:63
@ NET_CONF_INTERFACE_TYPE_ETHERNET
Definition: netconfig.h:49
@ NET_CONF_INTERFACE_TYPE_WIFI
Definition: netconfig.h:48
@ NET_CONF_ETH_CFG_DUPLEX_FULL
Definition: netconfig.h:59
@ NET_CONF_ETH_CFG_DUPLEX_HALF
Definition: netconfig.h:58