2015-10-05 07:27:43 +02:00
|
|
|
/**
|
|
|
|
* @file ac.h
|
|
|
|
* @brief AC service.
|
|
|
|
*/
|
2014-08-26 22:53:00 +02:00
|
|
|
#pragma once
|
2014-04-22 04:58:05 +02:00
|
|
|
|
2018-03-10 16:24:45 +01:00
|
|
|
/// Wifi security modes.
|
|
|
|
typedef enum {
|
2019-07-23 00:11:44 +02:00
|
|
|
AC_OPEN = 0, ///< Open authentication.
|
|
|
|
AC_WEP_40BIT = 1, ///< WEP 40-bit authentication.
|
|
|
|
AC_WEP_104BIT = 2, ///< WEP 104-bit authentication.
|
|
|
|
AC_WEP_128BIT = 3, ///< WEP 128-bit authentication.
|
2019-07-23 09:31:30 +02:00
|
|
|
AC_WPA_TKIP = 4, ///< WPA TKIP authentication.
|
2019-07-23 00:11:44 +02:00
|
|
|
AC_WPA2_TKIP = 5, ///< WPA2 TKIP authentication.
|
|
|
|
AC_WPA_AES = 6, ///< WPA AES authentication.
|
|
|
|
AC_WPA2_AES = 7, ///< WPA2 AES authentication.
|
2018-03-10 16:24:45 +01:00
|
|
|
} acSecurityMode;
|
|
|
|
|
2019-07-23 00:11:44 +02:00
|
|
|
/// Struct to contain the data for connecting to a Wifi network from a stored slot.
|
|
|
|
typedef struct {
|
|
|
|
u8 reserved[0x200];
|
|
|
|
} acuConfig;
|
|
|
|
|
2015-10-05 07:27:43 +02:00
|
|
|
/// Initializes AC.
|
2015-09-06 18:13:31 +02:00
|
|
|
Result acInit(void);
|
2015-10-05 07:27:43 +02:00
|
|
|
|
|
|
|
/// Exits AC.
|
2015-11-07 01:25:31 +01:00
|
|
|
void acExit(void);
|
2014-08-25 18:14:48 +02:00
|
|
|
|
2015-11-11 05:33:37 +01:00
|
|
|
/// Waits for the system to connect to the internet.
|
|
|
|
Result acWaitInternetConnection(void);
|
|
|
|
|
2015-10-05 07:27:43 +02:00
|
|
|
/**
|
2018-03-10 16:24:45 +01:00
|
|
|
* @brief Gets the connected Wifi status.
|
|
|
|
* @param out Pointer to output the connected Wifi status to. (0 = not connected, 1 = O3DS Internet, 2 = N3DS Internet)
|
2015-10-05 07:27:43 +02:00
|
|
|
*/
|
2015-11-05 11:48:23 +01:00
|
|
|
Result ACU_GetWifiStatus(u32 *out);
|
2017-12-01 17:58:08 +01:00
|
|
|
|
|
|
|
/**
|
2018-03-10 16:24:45 +01:00
|
|
|
* @brief Gets the connected Wifi status.
|
|
|
|
* @param out Pointer to output the connected Wifi status to. (1 = not connected, 3 = connected)
|
2017-12-01 17:58:08 +01:00
|
|
|
*/
|
|
|
|
Result ACU_GetStatus(u32 *out);
|
|
|
|
|
|
|
|
/**
|
2018-03-10 16:24:45 +01:00
|
|
|
* @brief Gets the connected Wifi security mode.
|
|
|
|
* @param mode Pointer to output the connected Wifi security mode to. (0 = Open Authentication, 1 = WEP 40-bit, 2 = WEP 104-bit, 3 = WEP 128-bit, 4 = WPA TKIP, 5 = WPA2 TKIP, 6 = WPA AES, 7 = WPA2 AES)
|
|
|
|
*/
|
|
|
|
Result ACU_GetSecurityMode(acSecurityMode *mode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the connected Wifi SSID.
|
|
|
|
* @param SSID Pointer to output the connected Wifi SSID to.
|
2017-12-01 17:58:08 +01:00
|
|
|
*/
|
2018-03-10 16:24:45 +01:00
|
|
|
Result ACU_GetSSID(char *SSID);
|
2017-12-01 17:58:08 +01:00
|
|
|
|
|
|
|
/**
|
2018-03-10 16:24:45 +01:00
|
|
|
* @brief Gets the connected Wifi SSID length.
|
|
|
|
* @param out Pointer to output the connected Wifi SSID length to.
|
2017-12-01 17:58:08 +01:00
|
|
|
*/
|
|
|
|
Result ACU_GetSSIDLength(u32 *out);
|
2018-03-10 16:24:45 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Determines whether proxy is enabled for the connected network.
|
|
|
|
* @param enable Pointer to output the proxy status to.
|
|
|
|
*/
|
|
|
|
Result ACU_GetProxyEnable(bool *enable);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the connected network's proxy port.
|
|
|
|
* @param out Pointer to output the proxy port to.
|
|
|
|
*/
|
|
|
|
Result ACU_GetProxyPort(u32 *out);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the connected network's proxy username.
|
|
|
|
* @param username Pointer to output the proxy username to. (The size must be at least 0x20-bytes)
|
|
|
|
*/
|
|
|
|
Result ACU_GetProxyUserName(char *username);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the connected network's proxy password.
|
|
|
|
* @param password Pointer to output the proxy password to. (The size must be at least 0x20-bytes)
|
|
|
|
*/
|
|
|
|
Result ACU_GetProxyPassword(char *password);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the last error to occur during a connection.
|
|
|
|
* @param errorCode Pointer to output the error code to.
|
|
|
|
*/
|
|
|
|
Result ACU_GetLastErrorCode(u32* errorCode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the last detailed error to occur during a connection.
|
|
|
|
* @param errorCode Pointer to output the error code to.
|
|
|
|
*/
|
|
|
|
Result ACU_GetLastDetailErrorCode(u32* errorCode);
|
2019-07-21 18:04:02 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Prepares a buffer to hold the configuration data to start a connection.
|
2019-07-23 00:11:44 +02:00
|
|
|
* @param config Pointer to an acuConfig struct to contain the data.
|
2019-07-21 18:04:02 +02:00
|
|
|
*/
|
2019-07-23 00:11:44 +02:00
|
|
|
Result ACU_CreateDefaultConfig(acuConfig* config);
|
2019-07-21 18:04:02 +02:00
|
|
|
|
2019-07-21 18:59:47 +02:00
|
|
|
/**
|
|
|
|
* @brief Sets something that makes the connection reliable.
|
2019-07-23 00:11:44 +02:00
|
|
|
* @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
|
2019-07-21 18:59:47 +02:00
|
|
|
* @param area Always 2 ?
|
|
|
|
*/
|
2019-07-23 00:11:44 +02:00
|
|
|
Result ACU_SetNetworkArea(acuConfig* config, u8 area);
|
2019-07-21 18:59:47 +02:00
|
|
|
|
2019-07-21 18:04:02 +02:00
|
|
|
/**
|
|
|
|
* @brief Sets the slot to use when connecting.
|
2019-07-23 00:11:44 +02:00
|
|
|
* @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
|
2019-07-21 18:04:02 +02:00
|
|
|
* @param type Allowed slots flag. 1 for slot 1, 2 for slot 2, 4 for slot 3.
|
|
|
|
*/
|
2019-07-23 00:11:44 +02:00
|
|
|
Result ACU_SetAllowApType(acuConfig* config, u8 type);
|
2019-07-21 18:04:02 +02:00
|
|
|
|
2019-07-21 18:59:47 +02:00
|
|
|
/**
|
|
|
|
* @brief Sets something that makes the connection reliable.
|
2019-07-23 00:11:44 +02:00
|
|
|
* @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
|
2019-07-21 18:59:47 +02:00
|
|
|
*/
|
2019-07-23 00:11:44 +02:00
|
|
|
Result ACU_SetRequestEulaVersion(acuConfig* config);
|
2019-07-21 18:59:47 +02:00
|
|
|
|
2019-07-21 18:04:02 +02:00
|
|
|
/**
|
|
|
|
* @brief Starts the connection procedure.
|
2019-07-23 00:11:44 +02:00
|
|
|
* @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
|
2019-07-21 18:04:02 +02:00
|
|
|
* @param connectionHandle Handle created with svcCreateEvent to wait on until the connection succeeds or fails.
|
|
|
|
*/
|
2019-07-23 00:11:44 +02:00
|
|
|
Result ACU_ConnectAsync(const acuConfig* config, Handle connectionHandle);
|