Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
socket.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_POSIX_SYS_SOCKET_H_
7#define ZEPHYR_INCLUDE_POSIX_SYS_SOCKET_H_
8
9#include <sys/types.h>
10#include <zephyr/net/socket.h>
11
12#define SHUT_RD ZSOCK_SHUT_RD
13#define SHUT_WR ZSOCK_SHUT_WR
14#define SHUT_RDWR ZSOCK_SHUT_RDWR
15
16#define MSG_PEEK ZSOCK_MSG_PEEK
17#define MSG_TRUNC ZSOCK_MSG_TRUNC
18#define MSG_DONTWAIT ZSOCK_MSG_DONTWAIT
19#define MSG_WAITALL ZSOCK_MSG_WAITALL
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25struct linger {
28};
29
30int accept(int sock, struct sockaddr *addr, socklen_t *addrlen);
31int bind(int sock, const struct sockaddr *addr, socklen_t addrlen);
32int connect(int sock, const struct sockaddr *addr, socklen_t addrlen);
33int getpeername(int sock, struct sockaddr *addr, socklen_t *addrlen);
34int getsockname(int sock, struct sockaddr *addr, socklen_t *addrlen);
35int getsockopt(int sock, int level, int optname, void *optval, socklen_t *optlen);
36int listen(int sock, int backlog);
37ssize_t recv(int sock, void *buf, size_t max_len, int flags);
38ssize_t recvfrom(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr,
39 socklen_t *addrlen);
40ssize_t recvmsg(int sock, struct msghdr *msg, int flags);
41ssize_t send(int sock, const void *buf, size_t len, int flags);
42ssize_t sendmsg(int sock, const struct msghdr *message, int flags);
43ssize_t sendto(int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr,
44 socklen_t addrlen);
45int setsockopt(int sock, int level, int optname, const void *optval, socklen_t optlen);
46int shutdown(int sock, int how);
47int sockatmark(int s);
48int socket(int family, int type, int proto);
49int socketpair(int family, int type, int proto, int sv[2]);
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif /* ZEPHYR_INCLUDE_POSIX_SYS_SOCKET_H_ */
irp nz macro MOVR cc s mov cc s endm endr irp aw macro LDR aa s
Definition asm-macro-32-bit-gnu.h:17
static int socket(int family, int type, int proto)
POSIX wrapper for zsock_socket.
Definition socket.h:867
static int getpeername(int sock, struct sockaddr *addr, socklen_t *addrlen)
POSIX wrapper for zsock_getpeername.
Definition socket.h:976
static int bind(int sock, const struct sockaddr *addr, socklen_t addrlen)
POSIX wrapper for zsock_bind.
Definition socket.h:891
static ssize_t sendmsg(int sock, const struct msghdr *message, int flags)
POSIX wrapper for zsock_sendmsg.
Definition socket.h:936
static ssize_t recvfrom(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, socklen_t *addrlen)
POSIX wrapper for zsock_recvfrom.
Definition socket.h:943
static int getsockopt(int sock, int level, int optname, void *optval, socklen_t *optlen)
POSIX wrapper for zsock_getsockopt.
Definition socket.h:962
static int accept(int sock, struct sockaddr *addr, socklen_t *addrlen)
POSIX wrapper for zsock_accept.
Definition socket.h:910
static int listen(int sock, int backlog)
POSIX wrapper for zsock_listen.
Definition socket.h:904
static ssize_t recvmsg(int sock, struct msghdr *msg, int flags)
POSIX wrapper for zsock_recvmsg.
Definition socket.h:950
static int setsockopt(int sock, int level, int optname, const void *optval, socklen_t optlen)
POSIX wrapper for zsock_setsockopt.
Definition socket.h:969
static int getsockname(int sock, struct sockaddr *addr, socklen_t *addrlen)
POSIX wrapper for zsock_getsockname.
Definition socket.h:983
static ssize_t sendto(int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen)
POSIX wrapper for zsock_sendto.
Definition socket.h:928
static ssize_t send(int sock, const void *buf, size_t len, int flags)
POSIX wrapper for zsock_send.
Definition socket.h:916
static int socketpair(int family, int type, int proto, int sv[2])
POSIX wrapper for zsock_socketpair.
Definition socket.h:873
static int connect(int sock, const struct sockaddr *addr, socklen_t addrlen)
POSIX wrapper for zsock_connect.
Definition socket.h:897
static ssize_t recv(int sock, void *buf, size_t max_len, int flags)
POSIX wrapper for zsock_recv.
Definition socket.h:922
static int shutdown(int sock, int how)
POSIX wrapper for zsock_shutdown.
Definition socket.h:885
size_t socklen_t
Length of a socket address.
Definition net_ip.h:168
__SIZE_TYPE__ ssize_t
Definition types.h:28
BSD Sockets compatible API definitions.
flags
Definition parser.h:96
int sockatmark(int s)
Definition socket.h:25
int l_linger
Definition socket.h:27
int l_onoff
Definition socket.h:26
Message struct.
Definition net_ip.h:247
Generic sockaddr struct.
Definition net_ip.h:385
static void msg(uint64_t c64)
Definition main.c:17