lwIP  2.1.0
Lightweight IP stack
sockets.h File Reference
#include "lwip/opt.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/err.h"
#include "lwip/inet.h"
#include "lwip/errno.h"
#include <string.h>

Macros

#define LWIP_TIMEVAL_PRIVATE   1
 
#define accept(s, addr, addrlen)   lwip_accept(s,addr,addrlen)
 
#define bind(s, name, namelen)   lwip_bind(s,name,namelen)
 
#define shutdown(s, how)   lwip_shutdown(s,how)
 
#define getpeername(s, name, namelen)   lwip_getpeername(s,name,namelen)
 
#define getsockname(s, name, namelen)   lwip_getsockname(s,name,namelen)
 
#define setsockopt(s, level, optname, opval, optlen)   lwip_setsockopt(s,level,optname,opval,optlen)
 
#define getsockopt(s, level, optname, opval, optlen)   lwip_getsockopt(s,level,optname,opval,optlen)
 
#define closesocket(s)   lwip_close(s)
 
#define connect(s, name, namelen)   lwip_connect(s,name,namelen)
 
#define listen(s, backlog)   lwip_listen(s,backlog)
 
#define recv(s, mem, len, flags)   lwip_recv(s,mem,len,flags)
 
#define recvmsg(s, message, flags)   lwip_recvmsg(s,message,flags)
 
#define recvfrom(s, mem, len, flags, from, fromlen)   lwip_recvfrom(s,mem,len,flags,from,fromlen)
 
#define send(s, dataptr, size, flags)   lwip_send(s,dataptr,size,flags)
 
#define sendmsg(s, message, flags)   lwip_sendmsg(s,message,flags)
 
#define sendto(s, dataptr, size, flags, to, tolen)   lwip_sendto(s,dataptr,size,flags,to,tolen)
 
#define socket(domain, type, protocol)   lwip_socket(domain,type,protocol)
 
#define select(maxfdp1, readset, writeset, exceptset, timeout)   lwip_select(maxfdp1,readset,writeset,exceptset,timeout)
 
#define poll(fds, nfds, timeout)   lwip_poll(fds,nfds,timeout)
 
#define ioctlsocket(s, cmd, argp)   lwip_ioctl(s,cmd,argp)
 
#define inet_ntop(af, src, dst, size)   lwip_inet_ntop(af,src,dst,size)
 
#define inet_pton(af, src, dst)   lwip_inet_pton(af,src,dst)
 
#define read(s, mem, len)   lwip_read(s,mem,len)
 
#define readv(s, iov, iovcnt)   lwip_readv(s,iov,iovcnt)
 
#define write(s, dataptr, len)   lwip_write(s,dataptr,len)
 
#define writev(s, iov, iovcnt)   lwip_writev(s,iov,iovcnt)
 
#define close(s)   lwip_close(s)
 
#define fcntl(s, cmd, val)   lwip_fcntl(s,cmd,val)
 
#define ioctl(s, cmd, argp)   lwip_ioctl(s,cmd,argp)
 

Functions

void lwip_socket_thread_init (void)
 
void lwip_socket_thread_cleanup (void)
 
int lwip_shutdown (int s, int how)
 
int lwip_listen (int s, int backlog)
 
int lwip_fcntl (int s, int cmd, int val)
 

Detailed Description

Socket API (to be used from non-TCPIP threads)

Macro Definition Documentation

◆ LWIP_TIMEVAL_PRIVATE

#define LWIP_TIMEVAL_PRIVATE   1

LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided by your system, set this to 0 and include <sys/time.h> in cc.h

Function Documentation

◆ lwip_fcntl()

int lwip_fcntl ( int  s,
int  cmd,
int  val 
)

A minimal implementation of fcntl. Currently only the commands F_GETFL and F_SETFL are implemented. The flag O_NONBLOCK and access modes are supported for F_GETFL, only the flag O_NONBLOCK is implemented for F_SETFL.

◆ lwip_listen()

int lwip_listen ( int  s,
int  backlog 
)

Set a socket into listen mode. The socket may not have been used for another connection previously.

Parameters
sthe socket to set to listening mode
backlog(ATTENTION: needs TCP_LISTEN_BACKLOG=1)
Returns
0 on success, non-zero on failure

◆ lwip_shutdown()

int lwip_shutdown ( int  s,
int  how 
)

Close one end of a full-duplex connection.

◆ lwip_socket_thread_cleanup()

void lwip_socket_thread_cleanup ( void  )

LWIP_NETCONN_SEM_PER_THREAD==1: destroy thread-local semaphore

◆ lwip_socket_thread_init()

void lwip_socket_thread_init ( void  )

LWIP_NETCONN_SEM_PER_THREAD==1: initialize thread-local semaphore