posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
socket.h File Reference

POSIX socket API (<sys/socket.h>) More...

#include <sys/types.h>
#include <zephyr/net/socket.h>
Include dependency graph for socket.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  linger
 Socket linger option structure. More...
 

Macros

#define SHUT_RD   ZSOCK_SHUT_RD
 Shut down the read half of the connection.
 
#define SHUT_WR   ZSOCK_SHUT_WR
 Shut down the write half of the connection.
 
#define SHUT_RDWR   ZSOCK_SHUT_RDWR
 Shut down both halves of the connection.
 
#define MSG_PEEK   ZSOCK_MSG_PEEK
 Peek at incoming data without removing it from the queue.
 
#define MSG_TRUNC   ZSOCK_MSG_TRUNC
 Return the real length of the datagram even if it was truncated.
 
#define MSG_DONTWAIT   ZSOCK_MSG_DONTWAIT
 Enable non-blocking operation for this call only.
 
#define MSG_WAITALL   ZSOCK_MSG_WAITALL
 Block until all requested data has been received.
 
#define _SOCKLEN_T_DECLARED
 
#define __socklen_t_defined
 

Typedefs

typedef uint32_t socklen_t
 Type for socket address length values.
 

Functions

int accept (int sock, struct sockaddr *addr, socklen_t *addrlen)
 Accept a new connection on a listening socket.
 
int bind (int sock, const struct sockaddr *addr, socklen_t addrlen)
 Assign a local address to a socket.
 
int connect (int sock, const struct sockaddr *addr, socklen_t addrlen)
 Initiate a connection on a socket.
 
int getpeername (int sock, struct sockaddr *addr, socklen_t *addrlen)
 Get the address of the peer connected to a socket.
 
int getsockname (int sock, struct sockaddr *addr, socklen_t *addrlen)
 Get the local address bound to a socket.
 
int getsockopt (int sock, int level, int optname, void *optval, socklen_t *optlen)
 Get socket options.
 
int listen (int sock, int backlog)
 Mark a socket as passive (ready to accept connections).
 
ssize_t recv (int sock, void *buf, size_t max_len, int flags)
 Receive data from a connected socket.
 
ssize_t recvfrom (int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, socklen_t *addrlen)
 Receive data and the sender's address from a socket.
 
ssize_t recvmsg (int sock, struct msghdr *msg, int flags)
 Receive a message (with scatter-gather I/O and ancillary data).
 
ssize_t send (int sock, const void *buf, size_t len, int flags)
 Send data on a connected socket.
 
ssize_t sendmsg (int sock, const struct msghdr *message, int flags)
 Send a message (with scatter-gather I/O and ancillary data).
 
ssize_t sendto (int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen)
 Send data to a specific destination address.
 
int setsockopt (int sock, int level, int optname, const void *optval, socklen_t optlen)
 Set socket options.
 
int shutdown (int sock, int how)
 Shut down part or all of a full-duplex connection.
 
int sockatmark (int s)
 Determine whether a socket is at the out-of-band mark.
 
int socket (int family, int type, int proto)
 Create a new socket.
 
int socketpair (int family, int type, int proto, int sv[2])
 Create a pair of connected sockets.
 

Detailed Description

POSIX socket API (<sys/socket.h>)

Provides the BSD socket interface: creating sockets, binding, connecting, sending, receiving, and socket options.

See also
POSIX.1-2017 <sys/socket.h>

Definition in file socket.h.

Macro Definition Documentation

◆ __socklen_t_defined

#define __socklen_t_defined

Definition at line 50 of file socket.h.

◆ _SOCKLEN_T_DECLARED

#define _SOCKLEN_T_DECLARED

Definition at line 49 of file socket.h.