Difference between revisions of "Network Interface services"

From Nintendo Switch Brew
Jump to navigation Jump to search
 
(37 intermediate revisions by 2 users not shown)
Line 8: Line 8:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name || Notes
+
! Cmd || Name
 
|-  
 
|-  
| 4 || [[#CreateGeneralServiceOld]] ([1.0.0-2.3.0] CreateGeneralService) ||
+
| 4 || [[#CreateGeneralServiceOld]] ([1.0.0-2.3.0] CreateGeneralService)
 
|-
 
|-
| 5 || [3.0.0+] [[#CreateGeneralService]] ||
+
| 5 || [3.0.0+] [[#CreateGeneralService]]
 
|}
 
|}
  
Line 26: Line 26:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name || Notes
+
! Cmd || Name
 +
|-
 +
| 1 || [[#GetClientId]]
 +
|-
 +
| 2 || [[#CreateScanRequest]]
 +
|-
 +
| 4 || [[#CreateRequest]]
 +
|-
 +
| 5 || [[#GetCurrentNetworkProfile]]
 +
|-
 +
| 6 || EnumerateNetworkInterfaces
 +
|-
 +
| 7 || EnumerateNetworkProfiles
 +
|-
 +
| 8 || [[#GetNetworkProfile]]
 +
|-
 +
| 9 || [[#SetNetworkProfile]]
 
|-
 
|-
| 1 || [[#GetClientId]] ||
+
| 10 || RemoveNetworkProfile
 
|-
 
|-
| 2 || CreateScanRequest || Returns an [[#IScanRequest]].
+
| 11 || GetScanDataOld ([1.0.0-3.0.2] GetScanData)
 
|-
 
|-
| 4 || CreateRequest || Returns an [[#IRequest]].
+
| 12 || [[#GetCurrentIpAddress]]
 
|-
 
|-
| 5 || [[#GetCurrentNetworkProfile]] ||
+
| 13 || GetCurrentAccessPointOld ([1.0.0-3.0.2] GetCurrentAccessPoint)
 
|-
 
|-
| 6 || EnumerateNetworkInterfaces ||
+
| 14 || [[#CreateTemporaryNetworkProfile]]
 
|-
 
|-
| 7 || EnumerateNetworkProfiles ||
+
| 15 || [[#GetCurrentIpConfigInfo]]
 
|-
 
|-
| 8 || GetNetworkProfile ||
+
| 16 || SetWirelessCommunicationEnabled
 
|-
 
|-
| 9 || SetNetworkProfile ||
+
| 17 || IsWirelessCommunicationEnabled
 
|-
 
|-
| 10 || RemoveNetworkProfile ||
+
| 18 || GetInternetConnectionStatus
 
|-
 
|-
| 11 || GetScanDataOld ([1.0.0-3.0.2] GetScanData) ||
+
| 19 || SetEthernetCommunicationEnabled
 
|-
 
|-
| 12 || GetCurrentIpAddress ||
+
| 20 || IsEthernetCommunicationEnabled
 
|-
 
|-
| 13 || GetCurrentAccessPointOld ([1.0.0-3.0.2] GetCurrentAccessPoint) ||
+
| 21 || [[#IsAnyInternetRequestAccepted]]
 
|-
 
|-
| 14 || CreateTemporaryNetworkProfile || Returns an [[#INetworkProfile]].
+
| 22 || IsAnyForegroundRequestAccepted
 
|-
 
|-
| 15 || GetCurrentIpConfigInfo ||
+
| 23 || PutToSleep
 
|-
 
|-
| 16 || SetWirelessCommunicationEnabled ||
+
| 24 || WakeUp
 
|-
 
|-
| 17 || IsWirelessCommunicationEnabled ||
+
| 25 || GetSsidListVersion
 
|-
 
|-
| 18 || GetInternetConnectionStatus ||
+
| 26 || SetExclusiveClient
 
|-
 
|-
| 19 || SetEthernetCommunicationEnabled ||
+
| 27 || GetDefaultIpSetting
 
|-
 
|-
| 20 || IsEthernetCommunicationEnabled ||
+
| 28 || SetDefaultIpSetting
 
|-
 
|-
| 21 || [[#IsAnyInternetRequestAccepted]] ||
+
| 29 || SetWirelessCommunicationEnabledForTest
 
|-
 
|-
| 22 || IsAnyForegroundRequestAccepted ||
+
| 30 || SetEthernetCommunicationEnabledForTest
 
|-
 
|-
| 23 || PutToSleep ||
+
| 31 || [2.0.0+] GetTelemetorySystemEventReadableHandle
 
|-
 
|-
| 24 || WakeUp ||
+
| 32 || [2.0.0+] GetTelemetryInfo
 
|-
 
|-
| 25 || GetSsidListVersion ||
+
| 33 || [2.0.0+] ConfirmSystemAvailability
 
|-
 
|-
| 26 || SetExclusiveClient ||
+
| 34 || [4.0.0+] SetBackgroundRequestEnabled
 
|-
 
|-
| 27 || GetDefaultIpSetting ||
+
| 35 || [4.0.0+] GetScanData
 
|-
 
|-
| 28 || SetDefaultIpSetting ||
+
| 36 || [4.0.0+] GetCurrentAccessPoint
 
|-
 
|-
| 29 || SetWirelessCommunicationEnabledForTest ||
+
| 37 || [4.0.0+] Shutdown
 
|-
 
|-
| 30 || SetEthernetCommunicationEnabledForTest ||
+
| 38 || [6.0.0+] GetAllowedChannels
 
|-
 
|-
| 31 || [2.0.0+] GetTelemetorySystemEventReadableHandle ||
+
| 39 || [8.0.0+] NotifyApplicationSuspended
 
|-
 
|-
| 32 || [2.0.0+] GetTelemetryInfo ||
+
| 40 || [8.0.0+] SetAcceptableNetworkTypeFlag
 
|-
 
|-
| 33 || [2.0.0+] ConfirmSystemAvailability ||
+
| 41 || [8.0.0+] GetAcceptableNetworkTypeFlag
 
|-
 
|-
| 34 || [4.0.0+] SetBackgroundRequestEnabled ||
+
| 42 || [8.0.0+] NotifyConnectionStateChanged
 
|-
 
|-
| 35 || [4.0.0+] GetScanData ||
+
| 43 || [9.0.0+] [[#SetWowlDelayedWakeTime]]
 
|-
 
|-
| 36 || [4.0.0+] GetCurrentAccessPoint ||
+
| 44 || [18.0.0+] IsWiredConnectionAvailable
 
|-
 
|-
| 37 || [4.0.0+] Shutdown ||
+
| 45 || [18.0.0+] IsNetworkEmulationFeatureEnabled
 
|-
 
|-
| 38 || [6.0.0+] GetAllowedChannels ||
+
| 46 || [18.0.0+] SelectActiveNetworkEmulationProfileIdForDebug
 
|-
 
|-
| 39 || [8.0.0+] NotifyApplicationSuspended ||
+
| 47 || [19.0.0+] GetScanData
 
|-
 
|-
| 40 || [8.0.0+] SetAcceptableNetworkTypeFlag ||
+
| 49 || [18.0.0+] GetActiveNetworkEmulationProfileId
 
|-
 
|-
| 41 || [8.0.0+] GetAcceptableNetworkTypeFlag ||
+
| 50 || [18.0.0+] IsRewriteFeatureEnabled
 
|-
 
|-
| 42 || [8.0.0+] NotifyConnectionStateChanged ||
+
| 51 || [18.0.0+] CreateRewriteRule
 
|-
 
|-
| 43 || [9.0.0+] SetWowlDelayedWakeTime ||
+
| 52 || [18.0.0+] DestroyRewriteRule
 
|}
 
|}
  
Line 117: Line 133:
  
 
The wrapper for this with official sw will return 0 when any errors occur (wrapper returns [[#ClientId]] not Result).
 
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 ===
 
=== GetCurrentNetworkProfile ===
Line 122: Line 146:
  
 
sdknso converts the output to [[#NetworkProfileData]].
 
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]].
 +
 +
=== CreateTemporaryNetworkProfile ===
 +
Returns an [[#INetworkProfile]].
 +
 +
=== GetCurrentIpConfigInfo ===
 +
No input, returns an output [[#IpAddressSetting]] and a [[#DnsSetting]].
  
 
=== IsAnyInternetRequestAccepted ===
 
=== IsAnyInternetRequestAccepted ===
Line 127: Line 172:
  
 
The wrapper for this with official sw will return 0 when any errors occur (wrapper returns bool not Result).
 
The wrapper for this with official sw will return 0 when any errors occur (wrapper returns bool not Result).
 +
 +
=== SetWowlDelayedWakeTime ===
 +
Takes an input s32, no output.
 +
 +
This requires nifm:a/nifm:s.
 +
 +
This goes through a list of objects to call a vfunc with the input value, that func then writes the input into the object state. The default value is 0. This field in state is later used for [[WLAN_services|wlaninf]] cmd30.
  
 
=== IScanRequest ===
 
=== IScanRequest ===
Line 147: Line 199:
  
 
=== IRequest ===
 
=== IRequest ===
This is "nn::nifm::detail::IRequest". This represents an application or sysmodule's request to bring a network up.
+
This is "nn::nifm::detail::IRequest".
 +
 
 +
This represents an application or sysmodule's request to bring a network up.
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 193: Line 247:
 
| 20 || GetRevision
 
| 20 || GetRevision
 
|-
 
|-
| 21 || GetAppletInfo
+
| 21 || [[#GetAppletInfo]]
 
|-
 
|-
 
| 22 || GetAdditionalInfo
 
| 22 || GetAdditionalInfo
 
|-
 
|-
| 23 || [3.0.0+] SetKeptInSleep
+
| 23 || [3.0.0+] [[#SetKeptInSleep]]
 
|-
 
|-
| 24 || [3.0.0+] RegisterSocketDescriptor
+
| 24 || [3.0.0+] [[#RegisterSocketDescriptor]]
 
|-
 
|-
| 25 || [3.0.0+] UnregisterSocketDescriptor
+
| 25 || [3.0.0+] [[#UnregisterSocketDescriptor]]
 
|}
 
|}
  
 
==== GetRequestState ====
 
==== GetRequestState ====
{| class="wikitable" border="1"
+
No input. Returns an output [[#RequestState]].
|-
 
! Number || Description
 
|-
 
| 1 || Not yet submitted or error
 
|-
 
| 2 || Pending (sdk calls this OnHold)
 
|-
 
| 3 || Connected
 
|}
 
  
 
==== 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 ====
Returns two event handles. The first one signals when the RequestState changes.
+
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.
  
Line 234: Line 289:
  
 
==== SetConnectionConfirmationOption ====
 
==== SetConnectionConfirmationOption ====
Set how to verify the internet connection.
+
Takes an input [[#ConnectionConfirmationOption]]. No output.
 
 
{| class="wikitable" border="1"
 
|-
 
! Option || Description
 
|-
 
| 0 ||
 
|-
 
| 1 ||
 
|-
 
| 2 || "Local" network (does not check for working DNS)
 
|-
 
| 3 ||
 
|-
 
| 4 || Default
 
|-
 
| 5 ||
 
|-
 
|}
 
  
 
==== SetPersistent ====
 
==== SetPersistent ====
Line 261: Line 298:
  
 
[3.0.0+] Returns an additional 4-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.
 +
 +
==== SetKeptInSleep ====
 +
Takes an input bool, no output.
 +
 +
[[#GetRequestState|RequestState]] must be value 1. This sets a flag in state.
 +
 +
==== RegisterSocketDescriptor ====
 +
Takes an input s32 sockfd, no output.
 +
 +
[[#GetRequestState|RequestState]] must be value 3. Only 1 socket can be registered at a time per IRequest. The specified sockfd is written into state.
 +
 +
During sleep-entry, [[WLAN_services|wlan:inf]] cmd19 is eventually used with data from currently-open IRequest objects' registered-sockets. Note however, the wlaninf cmd only supports a single set of data, hence if there's more than 1 IRequest with a registered socket only the last object in the list will actually get used during wlan:inf RequestSleep.
 +
 +
==== UnregisterSocketDescriptor ====
 +
Takes an input s32 sockfd, no output.
 +
 +
[[#GetRequestState|RequestState]] must be value 3. The input sockfd must match the one previously registered with [[#RegisterSocketDescriptor]].
  
 
=== INetworkProfile ===
 
=== INetworkProfile ===
Line 277: Line 346:
  
 
= ClientId =
 
= ClientId =
This is "nn::nifm::ClientId". This contains an u32.
+
This is "nn::nifm::ClientId". This is a 0x4-byte struct.
  
 
= SfNetworkProfileData =
 
= SfNetworkProfileData =
Line 288: Line 357:
 
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0xC2 || [[#IpSettingData]]
+
| 0x0 || 0xC2 || [[#IpSettingData|IpSetting]]
 
|-
 
|-
| 0xC2 || 0x10 ||  
+
| 0xC2 || 0x10 || Id
 
|-
 
|-
| 0xD2 || 0x40 || NUL-terminated string
+
| 0xD2 || 0x40 || Name (NUL-terminated Network Name string)
 
|-
 
|-
 
| 0x112 || 0x1 ||  
 
| 0x112 || 0x1 ||  
Line 302: Line 371:
 
| 0x115 || 0x1 ||  
 
| 0x115 || 0x1 ||  
 
|-
 
|-
| 0x116 || 0x66 || [[#SfWirelessSettingData]]
+
| 0x116 || 0x65 || [[#SfWirelessSettingData|SfWirelessSettingData]]
 +
|-
 +
| 0x17B || 0x1 || Reserved
 
|}
 
|}
  
Line 314: Line 385:
 
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x10 ||  
+
| 0x0 || 0x10 || Id
 +
|-
 +
| 0x10 || 0x40 || Name (NUL-terminated Network Name string)
 
|-
 
|-
| 0x10 || 0x40 || NUL-terminated string
+
| 0x50 || 0x4 || [[#NetworkProfileType|NetworkProfileType]]
 
|-
 
|-
| 0x50 || 0x4 ||  
+
| 0x54 || 0x4 || [[#NetworkInterfaceType|NetworkInterfaceType]]
 
|-
 
|-
| 0x54 || 0x4 ||  
+
| 0x58 || 0x1 || IsAutoConnect
 
|-
 
|-
| 0x58 || 0x1 ||  
+
| 0x59 || 0x1 || IsLargeCapacity
 
|-
 
|-
| 0x59 || 0x1 ||  
+
| 0x5A || 0x2 || Reserved
 +
|-
 +
| 0x5C || 0x70 || [[#WirelessSettingData|WirelessSetting]]
 +
|-
 +
| 0xCC || 0xC2 || [[#IpSettingData|IpSetting]]
 +
|}
 +
 
 +
= NetworkProfileType =
 +
This is "nn::nifm::NetworkProfileType".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Bits
 +
! Description
 +
|-
 +
| 0 || User
 +
|-
 +
| 1 || SsidList
 +
|-
 +
| 2 || Temporary
 +
|}
 +
 
 +
= NetworkInterfaceType =
 +
This is "nn::nifm::NetworkInterfaceType".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Value
 +
! Description
 
|-
 
|-
| 0x5A || 0x2 || Padding
+
| 0 || Invalid
 
|-
 
|-
| 0x5C || 0x70 || [[#WirelessSettingData]]
+
| 1 || Ieee80211
 
|-
 
|-
| 0xCC || 0xC2 || [[#IpSettingData]]
+
| 2 || Ethernet
 
|}
 
|}
  
 
= SfWirelessSettingData =
 
= SfWirelessSettingData =
This is a 0x66-byte struct. This is converted to/from [[#WirelessSettingData]] during the [[#NetworkProfileData]] conversion.
+
This is a 0x65-byte struct. This is converted to/from [[#WirelessSettingData]] during the [[#NetworkProfileData]] conversion.
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 342: Line 443:
 
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x1 || SSID length (Clamped to max len 0x20 during [[#NetworkProfileData]] conversion)
+
| 0x0 || 0x21 || [[#Ssid|Ssid]] (length is clamped to 0x20 during [[#NetworkProfileData]] conversion)
 
|-
 
|-
| 0x1 || 0x21 || NUL-terminated SSID string
+
| 0x21 || 0x1 ||  
 
|-
 
|-
 
| 0x22 || 0x1 ||  
 
| 0x22 || 0x1 ||  
Line 350: Line 451:
 
| 0x23 || 0x1 ||  
 
| 0x23 || 0x1 ||  
 
|-
 
|-
| 0x24 || 0x1 || Passphrase length?
+
| 0x24 || 0x41 || [[#SharedKey|SharedKey]]
|-
 
| 0x25 || 0x41 || Passphrase
 
 
|}
 
|}
  
Line 364: Line 463:
 
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x1 || SSID [[#SfWirelessSettingData|length]]
+
| 0x0 || 0x22 || [[#SsidConfig|SsidConfig]]
 +
|-
 +
| 0x23 || 0x2 || Reserved
 +
|-
 +
| 0x24 || 0x4C || [[#Security|Security]]
 +
|}
 +
 
 +
= SsidConfig =
 +
This is "nn::nifm::SsidConfig". This is a 0x22-byte struct.
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x21 || [[#Ssid|Ssid]]
 +
|-
 +
| 0x21 || 0x1 || NonBroadcast
 +
|}
 +
 
 +
= Security =
 +
This is "nn::nifm::Security". This is a 0x4C-byte struct.
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x8 || [[#AuthEncryption|AuthEncryption]]
 +
|-
 +
| 0x8 || 0x41 || [[#SharedKey|SharedKey]]
 +
|-
 +
| 0x49 || 0x3 || Reserved
 +
|}
 +
 
 +
= Ssid =
 +
This is "nn::nifm::Ssid". This is a 0x21-byte struct.
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x1 || Length
 +
|-
 +
| 0x1 || 0x20 || Hex (NUL-terminated SSID string)
 +
|}
 +
 
 +
= AuthEncryption =
 +
This is "nn::nifm::AuthEncryption". This is a 0x8-byte struct.
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x4 || [[#Authentication|Authentication]]
 +
|-
 +
| 0x4 || 0x4 || [[#Encryption|Encryption]]
 +
|}
 +
 
 +
= SharedKey =
 +
This is "nn::nifm::SharedKey". This is a 0x41-byte struct.
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x1 || Length
 +
|-
 +
| 0x1 || 0x40 || KeyMaterial
 +
|}
 +
 
 +
= Authentication =
 +
This is "nn::nifm::Authentication".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Value
 +
! Description
 +
|-
 +
| 0 || Invalid
 +
|-
 +
| 1 || Open
 +
|-
 +
| 2 || Shared
 +
|-
 +
| 3 || Wpa
 
|-
 
|-
| 0x1 || 0x21 || NUL-terminated SSID string
+
| 4 || WpaPsk
 
|-
 
|-
| 0x22 || 0x1 ||  
+
| 5 || Wpa2
 +
|-
 +
| 6 || Wpa2Psk
 +
|-
 +
| 7 || Unknown
 +
|}
 +
 
 +
= Encryption =
 +
This is "nn::nifm::Encryption".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Value
 +
! Description
 
|-
 
|-
| 0x23 || 0x1 || Padding
+
| 0 || Invalid
 
|-
 
|-
| 0x24 || 0x4 ||  
+
| 1 || None
 
|-
 
|-
| 0x28 || 0x4 || Passphrase length?
+
| 2 || Wep
 
|-
 
|-
| 0x2C || 0x41 || Passphrase
+
| 3 || Tkip
 
|-
 
|-
| 0x6D || 0x3 || Padding
+
| 4 || Aes
 
|}
 
|}
  
Line 390: Line 595:
 
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x16 ||  
+
| 0x0 || 0xD || [[#IpAddressSetting|Ip]]
 
|-
 
|-
| 0x16 || 0xAA || [[#ProxySetting]]
+
| 0xD || 0x9 || [[#DnsSetting|Dns]]
 
|-
 
|-
| 0xC0 || 0x2 ||  
+
| 0x16 || 0xAA || [[#ProxySetting|Proxy]]
 +
|-
 +
| 0xC0 || 0x2 || Mtu
 
|}
 
|}
  
Line 406: Line 613:
 
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x1 ||  
+
| 0x0 || 0x1 || IsEnabled
 
|-
 
|-
| 0x1 || 0x1 || Padding
+
| 0x1 || 0x1 || Reserved
 
|-
 
|-
 
| 0x2 || 0x2 || Port
 
| 0x2 || 0x2 || Port
 
|-
 
|-
| 0x4 || ? || Server string
+
| 0x4 || 0x64 || Proxy (server string, NUL-terminated)
 +
|-
 +
| 0x68 || 0x41 || [[#AuthenticationSetting|Authentication]]
 +
|-
 +
| 0xA9 || 0x1 || Reserved
 +
|}
 +
 
 +
= AuthenticationSetting =
 +
This is "nn::nifm::AuthenticationSetting". This is a 0x41-byte struct.
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x1 || IsEnabled
 +
|-
 +
| 0x1 || 0x20 || Username (user string, NUL-terminated)
 +
|-
 +
| 0x21 || 0x20 || Password (password string, NUL-terminated)
 +
|}
 +
 
 +
= 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 || IsAuto (Ignored by [[#GetCurrentIpConfigInfo]])
 +
|-
 +
| 0x1 || 0x4 || IpAddress (Copied to an output <code>struct in_addr</code> by sdknso)
 +
|-
 +
| 0x5 || 0x4 || SubnetMask (Copied to an output <code>struct in_addr</code> by sdknso)
 +
|-
 +
| 0x9 || 0x4 || DefaultGateway (Copied to an output <code>struct in_addr</code> by sdknso)
 +
|}
 +
 
 +
= DnsSetting =
 +
This is "nn::nifm::DnsSetting". This is a 0x9-byte struct.
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x1 || IsAuto (Ignored by [[#GetCurrentIpConfigInfo]])
 +
|-
 +
| 0x1 || 0x4 || PreferredDns (Copied to an output <code>struct in_addr</code> by sdknso)
 +
|-
 +
| 0x5 || 0x4 || AlternateDns (Copied to an output <code>struct in_addr</code> by sdknso)
 +
|}
 +
 
 +
= RequestState =
 +
This is "nn::nifm::RequestState".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Value
 +
! Description
 +
|-
 +
| 0 || Invalid
 +
|-
 +
| 1 || Free
 +
|-
 +
| 2 || OnHold
 +
|-
 +
| 3 || Accepted
 +
|-
 +
| 4 || Blocking
 +
|}
 +
 
 +
= ConnectionConfirmationOption =
 +
This is "nn::nifm::ConnectionConfirmationOption".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Value
 +
! Description
 +
|-
 +
| 0 || Invalid
 +
|-
 +
| 1 || Prohibited
 +
|-
 +
| 2 || NotRequired
 +
|-
 +
| 3 || Preferred
 +
|-
 +
| 4 || Required
 +
|-
 +
| 5 || Forced
 
|}
 
|}
  
 
[[Category:Services]]
 
[[Category:Services]]

Latest revision as of 19:46, 8 October 2024

nifm:a, nifm:s, nifm:u

These are "nn::nifm::detail::IStaticService".

Max sessions: nifm:a = 0x2, nifm:s = 0x10, nifm:u = 0x5.

nifm:u = User, nifm:s = System, and nifm:a = Admin.

Cmd Name
4 #CreateGeneralServiceOld ([1.0.0-2.3.0] CreateGeneralService)
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

This is "nn::nifm::detail::IGeneralService".

Cmd Name
1 #GetClientId
2 #CreateScanRequest
4 #CreateRequest
5 #GetCurrentNetworkProfile
6 EnumerateNetworkInterfaces
7 EnumerateNetworkProfiles
8 #GetNetworkProfile
9 #SetNetworkProfile
10 RemoveNetworkProfile
11 GetScanDataOld ([1.0.0-3.0.2] GetScanData)
12 #GetCurrentIpAddress
13 GetCurrentAccessPointOld ([1.0.0-3.0.2] GetCurrentAccessPoint)
14 #CreateTemporaryNetworkProfile
15 #GetCurrentIpConfigInfo
16 SetWirelessCommunicationEnabled
17 IsWirelessCommunicationEnabled
18 GetInternetConnectionStatus
19 SetEthernetCommunicationEnabled
20 IsEthernetCommunicationEnabled
21 #IsAnyInternetRequestAccepted
22 IsAnyForegroundRequestAccepted
23 PutToSleep
24 WakeUp
25 GetSsidListVersion
26 SetExclusiveClient
27 GetDefaultIpSetting
28 SetDefaultIpSetting
29 SetWirelessCommunicationEnabledForTest
30 SetEthernetCommunicationEnabledForTest
31 [2.0.0+] GetTelemetorySystemEventReadableHandle
32 [2.0.0+] GetTelemetryInfo
33 [2.0.0+] ConfirmSystemAvailability
34 [4.0.0+] SetBackgroundRequestEnabled
35 [4.0.0+] GetScanData
36 [4.0.0+] GetCurrentAccessPoint
37 [4.0.0+] Shutdown
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
44 [18.0.0+] IsWiredConnectionAvailable
45 [18.0.0+] IsNetworkEmulationFeatureEnabled
46 [18.0.0+] SelectActiveNetworkEmulationProfileIdForDebug
47 [19.0.0+] GetScanData
49 [18.0.0+] GetActiveNetworkEmulationProfileId
50 [18.0.0+] IsRewriteFeatureEnabled
51 [18.0.0+] CreateRewriteRule
52 [18.0.0+] DestroyRewriteRule

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.

CreateTemporaryNetworkProfile

Returns an #INetworkProfile.

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).

SetWowlDelayedWakeTime

Takes an input s32, no output.

This requires nifm:a/nifm:s.

This goes through a list of objects to call a vfunc with the input value, that func then writes the input into the object state. The default value is 0. This field in state is later used for wlaninf cmd30.

IScanRequest

This is "nn::nifm::detail::IScanRequest".

Cmd Name
0 Submit
1 IsProcessing
2 GetResult
3 GetSystemEventReadableHandle
4 [6.0.0+] SetChannels

IRequest

This is "nn::nifm::detail::IRequest".

This represents an application or sysmodule's request to bring a network up.

Cmd Name
0 #GetRequestState
1 #GetResult
2 #GetSystemEventReadableHandles
3 #Cancel
4 #Submit
5 #SetRequirement
6 SetRequirementPreset
8 SetPriority
9 SetNetworkProfileId
10 SetRejectable
11 #SetConnectionConfirmationOption
12 #SetPersistent
13 SetInstant
14 SetSustainable
15 SetRawPriority
16 SetGreedy
17 SetSharable
18 SetRequirementByRevision
19 #GetRequirement
20 GetRevision
21 #GetAppletInfo
22 GetAdditionalInfo
23 [3.0.0+] #SetKeptInSleep
24 [3.0.0+] #RegisterSocketDescriptor
25 [3.0.0+] #UnregisterSocketDescriptor

GetRequestState

No input. Returns an output #RequestState.

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.

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

No input/output.

Cancels the request to bring the network up.

Submit

No input/output.

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

Takes an input #ConnectionConfirmationOption. No output.

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.

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 nn::applet::GetExpectedThemeColorForSystem().

The output u32s are: AppletId, 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.

SetKeptInSleep

Takes an input bool, no output.

RequestState must be value 1. This sets a flag in state.

RegisterSocketDescriptor

Takes an input s32 sockfd, no output.

RequestState must be value 3. Only 1 socket can be registered at a time per IRequest. The specified sockfd is written into state.

During sleep-entry, wlan:inf cmd19 is eventually used with data from currently-open IRequest objects' registered-sockets. Note however, the wlaninf cmd only supports a single set of data, hence if there's more than 1 IRequest with a registered socket only the last object in the list will actually get used during wlan:inf RequestSleep.

UnregisterSocketDescriptor

Takes an input s32 sockfd, no output.

RequestState must be value 3. The input sockfd must match the one previously registered with #RegisterSocketDescriptor.

INetworkProfile

This is "nn::nifm::detail::INetworkProfile".

Cmd Name
0 Update
1 PersistOld ([1.0.0-2.3.0] Persist)
2 [3.0.0+] Persist

ClientId

This is "nn::nifm::ClientId". This is a 0x4-byte struct.

SfNetworkProfileData

This is "nn::nifm::detail::sf::NetworkProfileData". This is a 0x17C-byte struct. This is converted to/from #NetworkProfileData by sdknso.

Offset Size Description
0x0 0xC2 IpSetting
0xC2 0x10 Id
0xD2 0x40 Name (NUL-terminated Network Name string)
0x112 0x1
0x113 0x1
0x114 0x1
0x115 0x1
0x116 0x65 SfWirelessSettingData
0x17B 0x1 Reserved

NetworkProfileData

This is "nn::nifm::NetworkProfileData". This is converted from/to #SfNetworkProfileData by sdknso.

Offset Size Description
0x0 0x10 Id
0x10 0x40 Name (NUL-terminated Network Name string)
0x50 0x4 NetworkProfileType
0x54 0x4 NetworkInterfaceType
0x58 0x1 IsAutoConnect
0x59 0x1 IsLargeCapacity
0x5A 0x2 Reserved
0x5C 0x70 WirelessSetting
0xCC 0xC2 IpSetting

NetworkProfileType

This is "nn::nifm::NetworkProfileType".

Bits Description
0 User
1 SsidList
2 Temporary

NetworkInterfaceType

This is "nn::nifm::NetworkInterfaceType".

Value Description
0 Invalid
1 Ieee80211
2 Ethernet

SfWirelessSettingData

This is a 0x65-byte struct. This is converted to/from #WirelessSettingData during the #NetworkProfileData conversion.

Offset Size Description
0x0 0x21 Ssid (length is clamped to 0x20 during #NetworkProfileData conversion)
0x21 0x1
0x22 0x1
0x23 0x1
0x24 0x41 SharedKey

WirelessSettingData

This is "nn::nifm::WirelessSettingData". This is a 0x70-byte struct.

Offset Size Description
0x0 0x22 SsidConfig
0x23 0x2 Reserved
0x24 0x4C Security

SsidConfig

This is "nn::nifm::SsidConfig". This is a 0x22-byte struct.

Offset Size Description
0x0 0x21 Ssid
0x21 0x1 NonBroadcast

Security

This is "nn::nifm::Security". This is a 0x4C-byte struct.

Offset Size Description
0x0 0x8 AuthEncryption
0x8 0x41 SharedKey
0x49 0x3 Reserved

Ssid

This is "nn::nifm::Ssid". This is a 0x21-byte struct.

Offset Size Description
0x0 0x1 Length
0x1 0x20 Hex (NUL-terminated SSID string)

AuthEncryption

This is "nn::nifm::AuthEncryption". This is a 0x8-byte struct.

Offset Size Description
0x0 0x4 Authentication
0x4 0x4 Encryption

SharedKey

This is "nn::nifm::SharedKey". This is a 0x41-byte struct.

Offset Size Description
0x0 0x1 Length
0x1 0x40 KeyMaterial

Authentication

This is "nn::nifm::Authentication".

Value Description
0 Invalid
1 Open
2 Shared
3 Wpa
4 WpaPsk
5 Wpa2
6 Wpa2Psk
7 Unknown

Encryption

This is "nn::nifm::Encryption".

Value Description
0 Invalid
1 None
2 Wep
3 Tkip
4 Aes

IpSettingData

This is "nn::nifm::IpSettingData". This is a 0xC2-byte struct.

Offset Size Description
0x0 0xD Ip
0xD 0x9 Dns
0x16 0xAA Proxy
0xC0 0x2 Mtu

ProxySetting

This is "nn::nifm::ProxySetting". This is a 0xAA-byte struct.

Offset Size Description
0x0 0x1 IsEnabled
0x1 0x1 Reserved
0x2 0x2 Port
0x4 0x64 Proxy (server string, NUL-terminated)
0x68 0x41 Authentication
0xA9 0x1 Reserved

AuthenticationSetting

This is "nn::nifm::AuthenticationSetting". This is a 0x41-byte struct.

Offset Size Description
0x0 0x1 IsEnabled
0x1 0x20 Username (user string, NUL-terminated)
0x21 0x20 Password (password string, NUL-terminated)

IpV4Address

This is "nn::nifm::IpV4Address". This is a 0x4-byte struct.

sdknso copies this into struct in_addr.

IpAddressSetting

This is "nn::nifm::IpAddressSetting". This is a 0xD-byte struct.

Offset Size Description
0x0 0x1 IsAuto (Ignored by #GetCurrentIpConfigInfo)
0x1 0x4 IpAddress (Copied to an output struct in_addr by sdknso)
0x5 0x4 SubnetMask (Copied to an output struct in_addr by sdknso)
0x9 0x4 DefaultGateway (Copied to an output struct in_addr by sdknso)

DnsSetting

This is "nn::nifm::DnsSetting". This is a 0x9-byte struct.

Offset Size Description
0x0 0x1 IsAuto (Ignored by #GetCurrentIpConfigInfo)
0x1 0x4 PreferredDns (Copied to an output struct in_addr by sdknso)
0x5 0x4 AlternateDns (Copied to an output struct in_addr by sdknso)

RequestState

This is "nn::nifm::RequestState".

Value Description
0 Invalid
1 Free
2 OnHold
3 Accepted
4 Blocking

ConnectionConfirmationOption

This is "nn::nifm::ConnectionConfirmationOption".

Value Description
0 Invalid
1 Prohibited
2 NotRequired
3 Preferred
4 Required
5 Forced