mirror of
https://github.com/devkitPro/wut.git
synced 2026-03-21 17:34:47 -05:00
Fix typo in nsysnet and add more nn::ac functions. (#401)
Co-authored-by: Daniel K. O. (dkosmari) <none@none>
This commit is contained in:
parent
ad730b9dcb
commit
8b65fd6ce9
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <wut.h>
|
||||
#include <nn/result.h>
|
||||
#include <nsysnet/netconfig.h>
|
||||
|
||||
/**
|
||||
* \defgroup nn_ac_cpp Auto Connect C++ API
|
||||
|
|
@ -24,103 +25,54 @@ namespace ac
|
|||
* An ID number representing a network configuration. These are the same IDs as
|
||||
* shown in System Settings' Connection List.
|
||||
*/
|
||||
typedef uint32_t ConfigIdNum;
|
||||
using ConfigIdNum = uint32_t;
|
||||
|
||||
/**
|
||||
* C++ linkage for the autoconnect API, see \link nn::ac \endlink for use.
|
||||
* Cafe provides mangled symbols for C++ APIs, so nn::ac is actually static
|
||||
* inline calls to the mangled symbols under nn::ac::detail.
|
||||
* The configuration for a given network profile (from 1 to 6).
|
||||
* \sa NetConfCfg
|
||||
*/
|
||||
namespace detail
|
||||
{
|
||||
extern "C"
|
||||
{
|
||||
using Config = NetConfCfg;
|
||||
|
||||
nn::Result Initialize__Q2_2nn2acFv();
|
||||
void Finalize__Q2_2nn2acFv();
|
||||
nn::Result Connect__Q2_2nn2acFv();
|
||||
nn::Result ConnectAsync__Q2_2nn2acFv();
|
||||
nn::Result Close__Q2_2nn2acFv();
|
||||
nn::Result GetCloseStatus__Q2_2nn2acFPQ3_2nn2ac6Status();
|
||||
nn::Result GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum(ConfigIdNum *id);
|
||||
nn::Result Connect__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum(ConfigIdNum id);
|
||||
nn::Result GetAssignedAddress__Q2_2nn2acFPUl(uint32_t *ip);
|
||||
using ErrorCode = uint32_t;
|
||||
|
||||
} // extern "C"
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* Initialise the Auto Connect library. Call this function before any other nn::ac
|
||||
* functions.
|
||||
*
|
||||
* \return
|
||||
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
|
||||
* and \link nn::Result::IsFailure \endlink.
|
||||
*
|
||||
* \sa
|
||||
* - \link Finalize \endlink
|
||||
*/
|
||||
static inline nn::Result
|
||||
Initialize()
|
||||
{
|
||||
return detail::Initialize__Q2_2nn2acFv();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup the Auto Connect library. Do not call any nn::ac functions (other
|
||||
* than \link Initialize \endlink) after calling this function.
|
||||
*
|
||||
* \sa
|
||||
* - \link Initialize \endlink
|
||||
*/
|
||||
static inline void
|
||||
Finalize()
|
||||
{
|
||||
return detail::Finalize__Q2_2nn2acFv();
|
||||
}
|
||||
enum Status {
|
||||
STATUS_FAILED = -1,
|
||||
STATUS_OK = 0,
|
||||
STATUS_PROCESSING = 1,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Gets the default connection configuration id. This is the default as marked
|
||||
* in System Settings.
|
||||
*
|
||||
* \param id
|
||||
* A pointer to an \link ConfigIdNum \endlink to write the config ID to. Must
|
||||
* not be a \c nullptr.
|
||||
*
|
||||
* \return
|
||||
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
|
||||
* and \link nn::Result::IsFailure \endlink.
|
||||
*/
|
||||
static inline nn::Result
|
||||
GetStartupId(ConfigIdNum *id)
|
||||
{
|
||||
return detail::GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum(id);
|
||||
}
|
||||
nn::Result
|
||||
BeginLocalConnection(bool unknown)
|
||||
asm("BeginLocalConnection__Q2_2nn2acFb");
|
||||
|
||||
static inline nn::Result
|
||||
Connect()
|
||||
{
|
||||
return detail::Connect__Q2_2nn2acFv();
|
||||
}
|
||||
void
|
||||
ClearConfig(Config *cfg)
|
||||
asm("ClearConfig__Q2_2nn2acFP16netconf_profile_");
|
||||
|
||||
static inline nn::Result
|
||||
ConnectAsync()
|
||||
{
|
||||
return detail::ConnectAsync__Q2_2nn2acFv();
|
||||
}
|
||||
|
||||
static inline nn::Result
|
||||
nn::Result
|
||||
Close()
|
||||
{
|
||||
return detail::Close__Q2_2nn2acFv();
|
||||
}
|
||||
asm("Close__Q2_2nn2acFv");
|
||||
|
||||
static inline nn::Result
|
||||
GetCloseStatus()
|
||||
{
|
||||
return detail::GetCloseStatus__Q2_2nn2acFPQ3_2nn2ac6Status();
|
||||
}
|
||||
nn::Result
|
||||
CloseAll()
|
||||
asm("CloseAll__Q2_2nn2acFv");
|
||||
|
||||
nn::Result
|
||||
Connect(const Config *cfg)
|
||||
asm("Connect__Q2_2nn2acFPC16netconf_profile_");
|
||||
|
||||
nn::Result
|
||||
Connect(ConfigIdNum id)
|
||||
asm("Connect__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
|
||||
|
||||
nn::Result
|
||||
Connect()
|
||||
asm("Connect__Q2_2nn2acFv");
|
||||
|
||||
nn::Result
|
||||
ConnectAsync(const Config *cfg)
|
||||
asm("ConnectAsync__Q2_2nn2acFPC16netconf_profile_");
|
||||
|
||||
/**
|
||||
* Connects to a network, using the configuration represented by the given
|
||||
|
|
@ -133,11 +85,36 @@ GetCloseStatus()
|
|||
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
|
||||
* and \link nn::Result::IsFailure \endlink.
|
||||
*/
|
||||
static inline nn::Result
|
||||
Connect(ConfigIdNum id)
|
||||
{
|
||||
return detail::Connect__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum(id);
|
||||
}
|
||||
nn::Result
|
||||
ConnectAsync(ConfigIdNum id)
|
||||
asm("ConnectAsync__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
|
||||
|
||||
nn::Result
|
||||
ConnectAsync()
|
||||
asm("ConnectAsync__Q2_2nn2acFv");
|
||||
|
||||
nn::Result
|
||||
ConnectWithRetry()
|
||||
asm("ConnectWithRetry__Q2_2nn2acFv");
|
||||
|
||||
nn::Result
|
||||
DeleteConfig(ConfigIdNum id)
|
||||
asm("DeleteConfig__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
|
||||
|
||||
nn::Result
|
||||
EndLocalConnection()
|
||||
asm("EndLocalConnection__Q2_2nn2acFv");
|
||||
|
||||
/**
|
||||
* Cleans up the Auto Connect library. Do not call any nn::ac functions (other
|
||||
* than \link Initialize \endlink) after calling this function.
|
||||
*
|
||||
* \sa
|
||||
* - \link Initialize \endlink
|
||||
*/
|
||||
void
|
||||
Finalize()
|
||||
asm("Finalize__Q2_2nn2acFv");
|
||||
|
||||
/**
|
||||
* Gets the IP address assosciated with the currently active connection.
|
||||
|
|
@ -151,11 +128,120 @@ Connect(ConfigIdNum id)
|
|||
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
|
||||
* and \link nn::Result::IsFailure \endlink.
|
||||
*/
|
||||
static inline nn::Result
|
||||
nn::Result
|
||||
GetAssignedAddress(uint32_t *ip)
|
||||
{
|
||||
return detail::GetAssignedAddress__Q2_2nn2acFPUl(ip);
|
||||
}
|
||||
asm("GetAssignedAddress__Q2_2nn2acFPUl");
|
||||
|
||||
nn::Result
|
||||
GetAssignedAlternativeDns(uint32_t *ip)
|
||||
asm("GetAssignedAlternativeDns__Q2_2nn2acFPUl");
|
||||
|
||||
nn::Result
|
||||
GetAssignedGateway(uint32_t *ip)
|
||||
asm("GetAssignedGateway__Q2_2nn2acFPUl");
|
||||
|
||||
nn::Result
|
||||
GetAssignedPreferedDns(uint32_t *ip)
|
||||
asm("GetAssignedPreferedDns__Q2_2nn2acFPUl");
|
||||
|
||||
nn::Result
|
||||
GetAssignedSubnet(uint32_t *ip)
|
||||
asm("GetAssignedSubnet__Q2_2nn2acFPUl");
|
||||
|
||||
nn::Result
|
||||
GetCloseStatus(Status *status)
|
||||
asm("GetCloseStatus__Q2_2nn2acFPQ3_2nn2ac6Status");
|
||||
|
||||
nn::Result
|
||||
GetCompatId(ConfigIdNum *id)
|
||||
asm("GetCompatId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum");
|
||||
|
||||
nn::Result
|
||||
GetConnectResult(nn::Result *result)
|
||||
asm("GetConnectResult__Q2_2nn2acFPQ2_2nn6Result");
|
||||
|
||||
nn::Result
|
||||
GetConnectStatus(Status *status)
|
||||
asm("GetConnectStatus__Q2_2nn2acFPQ3_2nn2ac6Status");
|
||||
|
||||
nn::Result
|
||||
GetLastErrorCode(ErrorCode *error)
|
||||
asm("GetLastErrorCode__Q2_2nn2acFPUi");
|
||||
|
||||
nn::Result
|
||||
GetRunningConfig(Config *cfg)
|
||||
asm("GetRunningConfig__Q2_2nn2acFP16netconf_profile_");
|
||||
|
||||
/**
|
||||
* Gets the default connection configuration id. This is the default as marked
|
||||
* in System Settings.
|
||||
*
|
||||
* \param id
|
||||
* A pointer to an \link ConfigIdNum \endlink to write the config ID to. Must
|
||||
* not be a \c nullptr.
|
||||
*
|
||||
* \return
|
||||
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
|
||||
* and \link nn::Result::IsFailure \endlink.
|
||||
*/
|
||||
nn::Result
|
||||
GetStartupId(ConfigIdNum *id)
|
||||
asm("GetStartupId__Q2_2nn2acFPQ3_2nn2ac11ConfigIdNum");
|
||||
|
||||
/**
|
||||
* Initializes the Auto Connect library. Call this function before any other nn::ac
|
||||
* functions.
|
||||
*
|
||||
* \return
|
||||
* A \link nn::Result Result\endlink - see \link nn::Result::IsSuccess \endlink
|
||||
* and \link nn::Result::IsFailure \endlink.
|
||||
*
|
||||
* \sa
|
||||
* - \link Finalize \endlink
|
||||
*/
|
||||
nn::Result
|
||||
Initialize()
|
||||
asm("Initialize__Q2_2nn2acFv");
|
||||
|
||||
nn::Result
|
||||
IsAnyKeepingConnect(bool keeping)
|
||||
asm("IsAnyKeepingConnect__Q2_2nn2acFPb");
|
||||
|
||||
nn::Result
|
||||
IsApplicationConnected(bool *connected)
|
||||
asm("IsApplicationConnected__Q2_2nn2acFPb");
|
||||
|
||||
nn::Result
|
||||
IsAutoConnectionFatallyFailed(nn::Result *failed)
|
||||
asm("IsAutoConnectionFatallyFailed__Q2_2nn2acFQ2_2nn6Result");
|
||||
|
||||
nn::Result
|
||||
IsConfigExisting(ConfigIdNum id, bool *existing)
|
||||
asm("IsConfigExisting__Q2_2nn2acFQ3_2nn2ac11ConfigIdNumPb");
|
||||
|
||||
nn::Result
|
||||
IsKeepingConnect(bool *keeping)
|
||||
asm("IsKeepingConnect__Q2_2nn2acFPb");
|
||||
|
||||
nn::Result
|
||||
IsReadyToConnect(bool *ready)
|
||||
asm("IsReadyToConnect__Q2_2nn2acFPb");
|
||||
|
||||
nn::Result
|
||||
ReadConfig(ConfigIdNum id, Config *cfg)
|
||||
asm("ReadConfig__Q2_2nn2acFQ3_2nn2ac11ConfigIdNumP16netconf_profile_");
|
||||
|
||||
nn::Result
|
||||
SetCompatId(ConfigIdNum id)
|
||||
asm("SetCompatId__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
|
||||
|
||||
nn::Result
|
||||
SetStartupId(ConfigIdNum id)
|
||||
asm("SetStartupId__Q2_2nn2acFQ3_2nn2ac11ConfigIdNum");
|
||||
|
||||
nn::Result
|
||||
WriteConfig(ConfigIdNum id, const Config *cfg)
|
||||
asm("WriteConfig__Q2_2nn2acFQ3_2nn2ac11ConfigIdNumPC16netconf_profile_");
|
||||
|
||||
} // namespace ac
|
||||
} // namespace nn
|
||||
|
|
|
|||
|
|
@ -228,6 +228,11 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
Result() :
|
||||
mValue(0)
|
||||
{
|
||||
}
|
||||
|
||||
Result(Level level, Module module, unsigned description) :
|
||||
mValue(((level & 0x7) << 29) | ((module & 0x1FF) << 20) | (description & 0xFFFFF))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ WUT_CHECK_OFFSET(NetConfWifiConfigDataPrivacy, 0x06, aes_key);
|
|||
WUT_CHECK_SIZE(NetConfWifiConfigDataPrivacy, 0x48);
|
||||
|
||||
struct WUT_PACKED NetConfWifiConfigData {
|
||||
uint8_t ssid[0x20];
|
||||
char ssid[0x20];
|
||||
uint16_t ssidlength;
|
||||
WUT_PADDING_BYTES(2);
|
||||
NetConfWifiConfigDataPrivacy privacy;
|
||||
|
|
@ -198,12 +198,12 @@ WUT_CHECK_SIZE(NetConfOpt, 0x2c1);
|
|||
|
||||
struct WUT_PACKED NetConfInterface {
|
||||
uint16_t if_index;
|
||||
uint16_t if_sate;
|
||||
uint16_t if_state;
|
||||
uint32_t if_mtu;
|
||||
NetConfIPv4Info ipv4Info;
|
||||
};
|
||||
WUT_CHECK_OFFSET(NetConfInterface, 0x00, if_index);
|
||||
WUT_CHECK_OFFSET(NetConfInterface, 0x02, if_sate);
|
||||
WUT_CHECK_OFFSET(NetConfInterface, 0x02, if_state);
|
||||
WUT_CHECK_OFFSET(NetConfInterface, 0x04, if_mtu);
|
||||
WUT_CHECK_OFFSET(NetConfInterface, 0x08, ipv4Info);
|
||||
WUT_CHECK_SIZE(NetConfInterface, 0x20);
|
||||
|
|
@ -457,4 +457,4 @@ netconf_write_compat_profile_id(uint32_t unk1);
|
|||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user