Changes

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 91: Line 99:  
== 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.
 +
 +
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.
 +
 +
static size_t _bsdGetTransferMemSizeForBufferConfig(const BsdBufferConfig *config)
 +
{
 +
    u32 tcp_tx_buf_max_size = config->tcp_tx_buf_max_size != 0 ? config->tcp_tx_buf_max_size : config->tcp_tx_buf_size;
 +
    u32 tcp_rx_buf_max_size = config->tcp_rx_buf_max_size != 0 ? config->tcp_rx_buf_max_size : config->tcp_rx_buf_size;
 +
    u32 sum = tcp_tx_buf_max_size + tcp_rx_buf_max_size + config->udp_tx_buf_size + config->udp_rx_buf_size;
 +
 +
    sum = ((sum + 0xFFF) >> 12) << 12; // page round-up
 +
    return (size_t)(config->sb_efficiency * sum);
 +
}
    
== Socket ==
 
== Socket ==
Line 149: Line 169:  
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 =
+
= bsdcfg, ifcfg =
 
This is "nn::bsdsocket::cfg::ServerInterface".
 
This is "nn::bsdsocket::cfg::ServerInterface".
   −
This has IPC max_sessions 4.
+
[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 307: Line 331:  
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || SetDnsAddressesPrivateRequest (stubbed, returns 0x7FE03)
+
| 0 || SetDnsAddressesPrivateRequest
 
|-
 
|-
| 1 || GetDnsAddressPrivateRequest (stubbed, returns 0x7FE03)
+
| 1 || GetDnsAddressPrivateRequest
 
|-
 
|-
 
| 2 || GetHostByNameRequest
 
| 2 || GetHostByNameRequest
Line 381: Line 405:     
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 IPC max_sessions 20, nsd:a has IPC max_sessions 5. No retail system titles have access to nsd:a.
+
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 593: Line 635:     
== CreateUserService ==
 
== CreateUserService ==
Unofficial name.
  −
   
No input. Returns an [[#ISfUserService]].
 
No input. Returns an [[#ISfUserService]].
   Line 606: Line 646:  
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || [[#CreateAssignedNetworkInterfaceService]]
+
| 0 || [[#Assign]]
 
|-
 
|-
| 128 ||  
+
| 128 || GetUserInfo
 
|-
 
|-
| 129 ||  
+
| 129 || GetStateChangedEvent
 
|}
 
|}
   −
=== CreateAssignedNetworkInterfaceService ===
+
=== Assign ===
Unofficial name.
  −
 
   
Takes an input handle. Returns an [[#ISfAssignedNetworkInterfaceService]].
 
Takes an input handle. Returns an [[#ISfAssignedNetworkInterfaceService]].
   Line 629: Line 667:  
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||  
+
| 0 || [[#AddSession]]
 
|}
 
|}
   −
==== Cmd0 ====
+
==== AddSession ====
 
Takes an input handle, no output.
 
Takes an input handle, no output.
    
The handle is the service-session handle for "nn::anif::detail::ISfNetworkInterfaceService".
 
The handle is the service-session handle for "nn::anif::detail::ISfNetworkInterfaceService".
   −
=== LibraryConfigData ===
+
= LibraryConfigData =
 
This is "nn::socket::sf::LibraryConfigData".
 
This is "nn::socket::sf::LibraryConfigData".
   Line 653: Line 691:  
   
 
   
 
     u32 sb_efficiency;          ///< Number of buffers for each socket (standard values range from 1 to 8).
 
     u32 sb_efficiency;          ///< Number of buffers for each socket (standard values range from 1 to 8).
  } BsdBufferConfig;
+
  } LibraryConfigData;
    +
Versions:
   −
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.
+
{| class="wikitable" border="1"
 
+
|-
static size_t _bsdGetTransferMemSizeForBufferConfig(const BsdBufferConfig *config)
+
! System version
{
+
! Version
    u32 tcp_tx_buf_max_size = config->tcp_tx_buf_max_size != 0 ? config->tcp_tx_buf_max_size : config->tcp_tx_buf_size;
+
|-
    u32 tcp_rx_buf_max_size = config->tcp_rx_buf_max_size != 0 ? config->tcp_rx_buf_max_size : config->tcp_rx_buf_size;
+
| [1.0.0-2.3.0] || 0x1
    u32 sum = tcp_tx_buf_max_size + tcp_rx_buf_max_size + config->udp_tx_buf_size + config->udp_rx_buf_size;
+
|-
+
| [3.0.0-3.0.2] || 0x2
    sum = ((sum + 0xFFF) >> 12) << 12; // page round-up
+
|-
    return (size_t)(config->sb_efficiency * sum);
+
| [4.0.0-4.1.0] || 0x3
}
+
|-
 +
| [5.0.0-5.1.0] || 0x4
 +
|-
 +
| [6.0.0-7.0.1] || 0x5
 +
|-
 +
| [8.0.0-8.1.1] || 0x6
 +
|-
 +
| [9.0.0-12.1.0] || 0x7
 +
|-
 +
| [13.0.0-15.0.1] || 0x8
 +
|-
 +
| [16.0.0+] || 0x9
 +
|}
    
= DeleteMode =
 
= DeleteMode =
This is s32 enum "nn::nsd::DeleteMode".
+
This is "nn::nsd::DeleteMode".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 682: Line 733:     
= ImportMode =
 
= ImportMode =
This is s32 enum "nn::nsd::ImportMode".
+
This is "nn::nsd::ImportMode".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"