![]() |
EVE 1.0
|
![]() |
Data Structures | |
struct | sockaddr |
struct | in_addr |
struct | sockaddr_in |
Macros | |
#define | AF_INET 2 |
#define | SOCK_STREAM 1 |
#define | SOCK_DGRAM 2 |
#define | IPPROTO_TCP 6 |
#define | IPPROTO_UDP 17 |
#define | SOL_SOCKET 1 |
#define | SO_RCVTIMEO 20 |
#define | SO_SNDTIMEO 21 |
#define | TCP_NODELAY 1 |
#define | FIONBIO 0x5421 |
#define | HTONS(hostshort) UIP_HTONS(hostshort) |
Typedefs | |
typedef uint16_t | sa_family_t |
typedef uint32_t | socklen_t |
Functions | |
static uint16_t | htons (uint16_t hostshort) |
int | socket (int domain, int type, int protocol) |
int | bind (int sockfd, const struct sockaddr *addr, socklen_t addrlen) |
int | listen (int sockfd, int backlog) |
int | accept (int sockfd, struct sockaddr *addr, socklen_t *addrlen) |
int | connect (int sockfd, const struct sockaddr *addr, socklen_t addrlen) |
int | closesocket (int sockfd) |
ssize_t | recv (int sockfd, void *buf, size_t len, int flags) |
int | poll_recv (int sockfd, uint32_t timeout) |
ssize_t | send (int sockfd, const void *buf, size_t len, int flags) |
int | poll_send (int sockfd, uint32_t timeout) |
int | select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) |
int | ioctlsocket (int sockfd, int request, const void *opt) |
int | setsockopt (int sockfd, int level, int request, const void *opt, socklen_t length) |
#define HTONS | ( | hostshort | ) | UIP_HTONS(hostshort) |
typedef uint16_t sa_family_t |
|
inlinestatic |
Host to network order
hostshort | Host-order short value |
Definition at line 818 of file rtos.h.
References accept(), backlog, bind(), closesocket(), connect(), ioctlsocket(), listen(), poll_recv(), poll_send(), recv(), select(), send(), setsockopt(), socket(), and UIP_HTONS.
int socket | ( | int | domain, |
int | type, | ||
int | protocol | ||
) |
Creates an endpoint for communication and returns a descriptor for the socket.
domain | The protocol family of the created socket. |
type | SOCK_STREAM or SOCK_DGRAM |
protocol | The actual transport protocol to use. 0 or IPPROTO_xxx |
Referenced by htons().
Assigns a socket to an address.
sockfd | A descriptor representing the socket to perform the bind on. |
addr | A pointer to a sockaddr structure representing the address to bind to. |
addrlen | The size of the sockaddr structure, pointed by addr. |
Referenced by htons().
int listen | ( | int | sockfd, |
int | backlog | ||
) |
Prepares a socket for incoming connections.
sockfd | A socket descriptor. |
backlog | The number of pending connections that can be queued up at any one time (ignored by the current implementation). |
Referenced by htons().
Creates a new socket for an incoming connection.
sockfd | A descriptor representing the listening socket. |
addr | A pointer to a sockaddr structure to receive the client's address information. |
addrlen | A pointer to a variable, containing size of the sockaddr structure. Updated by the call. |
Referenced by htons().
Establishes a communication link towards a remote host.
sockfd | A local socket descriptor |
addr | A pointer to a sockaddr structure representing the address of the remote host. |
addrlen | The size of the sockaddr structure, pointed by addr. |
Referenced by htons().
int closesocket | ( | int | sockfd | ) |
Closes a socket desctiptor.
sockfd | A socket descriptor |
Referenced by htons().
ssize_t recv | ( | int | sockfd, |
void * | buf, | ||
size_t | len, | ||
int | flags | ||
) |
Receives data from a socket
sockfd | A socket descriptor. |
buf | The buffer to be filled by data |
len | Length of the buffer. |
flags | Ignored in the current implementation |
Referenced by htons().
int poll_recv | ( | int | sockfd, |
uint32_t | timeout | ||
) |
Waits for a socket becomes available for data reading
If this function returns 0 for a socket, then a consequent recv() call will not block and will not return EWOULDBLOCK.
sockfd | A socket descriptor. |
timeout | Timeout in system ticks. |
Referenced by htons().
ssize_t send | ( | int | sockfd, |
const void * | buf, | ||
size_t | len, | ||
int | flags | ||
) |
Sends data into a socket
sockfd | A socket descriptor. |
buf | The buffer to be sent |
len | Length of the buffer. |
flags | Ignored in the current implementation |
Referenced by htons(), and uip_process().
int poll_send | ( | int | sockfd, |
uint32_t | timeout | ||
) |
Waits for a socket becomes available for data sending
If thiss function returns 0 for a socket, then a consequent send() call will not block and will not return EWOULDBLOCK.
sockfd | A socket descriptor. |
timeout | Timeout in system ticks. |
Referenced by htons().
int select | ( | int | nfds, |
fd_set * | readfds, | ||
fd_set * | writefds, | ||
fd_set * | exceptfds, | ||
struct timeval * | timeout | ||
) |
Synchronous I/O multiplexing
nfds | The highest-numbered socket descriptor plus 1. |
readfds | set of sockets, watched for read, updated on return. |
writefds | set of sockets, watched for write, updated on return. |
exceptfds | set of sockets, watched for exception, updated on return. |
timeout | timeout. Infinite if NULL. |
Referenced by htons().
int ioctlsocket | ( | int | sockfd, |
int | request, | ||
const void * | opt | ||
) |
Controls socket options (IOCTL ones).
sockfd | A socket descriptor. |
request | IOCTL request (so far FIONBIO is the only supported) |
opt | The option value |
Referenced by htons().
int setsockopt | ( | int | sockfd, |
int | level, | ||
int | request, | ||
const void * | opt, | ||
socklen_t | length | ||
) |
Controls socket options (setsockopt ones).
sockfd | A socket descriptor. |
level | Option level (SOL_SOCKET, IPPROTO_TCP) |
request | The option name (SO_RCVTIMEO, SO_SNDTIMEO, TCP_NODELAY) |
opt | The option value |
length | Length of the option |
Referenced by htons().