/dev/socket

From WiiUBrew
Jump to navigation Jump to search

/dev/socket is the IOSU device node that implements the Berkeley sockets (BSD sockets) API. Its functions are exposed to the Cafe OS userspace through nsysnet.rpl.

ioctl() interface

0x04 - connect()

This function is used to connect a socket to a remote host. Its input is a 24-byte buffer containing: the 32-bit socket descriptor, a 16-byte socket address structure (as defined here), and the 32-bit length of the structure (0x10 bytes). No output is produced by IOSU.

0x11 - socket()

This function is used to create a new socket. Its input is a 12-byte buffer containing 32-bit values for the domain, type, and protocol of the socket, as defined by Unix. No output is produced by IOSU, except for the socket descriptor, which is returned by IOS_Ioctl().

ioctlv() interface

0x0E - send()

This function is used to send data over a socket. It takes four buffers through the ioctlv interface: an 8-byte buffer, containing the socket descriptor and send() flags as 32-bit values, and up to 3 actual data buffers. The data addresses and lengths must be 0x40-byte aligned, and cannot be larger than 0x5C6 bytes, to meet the MTU of the network hardware.