libctru  v2.4.1
ac.h
Go to the documentation of this file.
1 /**
2  * @file ac.h
3  * @brief AC service.
4  */
5 #pragma once
6 
7 #include <3ds/types.h>
8 
9 /// Wifi security modes.
10 typedef enum {
11  AC_OPEN = 0, ///< Open authentication.
12  AC_WEP_40BIT = 1, ///< WEP 40-bit authentication.
13  AC_WEP_104BIT = 2, ///< WEP 104-bit authentication.
14  AC_WEP_128BIT = 3, ///< WEP 128-bit authentication.
15  AC_WPA_TKIP = 4, ///< WPA TKIP authentication.
16  AC_WPA2_TKIP = 5, ///< WPA2 TKIP authentication.
17  AC_WPA_AES = 6, ///< WPA AES authentication.
18  AC_WPA2_AES = 7, ///< WPA2 AES authentication.
20 
21 /// Wifi access point types (bitfield).
22 enum {
23  AC_AP_TYPE_NONE = 0, ///< No access point/none allowed.
24  AC_AP_TYPE_SLOT1 = BIT(1), ///< Slot 1 in System Settings.
25  AC_AP_TYPE_SLOT2 = BIT(2), ///< Slot 2 in System Settings.
26  AC_AP_TYPE_SLOT3 = BIT(3), ///< Slot 3 in System Settings.
27 
28  AC_AP_TYPE_ALL = 0x7FFFFFFF, ///< All access point types allowed.
29 };
30 
31 /// Struct to contain the data for connecting to a Wifi network from a stored slot.
32 typedef struct {
33  u8 reserved[0x200];
34 } acuConfig;
35 
36 /// Initializes AC.
37 Result acInit(void);
38 
39 /// Exits AC.
40 void acExit(void);
41 
42 /// Gets the current AC session handle.
44 
45 /// Waits for the system to connect to the internet.
47 
48 /**
49  * @brief Describes the access point the console is currently connected to with AC_AP_TYPE_* flags.
50  * @param out Pointer to output the combination of AC_AP_TYPE_* flags describing the AP to.
51  */
53 
54 /**
55  * @brief Gets the connected Wifi status.
56  * @param out Pointer to output the connected Wifi status to. (1 = not connected, 3 = connected)
57  */
59 
60 /**
61  * @brief Gets the connected Wifi security mode.
62  * @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)
63  */
65 
66 /**
67  * @brief Gets the connected Wifi SSID.
68  * @param SSID Pointer to output the connected Wifi SSID to.
69  */
70 Result ACU_GetSSID(char *SSID);
71 
72 /**
73  * @brief Gets the connected Wifi SSID length.
74  * @param out Pointer to output the connected Wifi SSID length to.
75  */
77 
78 /**
79  * @brief Determines whether proxy is enabled for the connected network.
80  * @param enable Pointer to output the proxy status to.
81  */
82 Result ACU_GetProxyEnable(bool *enable);
83 
84 /**
85  * @brief Gets the connected network's proxy port.
86  * @param out Pointer to output the proxy port to.
87  */
89 
90 /**
91  * @brief Gets the connected network's proxy username.
92  * @param username Pointer to output the proxy username to. (The size must be at least 0x20-bytes)
93  */
94 Result ACU_GetProxyUserName(char *username);
95 
96 /**
97  * @brief Gets the connected network's proxy password.
98  * @param password Pointer to output the proxy password to. (The size must be at least 0x20-bytes)
99  */
100 Result ACU_GetProxyPassword(char *password);
101 
102 /**
103  * @brief Gets the last error to occur during a connection.
104  * @param errorCode Pointer to output the error code to.
105  */
107 
108 /**
109  * @brief Gets the last detailed error to occur during a connection.
110  * @param errorCode Pointer to output the error code to.
111  */
113 
114 /**
115  * @brief Prepares a buffer to hold the configuration data to start a connection.
116  * @param config Pointer to an acuConfig struct to contain the data.
117  */
119 
120 /**
121  * @brief Sets something that makes the connection reliable.
122  * @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
123  * @param area Always 2 ?
124  */
126 
127 /**
128  * @brief Sets the slot to use when connecting.
129  * @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
130  * @param type Allowed AP types bitmask, a combination of AC_AP_TYPE_* flags.
131  */
133 
134 /**
135  * @brief Sets something that makes the connection reliable.
136  * @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
137  */
139 
140 /**
141  * @brief Starts the connection procedure.
142  * @param config Pointer to an acuConfig struct used with ACU_CreateDefaultConfig previously.
143  * @param connectionHandle Handle created with svcCreateEvent to wait on until the connection succeeds or fails.
144  */
145 Result ACU_ConnectAsync(const acuConfig* config, Handle connectionHandle);
146 
147 /**
148  * @brief Selects the WiFi configuration slot for further ac:i operations.
149  * @param slot WiFi slot (0, 1 or 2).
150  */
152 
153 /**
154  * @brief Fetches the SSID of the previously selected WiFi configuration slot.
155  * @param[out] ssid Pointer to the output buffer of size 32B the SSID will be stored in.
156  */
Result ACU_GetSSID(char *SSID)
Gets the connected Wifi SSID.
Result ACU_GetSSIDLength(u32 *out)
Gets the connected Wifi SSID length.
@ AC_AP_TYPE_SLOT3
Slot 3 in System Settings.
Definition: ac.h:26
@ AC_AP_TYPE_NONE
No access point/none allowed.
Definition: ac.h:23
@ AC_AP_TYPE_SLOT2
Slot 2 in System Settings.
Definition: ac.h:25
@ AC_AP_TYPE_ALL
All access point types allowed.
Definition: ac.h:28
@ AC_AP_TYPE_SLOT1
Slot 1 in System Settings.
Definition: ac.h:24
Handle * acGetSessionHandle(void)
Gets the current AC session handle.
Result ACU_ConnectAsync(const acuConfig *config, Handle connectionHandle)
Starts the connection procedure.
Result ACU_GetProxyUserName(char *username)
Gets the connected network's proxy username.
Result ACU_SetRequestEulaVersion(acuConfig *config)
Sets something that makes the connection reliable.
Result ACU_GetSecurityMode(acSecurityMode *mode)
Gets the connected Wifi security mode.
Result ACU_GetWifiStatus(u32 *out)
Describes the access point the console is currently connected to with AC_AP_TYPE_* flags.
Result ACU_GetProxyEnable(bool *enable)
Determines whether proxy is enabled for the connected network.
Result acWaitInternetConnection(void)
Waits for the system to connect to the internet.
Result ACU_GetLastDetailErrorCode(u32 *errorCode)
Gets the last detailed error to occur during a connection.
Result ACU_GetProxyPassword(char *password)
Gets the connected network's proxy password.
Result ACI_LoadNetworkSetting(u32 slot)
Selects the WiFi configuration slot for further ac:i operations.
acSecurityMode
Wifi security modes.
Definition: ac.h:10
@ AC_WPA_TKIP
WPA TKIP authentication.
Definition: ac.h:15
@ AC_WPA2_AES
WPA2 AES authentication.
Definition: ac.h:18
@ AC_WPA_AES
WPA AES authentication.
Definition: ac.h:17
@ AC_WEP_128BIT
WEP 128-bit authentication.
Definition: ac.h:14
@ AC_WPA2_TKIP
WPA2 TKIP authentication.
Definition: ac.h:16
@ AC_OPEN
Open authentication.
Definition: ac.h:11
@ AC_WEP_104BIT
WEP 104-bit authentication.
Definition: ac.h:13
@ AC_WEP_40BIT
WEP 40-bit authentication.
Definition: ac.h:12
Result ACU_GetProxyPort(u32 *out)
Gets the connected network's proxy port.
Result ACU_CreateDefaultConfig(acuConfig *config)
Prepares a buffer to hold the configuration data to start a connection.
Result ACU_GetStatus(u32 *out)
Gets the connected Wifi status.
void acExit(void)
Exits AC.
Result ACU_SetNetworkArea(acuConfig *config, u8 area)
Sets something that makes the connection reliable.
Result ACI_GetNetworkWirelessEssidSecuritySsid(void *ssid)
Fetches the SSID of the previously selected WiFi configuration slot.
Result ACU_SetAllowApType(acuConfig *config, u8 type)
Sets the slot to use when connecting.
Result ACU_GetLastErrorCode(u32 *errorCode)
Gets the last error to occur during a connection.
Result acInit(void)
Initializes AC.
void errorCode(errorConf *err, int error)
Sets error code to display.
Struct to contain the data for connecting to a Wifi network from a stored slot.
Definition: ac.h:32
Various system types.
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:47
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
u32 Handle
Resource handle.
Definition: types.h:41
s32 Result
Function result.
Definition: types.h:42
uint32_t u32
32-bit unsigned integer
Definition: types.h:23