35#ifndef BSD_SOCKET_SUPPORT
36 #define BSD_SOCKET_SUPPORT ENABLED
37#elif (BSD_SOCKET_SUPPORT != ENABLED && BSD_SOCKET_SUPPORT != DISABLED)
38 #error BSD_SOCKET_SUPPORT parameter is not valid
45 #error FD_SETSIZE parameter is not valid
49#ifndef BSD_SOCKET_SET_ERRNO
50 #define BSD_SOCKET_SET_ERRNO(e)
54#if defined(USE_RTX) && !defined(RTX_CUSTOM_HEADER)
57#undef BSD_SOCKET_SUPPORT
58#define BSD_SOCKET_SUPPORT DISABLED
61#elif defined(_WIN32) && !defined(_DONT_USE_WINSOCK)
72#elif (BSD_SOCKET_SUPPORT == ENABLED)
84#define PF_UNSPEC AF_UNSPEC
85#define PF_INET AF_INET
86#define PF_INET6 AF_INET6
87#define PF_PACKET AF_PACKET
100#define IPPROTO_IPV6 41
101#define IPPROTO_ESP 50
103#define IPPROTO_ICMPV6 58
106#define ETH_P_ALL 0x0000
107#define ETH_P_IP 0x0800
108#define ETH_P_ARP 0x0806
109#define ETH_P_IPV6 0x86DD
112#define SOL_SOCKET 0xFFFF
115#define INADDR_ANY 0x00000000
116#define INADDR_LOOPBACK 0x7F000001
117#define INADDR_BROADCAST 0xFFFFFFFF
120#define MSG_PEEK 0x0002
121#define MSG_DONTROUTE 0x0004
122#define MSG_CTRUNC 0x0008
123#define MSG_DONTWAIT 0x0040
124#define MSG_WAITALL 0x0100
132#define SHUT_RD SD_RECEIVE
133#define SHUT_WR SD_SEND
134#define SHUT_RDWR SD_BOTH
137#define SO_REUSEADDR 0x0004
138#define SO_KEEPALIVE 0x0008
139#define SO_DONTROUTE 0x0010
140#define SO_BROADCAST 0x0020
141#define SO_LINGER 0x0080
142#define SO_SNDBUF 0x1001
143#define SO_RCVBUF 0x1002
144#define SO_SNDTIMEO 0x1005
145#define SO_RCVTIMEO 0x1006
146#define SO_ERROR 0x1007
147#define SO_TYPE 0x1008
148#define SO_MAX_MSG_SIZE 0x2003
149#define SO_BINDTODEVICE 0x3000
154#define IP_ROUTER_ALERT 5
158#define IP_MULTICAST_IF 32
159#define IP_MULTICAST_TTL 33
160#define IP_MULTICAST_LOOP 34
161#define IP_ADD_MEMBERSHIP 35
162#define IP_DROP_MEMBERSHIP 36
165#define IPV6_UNICAST_HOPS 16
166#define IPV6_MULTICAST_IF 17
167#define IPV6_MULTICAST_HOPS 18
168#define IPV6_MULTICAST_LOOP 19
169#define IPV6_ADD_MEMBERSHIP 20
170#define IPV6_DROP_MEMBERSHIP 21
171#define IPV6_V6ONLY 26
172#define IPV6_PKTINFO 50
173#define IPV6_RECVHOPLIMIT 51
174#define IPV6_HOPLIMIT 52
175#define IPV6_RECVTCLASS 66
176#define IPV6_TCLASS 67
179#define TCP_NODELAY 0x0001
180#define TCP_MAXSEG 0x0002
181#define TCP_KEEPIDLE 0x0004
182#define TCP_KEEPINTVL 0x0005
183#define TCP_KEEPCNT 0x0006
186#define IPTOS_LOWDELAY 0x10
187#define IPTOS_THROUGHPUT 0x08
188#define IPTOS_RELIABILITY 0x04
201#define O_NONBLOCK 0x0004
204#define AI_PASSIVE 0x01
205#define AI_CANONNAME 0x02
206#define AI_NUMERICHOST 0x04
207#define AI_NUMERICSERV 0x08
209#define AI_ADDRCONFIG 0x20
210#define AI_V4MAPPED 0x40
213#define NI_NOFQDN 0x01
214#define NI_NUMERICHOST 0x02
215#define NI_NAMEREQD 0x04
216#define NI_NUMERICSERV 0x08
220#define SOCKET_SUCCESS 0
221#define SOCKET_ERROR (-1)
224#define EAI_ADDRFAMILY 1
226#define EAI_BADFLAGS 3
233#define EAI_SOCKTYPE 10
235#define EAI_OVERFLOW 12
240#define EWOULDBLOCK 11
243#define EINPROGRESS 36
245#define ENAMETOOLONG 63
246#define ENOPROTOOPT 92
247#define ECONNRESET 104
251#define ECONNREFUSED 111
254#define NETDB_SUCCESS 0
255#define HOST_NOT_FOUND 1
261#define INADDR_NONE ((in_addr_t) (-1))
264#define INET_ADDRSTRLEN 16
267#define INET6_ADDRSTRLEN 40
350 uint16_t sin6_family;
352 uint32_t sin6_flowinfo;
354 uint32_t sin6_scope_id;
376 int_t ipv6mr_interface;
410 struct iovec *msg_iov;
413 size_t msg_controllen;
459 int_t fd_array[FD_SETSIZE];
487 char_t *ai_canonname;
492#ifndef _TIMEVAL_DEFINED
512#define CMSG_DATA(cmsg) ((uint8_t *) (cmsg) + sizeof(struct cmsghdr))
513#define CMSG_ALIGN(len) (((len) + sizeof(int_t) - 1) & ~(sizeof(int_t) - 1))
514#define CMSG_SPACE(len) (sizeof(struct cmsghdr) + CMSG_ALIGN(len))
515#define CMSG_LEN(len) (sizeof(struct cmsghdr) + (len))
516#define CMSG_FIRSTHDR(msg) socketCmsgFirstHdr(msg)
517#define CMSG_NXTHDR(msg, cmsg) socketCmsgNextHdr(msg, cmsg)
520void socketFdZero(
fd_set *fds);
521void socketFdSet(
fd_set *fds, int_t s);
522void socketFdClr(
fd_set *fds, int_t s);
523int_t socketFdIsSet(
fd_set *fds, int_t s);
526#define FD_ZERO(fds) socketFdZero(fds)
527#define FD_SET(s, fds) socketFdSet(fds, s)
528#define FD_CLR(s, fds) socketFdClr(fds, s)
529#define FD_ISSET(s, fds) socketFdIsSet(fds, s)
532extern const struct in6_addr in6addr_any;
533extern const struct in6_addr in6addr_loopback;
536int_t socket(int_t family, int_t type, int_t protocol);
539int_t listen(int_t s, int_t backlog);
541int_t send(int_t s,
const void *data,
size_t length, int_t flags);
543int_t sendto(int_t s,
const void *data,
size_t length, int_t flags,
546int_t sendmsg(int_t s,
struct msghdr *msg, int_t flags);
548int_t recv(int_t s,
void *data,
size_t size, int_t flags);
550int_t recvfrom(int_t s,
void *data,
size_t size, int_t flags,
553int_t recvmsg(int_t s,
struct msghdr *msg, int_t flags);
558int_t setsockopt(int_t s, int_t level, int_t optname,
const void *optval,
561int_t getsockopt(int_t s, int_t level, int_t optname,
void *optval,
564int_t ioctlsocket(int_t s, uint32_t cmd,
void *arg);
565int_t fcntl(int_t s, int_t cmd,
void *arg);
567int_t shutdown(int_t s, int_t how);
568int_t closesocket(int_t s);
570int_t select(int_t nfds,
fd_set *readfds,
fd_set *writefds,
573int_t gethostname(char_t *name,
size_t len);
574struct hostent *gethostbyname(
const char_t *name);
576struct hostent *gethostbyname_r(
const char_t *name,
struct hostent *result,
577 char_t *buf,
size_t buflen, int_t *h_errnop);
579int_t getaddrinfo(
const char_t *node,
const char_t *service,
582void freeaddrinfo(
struct addrinfo *res);
585 char_t *host,
size_t hostlen, char_t *serv,
size_t servlen,
int flags);
589int_t inet_aton(
const char_t *cp,
struct in_addr *inp);
590const char_t *inet_ntoa(
struct in_addr in);
593int_t inet_pton(int_t af,
const char_t *src,
void *dst);
594const char_t *inet_ntop(int_t af,
const void *src, char_t *dst,
socklen_t size);
int_t socklen_t
Length type.
Definition bsd_socket.h:279
struct cmsghdr CMSGHDR
Ancillary data header.
struct hostent HOSTENT
Information about a given host.
struct in6_addr IN6_ADDR
Structure that represents an IPv6 address.
struct linger LINGER
Linger structure.
struct sockaddr_in SOCKADDR_IN
IPv4 address information.
struct in_addr IN_ADDR
Structure that represents an IPv4 address.
struct msghdr MSGHDR
Message header.
struct sockaddr_in6 SOCKADDR_IN6
IPv6 address information.
struct timeval TIMEVAL
Timeout structure.
struct ipv6_mreq IPV6_MREQ
Multicast group information for IPv6 addresses.
struct ip_mreq IP_MREQ
Multicast group information for IPv4 addresses.
uint32_t in_addr_t
IPv4 address.
Definition bsd_socket.h:286
struct sockaddr_storage SOCKADDR_STORAGE
Socket address storage.
struct in6_pktinfo IN6_PKTINFO
IPv6 packet information.
struct fd_set fd_set
Set of sockets.
struct addrinfo ADDRINFO
Information about address of a service provider.
struct sockaddr SOCKADDR
Socket address.
struct in_pktinfo IN_PKTINFO
IPv4 packet information.
Information about address of a service provider.
Definition bsd_socket.h:480
Ancillary data header.
Definition bsd_socket.h:423
Set of sockets.
Definition bsd_socket.h:457
Information about a given host.
Definition bsd_socket.h:468
Structure that represents an IPv6 address.
Definition bsd_socket.h:339
IPv6 packet information.
Definition bsd_socket.h:446
Structure that represents an IPv4 address.
Definition bsd_socket.h:316
IPv4 packet information.
Definition bsd_socket.h:435
Scatter/gather array.
Definition bsd_socket.h:396
Multicast group information for IPv4 addresses.
Definition bsd_socket.h:363
Multicast group information for IPv6 addresses.
Definition bsd_socket.h:374
Linger structure.
Definition bsd_socket.h:385
Message header.
Definition bsd_socket.h:407
IPv6 address information.
Definition bsd_socket.h:349
IPv4 address information.
Definition bsd_socket.h:326
Socket address storage.
Definition bsd_socket.h:305
Socket address.
Definition bsd_socket.h:294
Timeout structure.
Definition bsd_socket.h:499