60#define _SS_MAXSIZE 128
63#define _SS_ALIGNSIZE (sizeof(__uint64_t))
66#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(sa_family_t))
69#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof(sa_family_t) + \
70 _SS_PAD1SIZE + _SS_ALIGNSIZE))
134#define SO_ACCEPTCONN 1
135#define SO_BROADCAST 2
137#define SO_DONTROUTE 4
139#define SO_KEEPALIVE 6
141#define SO_OOBINLINE 8
143#define SO_RCVLOWAT 10
144#define SO_RCVTIMEO 11
145#define SO_REUSEADDR 12
147#define SO_SNDLOWAT 14
148#define SO_SNDTIMEO 15
166#define MSG_CTRUNC 0x01
167#define MSG_DONTROUTE 0x02
171#define MSG_TRUNC 0x20
172#define MSG_WAITALL 0x40
173#define MSG_DONTWAIT 0x80
190#define PF_UNSPEC AF_UNSPEC
193#define PF_INET AF_INET
196#define PF_INET6 AF_INET6
199#define SHUT_RD 0x00000001
202#define SHUT_WR 0x00000002
205#define SHUT_RDWR (SHUT_RD | SHUT_WR)
286ssize_t
recv(
int socket,
void *buffer,
size_t length,
int flags);
321ssize_t
send(
int socket,
const void *message,
size_t length,
int flags);
339ssize_t
sendto(
int socket,
const void *message,
size_t length,
int flags,
371int socket(
int domain,
int type,
int protocol);
int shutdown(int socket, int how)
Shutdown socket send and receive operations.
ssize_t recv(int socket, void *buffer, size_t length, int flags)
Receive a message on a connected socket.
#define _SS_PAD2SIZE
Second padding size used within struct sockaddr_storage.
Definition socket.h:69
int accept(int socket, struct sockaddr *address, socklen_t *address_len)
Accept a new connection on a socket.
int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len)
Set socket options.
int bind(int socket, const struct sockaddr *address, socklen_t address_len)
Bind a name to a socket.
int getsockname(int socket, struct sockaddr *name, socklen_t *name_len)
Get socket name.
__uint32_t socklen_t
Socket length type.
Definition socket.h:39
int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
Get socket options.
ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len)
Send a message on a socket.
int listen(int socket, int backlog)
Listen for socket connections and set the queue length.
ssize_t send(int socket, const void *message, size_t length, int flags)
Send a message on a connected socket.
__uint8_t sa_family_t
Socket address family type.
Definition socket.h:42
ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)
Receive a message on a socket.
#define _SS_PAD1SIZE
First padding size used within struct sockaddr_storage.
Definition socket.h:66
int connect(int socket, const struct sockaddr *address, socklen_t address_len)
Connect a socket.
int socket(int domain, int type, int protocol)
Create an endpoint for communications.
int getpeername(int socket, struct sockaddr *__RESTRICT name, socklen_t *__RESTRICT name_len)
Get the name of the connected peer socket.
#define __RESTRICT
Definition cdefs.h:176
Socket address structure of appropriate size to hold any supported socket type's addresses.
Definition socket.h:76
sa_family_t ss_family
Address family.
Definition socket.h:78
__uint64_t _ss_align
Used to force alignment.
Definition socket.h:84
char _ss_pad2[_SS_PAD2SIZE]
Second padding field to fill up the space required.
Definition socket.h:87
char _ss_pad1[_SS_PAD1SIZE]
First padding field.
Definition socket.h:81
Socket address structure.
Definition socket.h:47
char sa_data[]
Address data.
Definition socket.h:51
sa_family_t sa_family
Address family.
Definition socket.h:49
Header for terminal control operations.