libctru
v2.4.1
|
SOC service for sockets communications. More...
#include <netinet/in.h>
#include <sys/socket.h>
Go to the source code of this file.
Data Structures | |
struct | SOCU_ARPTableEntry |
One entry of the ARP table retrieved by using SOCU_GetNetworkOpt and NETOPT_ARP_TABLE. More... | |
struct | SOCU_IPInfo |
Structure returned by SOCU_GetNetworkOpt when using NETOPT_IP_INFO. More... | |
struct | SOCU_RoutingTableEntry |
One entry of the routing table retrieved by using SOCU_GetNetworkOpt and NETOPT_ROUTING_TABLE. More... | |
struct | SOCU_UDPTableEntry |
One entry of the UDP sockets table retrieved by using SOCU_GetNetworkOpt and NETOPT_UDP_TABLE. More... | |
struct | SOCU_TCPTableEntry |
One entry of the TCP sockets table retrieved by using SOCU_GetNetworkOpt and NETOPT_TCP_TABLE. More... | |
struct | SOCU_DNSTableEntry |
One entry of the DNS servers table retrieved by using SOCU_GetNetworkOpt and NETOPT_DNS_TABLE. More... | |
Macros | |
#define | SOL_CONFIG 0xfffe |
The config level to be used with SOCU_GetNetworkOpt. | |
#define | ROUTING_FLAG_G 0x01 |
The route uses a gateway. | |
TCP states | |
#define | TCP_STATE_CLOSED 1 |
#define | TCP_STATE_LISTEN 2 |
#define | TCP_STATE_ESTABLISHED 5 |
#define | TCP_STATE_FINWAIT1 6 |
#define | TCP_STATE_FINWAIT2 7 |
#define | TCP_STATE_CLOSE_WAIT 8 |
#define | TCP_STATE_LAST_ACK 9 |
#define | TCP_STATE_TIME_WAIT 11 |
Enumerations | |
enum | NetworkOpt { NETOPT_MAC_ADDRESS = 0x1004 , NETOPT_ARP_TABLE = 0x3002 , NETOPT_IP_INFO = 0x4003 , NETOPT_IP_MTU = 0x4004 , NETOPT_ROUTING_TABLE = 0x4006 , NETOPT_UDP_NUMBER = 0x8002 , NETOPT_UDP_TABLE = 0x8003 , NETOPT_TCP_NUMBER = 0x9002 , NETOPT_TCP_TABLE = 0x9003 , NETOPT_DNS_TABLE = 0xB003 , NETOPT_DHCP_LEASE_TIME = 0xC001 } |
Options to be used with SOCU_GetNetworkOpt. More... | |
Functions | |
Result | socInit (u32 *context_addr, u32 context_size) |
Initializes the SOC service. More... | |
Result | socExit (void) |
Closes the soc service. More... | |
long | gethostid (void) |
Gets the system's host ID. More... | |
int | gethostname (char *name, size_t namelen) |
int | SOCU_ShutdownSockets (void) |
int | SOCU_CloseSockets (void) |
int | SOCU_GetNetworkOpt (int level, NetworkOpt optname, void *optval, socklen_t *optlen) |
Retrieves information from the network configuration. More... | |
int | SOCU_GetIPInfo (struct in_addr *ip, struct in_addr *netmask, struct in_addr *broadcast) |
Gets the system's IP address, netmask, and subnet broadcast. More... | |
int | SOCU_AddGlobalSocket (int sockfd) |
Adds a global socket. More... | |
SOC service for sockets communications.
After initializing this service you will be able to use system calls from netdb.h, sys/socket.h etc.
enum NetworkOpt |
Options to be used with SOCU_GetNetworkOpt.
Enumerator | |
---|---|
NETOPT_MAC_ADDRESS | The mac address of the interface (u32 mac[6]) |
NETOPT_ARP_TABLE | The ARP table.
|
NETOPT_IP_INFO | The current IP setup.
|
NETOPT_IP_MTU | The value of the IP MTU (u32) |
NETOPT_ROUTING_TABLE | The routing table.
|
NETOPT_UDP_NUMBER | The number of sockets in the UDP table (u32) |
NETOPT_UDP_TABLE | The table of opened UDP sockets.
|
NETOPT_TCP_NUMBER | The number of sockets in the TCP table (u32) |
NETOPT_TCP_TABLE | The table of opened TCP sockets.
|
NETOPT_DNS_TABLE | The table of the DNS servers.
|
NETOPT_DHCP_LEASE_TIME | The DHCP lease time remaining, in seconds. |
long gethostid | ( | void | ) |
Result socExit | ( | void | ) |
Closes the soc service.
Initializes the SOC service.
context_addr | Address of a page-aligned (0x1000) buffer to be used. |
context_size | Size of the buffer, a multiple of 0x1000. |
int SOCU_AddGlobalSocket | ( | int | sockfd | ) |
Adds a global socket.
sockfd | The socket fd. |
Gets the system's IP address, netmask, and subnet broadcast.
int SOCU_GetNetworkOpt | ( | int | level, |
NetworkOpt | optname, | ||
void * | optval, | ||
socklen_t * | optlen | ||
) |
Retrieves information from the network configuration.
Similar to getsockopt().
level | Only value allowed seems to be SOL_CONFIG |
optname | The option to be retrieved |
optval | Will contain the output of the command |
optlen | Size of the optval buffer, will be updated to hold the size of the output |