Difference between revisions of "Socket"

From WiiBrew
Jump to: navigation, search
(made the table in the style of the others on here)
(Socket Ioctls: 0x4003)
 
(27 intermediate revisions by 12 users not shown)
Line 3: Line 3:
 
Fill me in!
 
Fill me in!
  
{| style="border-collapse: collapse; padding: 0.2em 0.2em 0.2em 0.2em;"
+
[[/Progress|Function Progress]]
|- style="background-color: #ddd;"
+
 
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #cdc;" | '''Request number'''
+
{| class="wikitable"
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ccd;" | '''Name'''
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ccc;" | '''input'''
+
! Request Number
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | '''output'''
+
! Name  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dcc;" | '''notes'''
+
! Input
|- style="background-color: #ddd;"
+
! Output
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x1
+
! Notes
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOAccept
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 4 bytes?
+
| 0x1  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | 0
+
| SOAccept  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | secret
+
| 4 bytes?  
|- style="background-color: #ddd;"
+
| 0  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x2
+
| secret  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOBind
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 0x24 bytes?
+
| 0x2  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | 0
+
| SOBind  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| (int socket, struct sockaddr_in *address)
|- style="background-color: #ddd;"
+
| 0  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x3
+
|
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOClose
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 4 bytes?
+
| 0x3  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOClose  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| 4 bytes?  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x4
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOConnect
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 0x24 bytes?
+
| 0x4  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | 0
+
| SOConnect  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| (int socket, struct sockaddr_in *address)
|- style="background-color: #ddd;"
+
| 0  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x5
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOFcntl
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x5
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOFcntl
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
|  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x7
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOGetSockName
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x6
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOGetPeerName
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
|  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x8
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOGetSockOpt
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 0
+
| 0x7  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | 0x18 bytes
+
| SOGetSockName  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
|  
|- style="background-color: #ddd;"
+
|
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x9
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOSetSockOpt
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 0x24 bytes?
+
| 0x8  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | 0
+
| SOGetSockOpt  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| 0  
|- style="background-color: #ddd;"
+
| 0x18 bytes  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0xA
+
|
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOListen
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 8 bytes?
+
| 0x9  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOSetSockOpt  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | secret
+
| 0x24 bytes?  
|- style="background-color: #ddd;"
+
| 0  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0xB
+
|
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOPoll
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0xA  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOListen  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| (s32 socket, s32 backlog)
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0xC
+
| secret  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SORead / SORecvFrom / SORecv
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | (vector) ?
+
| 0xB  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOPoll  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
|
|- style="background-color: #ddd;"
+
|
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0xD
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOSend / SOSendTo
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | (vector) ?
+
| 0xC  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SORecvFrom  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| (int socket, char * message, int msg_len, int flags)  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0xE
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOShutdown
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 8 bytes?
+
| 0xD  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOSendTo  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| (int socket, char * message, int msg_len, int flags)  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0xF
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | __SOCreateSocket
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 0xC bytes?
+
| 0xE  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | 0
+
| SOShutdown  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| 8 bytes?  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x10
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOGetHostId
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | none
+
| 0xF  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | none
+
| SOSocket
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | probably returns 32-bit numeric IP
+
| 0xC bytes (int domain, int type, int protocol)
|- style="background-color: #ddd;"
+
| 0  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x11
+
|
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOGetHostByName
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x10  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOGetHostId  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| none  
|- style="background-color: #ddd;"
+
| none  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x15
+
| returns 32-bit numeric IP  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOInetAtoN
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | hostname (null-terminated string)
+
| 0x11
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | 4 bytes
+
| SOGetHostByName
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | does DNS lookup
+
| (char *hostname)
|- style="background-color: #ddd;"
+
| hostent
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x16
+
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOInetPtoN
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x12
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOGetHostByAddr
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
|  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x17?
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOInetNtoP
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x13
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOGetNameInfo
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | secret
+
| (vector) ?  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x18
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOGetAddrInfo
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | (vector) ?
+
| 0x15  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOInetAtoN  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
| IPv4 address (string)  
|- style="background-color: #ddd;"
+
| IPv4 address (4 bytes)
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x1C
+
| inet_aton()
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOGetInterfaceOpt
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | (vector) ?
+
| 0x16  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOInetPtoN  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
|  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x1D
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOSetInterfaceOpt
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | (vector) ?
+
| 0x17  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOInetNtoP  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?
+
|  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | ?
+
| secret  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOSockAtMark
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x18  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOGetAddrInfo  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | secret
+
| (vector) ?  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | ?
+
|
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | SOSetInterface
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x19
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOSockAtMark
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | secret
+
|  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | ?
+
| secret
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ICMPSocket
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x1C  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOGetInterfaceOpt  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | secret
+
| (vector 1 in 2 out) 8 bytes (u32 level, u32 optname)
|- style="background-color: #ddd;"
+
| optval, sizeof(optval)
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | ?
+
| see below for options
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ICMPPing
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x1D  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOSetInterfaceOpt  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | secret
+
| (vector) ?  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | ?
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ICMPCancel
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x1E
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOSetInterface
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | secret
+
|  
|- style="background-color: #ddd;"
+
|  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | ?
+
| secret  
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ICMPClose
+
|-
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ?
+
| 0x1F
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #fe9;" | ?
+
| SOStartup
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | secret
+
| 0  
 +
| 0  
 +
|
 +
|-
 +
| 0x30
 +
| ICMPSocket  
 +
| int domain
 +
|  
 +
| returns new socket
 +
|-
 +
| 0x31
 +
| ICMPEcho
 +
| (vector 2 in 0 out) struct {int socket, u32 has_addr, u64 timeout, struct sockaddr_in addr}, u8 echodata[]
 +
|  
 +
| echodata is optional/[http://en.wikipedia.org/wiki/Ping#ICMP_packet size limited by MTU]
 +
|-
 +
| 0x32
 +
| ICMPCancel  
 +
| int socket
 +
|  
 +
| Cancels an outstanding echo request
 +
|-
 +
| 0x33
 +
| ICMPClose  
 +
| int socket
 +
|  
 +
|  
 
|}
 
|}
 +
 +
=== GetInterfaceOpt ===
 +
SOGetInterfaceOpt works like SOGetSockOpt, except level is always 0xFFFE. The following is a list of possible values for optname and the appropriate matching optval sizes:
 +
{| class="wikitable"
 +
|-
 +
! Value
 +
! Size
 +
! Description
 +
! Typical Hex Value (for IOS58)
 +
|-
 +
| 0x1001
 +
| 4
 +
| internal function pointer
 +
| 13B59089
 +
|-
 +
| 0x1002
 +
| 4
 +
| internal function pointer
 +
| 13B59089
 +
|-
 +
| 0x1003
 +
| 4
 +
|
 +
| 00000000
 +
|-
 +
| 0x1004
 +
| 6
 +
| active interface MAC address
 +
| 000DC38A 3410
 +
|-
 +
| 0x1005
 +
| 4
 +
|
 +
| 00000001
 +
|-
 +
| 0x1006
 +
| 56
 +
| global packet/byte counters?
 +
| 00000000 00019B96 00000055 00000003 00000000 00000000 00000000 00000058 00000000 0000180B 00000007 00..
 +
|-
 +
| 0x1007
 +
| 4
 +
|
 +
| 00000000
 +
|-
 +
| 0x2001
 +
| 4
 +
|
 +
| 0000000A
 +
|-
 +
| 0x2002
 +
| 4
 +
|
 +
| 00000002
 +
|-
 +
| 0x2003
 +
| 4
 +
|
 +
| 00000005
 +
|-
 +
| 0x2004
 +
| 4
 +
|
 +
| 00000003
 +
|-
 +
| 0x2005
 +
| 256 bytes max
 +
|
 +
| zeroes
 +
|-
 +
| 0x3001
 +
| 4
 +
| hardcoded value
 +
| 00000010
 +
|-
 +
| 0x3002
 +
| multiple of 16
 +
| arp cache
 +
| struct {u32 ?, u32 ip, u8 mac[6], u8 pad[2]}[]
 +
|-
 +
| 0x4001
 +
| 64
 +
|
 +
| 00000057 00000000 00000000 00000000 00000000 00000057 0000005A 00000000 00..
 +
|-
 +
| 0x4002
 +
| 4
 +
| hardcoded value
 +
| 00000002
 +
|-
 +
| 0x4003
 +
| any
 +
| ip settings
 +
| If size >= 12 bytes, returns {u32 ip, u32 netmask, u32 subnet_broadcast}
 +
 +
followed by { u32 x0; u32 x4; u16 x8; u16 xa; } if size >= 24 bytes {{check}}
 +
 +
Writes 0, 12 or 24 to the size parameter depending on the amount of information returned.
 +
 +
|-
 +
| 0x4004
 +
| 4
 +
| MTU?
 +
| 000005DC
 +
|-
 +
| 0x4005
 +
| 4
 +
| hardcoded value
 +
| 00000020
 +
|-
 +
| 0x4006
 +
| multiple of 24
 +
| routing table
 +
| struct {u32 dest_ip, u32 netmask, u32 gw, u32 flags, u64 tick?}[]
 +
|-
 +
| 0x4009
 +
| 4
 +
|
 +
| 00000000
 +
|-
 +
| 0x5001
 +
| 104
 +
| ICMP stats?
 +
| zeroes
 +
|-
 +
| 0x6001
 +
| 72
 +
| IPV6 stats?
 +
| zeroes
 +
|-
 +
| 0x6002
 +
| 4
 +
|
 +
| 00000000
 +
|-
 +
| 0x6003
 +
| 4
 +
| harcoded value
 +
| 00000080
 +
|-
 +
| 0x6004
 +
|
 +
|
 +
|
 +
|-
 +
| 0x6009
 +
| 4
 +
|
 +
|
 +
|-
 +
| 0x600A
 +
| 4
 +
| hardcoded value
 +
| 00000080
 +
|-
 +
| 0x600B
 +
|
 +
|
 +
|
 +
|-
 +
| 0x600C
 +
| 4
 +
| hardcoded value
 +
| 00000080
 +
|-
 +
| 0x600D
 +
|
 +
|
 +
|
 +
|-
 +
| 0x600E
 +
|
 +
|
 +
| 00000080
 +
|-
 +
| 0x600F
 +
|
 +
|
 +
|
 +
|-
 +
| 0x6010
 +
|
 +
|
 +
| 00000080
 +
|-
 +
| 0x6011
 +
|
 +
|
 +
|
 +
|-
 +
| 0x7001
 +
| 136
 +
|
 +
| zeroes
 +
|-
 +
| 0x8001
 +
| 16
 +
|
 +
| 00000005 00000000 00000002 00000000
 +
|-
 +
| 0x8002
 +
| 4
 +
| active UDP sockets?
 +
| 00000003
 +
|-
 +
| 0x8003
 +
| multiple of 16
 +
| open UDP sockets?
 +
| struct {u8 localsize (8), u8 localfamily (2), u16 localport, u32 localip, u8 remotesize(8), u8 remotefamily(2), u16 remoteport, u32 remoteip}[]
 +
|-
 +
| 0x8004
 +
| 4
 +
|
 +
| 00000000
 +
|-
 +
| 0x8005
 +
|
 +
|
 +
|
 +
|-
 +
| 0x9001
 +
| 40
 +
|
 +
| 00000002 00000001 00000000 00000002 00000000 00000050 00000007 00000000 00000000 00000003
 +
|-
 +
| 0x9002
 +
| 4
 +
| active TCP sockets?
 +
| 00000001
 +
|-
 +
| 0x9003
 +
| multiple of 20
 +
| TCP sockets
 +
| struct {u32 state, u8 localsize (8), u8 localfamily (2), u16 localport, u32 localip, u8 remotesize(8), u8 remotefamily(2), u16 remoteport, u32 remoteip}[]
 +
|-
 +
| 0x9004
 +
| 4
 +
|
 +
| 00000000
 +
|-
 +
| 0x9005
 +
|
 +
|
 +
|
 +
|-
 +
| 0x9006
 +
| 4
 +
|
 +
| 00000078
 +
|-
 +
| 0x9007
 +
| 4
 +
|
 +
| 000001F4
 +
|-
 +
| 0x9008
 +
| 4
 +
|
 +
| 000000F0
 +
|-
 +
| 0x9009
 +
| 4
 +
|
 +
| 00000003
 +
|-
 +
| 0xA001
 +
| 4
 +
|
 +
| 00000002
 +
|-
 +
| 0xB001
 +
| 256 bytes max
 +
|
 +
| zeroes
 +
|-
 +
| 0xB002
 +
| 4
 +
| hardcoded value
 +
| 00000002
 +
|-
 +
| 0xB003
 +
| multiple of 4
 +
| DNS Servers
 +
| u32 dns_ips[]
 +
|-
 +
| 0xC001
 +
| 4
 +
| DHCP lease time remaining?
 +
| 000029EF
 +
|}
 +
 +
[[Category:Hardware]]

Latest revision as of 16:57, 20 April 2018

Socket Ioctls

Fill me in!

Function Progress

Request Number Name Input Output Notes
0x1 SOAccept 4 bytes? 0 secret
0x2 SOBind (int socket, struct sockaddr_in *address) 0
0x3 SOClose 4 bytes?
0x4 SOConnect (int socket, struct sockaddr_in *address) 0
0x5 SOFcntl
0x6 SOGetPeerName
0x7 SOGetSockName
0x8 SOGetSockOpt 0 0x18 bytes
0x9 SOSetSockOpt 0x24 bytes? 0
0xA SOListen (s32 socket, s32 backlog) secret
0xB SOPoll
0xC SORecvFrom (int socket, char * message, int msg_len, int flags)
0xD SOSendTo (int socket, char * message, int msg_len, int flags)
0xE SOShutdown 8 bytes?
0xF SOSocket 0xC bytes (int domain, int type, int protocol) 0
0x10 SOGetHostId none none returns 32-bit numeric IP
0x11 SOGetHostByName (char *hostname) hostent
0x12 SOGetHostByAddr
0x13 SOGetNameInfo (vector) ?
0x15 SOInetAtoN IPv4 address (string) IPv4 address (4 bytes) inet_aton()
0x16 SOInetPtoN
0x17 SOInetNtoP secret
0x18 SOGetAddrInfo (vector) ?
0x19 SOSockAtMark secret
0x1C SOGetInterfaceOpt (vector 1 in 2 out) 8 bytes (u32 level, u32 optname) optval, sizeof(optval) see below for options
0x1D SOSetInterfaceOpt (vector) ?
0x1E SOSetInterface secret
0x1F SOStartup 0 0
0x30 ICMPSocket int domain returns new socket
0x31 ICMPEcho (vector 2 in 0 out) struct {int socket, u32 has_addr, u64 timeout, struct sockaddr_in addr}, u8 echodata[] echodata is optional/size limited by MTU
0x32 ICMPCancel int socket Cancels an outstanding echo request
0x33 ICMPClose int socket

GetInterfaceOpt

SOGetInterfaceOpt works like SOGetSockOpt, except level is always 0xFFFE. The following is a list of possible values for optname and the appropriate matching optval sizes:

Value Size Description Typical Hex Value (for IOS58)
0x1001 4 internal function pointer 13B59089
0x1002 4 internal function pointer 13B59089
0x1003 4 00000000
0x1004 6 active interface MAC address 000DC38A 3410
0x1005 4 00000001
0x1006 56 global packet/byte counters? 00000000 00019B96 00000055 00000003 00000000 00000000 00000000 00000058 00000000 0000180B 00000007 00..
0x1007 4 00000000
0x2001 4 0000000A
0x2002 4 00000002
0x2003 4 00000005
0x2004 4 00000003
0x2005 256 bytes max zeroes
0x3001 4 hardcoded value 00000010
0x3002 multiple of 16 arp cache struct {u32 ?, u32 ip, u8 mac[6], u8 pad[2]}[]
0x4001 64 00000057 00000000 00000000 00000000 00000000 00000057 0000005A 00000000 00..
0x4002 4 hardcoded value 00000002
0x4003 any ip settings If size >= 12 bytes, returns {u32 ip, u32 netmask, u32 subnet_broadcast}

followed by { u32 x0; u32 x4; u16 x8; u16 xa; } if size >= 24 bytes [check]

Writes 0, 12 or 24 to the size parameter depending on the amount of information returned.

0x4004 4 MTU? 000005DC
0x4005 4 hardcoded value 00000020
0x4006 multiple of 24 routing table struct {u32 dest_ip, u32 netmask, u32 gw, u32 flags, u64 tick?}[]
0x4009 4 00000000
0x5001 104 ICMP stats? zeroes
0x6001 72 IPV6 stats? zeroes
0x6002 4 00000000
0x6003 4 harcoded value 00000080
0x6004
0x6009 4
0x600A 4 hardcoded value 00000080
0x600B
0x600C 4 hardcoded value 00000080
0x600D
0x600E 00000080
0x600F
0x6010 00000080
0x6011
0x7001 136 zeroes
0x8001 16 00000005 00000000 00000002 00000000
0x8002 4 active UDP sockets? 00000003
0x8003 multiple of 16 open UDP sockets? struct {u8 localsize (8), u8 localfamily (2), u16 localport, u32 localip, u8 remotesize(8), u8 remotefamily(2), u16 remoteport, u32 remoteip}[]
0x8004 4 00000000
0x8005
0x9001 40 00000002 00000001 00000000 00000002 00000000 00000050 00000007 00000000 00000000 00000003
0x9002 4 active TCP sockets? 00000001
0x9003 multiple of 20 TCP sockets struct {u32 state, u8 localsize (8), u8 localfamily (2), u16 localport, u32 localip, u8 remotesize(8), u8 remotefamily(2), u16 remoteport, u32 remoteip}[]
0x9004 4 00000000
0x9005
0x9006 4 00000078
0x9007 4 000001F4
0x9008 4 000000F0
0x9009 4 00000003
0xA001 4 00000002
0xB001 256 bytes max zeroes
0xB002 4 hardcoded value 00000002
0xB003 multiple of 4 DNS Servers u32 dns_ips[]
0xC001 4 DHCP lease time remaining? 000029EF