Sockets services: Difference between revisions
No edit summary |
|||
| (16 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
= bsd:u, bsd:s = | = bsd:u, bsd:s, bsd:a = | ||
This is "nn::socket::sf::IClient". | This is "nn::socket::sf::IClient". | ||
[15.0.0+] This is "nn::socket::sf::IClient_MC". | [15.0.0+] This is "nn::socket::sf::IClient_MC". | ||
[18.0.0+] This is "nn::socket::sf::IClient". | |||
All the services commands but the first two return -1 on failure and set errno when that happens. Although Nintendo has the FreeBSD kernel's to socket stack, '''the errno macro definitions being in use actually come from Linux (and not from FreeBSD as one would expect!)'''. | All the services commands but the first two return -1 on failure and set errno when that happens. Although Nintendo has the FreeBSD kernel's to socket stack, '''the errno macro definitions being in use actually come from Linux (and not from FreeBSD as one would expect!)'''. | ||
[18.0.0+] bsd:a was added. | |||
These services have max_sessions 0x40. There's 22 IPC handler threads for bsd:u, and 11 for bsd:s. | These services have max_sessions 0x40. There's 22 IPC handler threads for bsd:u, and 11 for bsd:s. | ||
[16.0.0+] bsd:u has max_sessions 0x24 and bsd:s has max_sessions 0x7E. | |||
[18.0.0+] bsd:u has max_sessions 0xF, bsd:s has max_sessions 0x7E and bsd:a has max_sessions 0x17. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
| Line 14: | Line 22: | ||
| 0 || [[#RegisterClient]] | | 0 || [[#RegisterClient]] | ||
|- | |- | ||
| 1 || StartMonitoring | | 1 || [[#StartMonitoring]] | ||
|- | |- | ||
| 2 || [[#Socket]] | | 2 || [[#Socket]] | ||
| Line 83: | Line 91: | ||
|- | |- | ||
| 35 || [17.0.0+] NifIoctl | | 35 || [17.0.0+] NifIoctl | ||
|- | |||
| 36 || [18.0.0+] | |||
|- | |||
| 37 || [18.0.0+] | |||
|- | |||
| 38 || [18.0.0+] | |||
|- | |||
| 39 || [20.0.0+] | |||
|- | |||
| 40 || [20.0.0+] | |||
|- | |||
| 41 || [21.0.0+] | |||
|- | |||
| 42 || [21.0.0+] | |||
|- | |||
| 43 || [21.0.0+] | |||
|- | |- | ||
| 200 || [15.0.0+] SetThreadCoreMask | | 200 || [15.0.0+] SetThreadCoreMask | ||
| Line 90: | Line 114: | ||
== RegisterClient == | == RegisterClient == | ||
Takes a [[#LibraryConfigData]], the PID, the size of the transfer memory and a copy-handle of the latter. | Takes a [[#LibraryConfigData]], the PID, the size of the transfer memory and a copy-handle of the latter. Returns 4-bytes of output. | ||
The transfer memory must be larger than a the computed size below. Should the transfer memory be smaller than that, the BSD sockets service would only send ZeroWindow packets (for TCP), resulting in a transfer rate not exceeding 1 byte/s. | The transfer memory must be larger than a the computed size below. Should the transfer memory be smaller than that, the BSD sockets service would only send ZeroWindow packets (for TCP), resulting in a transfer rate not exceeding 1 byte/s. | ||
| Line 103: | Line 127: | ||
return (size_t)(config->sb_efficiency * sum); | return (size_t)(config->sb_efficiency * sum); | ||
} | } | ||
== StartMonitoring == | |||
Takes a PID and an u64 pid_reserved, no output. | |||
This is used after the RegisterClient* cmd by the user-process. | |||
== Socket == | == Socket == | ||
| Line 152: | Line 181: | ||
== RegisterResourceStatisticsName == | == RegisterResourceStatisticsName == | ||
[10.0.0+] Now takes an additional 8-bytes of input. | |||
== RegisterClientShared == | == RegisterClientShared == | ||
| Line 161: | Line 190: | ||
sdknso will only use this cmd when two flags in the input config are set: the first one being set indicates that the bsd:s service is used, while the second flag enables using this cmd. An error is thrown if the work-buffer size is <0x1000. Otherwise when these flags aren't set, [[#RegisterClient]] is used as usual. | sdknso will only use this cmd when two flags in the input config are set: the first one being set indicates that the bsd:s service is used, while the second flag enables using this cmd. An error is thrown if the work-buffer size is <0x1000. Otherwise when these flags aren't set, [[#RegisterClient]] is used as usual. | ||
= bsdcfg = | == Cmd36 == | ||
Takes a PID, an input u32 [[#LibraryConfigData|version]], an u64 pid_reserved, returns 4-bytes of output. | |||
On NX this is stubbed, just returns 0. | |||
On Ounce this is used as a new version of RegisterClient*, when initializing bsd:s/bsd:a. | |||
== Cmd38 == | |||
Takes 4-bytes of input and a type-0x21 input buffer. Returns a total of 8-bytes of output. | |||
On NX this just returns Result 0 and writes an error to output. | |||
== Cmd39 == | |||
[21.0.0+] Now no longer returns two output handles. | |||
On NX this writes errors to output. | |||
== Cmd41 == | |||
On NX this writes errors to output. | |||
= bsdcfg, ifcfg = | |||
This is "nn::bsdsocket::cfg::ServerInterface". | This is "nn::bsdsocket::cfg::ServerInterface". | ||
This has | [17.0.0+] ifcfg was added. | ||
This has max_sessions 4. | |||
[18.0.0+] bsdcfg has max_sessions 1 and ifcfg has max_sessions 4. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
| Line 217: | Line 270: | ||
|- | |- | ||
| 23 || [17.0.0+] | | 23 || [17.0.0+] | ||
|- | |||
| 24 || [19.0.0+] | |||
|- | |- | ||
| 50 || [17.0.0+] | | 50 || [17.0.0+] | ||
| Line 319: | Line 374: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || SetDnsAddressesPrivateRequest | | 0 || SetDnsAddressesPrivateRequest | ||
|- | |- | ||
| 1 || GetDnsAddressPrivateRequest | | 1 || GetDnsAddressPrivateRequest | ||
|- | |- | ||
| 2 || GetHostByNameRequest | | 2 || GetHostByNameRequest | ||
| Line 393: | Line 448: | ||
The list should be terminated with a sentinel four-byte zero value. | The list should be terminated with a sentinel four-byte zero value. | ||
= dns:priv = | |||
This is "nn::socket::resolver::IPrivateResolver". | |||
This was added with [18.0.0+]. | |||
This has max_sessions 1. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Cmd || Name | |||
|- | |||
| 0 || | |||
|- | |||
| 1 || | |||
|- | |||
| 2 || | |||
|} | |||
= nsd:u, nsd:a = | = nsd:u, nsd:a = | ||
This is "nn::nsd::detail::IManager". | This is "nn::nsd::detail::IManager". | ||
nsd:u has | nsd:u has max_sessions 20, nsd:a has IPC max_sessions 5. No retail system titles have access to nsd:a. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
| Line 491: | Line 564: | ||
This is only usable with nsd:a. | This is only usable with nsd:a. | ||
This also verifies a RSA signature, etc. | |||
== SetChangeEnvironmentIdentifierDisabled == | == SetChangeEnvironmentIdentifierDisabled == | ||
| Line 605: | Line 680: | ||
== CreateUserService == | == CreateUserService == | ||
No input. Returns an [[#ISfUserService]]. | No input. Returns an [[#ISfUserService]]. | ||
| Line 618: | Line 691: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || [[# | | 0 || [[#Assign]] | ||
|- | |- | ||
| 128 || | | 128 || GetUserInfo | ||
|- | |- | ||
| 129 || | | 129 || GetStateChangedEvent | ||
|} | |} | ||
=== | === Assign === | ||
Takes an input handle. Returns an [[#ISfAssignedNetworkInterfaceService]]. | Takes an input handle. Returns an [[#ISfAssignedNetworkInterfaceService]]. | ||
| Line 641: | Line 712: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| 0 || | | 0 || [[#AddSession]] | ||
|} | |} | ||
==== | ==== AddSession ==== | ||
Takes an input handle, no output. | Takes an input handle, no output. | ||
| Line 690: | Line 761: | ||
| [13.0.0-15.0.1] || 0x8 | | [13.0.0-15.0.1] || 0x8 | ||
|- | |- | ||
| [16.0.0+] || | | [16.0.0-18.1.0] || 0x9 | ||
|- | |||
| [19.0.0+] || 0xA | |||
|} | |} | ||
On NX the upper u16 of the version is 0x0, while on Ounce it's 0x1. | |||
= DeleteMode = | = DeleteMode = | ||