RetroArch
Classes | Macros | Typedefs | Functions
network.h File Reference
#include <gctypes.h>
#include <sys/time.h>
#include <sys/types.h>
Include dependency graph for network.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  linger
 
struct  fd_set
 
struct  in_addr
 
struct  sockaddr_in
 
struct  sockaddr
 
struct  hostent
 
struct  pollsd
 

Macros

#define INVALID_SOCKET   (~0)
 
#define SOCKET_ERROR   (-1)
 
#define SOCK_STREAM   1
 
#define SOCK_DGRAM   2
 
#define SOCK_RAW   3
 
#define SO_DEBUG   0x0001 /* turn on debugging info recording */
 
#define SO_ACCEPTCONN   0x0002 /* socket has had listen() */
 
#define SO_REUSEADDR   0x0004 /* allow local address reuse */
 
#define SO_KEEPALIVE   0x0008 /* keep connections alive */
 
#define SO_DONTROUTE   0x0010 /* just use interface addresses */
 
#define SO_BROADCAST   0x0020 /* permit sending of broadcast msgs */
 
#define SO_USELOOPBACK   0x0040 /* bypass hardware when possible */
 
#define SO_LINGER   0x0080 /* linger on close if data present */
 
#define SO_OOBINLINE   0x0100 /* leave received OOB data in line */
 
#define SO_REUSEPORT   0x0200 /* allow local address & port reuse */
 
#define SO_DONTLINGER   (int)(~SO_LINGER)
 
#define SO_SNDBUF   0x1001 /* send buffer size */
 
#define SO_RCVBUF   0x1002 /* receive buffer size */
 
#define SO_SNDLOWAT   0x1003 /* send low-water mark */
 
#define SO_RCVLOWAT   0x1004 /* receive low-water mark */
 
#define SO_SNDTIMEO   0x1005 /* send timeout */
 
#define SO_RCVTIMEO   0x1006 /* receive timeout */
 
#define SO_ERROR   0x1007 /* get error status and clear */
 
#define SO_TYPE   0x1008 /* get socket type */
 
#define SOL_SOCKET   0xffff /* options for socket level */
 
#define AF_UNSPEC   0
 
#define AF_INET   2
 
#define PF_INET   AF_INET
 
#define PF_UNSPEC   AF_UNSPEC
 
#define IPPROTO_IP   0
 
#define IPPROTO_TCP   6
 
#define IPPROTO_UDP   17
 
#define INADDR_ANY   0
 
#define INADDR_BROADCAST   0xffffffff
 
#define MSG_DONTWAIT   0x40 /* Nonblocking i/o for this operation only */
 
#define IP_TOS   1
 
#define IP_TTL   2
 
#define IPTOS_TOS_MASK   0x1E
 
#define IPTOS_TOS(tos)   ((tos) & IPTOS_TOS_MASK)
 
#define IPTOS_LOWDELAY   0x10
 
#define IPTOS_THROUGHPUT   0x08
 
#define IPTOS_RELIABILITY   0x04
 
#define IPTOS_LOWCOST   0x02
 
#define IPTOS_MINCOST   IPTOS_LOWCOST
 
#define IPTOS_PREC_MASK   0xe0
 
#define IPTOS_PREC(tos)   ((tos) & IPTOS_PREC_MASK)
 
#define IPTOS_PREC_NETCONTROL   0xe0
 
#define IPTOS_PREC_INTERNETCONTROL   0xc0
 
#define IPTOS_PREC_CRITIC_ECP   0xa0
 
#define IPTOS_PREC_FLASHOVERRIDE   0x80
 
#define IPTOS_PREC_FLASH   0x60
 
#define IPTOS_PREC_IMMEDIATE   0x40
 
#define IPTOS_PREC_PRIORITY   0x20
 
#define IPTOS_PREC_ROUTINE   0x00
 
#define IOCPARM_MASK   0x7f /* parameters must be < 128 bytes */
 
#define IOC_VOID   0x20000000 /* no parameters */
 
#define IOC_OUT   0x40000000 /* copy out parameters */
 
#define IOC_IN   0x80000000 /* copy in parameters */
 
#define IOC_INOUT   (IOC_IN|IOC_OUT)
 
#define _IO(x, y)   (IOC_VOID|((x)<<8)|(y))
 
#define _IOR(x, y, t)   (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
 
#define _IOW(x, y, t)   (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
 
#define FIONREAD   _IOR('f', 127, unsigned long) /* get # bytes to read */
 
#define FIONBIO   _IOW('f', 126, unsigned long) /* set/clear non-blocking i/o */
 
#define SIOCSHIWAT   _IOW('s', 0, unsigned long) /* set high watermark */
 
#define SIOCGHIWAT   _IOR('s', 1, unsigned long) /* get high watermark */
 
#define SIOCSLOWAT   _IOW('s', 2, unsigned long) /* set low watermark */
 
#define SIOCGLOWAT   _IOR('s', 3, unsigned long) /* get low watermark */
 
#define SIOCATMARK   _IOR('s', 7, unsigned long) /* at oob mark? */
 
#define O_NONBLOCK   04000U
 
#define FD_SETSIZE   16
 
#define FD_SET(n, p)   ((p)->fd_bits[(n)/8] |= (1 << ((n) & 7)))
 
#define FD_CLR(n, p)   ((p)->fd_bits[(n)/8] &= ~(1 << ((n) & 7)))
 
#define FD_ISSET(n, p)   ((p)->fd_bits[(n)/8] & (1 << ((n) & 7)))
 
#define FD_ZERO(p)   memset((void*)(p),0,sizeof(*(p)))
 
#define TCP_NODELAY   0x01 /* don't delay send to coalesce packets */
 
#define TCP_KEEPALIVE   0x02 /* send KEEPALIVE probes when idle for pcb->keepalive miliseconds */
 
#define socklen_t   u32
 
#define htons(x)   (x)
 
#define ntohs(x)   (x)
 
#define htonl(x)   (x)
 
#define ntohl(x)   (x)
 
#define h_addr   h_addr_list[0]
 
#define IP4_ADDR(ipaddr, a, b, c, d)   (ipaddr)->s_addr = htonl(((u32)(a&0xff)<<24)|((u32)(b&0xff)<<16)|((u32)(c&0xff)<<8)|(u32)(d&0xff))
 
#define ip4_addr1(ipaddr)   ((u32)(ntohl((ipaddr)->s_addr) >> 24) & 0xff)
 
#define ip4_addr2(ipaddr)   ((u32)(ntohl((ipaddr)->s_addr) >> 16) & 0xff)
 
#define ip4_addr3(ipaddr)   ((u32)(ntohl((ipaddr)->s_addr) >> 8) & 0xff)
 
#define ip4_addr4(ipaddr)   ((u32)(ntohl((ipaddr)->s_addr)) & 0xff)
 
#define POLLIN   0x0001
 
#define POLLPRI   0x0002
 
#define POLLOUT   0x0004
 
#define POLLERR   0x0008
 
#define POLLHUP   0x0010
 
#define POLLNVAL   0x0020
 
#define HAVE_IN_ADDR
 

Typedefs

typedef struct fd_set fd_set
 

Functions

u32 inet_addr (const char *cp)
 
s8 inet_aton (const char *cp, struct in_addr *addr)
 
char * inet_ntoa (struct in_addr addr)
 
s32 if_config (char *local_ip, char *netmask, char *gateway, bool use_dhcp, int max_retries)
 
s32 if_configex (struct in_addr *local_ip, struct in_addr *netmask, struct in_addr *gateway, bool use_dhcp, int max_retries)
 
s32 net_init ()
 
void net_deinit ()
 
u32 net_gethostip ()
 
s32 net_socket (u32 domain, u32 type, u32 protocol)
 
s32 net_bind (s32 s, struct sockaddr *name, socklen_t namelen)
 
s32 net_listen (s32 s, u32 backlog)
 
s32 net_accept (s32 s, struct sockaddr *addr, socklen_t *addrlen)
 
s32 net_connect (s32 s, struct sockaddr *, socklen_t)
 
s32 net_write (s32 s, const void *data, s32 size)
 
s32 net_send (s32 s, const void *data, s32 size, u32 flags)
 
s32 net_sendto (s32 s, const void *data, s32 len, u32 flags, struct sockaddr *to, socklen_t tolen)
 
s32 net_recv (s32 s, void *mem, s32 len, u32 flags)
 
s32 net_recvfrom (s32 s, void *mem, s32 len, u32 flags, struct sockaddr *from, socklen_t *fromlen)
 
s32 net_read (s32 s, void *mem, s32 len)
 
s32 net_close (s32 s)
 
s32 net_select (s32 maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, struct timeval *timeout)
 
s32 net_setsockopt (s32 s, u32 level, u32 optname, const void *optval, socklen_t optlen)
 
s32 net_ioctl (s32 s, u32 cmd, void *argp)
 
s32 net_fcntl (s32 s, u32 cmd, u32 flags)
 
s32 net_poll (struct pollsd *sds, s32 nsds, s32 timeout)
 
s32 net_shutdown (s32 s, u32 how)
 
struct hostentnet_gethostbyname (const char *addrString)
 

Macro Definition Documentation

◆ _IO

#define _IO (   x,
  y 
)    (IOC_VOID|((x)<<8)|(y))

◆ _IOR

#define _IOR (   x,
  y,
  t 
)    (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))

◆ _IOW

#define _IOW (   x,
  y,
  t 
)    (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))

◆ AF_INET

#define AF_INET   2

◆ AF_UNSPEC

#define AF_UNSPEC   0

◆ FD_CLR

#define FD_CLR (   n,
  p 
)    ((p)->fd_bits[(n)/8] &= ~(1 << ((n) & 7)))

◆ FD_ISSET

#define FD_ISSET (   n,
  p 
)    ((p)->fd_bits[(n)/8] & (1 << ((n) & 7)))

◆ FD_SET

#define FD_SET (   n,
  p 
)    ((p)->fd_bits[(n)/8] |= (1 << ((n) & 7)))

◆ FD_SETSIZE

#define FD_SETSIZE   16

◆ FD_ZERO

#define FD_ZERO (   p)    memset((void*)(p),0,sizeof(*(p)))

◆ FIONBIO

#define FIONBIO   _IOW('f', 126, unsigned long) /* set/clear non-blocking i/o */

◆ FIONREAD

#define FIONREAD   _IOR('f', 127, unsigned long) /* get # bytes to read */

◆ h_addr

#define h_addr   h_addr_list[0]

◆ HAVE_IN_ADDR

#define HAVE_IN_ADDR

◆ htonl

#define htonl (   x)    (x)

◆ htons

#define htons (   x)    (x)

◆ INADDR_ANY

#define INADDR_ANY   0

◆ INADDR_BROADCAST

#define INADDR_BROADCAST   0xffffffff

◆ INVALID_SOCKET

#define INVALID_SOCKET   (~0)

◆ IOC_IN

#define IOC_IN   0x80000000 /* copy in parameters */

◆ IOC_INOUT

#define IOC_INOUT   (IOC_IN|IOC_OUT)

◆ IOC_OUT

#define IOC_OUT   0x40000000 /* copy out parameters */

◆ IOC_VOID

#define IOC_VOID   0x20000000 /* no parameters */

◆ IOCPARM_MASK

#define IOCPARM_MASK   0x7f /* parameters must be < 128 bytes */

◆ IP4_ADDR

#define IP4_ADDR (   ipaddr,
  a,
  b,
  c,
 
)    (ipaddr)->s_addr = htonl(((u32)(a&0xff)<<24)|((u32)(b&0xff)<<16)|((u32)(c&0xff)<<8)|(u32)(d&0xff))

◆ ip4_addr1

#define ip4_addr1 (   ipaddr)    ((u32)(ntohl((ipaddr)->s_addr) >> 24) & 0xff)

◆ ip4_addr2

#define ip4_addr2 (   ipaddr)    ((u32)(ntohl((ipaddr)->s_addr) >> 16) & 0xff)

◆ ip4_addr3

#define ip4_addr3 (   ipaddr)    ((u32)(ntohl((ipaddr)->s_addr) >> 8) & 0xff)

◆ ip4_addr4

#define ip4_addr4 (   ipaddr)    ((u32)(ntohl((ipaddr)->s_addr)) & 0xff)

◆ IP_TOS

#define IP_TOS   1

◆ IP_TTL

#define IP_TTL   2

◆ IPPROTO_IP

#define IPPROTO_IP   0

◆ IPPROTO_TCP

#define IPPROTO_TCP   6

◆ IPPROTO_UDP

#define IPPROTO_UDP   17

◆ IPTOS_LOWCOST

#define IPTOS_LOWCOST   0x02

◆ IPTOS_LOWDELAY

#define IPTOS_LOWDELAY   0x10

◆ IPTOS_MINCOST

#define IPTOS_MINCOST   IPTOS_LOWCOST

◆ IPTOS_PREC

#define IPTOS_PREC (   tos)    ((tos) & IPTOS_PREC_MASK)

◆ IPTOS_PREC_CRITIC_ECP

#define IPTOS_PREC_CRITIC_ECP   0xa0

◆ IPTOS_PREC_FLASH

#define IPTOS_PREC_FLASH   0x60

◆ IPTOS_PREC_FLASHOVERRIDE

#define IPTOS_PREC_FLASHOVERRIDE   0x80

◆ IPTOS_PREC_IMMEDIATE

#define IPTOS_PREC_IMMEDIATE   0x40

◆ IPTOS_PREC_INTERNETCONTROL

#define IPTOS_PREC_INTERNETCONTROL   0xc0

◆ IPTOS_PREC_MASK

#define IPTOS_PREC_MASK   0xe0

◆ IPTOS_PREC_NETCONTROL

#define IPTOS_PREC_NETCONTROL   0xe0

◆ IPTOS_PREC_PRIORITY

#define IPTOS_PREC_PRIORITY   0x20

◆ IPTOS_PREC_ROUTINE

#define IPTOS_PREC_ROUTINE   0x00

◆ IPTOS_RELIABILITY

#define IPTOS_RELIABILITY   0x04

◆ IPTOS_THROUGHPUT

#define IPTOS_THROUGHPUT   0x08

◆ IPTOS_TOS

#define IPTOS_TOS (   tos)    ((tos) & IPTOS_TOS_MASK)

◆ IPTOS_TOS_MASK

#define IPTOS_TOS_MASK   0x1E

◆ MSG_DONTWAIT

#define MSG_DONTWAIT   0x40 /* Nonblocking i/o for this operation only */

◆ ntohl

#define ntohl (   x)    (x)

◆ ntohs

#define ntohs (   x)    (x)

◆ O_NONBLOCK

#define O_NONBLOCK   04000U

◆ PF_INET

#define PF_INET   AF_INET

◆ PF_UNSPEC

#define PF_UNSPEC   AF_UNSPEC

◆ POLLERR

#define POLLERR   0x0008

◆ POLLHUP

#define POLLHUP   0x0010

◆ POLLIN

#define POLLIN   0x0001

◆ POLLNVAL

#define POLLNVAL   0x0020

◆ POLLOUT

#define POLLOUT   0x0004

◆ POLLPRI

#define POLLPRI   0x0002

◆ SIOCATMARK

#define SIOCATMARK   _IOR('s', 7, unsigned long) /* at oob mark? */

◆ SIOCGHIWAT

#define SIOCGHIWAT   _IOR('s', 1, unsigned long) /* get high watermark */

◆ SIOCGLOWAT

#define SIOCGLOWAT   _IOR('s', 3, unsigned long) /* get low watermark */

◆ SIOCSHIWAT

#define SIOCSHIWAT   _IOW('s', 0, unsigned long) /* set high watermark */

◆ SIOCSLOWAT

#define SIOCSLOWAT   _IOW('s', 2, unsigned long) /* set low watermark */

◆ SO_ACCEPTCONN

#define SO_ACCEPTCONN   0x0002 /* socket has had listen() */

◆ SO_BROADCAST

#define SO_BROADCAST   0x0020 /* permit sending of broadcast msgs */

◆ SO_DEBUG

#define SO_DEBUG   0x0001 /* turn on debugging info recording */

◆ SO_DONTLINGER

#define SO_DONTLINGER   (int)(~SO_LINGER)

◆ SO_DONTROUTE

#define SO_DONTROUTE   0x0010 /* just use interface addresses */

◆ SO_ERROR

#define SO_ERROR   0x1007 /* get error status and clear */

◆ SO_KEEPALIVE

#define SO_KEEPALIVE   0x0008 /* keep connections alive */

◆ SO_LINGER

#define SO_LINGER   0x0080 /* linger on close if data present */

◆ SO_OOBINLINE

#define SO_OOBINLINE   0x0100 /* leave received OOB data in line */

◆ SO_RCVBUF

#define SO_RCVBUF   0x1002 /* receive buffer size */

◆ SO_RCVLOWAT

#define SO_RCVLOWAT   0x1004 /* receive low-water mark */

◆ SO_RCVTIMEO

#define SO_RCVTIMEO   0x1006 /* receive timeout */

◆ SO_REUSEADDR

#define SO_REUSEADDR   0x0004 /* allow local address reuse */

◆ SO_REUSEPORT

#define SO_REUSEPORT   0x0200 /* allow local address & port reuse */

◆ SO_SNDBUF

#define SO_SNDBUF   0x1001 /* send buffer size */

◆ SO_SNDLOWAT

#define SO_SNDLOWAT   0x1003 /* send low-water mark */

◆ SO_SNDTIMEO

#define SO_SNDTIMEO   0x1005 /* send timeout */

◆ SO_TYPE

#define SO_TYPE   0x1008 /* get socket type */

◆ SO_USELOOPBACK

#define SO_USELOOPBACK   0x0040 /* bypass hardware when possible */

◆ SOCK_DGRAM

#define SOCK_DGRAM   2

◆ SOCK_RAW

#define SOCK_RAW   3

◆ SOCK_STREAM

#define SOCK_STREAM   1

◆ SOCKET_ERROR

#define SOCKET_ERROR   (-1)

◆ socklen_t

#define socklen_t   u32

◆ SOL_SOCKET

#define SOL_SOCKET   0xffff /* options for socket level */

◆ TCP_KEEPALIVE

#define TCP_KEEPALIVE   0x02 /* send KEEPALIVE probes when idle for pcb->keepalive miliseconds */

◆ TCP_NODELAY

#define TCP_NODELAY   0x01 /* don't delay send to coalesce packets */

Typedef Documentation

◆ fd_set

typedef struct fd_set fd_set

Function Documentation

◆ if_config()

s32 if_config ( char *  local_ip,
char *  netmask,
char *  gateway,
bool  use_dhcp,
int  max_retries 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ if_configex()

s32 if_configex ( struct in_addr local_ip,
struct in_addr netmask,
struct in_addr gateway,
bool  use_dhcp,
int  max_retries 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ inet_addr()

u32 inet_addr ( const char *  cp)
Here is the call graph for this function:

◆ inet_aton()

s8 inet_aton ( const char *  cp,
struct in_addr addr 
)

◆ inet_ntoa()

char* inet_ntoa ( struct in_addr  addr)

◆ net_accept()

s32 net_accept ( s32  s,
struct sockaddr addr,
socklen_t addrlen 
)
Here is the call graph for this function:

◆ net_bind()

s32 net_bind ( s32  s,
struct sockaddr name,
socklen_t  namelen 
)
Here is the call graph for this function:

◆ net_close()

s32 net_close ( s32  s)
Here is the call graph for this function:

◆ net_connect()

s32 net_connect ( s32  s,
struct sockaddr ,
socklen_t   
)
Here is the call graph for this function:

◆ net_deinit()

void net_deinit ( )
Here is the caller graph for this function:

◆ net_fcntl()

s32 net_fcntl ( s32  s,
u32  cmd,
u32  flags 
)

◆ net_gethostbyname()

struct hostent* net_gethostbyname ( const char *  addrString)

◆ net_gethostip()

u32 net_gethostip ( )

◆ net_init()

s32 net_init ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_ioctl()

s32 net_ioctl ( s32  s,
u32  cmd,
void argp 
)
Here is the call graph for this function:

◆ net_listen()

s32 net_listen ( s32  s,
u32  backlog 
)
Here is the call graph for this function:

◆ net_poll()

s32 net_poll ( struct pollsd sds,
s32  nsds,
s32  timeout 
)

◆ net_read()

s32 net_read ( s32  s,
void mem,
s32  len 
)
Here is the call graph for this function:

◆ net_recv()

s32 net_recv ( s32  s,
void mem,
s32  len,
u32  flags 
)
Here is the call graph for this function:

◆ net_recvfrom()

s32 net_recvfrom ( s32  s,
void mem,
s32  len,
u32  flags,
struct sockaddr from,
socklen_t fromlen 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_select()

s32 net_select ( s32  maxfdp1,
fd_set readset,
fd_set writeset,
fd_set exceptset,
struct timeval timeout 
)
Here is the call graph for this function:

◆ net_send()

s32 net_send ( s32  s,
const void data,
s32  size,
u32  flags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ net_sendto()

s32 net_sendto ( s32  s,
const void data,
s32  len,
u32  flags,
struct sockaddr to,
socklen_t  tolen 
)
Here is the call graph for this function:

◆ net_setsockopt()

s32 net_setsockopt ( s32  s,
u32  level,
u32  optname,
const void optval,
socklen_t  optlen 
)
Here is the call graph for this function:

◆ net_shutdown()

s32 net_shutdown ( s32  s,
u32  how 
)

◆ net_socket()

s32 net_socket ( u32  domain,
u32  type,
u32  protocol 
)
Here is the call graph for this function:

◆ net_write()

s32 net_write ( s32  s,
const void data,
s32  size 
)
Here is the call graph for this function: