Network Interface services: Difference between revisions
(38 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
! Cmd || Name || Notes | ! Cmd || Name || Notes | ||
|- | |- | ||
| 4 || CreateGeneralServiceOld ([1.0.0-2.3.0] CreateGeneralService) || | | 4 || [[#CreateGeneralServiceOld]] ([1.0.0-2.3.0] CreateGeneralService) || | ||
|- | |- | ||
| 5 || [3.0.0+] | | 5 || [3.0.0+] [[#CreateGeneralService]] || | ||
|} | |} | ||
== CreateGeneralServiceOld == | |||
No input, returns an [[#IGeneralService]]. | |||
== CreateGeneralService == | |||
Takes a PID and an input u64 reserved_pid, returns an [[#IGeneralService]]. | |||
== IGeneralService == | == IGeneralService == | ||
Line 22: | Line 28: | ||
! Cmd || Name || Notes | ! Cmd || Name || Notes | ||
|- | |- | ||
| 1 || GetClientId || | | 1 || [[#GetClientId]] || | ||
|- | |- | ||
| 2 || | | 2 || [[#CreateScanRequest]] || | ||
|- | |- | ||
| 4 || | | 4 || [[#CreateRequest]] || | ||
|- | |- | ||
| 5 || GetCurrentNetworkProfile || | | 5 || [[#GetCurrentNetworkProfile]] || | ||
|- | |- | ||
| 6 || EnumerateNetworkInterfaces || | | 6 || EnumerateNetworkInterfaces || | ||
Line 34: | Line 40: | ||
| 7 || EnumerateNetworkProfiles || | | 7 || EnumerateNetworkProfiles || | ||
|- | |- | ||
| 8 || GetNetworkProfile || | | 8 || [[#GetNetworkProfile]] || | ||
|- | |- | ||
| 9 || SetNetworkProfile || | | 9 || [[#SetNetworkProfile]] || | ||
|- | |- | ||
| 10 || RemoveNetworkProfile || | | 10 || RemoveNetworkProfile || | ||
Line 42: | Line 48: | ||
| 11 || GetScanDataOld ([1.0.0-3.0.2] GetScanData) || | | 11 || GetScanDataOld ([1.0.0-3.0.2] GetScanData) || | ||
|- | |- | ||
| 12 || GetCurrentIpAddress || | | 12 || [[#GetCurrentIpAddress]] || | ||
|- | |- | ||
| 13 || GetCurrentAccessPointOld ([1.0.0-3.0.2] GetCurrentAccessPoint) || | | 13 || GetCurrentAccessPointOld ([1.0.0-3.0.2] GetCurrentAccessPoint) || | ||
Line 48: | Line 54: | ||
| 14 || CreateTemporaryNetworkProfile || Returns an [[#INetworkProfile]]. | | 14 || CreateTemporaryNetworkProfile || Returns an [[#INetworkProfile]]. | ||
|- | |- | ||
| 15 || GetCurrentIpConfigInfo || | | 15 || [[#GetCurrentIpConfigInfo]] || | ||
|- | |- | ||
| 16 || SetWirelessCommunicationEnabled || | | 16 || SetWirelessCommunicationEnabled || | ||
Line 60: | Line 66: | ||
| 20 || IsEthernetCommunicationEnabled || | | 20 || IsEthernetCommunicationEnabled || | ||
|- | |- | ||
| 21 || IsAnyInternetRequestAccepted || | | 21 || [[#IsAnyInternetRequestAccepted]] || | ||
|- | |- | ||
| 22 || IsAnyForegroundRequestAccepted || | | 22 || IsAnyForegroundRequestAccepted || | ||
Line 95: | Line 101: | ||
|- | |- | ||
| 38 || [6.0.0+] GetAllowedChannels || | | 38 || [6.0.0+] GetAllowedChannels || | ||
|- | |||
| 39 || [8.0.0+] NotifyApplicationSuspended || | |||
|- | |||
| 40 || [8.0.0+] SetAcceptableNetworkTypeFlag || | |||
|- | |||
| 41 || [8.0.0+] GetAcceptableNetworkTypeFlag || | |||
|- | |||
| 42 || [8.0.0+] NotifyConnectionStateChanged || | |||
|- | |||
| 43 || [9.0.0+] SetWowlDelayedWakeTime || | |||
|} | |} | ||
=== GetClientId === | |||
Takes a type-0x1A output buffer containing a [[#ClientId]], no output. | |||
The wrapper for this with official sw will return 0 when any errors occur (wrapper returns [[#ClientId]] not Result). | |||
=== CreateScanRequest === | |||
No input, returns an output [[#IScanRequest]]. | |||
=== CreateRequest === | |||
Takes an input s32 "nn::nifm::RequirementPreset", returns an output [[#IRequest]]. | |||
sdknso loads the s32 from "nn::nifm::RequestParameters", which has hard-coded value 0x2. | |||
=== GetCurrentNetworkProfile === | |||
Takes a type-0x1A output buffer containing a [[#SfNetworkProfileData]]. | |||
sdknso converts the output to [[#NetworkProfileData]]. | |||
=== GetNetworkProfile === | |||
Takes an input "nn::util::Uuid" (same Uuid from [[#SfNetworkProfileData]]) and a type-0x1A output buffer containing a [[#SfNetworkProfileData]]. | |||
sdknso converts the output to [[#NetworkProfileData]]. | |||
=== SetNetworkProfile === | |||
Takes a type-0x19 input buffer containing a [[#SfNetworkProfileData]] and returns an output "nn::util::Uuid". | |||
sdknso converts the input to [[#SfNetworkProfileData]], which is then passed to the cmd. | |||
This is only available with nifm:a. | |||
=== GetCurrentIpAddress === | |||
No input, returns an output [[#IpV4Address]]. | |||
=== GetCurrentIpConfigInfo === | |||
No input, returns an output [[#IpAddressSetting]] and a [[#DnsSetting]]. | |||
=== IsAnyInternetRequestAccepted === | |||
Takes a type-0x19 input buffer containing a [[#ClientId]], returns an output u8 bool. | |||
The wrapper for this with official sw will return 0 when any errors occur (wrapper returns bool not Result). | |||
=== IScanRequest === | === IScanRequest === | ||
Line 112: | Line 169: | ||
| 3 || GetSystemEventReadableHandle | | 3 || GetSystemEventReadableHandle | ||
|- | |- | ||
| 4 || [6.0.0+] | | 4 || [6.0.0+] SetChannels | ||
|} | |} | ||
Line 132: | Line 189: | ||
| 4 || [[#Submit]] | | 4 || [[#Submit]] | ||
|- | |- | ||
| 5 || SetRequirement | | 5 || [[#SetRequirement]] | ||
|- | |- | ||
| 6 || SetRequirementPreset | | 6 || SetRequirementPreset | ||
Line 158: | Line 215: | ||
| 18 || SetRequirementByRevision | | 18 || SetRequirementByRevision | ||
|- | |- | ||
| 19 || GetRequirement | | 19 || [[#GetRequirement]] | ||
|- | |- | ||
| 20 || GetRevision | | 20 || GetRevision | ||
|- | |- | ||
| 21 || GetAppletInfo | | 21 || [[#GetAppletInfo]] | ||
|- | |- | ||
| 22 || GetAdditionalInfo | | 22 || GetAdditionalInfo | ||
|- | |- | ||
| 23 || SetKeptInSleep | | 23 || [3.0.0+] SetKeptInSleep | ||
|- | |- | ||
| 24 || RegisterSocketDescriptor | | 24 || [3.0.0+] RegisterSocketDescriptor | ||
|- | |- | ||
| 25 || UnregisterSocketDescriptor | | 25 || [3.0.0+] UnregisterSocketDescriptor | ||
|} | |} | ||
Line 177: | Line 234: | ||
|- | |- | ||
! Number || Description | ! Number || Description | ||
|- | |||
| 0 || Set by sdknso when the cmd returns an error. | |||
|- | |- | ||
| 1 || Not yet submitted or error | | 1 || Not yet submitted or error | ||
|- | |- | ||
| 2 || Pending ( | | 2 || Pending (sdknso calls this OnHold) | ||
|- | |||
| 3 || Connected (sdknso calls this Available) | |||
|- | |- | ||
| | | 5 || | ||
|} | |} | ||
==== GetResult ==== | ==== GetResult ==== | ||
No input/output. | |||
If the request enters state 1, this command can be used to determine why. It responds with the nice networking error codes that there are support pages for. | If the request enters state 1, this command can be used to determine why. It responds with the nice networking error codes that there are support pages for. | ||
==== GetSystemEventReadableHandles ==== | ==== GetSystemEventReadableHandles ==== | ||
No input, returns two Event handles. The first one signals when the RequestState changes. | |||
This is used immediately after [[#CreateRequest]]. | |||
sdknso uses EventClearMode=1 for the first Event, for the second Event this can be user-specified or a default value of 1. | |||
==== Cancel ==== | ==== Cancel ==== | ||
No input/output. | |||
Cancels the request to bring the network up. | Cancels the request to bring the network up. | ||
==== Submit ==== | ==== Submit ==== | ||
No input/output. | |||
Submits the request to bring the network up. Call this after configuring the request. | Submits the request to bring the network up. Call this after configuring the request. | ||
==== SetRequirement ==== | |||
Takes a total of 0x20-bytes of input, no output. | |||
[3.0.0+] Takes an additional 4-bytes of input. | |||
==== SetConnectionConfirmationOption ==== | ==== SetConnectionConfirmationOption ==== | ||
Line 220: | Line 296: | ||
==== SetPersistent ==== | ==== SetPersistent ==== | ||
If this is set, when the network connection is lost, rather than causing the request to enter state 1, it will instead enter state 2 and attempt to bring the network back up again. | If this is set, when the network connection is lost, rather than causing the request to enter state 1, it will instead enter state 2 and attempt to bring the network back up again. | ||
==== GetRequirement ==== | |||
No input, returns a total of 0x20-bytes of output. | |||
[3.0.0+] Returns an additional 4-bytes of output. | |||
==== GetAppletInfo ==== | |||
Takes an input u32, a type-0x6 output buffer, and 3 output u32s. | |||
sdknso uses the output from this to launch a LibraryApplet. | |||
The input u32 is set to the output from <code>nn::applet::GetExpectedThemeColorForSystem()</code>. | |||
The output u32s are: [[Applet_Manager_services#AppletId|AppletId]], [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]], out_size. | |||
sdknso uses size 0x1000 for the buffer. | |||
The out_size is the total data size written to the output buffer. The buffer contains an array of: {s32 size} {data with the specified size}, with size==-1 indicating that the end of the array was reached. The data from here is pushed as applet input storage. | |||
The returned AppletId is one of the following: error, wifiWebAuth, or netConnect. | |||
=== INetworkProfile === | === INetworkProfile === | ||
Line 233: | Line 329: | ||
|- | |- | ||
| 2 || [3.0.0+] Persist | | 2 || [3.0.0+] Persist | ||
|} | |||
= ClientId = | |||
This is "nn::nifm::ClientId". This contains an u32. | |||
= SfNetworkProfileData = | |||
This is "nn::nifm::detail::sf::NetworkProfileData". This is a 0x17C-byte struct. This is converted to/from [[#NetworkProfileData]] by sdknso. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0xC2 || [[#IpSettingData]] | |||
|- | |||
| 0xC2 || 0x10 || "nn::util::Uuid" | |||
|- | |||
| 0xD2 || 0x40 || NUL-terminated Network Name string | |||
|- | |||
| 0x112 || 0x1 || | |||
|- | |||
| 0x113 || 0x1 || | |||
|- | |||
| 0x114 || 0x1 || | |||
|- | |||
| 0x115 || 0x1 || | |||
|- | |||
| 0x116 || 0x65 || [[#SfWirelessSettingData]] | |||
|- | |||
| 0x17B || 0x1 || Padding | |||
|} | |||
= NetworkProfileData = | |||
This is "nn::nifm::NetworkProfileData". This is converted from/to [[#SfNetworkProfileData]] by sdknso. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x10 || "nn::util::Uuid" | |||
|- | |||
| 0x10 || 0x40 || NUL-terminated Network Name string | |||
|- | |||
| 0x50 || 0x4 || | |||
|- | |||
| 0x54 || 0x4 || | |||
|- | |||
| 0x58 || 0x1 || | |||
|- | |||
| 0x59 || 0x1 || | |||
|- | |||
| 0x5A || 0x2 || Padding | |||
|- | |||
| 0x5C || 0x70 || [[#WirelessSettingData]] | |||
|- | |||
| 0xCC || 0xC2 || [[#IpSettingData]] | |||
|} | |||
= SfWirelessSettingData = | |||
This is a 0x65-byte struct. This is converted to/from [[#WirelessSettingData]] during the [[#NetworkProfileData]] conversion. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x1 || SSID length (Clamped to max len 0x20 during [[#NetworkProfileData]] conversion) | |||
|- | |||
| 0x1 || 0x20 || SSID string | |||
|- | |||
| 0x21 || 0x1 || | |||
|- | |||
| 0x22 || 0x1 || | |||
|- | |||
| 0x23 || 0x1 || | |||
|- | |||
| 0x24 || 0x41 || Passphrase | |||
|} | |||
= WirelessSettingData = | |||
This is "nn::nifm::WirelessSettingData". This is a 0x70-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x1 || SSID [[#SfWirelessSettingData|length]] | |||
|- | |||
| 0x1 || 0x21 || NUL-terminated SSID string | |||
|- | |||
| 0x22 || 0x1 || | |||
|- | |||
| 0x23 || 0x1 || Padding | |||
|- | |||
| 0x24 || 0x4 || | |||
|- | |||
| 0x28 || 0x4 || | |||
|- | |||
| 0x2C || 0x41 || Passphrase | |||
|- | |||
| 0x6D || 0x3 || Padding | |||
|} | |||
= IpSettingData = | |||
This is "nn::nifm::IpSettingData". This is a 0xC2-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0xD || [[#IpAddressSetting]] | |||
|- | |||
| 0xD || 0x9 || [[#DnsSetting]] | |||
|- | |||
| 0x16 || 0xAA || [[#ProxySetting]] | |||
|- | |||
| 0xC0 || 0x2 || MTU | |||
|} | |||
= ProxySetting = | |||
This is "nn::nifm::ProxySetting". This is a 0xAA-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x1 || Enables using the proxy when set. | |||
|- | |||
| 0x1 || 0x1 || Padding | |||
|- | |||
| 0x2 || 0x2 || Port | |||
|- | |||
| 0x4 || 0x64 || Server string, NUL-terminated. | |||
|- | |||
| 0x68 || 0x1 || Enables auto-authentication when set, which uses the following two strings. | |||
|- | |||
| 0x69 || 0x20 || User string, NUL-terminated. | |||
|- | |||
| 0x89 || 0x20 || Password string, NUL-terminated. | |||
|- | |||
| 0xA9 || 0x1 || Padding | |||
|} | |||
= IpV4Address = | |||
This is "nn::nifm::IpV4Address". This is a 0x4-byte struct. | |||
sdknso copies this into <code>struct in_addr</code>. | |||
= IpAddressSetting = | |||
This is "nn::nifm::IpAddressSetting". This is a 0xD-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x1 || Whether this setting is automatic. Ignored by [[#GetCurrentIpConfigInfo]]. | |||
|- | |||
| 0x1 || 0x4 || Copied to an output <code>struct in_addr</code> by sdknso. Same as the output from [[#GetCurrentIpAddress]]. | |||
|- | |||
| 0x5 || 0x4 || Copied to an output <code>struct in_addr</code> by sdknso. Subnet Mask. | |||
|- | |||
| 0x9 || 0x4 || Copied to an output <code>struct in_addr</code> by sdknso. Gateway. | |||
|} | |||
= DnsSetting = | |||
This is "nn::nifm::DnsSetting". This is a 0x9-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x1 || Whether this setting is automatic. Ignored by [[#GetCurrentIpConfigInfo]]. | |||
|- | |||
| 0x1 || 0x4 || Copied to an output <code>struct in_addr</code> by sdknso. Primary DNS server. | |||
|- | |||
| 0x5 || 0x4 || Copied to an output <code>struct in_addr</code> by sdknso. Secondary DNS server. | |||
|} | |} | ||
[[Category:Services]] | [[Category:Services]] |