BSD socket API. More...
#include "os_port.h"
Go to the source code of this file.
Data Structures | |
struct | sockaddr |
Socket address. More... | |
struct | sockaddr_storage |
Socket address storage. More... | |
struct | in_addr |
Structure that represents an IPv4 address. More... | |
struct | sockaddr_in |
IPv4 address information. More... | |
struct | in6_addr |
Structure that represents an IPv6 address. More... | |
struct | sockaddr_in6 |
IPv6 address information. More... | |
struct | ip_mreq |
Any-source multicast group information (for IPv4 only) More... | |
struct | ip_mreq_source |
Source-specific multicast group information (for IPv4 only) More... | |
struct | ipv6_mreq |
Any-source multicast group information (for IPv6 only) More... | |
struct | group_req |
Any-source multicast group information (for IPv4/IPv6) More... | |
struct | group_source_req |
Source-specific multicast group information (for IPv4/IPv6) More... | |
struct | linger |
Linger structure. More... | |
struct | iovec |
Scatter/gather array. More... | |
struct | msghdr |
Message header. More... | |
struct | cmsghdr |
Ancillary data header. More... | |
struct | in_pktinfo |
IPv4 packet information. More... | |
struct | in6_pktinfo |
IPv6 packet information. More... | |
struct | fd_set |
Set of sockets. More... | |
struct | hostent |
Information about a given host. More... | |
struct | addrinfo |
Information about address of a service provider. More... | |
struct | timeval |
Timeout structure. More... | |
Macros | |
#define | BSD_SOCKET_SUPPORT ENABLED |
#define | FD_SETSIZE 8 |
#define | BSD_SOCKET_SET_ERRNO(e) |
#define | AF_UNSPEC 0 |
#define | AF_INET 2 |
#define | AF_INET6 10 |
#define | AF_PACKET 17 |
#define | PF_UNSPEC AF_UNSPEC |
#define | PF_INET AF_INET |
#define | PF_INET6 AF_INET6 |
#define | PF_PACKET AF_PACKET |
#define | SOCK_STREAM 1 |
#define | SOCK_DGRAM 2 |
#define | SOCK_RAW 3 |
#define | IPPROTO_IP 0 |
#define | IPPROTO_ICMP 1 |
#define | IPPROTO_IGMP 2 |
#define | IPPROTO_TCP 6 |
#define | IPPROTO_UDP 17 |
#define | IPPROTO_IPV6 41 |
#define | IPPROTO_ESP 50 |
#define | IPPROTO_AH 51 |
#define | IPPROTO_ICMPV6 58 |
#define | ETH_P_ALL 0x0000 |
#define | ETH_P_IP 0x0800 |
#define | ETH_P_ARP 0x0806 |
#define | ETH_P_IPV6 0x86DD |
#define | SOL_SOCKET 0xFFFF |
#define | INADDR_ANY 0x00000000 |
#define | INADDR_LOOPBACK 0x7F000001 |
#define | INADDR_BROADCAST 0xFFFFFFFF |
#define | MSG_PEEK 0x0002 |
#define | MSG_DONTROUTE 0x0004 |
#define | MSG_CTRUNC 0x0008 |
#define | MSG_DONTWAIT 0x0040 |
#define | MSG_WAITALL 0x0100 |
#define | SD_RECEIVE 0 |
#define | SD_SEND 1 |
#define | SD_BOTH 2 |
#define | SHUT_RD SD_RECEIVE |
#define | SHUT_WR SD_SEND |
#define | SHUT_RDWR SD_BOTH |
#define | SO_REUSEADDR 2 |
#define | SO_TYPE 3 |
#define | SO_ERROR 4 |
#define | SO_DONTROUTE 5 |
#define | SO_BROADCAST 6 |
#define | SO_SNDBUF 7 |
#define | SO_RCVBUF 8 |
#define | SO_KEEPALIVE 9 |
#define | SO_NO_CHECK 11 |
#define | SO_LINGER 13 |
#define | SO_SNDTIMEO 20 |
#define | SO_RCVTIMEO 21 |
#define | SO_BINDTODEVICE 25 |
#define | SO_ACCEPTCONN 30 |
#define | IP_TOS 1 |
#define | IP_TTL 2 |
#define | IP_ROUTER_ALERT 5 |
#define | IP_PKTINFO 8 |
#define | IP_RECVTTL 12 |
#define | IP_RECVTOS 13 |
#define | IP_MULTICAST_IF 32 |
#define | IP_MULTICAST_TTL 33 |
#define | IP_MULTICAST_LOOP 34 |
#define | IP_ADD_MEMBERSHIP 35 |
#define | IP_DROP_MEMBERSHIP 36 |
#define | IP_UNBLOCK_SOURCE 37 |
#define | IP_BLOCK_SOURCE 38 |
#define | IP_ADD_SOURCE_MEMBERSHIP 39 |
#define | IP_DROP_SOURCE_MEMBERSHIP 40 |
#define | MCAST_JOIN_GROUP 42 |
#define | MCAST_BLOCK_SOURCE 43 |
#define | MCAST_UNBLOCK_SOURCE 44 |
#define | MCAST_LEAVE_GROUP 45 |
#define | MCAST_JOIN_SOURCE_GROUP 46 |
#define | MCAST_LEAVE_SOURCE_GROUP 47 |
#define | IP_DONTFRAG 67 |
#define | IPV6_UNICAST_HOPS 16 |
#define | IPV6_MULTICAST_IF 17 |
#define | IPV6_MULTICAST_HOPS 18 |
#define | IPV6_MULTICAST_LOOP 19 |
#define | IPV6_ADD_MEMBERSHIP 20 |
#define | IPV6_DROP_MEMBERSHIP 21 |
#define | IPV6_V6ONLY 26 |
#define | IPV6_PKTINFO 50 |
#define | IPV6_RECVHOPLIMIT 51 |
#define | IPV6_HOPLIMIT 52 |
#define | IPV6_DONTFRAG 62 |
#define | IPV6_RECVTCLASS 66 |
#define | IPV6_TCLASS 67 |
#define | TCP_NODELAY 1 |
#define | TCP_MAXSEG 2 |
#define | TCP_KEEPIDLE 4 |
#define | TCP_KEEPINTVL 5 |
#define | TCP_KEEPCNT 6 |
#define | IPTOS_LOWDELAY 0x10 |
#define | IPTOS_THROUGHPUT 0x08 |
#define | IPTOS_RELIABILITY 0x04 |
#define | MCAST_EXCLUDE 0 |
#define | MCAST_INCLUDE 1 |
#define | FIONBIO 126 |
#define | FIONREAD 127 |
#define | FIONWRITE 121 |
#define | FIONSPACE 120 |
#define | F_GETFL 3 |
#define | F_SETFL 4 |
#define | O_NONBLOCK 0x0004 |
#define | AI_PASSIVE 0x01 |
#define | AI_CANONNAME 0x02 |
#define | AI_NUMERICHOST 0x04 |
#define | AI_NUMERICSERV 0x08 |
#define | AI_ALL 0x10 |
#define | AI_ADDRCONFIG 0x20 |
#define | AI_V4MAPPED 0x40 |
#define | NI_NOFQDN 0x01 |
#define | NI_NUMERICHOST 0x02 |
#define | NI_NAMEREQD 0x04 |
#define | NI_NUMERICSERV 0x08 |
#define | NI_DGRAM 0x10 |
#define | SOCKET_SUCCESS 0 |
#define | SOCKET_ERROR (-1) |
#define | EAI_ADDRFAMILY 1 |
#define | EAI_AGAIN 2 |
#define | EAI_BADFLAGS 3 |
#define | EAI_FAIL 4 |
#define | EAI_FAMILY 5 |
#define | EAI_MEMORY 6 |
#define | EAI_NODATA 7 |
#define | EAI_NONAME 8 |
#define | EAI_SERVICE 9 |
#define | EAI_SOCKTYPE 10 |
#define | EAI_SYSTEM 11 |
#define | EAI_OVERFLOW 12 |
#define | EINTR 4 |
#define | EAGAIN 11 |
#define | EWOULDBLOCK 11 |
#define | EFAULT 14 |
#define | EINVAL 22 |
#define | EINPROGRESS 36 |
#define | ETIMEDOUT 60 |
#define | ENAMETOOLONG 63 |
#define | EMSGSIZE 90 |
#define | ENOPROTOOPT 92 |
#define | EOPNOTSUPP 95 |
#define | EADDRNOTAVAIL 99 |
#define | ECONNRESET 104 |
#define | ENOBUFS 105 |
#define | EISCONN 106 |
#define | ENOTCONN 107 |
#define | ESHUTDOWN 108 |
#define | ECONNREFUSED 111 |
#define | NETDB_SUCCESS 0 |
#define | HOST_NOT_FOUND 1 |
#define | TRY_AGAIN 2 |
#define | NO_RECOVERY 3 |
#define | NO_ADDRESS 4 |
#define | INADDR_NONE ((in_addr_t) (-1)) |
#define | INET_ADDRSTRLEN 16 |
#define | INET6_ADDRSTRLEN 40 |
#define | IF_NAMESIZE (NET_MAX_IF_NAME_LEN + 1) |
#define | CMSG_DATA(cmsg) ((uint8_t *) (cmsg) + sizeof(CMSGHDR)) |
#define | CMSG_ALIGN(len) (((len) + sizeof(int_t) - 1) & ~(sizeof(int_t) - 1)) |
#define | CMSG_SPACE(len) (sizeof(CMSGHDR) + CMSG_ALIGN(len)) |
#define | CMSG_LEN(len) (sizeof(CMSGHDR) + (len)) |
#define | CMSG_FIRSTHDR(msg) socketCmsgFirstHdr(msg) |
#define | CMSG_NXTHDR(msg, cmsg) socketCmsgNextHdr(msg, cmsg) |
#define | FD_ZERO(fds) socketFdZero(fds) |
#define | FD_SET(s, fds) socketFdSet(fds, s) |
#define | FD_CLR(s, fds) socketFdClr(fds, s) |
#define | FD_ISSET(s, fds) socketFdIsSet(fds, s) |
Typedefs | |
typedef int_t | socklen_t |
Length type. More... | |
typedef uint16_t | sa_family_t |
Address family. More... | |
typedef uint16_t | in_port_t |
Port number. More... | |
typedef uint32_t | in_addr_t |
IPv4 address. More... | |
typedef struct sockaddr | SOCKADDR |
Socket address. More... | |
typedef struct sockaddr * | PSOCKADDR |
typedef struct sockaddr_storage | SOCKADDR_STORAGE |
Socket address storage. More... | |
typedef struct sockaddr_storage * | PSOCKADDR_STORAGE |
typedef struct in_addr | IN_ADDR |
Structure that represents an IPv4 address. More... | |
typedef struct in_addr * | PIN_ADDR |
typedef struct sockaddr_in | SOCKADDR_IN |
IPv4 address information. More... | |
typedef struct sockaddr_in * | PSOCKADDR_IN |
typedef struct in6_addr | IN6_ADDR |
Structure that represents an IPv6 address. More... | |
typedef struct in6_addr * | PIN6_ADDR |
typedef struct sockaddr_in6 | SOCKADDR_IN6 |
IPv6 address information. More... | |
typedef struct sockaddr_in6 * | PSOCKADDR_IN6 |
typedef struct ip_mreq | IP_MREQ |
Any-source multicast group information (for IPv4 only) More... | |
typedef struct ip_mreq * | PIP_MREQ |
typedef struct ip_mreq_source | IP_MREQ_SOURCE |
Source-specific multicast group information (for IPv4 only) More... | |
typedef struct ip_mreq_source * | PIP_MREQ_SOURCE |
typedef struct ipv6_mreq | IPV6_MREQ |
Any-source multicast group information (for IPv6 only) More... | |
typedef struct ipv6_mreq * | PIPV6_MREQ |
typedef struct group_req | GROUP_REQ |
Any-source multicast group information (for IPv4/IPv6) More... | |
typedef struct group_req * | PGROUP_REQ |
typedef struct group_source_req | GROUP_SOURCE_REQ |
Source-specific multicast group information (for IPv4/IPv6) More... | |
typedef struct group_source_req * | PGROUP_SOURCE_REQ |
typedef struct linger | LINGER |
Linger structure. More... | |
typedef struct linger * | PLINGER |
typedef struct msghdr | MSGHDR |
Message header. More... | |
typedef struct msghdr * | PMSGHDR |
typedef struct cmsghdr | CMSGHDR |
Ancillary data header. More... | |
typedef struct cmsghdr * | PCMSGHDR |
typedef struct in_pktinfo | IN_PKTINFO |
IPv4 packet information. More... | |
typedef struct in_pktinfo * | PIN_PKTINFO |
typedef struct in6_pktinfo | IN6_PKTINFO |
IPv6 packet information. More... | |
typedef struct in6_pktinfo * | PIN6_PKTINFO |
typedef struct fd_set | fd_set |
Set of sockets. More... | |
typedef struct fd_set | FD_SET |
typedef struct fd_set * | PFD_SET |
typedef struct hostent | HOSTENT |
Information about a given host. More... | |
typedef struct hostent * | PHOSTENT |
typedef struct addrinfo | ADDRINFO |
Information about address of a service provider. More... | |
typedef struct addrinfo * | PADDRINFO |
typedef struct timeval | TIMEVAL |
Timeout structure. More... | |
typedef struct timeval * | PTIMEVAL |
Functions | |
struct cmsghdr * | socketCmsgFirstHdr (struct msghdr *msg) |
Get first ancillary data header. More... | |
struct cmsghdr * | socketCmsgNextHdr (struct msghdr *msg, struct cmsghdr *cmsg) |
Get next ancillary data header. More... | |
void | socketFdZero (fd_set *fds) |
Initializes a descriptor set. More... | |
void | socketFdSet (fd_set *fds, int_t s) |
Add a descriptor to an existing set. More... | |
void | socketFdClr (fd_set *fds, int_t s) |
Remove a descriptor from an existing set. More... | |
int_t | socketFdIsSet (fd_set *fds, int_t s) |
Check whether a descriptor is set. More... | |
int_t | socket (int_t family, int_t type, int_t protocol) |
Create a socket that is bound to a specific transport service provider. More... | |
int_t | bind (int_t s, const struct sockaddr *addr, socklen_t addrlen) |
Associate a local address with a socket. More... | |
int_t | connect (int_t s, const struct sockaddr *addr, socklen_t addrlen) |
Establish a connection to a specified socket. More... | |
int_t | listen (int_t s, int_t backlog) |
Place a socket in the listening state. More... | |
int_t | accept (int_t s, struct sockaddr *addr, socklen_t *addrlen) |
Permit an incoming connection attempt on a socket. More... | |
int_t | send (int_t s, const void *data, size_t length, int_t flags) |
Send data to a connected socket. More... | |
int_t | sendto (int_t s, const void *data, size_t length, int_t flags, const struct sockaddr *addr, socklen_t addrlen) |
Send a datagram to a specific destination. More... | |
int_t | sendmsg (int_t s, struct msghdr *msg, int_t flags) |
Send a message. More... | |
int_t | recv (int_t s, void *data, size_t size, int_t flags) |
Receive data from a connected socket. More... | |
int_t | recvfrom (int_t s, void *data, size_t size, int_t flags, struct sockaddr *addr, socklen_t *addrlen) |
Receive a datagram. More... | |
int_t | recvmsg (int_t s, struct msghdr *msg, int_t flags) |
Receive a message. More... | |
int_t | getsockname (int_t s, struct sockaddr *addr, socklen_t *addrlen) |
Retrieves the local name for a socket. More... | |
int_t | getpeername (int_t s, struct sockaddr *addr, socklen_t *addrlen) |
Retrieves the address of the peer to which a socket is connected. More... | |
int_t | setsockopt (int_t s, int_t level, int_t optname, const void *optval, socklen_t optlen) |
The setsockopt function sets a socket option. More... | |
int_t | getsockopt (int_t s, int_t level, int_t optname, void *optval, socklen_t *optlen) |
The getsockopt function retrieves a socket option. More... | |
int_t | setipv4sourcefilter (int_t s, struct in_addr interface, struct in_addr group, uint32_t fmode, uint_t numsrc, struct in_addr *slist) |
Set multicast source filter (IPv4 only) More... | |
int_t | getipv4sourcefilter (int_t s, struct in_addr interface, struct in_addr group, uint32_t *fmode, uint_t *numsrc, struct in_addr *slist) |
Get multicast source filter (IPv4 only) More... | |
int_t | setsourcefilter (int_t s, uint32_t interface, struct sockaddr *group, socklen_t grouplen, uint32_t fmode, uint_t numsrc, struct sockaddr_storage *slist) |
Set multicast source filter. More... | |
int_t | getsourcefilter (int_t s, uint32_t interface, struct sockaddr *group, socklen_t grouplen, uint32_t *fmode, uint_t *numsrc, struct sockaddr_storage *slist) |
Get multicast source filter. More... | |
int_t | ioctlsocket (int_t s, uint32_t cmd, void *arg) |
Control the I/O mode of a socket. More... | |
int_t | fcntl (int_t s, int_t cmd, int_t arg) |
Perform specific operation. More... | |
int_t | shutdown (int_t s, int_t how) |
The shutdown function disables sends or receives on a socket. More... | |
int_t | closesocket (int_t s) |
The closesocket function closes an existing socket. More... | |
int_t | select (int_t nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout) |
Determine the status of one or more sockets. More... | |
int_t | gethostname (char_t *name, size_t len) |
Get system host name. More... | |
struct hostent * | gethostbyname (const char_t *name) |
Host name resolution. More... | |
struct hostent * | gethostbyname_r (const char_t *name, struct hostent *result, char_t *buf, size_t buflen, int_t *h_errnop) |
Host name resolution (reentrant version) More... | |
int_t | getaddrinfo (const char_t *node, const char_t *service, const struct addrinfo *hints, struct addrinfo **res) |
Convert host and service names to socket address. More... | |
void | freeaddrinfo (struct addrinfo *res) |
Free socket address structures. More... | |
int_t | getnameinfo (const struct sockaddr *addr, socklen_t addrlen, char_t *host, size_t hostlen, char_t *serv, size_t servlen, int flags) |
Convert a socket address to a corresponding host and service. More... | |
uint_t | if_nametoindex (const char_t *ifname) |
Map an interface name into its corresponding index. More... | |
char_t * | if_indextoname (uint_t ifindex, char_t *ifname) |
Map an interface index into its corresponding name. More... | |
in_addr_t | inet_addr (const char_t *cp) |
Convert a dot-decimal string into binary data in network byte order. More... | |
int_t | inet_aton (const char_t *cp, struct in_addr *inp) |
Convert a dot-decimal string into binary form. More... | |
const char_t * | inet_ntoa (struct in_addr in) |
Convert a binary IPv4 address to dot-decimal notation. More... | |
const char_t * | inet_ntoa_r (struct in_addr in, char_t *buf, socklen_t buflen) |
Convert a binary IPv4 address to dot-decimal notation (reentrant version) More... | |
int_t | inet_pton (int_t af, const char_t *src, void *dst) |
Convert an IPv4 or IPv6 address from text to binary form. More... | |
const char_t * | inet_ntop (int_t af, const void *src, char_t *dst, socklen_t size) |
Convert an IPv4 or IPv6 address from binary to text. More... | |
Variables | |
const struct in6_addr | in6addr_any |
const struct in6_addr | in6addr_loopback |
Detailed Description
BSD socket API.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file bsd_socket.h.
Macro Definition Documentation
◆ AF_INET
#define AF_INET 2 |
Definition at line 79 of file bsd_socket.h.
◆ AF_INET6
#define AF_INET6 10 |
Definition at line 80 of file bsd_socket.h.
◆ AF_PACKET
#define AF_PACKET 17 |
Definition at line 81 of file bsd_socket.h.
◆ AF_UNSPEC
#define AF_UNSPEC 0 |
Definition at line 78 of file bsd_socket.h.
◆ AI_ADDRCONFIG
#define AI_ADDRCONFIG 0x20 |
Definition at line 226 of file bsd_socket.h.
◆ AI_ALL
#define AI_ALL 0x10 |
Definition at line 225 of file bsd_socket.h.
◆ AI_CANONNAME
#define AI_CANONNAME 0x02 |
Definition at line 222 of file bsd_socket.h.
◆ AI_NUMERICHOST
#define AI_NUMERICHOST 0x04 |
Definition at line 223 of file bsd_socket.h.
◆ AI_NUMERICSERV
#define AI_NUMERICSERV 0x08 |
Definition at line 224 of file bsd_socket.h.
◆ AI_PASSIVE
#define AI_PASSIVE 0x01 |
Definition at line 221 of file bsd_socket.h.
◆ AI_V4MAPPED
#define AI_V4MAPPED 0x40 |
Definition at line 227 of file bsd_socket.h.
◆ BSD_SOCKET_SET_ERRNO
#define BSD_SOCKET_SET_ERRNO | ( | e | ) |
Definition at line 50 of file bsd_socket.h.
◆ BSD_SOCKET_SUPPORT
#define BSD_SOCKET_SUPPORT ENABLED |
Definition at line 36 of file bsd_socket.h.
◆ CMSG_ALIGN
Definition at line 586 of file bsd_socket.h.
◆ CMSG_DATA
#define CMSG_DATA | ( | cmsg | ) | ((uint8_t *) (cmsg) + sizeof(CMSGHDR)) |
Definition at line 585 of file bsd_socket.h.
◆ CMSG_FIRSTHDR
#define CMSG_FIRSTHDR | ( | msg | ) | socketCmsgFirstHdr(msg) |
Definition at line 589 of file bsd_socket.h.
◆ CMSG_LEN
#define CMSG_LEN | ( | len | ) | (sizeof(CMSGHDR) + (len)) |
Definition at line 588 of file bsd_socket.h.
◆ CMSG_NXTHDR
#define CMSG_NXTHDR | ( | msg, | |
cmsg | |||
) | socketCmsgNextHdr(msg, cmsg) |
Definition at line 590 of file bsd_socket.h.
◆ CMSG_SPACE
#define CMSG_SPACE | ( | len | ) | (sizeof(CMSGHDR) + CMSG_ALIGN(len)) |
Definition at line 587 of file bsd_socket.h.
◆ EADDRNOTAVAIL
#define EADDRNOTAVAIL 99 |
Definition at line 266 of file bsd_socket.h.
◆ EAGAIN
#define EAGAIN 11 |
Definition at line 256 of file bsd_socket.h.
◆ EAI_ADDRFAMILY
#define EAI_ADDRFAMILY 1 |
Definition at line 241 of file bsd_socket.h.
◆ EAI_AGAIN
#define EAI_AGAIN 2 |
Definition at line 242 of file bsd_socket.h.
◆ EAI_BADFLAGS
#define EAI_BADFLAGS 3 |
Definition at line 243 of file bsd_socket.h.
◆ EAI_FAIL
#define EAI_FAIL 4 |
Definition at line 244 of file bsd_socket.h.
◆ EAI_FAMILY
#define EAI_FAMILY 5 |
Definition at line 245 of file bsd_socket.h.
◆ EAI_MEMORY
#define EAI_MEMORY 6 |
Definition at line 246 of file bsd_socket.h.
◆ EAI_NODATA
#define EAI_NODATA 7 |
Definition at line 247 of file bsd_socket.h.
◆ EAI_NONAME
#define EAI_NONAME 8 |
Definition at line 248 of file bsd_socket.h.
◆ EAI_OVERFLOW
#define EAI_OVERFLOW 12 |
Definition at line 252 of file bsd_socket.h.
◆ EAI_SERVICE
#define EAI_SERVICE 9 |
Definition at line 249 of file bsd_socket.h.
◆ EAI_SOCKTYPE
#define EAI_SOCKTYPE 10 |
Definition at line 250 of file bsd_socket.h.
◆ EAI_SYSTEM
#define EAI_SYSTEM 11 |
Definition at line 251 of file bsd_socket.h.
◆ ECONNREFUSED
#define ECONNREFUSED 111 |
Definition at line 272 of file bsd_socket.h.
◆ ECONNRESET
#define ECONNRESET 104 |
Definition at line 267 of file bsd_socket.h.
◆ EFAULT
#define EFAULT 14 |
Definition at line 258 of file bsd_socket.h.
◆ EINPROGRESS
#define EINPROGRESS 36 |
Definition at line 260 of file bsd_socket.h.
◆ EINTR
#define EINTR 4 |
Definition at line 255 of file bsd_socket.h.
◆ EINVAL
#define EINVAL 22 |
Definition at line 259 of file bsd_socket.h.
◆ EISCONN
#define EISCONN 106 |
Definition at line 269 of file bsd_socket.h.
◆ EMSGSIZE
#define EMSGSIZE 90 |
Definition at line 263 of file bsd_socket.h.
◆ ENAMETOOLONG
#define ENAMETOOLONG 63 |
Definition at line 262 of file bsd_socket.h.
◆ ENOBUFS
#define ENOBUFS 105 |
Definition at line 268 of file bsd_socket.h.
◆ ENOPROTOOPT
#define ENOPROTOOPT 92 |
Definition at line 264 of file bsd_socket.h.
◆ ENOTCONN
#define ENOTCONN 107 |
Definition at line 270 of file bsd_socket.h.
◆ EOPNOTSUPP
#define EOPNOTSUPP 95 |
Definition at line 265 of file bsd_socket.h.
◆ ESHUTDOWN
#define ESHUTDOWN 108 |
Definition at line 271 of file bsd_socket.h.
◆ ETH_P_ALL
#define ETH_P_ALL 0x0000 |
Definition at line 106 of file bsd_socket.h.
◆ ETH_P_ARP
#define ETH_P_ARP 0x0806 |
Definition at line 108 of file bsd_socket.h.
◆ ETH_P_IP
#define ETH_P_IP 0x0800 |
Definition at line 107 of file bsd_socket.h.
◆ ETH_P_IPV6
#define ETH_P_IPV6 0x86DD |
Definition at line 109 of file bsd_socket.h.
◆ ETIMEDOUT
#define ETIMEDOUT 60 |
Definition at line 261 of file bsd_socket.h.
◆ EWOULDBLOCK
#define EWOULDBLOCK 11 |
Definition at line 257 of file bsd_socket.h.
◆ F_GETFL
#define F_GETFL 3 |
Definition at line 214 of file bsd_socket.h.
◆ F_SETFL
#define F_SETFL 4 |
Definition at line 215 of file bsd_socket.h.
◆ FD_CLR
#define FD_CLR | ( | s, | |
fds | |||
) | socketFdClr(fds, s) |
Definition at line 601 of file bsd_socket.h.
◆ FD_ISSET
#define FD_ISSET | ( | s, | |
fds | |||
) | socketFdIsSet(fds, s) |
Definition at line 602 of file bsd_socket.h.
◆ FD_SET
#define FD_SET | ( | s, | |
fds | |||
) | socketFdSet(fds, s) |
Definition at line 600 of file bsd_socket.h.
◆ FD_SETSIZE
#define FD_SETSIZE 8 |
Definition at line 43 of file bsd_socket.h.
◆ FD_ZERO
#define FD_ZERO | ( | fds | ) | socketFdZero(fds) |
Definition at line 599 of file bsd_socket.h.
◆ FIONBIO
#define FIONBIO 126 |
Definition at line 208 of file bsd_socket.h.
◆ FIONREAD
#define FIONREAD 127 |
Definition at line 209 of file bsd_socket.h.
◆ FIONSPACE
#define FIONSPACE 120 |
Definition at line 211 of file bsd_socket.h.
◆ FIONWRITE
#define FIONWRITE 121 |
Definition at line 210 of file bsd_socket.h.
◆ HOST_NOT_FOUND
#define HOST_NOT_FOUND 1 |
Definition at line 276 of file bsd_socket.h.
◆ IF_NAMESIZE
#define IF_NAMESIZE (NET_MAX_IF_NAME_LEN + 1) |
Definition at line 291 of file bsd_socket.h.
◆ INADDR_ANY
#define INADDR_ANY 0x00000000 |
Definition at line 115 of file bsd_socket.h.
◆ INADDR_BROADCAST
#define INADDR_BROADCAST 0xFFFFFFFF |
Definition at line 117 of file bsd_socket.h.
◆ INADDR_LOOPBACK
#define INADDR_LOOPBACK 0x7F000001 |
Definition at line 116 of file bsd_socket.h.
◆ INADDR_NONE
#define INADDR_NONE ((in_addr_t) (-1)) |
Definition at line 282 of file bsd_socket.h.
◆ INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 40 |
Definition at line 288 of file bsd_socket.h.
◆ INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16 |
Definition at line 285 of file bsd_socket.h.
◆ IP_ADD_MEMBERSHIP
#define IP_ADD_MEMBERSHIP 35 |
Definition at line 162 of file bsd_socket.h.
◆ IP_ADD_SOURCE_MEMBERSHIP
#define IP_ADD_SOURCE_MEMBERSHIP 39 |
Definition at line 166 of file bsd_socket.h.
◆ IP_BLOCK_SOURCE
#define IP_BLOCK_SOURCE 38 |
Definition at line 165 of file bsd_socket.h.
◆ IP_DONTFRAG
#define IP_DONTFRAG 67 |
Definition at line 174 of file bsd_socket.h.
◆ IP_DROP_MEMBERSHIP
#define IP_DROP_MEMBERSHIP 36 |
Definition at line 163 of file bsd_socket.h.
◆ IP_DROP_SOURCE_MEMBERSHIP
#define IP_DROP_SOURCE_MEMBERSHIP 40 |
Definition at line 167 of file bsd_socket.h.
◆ IP_MULTICAST_IF
#define IP_MULTICAST_IF 32 |
Definition at line 159 of file bsd_socket.h.
◆ IP_MULTICAST_LOOP
#define IP_MULTICAST_LOOP 34 |
Definition at line 161 of file bsd_socket.h.
◆ IP_MULTICAST_TTL
#define IP_MULTICAST_TTL 33 |
Definition at line 160 of file bsd_socket.h.
◆ IP_PKTINFO
#define IP_PKTINFO 8 |
Definition at line 156 of file bsd_socket.h.
◆ IP_RECVTOS
#define IP_RECVTOS 13 |
Definition at line 158 of file bsd_socket.h.
◆ IP_RECVTTL
#define IP_RECVTTL 12 |
Definition at line 157 of file bsd_socket.h.
◆ IP_ROUTER_ALERT
#define IP_ROUTER_ALERT 5 |
Definition at line 155 of file bsd_socket.h.
◆ IP_TOS
#define IP_TOS 1 |
Definition at line 153 of file bsd_socket.h.
◆ IP_TTL
#define IP_TTL 2 |
Definition at line 154 of file bsd_socket.h.
◆ IP_UNBLOCK_SOURCE
#define IP_UNBLOCK_SOURCE 37 |
Definition at line 164 of file bsd_socket.h.
◆ IPPROTO_AH
#define IPPROTO_AH 51 |
Definition at line 102 of file bsd_socket.h.
◆ IPPROTO_ESP
#define IPPROTO_ESP 50 |
Definition at line 101 of file bsd_socket.h.
◆ IPPROTO_ICMP
#define IPPROTO_ICMP 1 |
Definition at line 96 of file bsd_socket.h.
◆ IPPROTO_ICMPV6
#define IPPROTO_ICMPV6 58 |
Definition at line 103 of file bsd_socket.h.
◆ IPPROTO_IGMP
#define IPPROTO_IGMP 2 |
Definition at line 97 of file bsd_socket.h.
◆ IPPROTO_IP
#define IPPROTO_IP 0 |
Definition at line 95 of file bsd_socket.h.
◆ IPPROTO_IPV6
#define IPPROTO_IPV6 41 |
Definition at line 100 of file bsd_socket.h.
◆ IPPROTO_TCP
#define IPPROTO_TCP 6 |
Definition at line 98 of file bsd_socket.h.
◆ IPPROTO_UDP
#define IPPROTO_UDP 17 |
Definition at line 99 of file bsd_socket.h.
◆ IPTOS_LOWDELAY
#define IPTOS_LOWDELAY 0x10 |
Definition at line 199 of file bsd_socket.h.
◆ IPTOS_RELIABILITY
#define IPTOS_RELIABILITY 0x04 |
Definition at line 201 of file bsd_socket.h.
◆ IPTOS_THROUGHPUT
#define IPTOS_THROUGHPUT 0x08 |
Definition at line 200 of file bsd_socket.h.
◆ IPV6_ADD_MEMBERSHIP
#define IPV6_ADD_MEMBERSHIP 20 |
Definition at line 181 of file bsd_socket.h.
◆ IPV6_DONTFRAG
#define IPV6_DONTFRAG 62 |
Definition at line 187 of file bsd_socket.h.
◆ IPV6_DROP_MEMBERSHIP
#define IPV6_DROP_MEMBERSHIP 21 |
Definition at line 182 of file bsd_socket.h.
◆ IPV6_HOPLIMIT
#define IPV6_HOPLIMIT 52 |
Definition at line 186 of file bsd_socket.h.
◆ IPV6_MULTICAST_HOPS
#define IPV6_MULTICAST_HOPS 18 |
Definition at line 179 of file bsd_socket.h.
◆ IPV6_MULTICAST_IF
#define IPV6_MULTICAST_IF 17 |
Definition at line 178 of file bsd_socket.h.
◆ IPV6_MULTICAST_LOOP
#define IPV6_MULTICAST_LOOP 19 |
Definition at line 180 of file bsd_socket.h.
◆ IPV6_PKTINFO
#define IPV6_PKTINFO 50 |
Definition at line 184 of file bsd_socket.h.
◆ IPV6_RECVHOPLIMIT
#define IPV6_RECVHOPLIMIT 51 |
Definition at line 185 of file bsd_socket.h.
◆ IPV6_RECVTCLASS
#define IPV6_RECVTCLASS 66 |
Definition at line 188 of file bsd_socket.h.
◆ IPV6_TCLASS
#define IPV6_TCLASS 67 |
Definition at line 189 of file bsd_socket.h.
◆ IPV6_UNICAST_HOPS
#define IPV6_UNICAST_HOPS 16 |
Definition at line 177 of file bsd_socket.h.
◆ IPV6_V6ONLY
#define IPV6_V6ONLY 26 |
Definition at line 183 of file bsd_socket.h.
◆ MCAST_BLOCK_SOURCE
#define MCAST_BLOCK_SOURCE 43 |
Definition at line 169 of file bsd_socket.h.
◆ MCAST_EXCLUDE
#define MCAST_EXCLUDE 0 |
Definition at line 204 of file bsd_socket.h.
◆ MCAST_INCLUDE
#define MCAST_INCLUDE 1 |
Definition at line 205 of file bsd_socket.h.
◆ MCAST_JOIN_GROUP
#define MCAST_JOIN_GROUP 42 |
Definition at line 168 of file bsd_socket.h.
◆ MCAST_JOIN_SOURCE_GROUP
#define MCAST_JOIN_SOURCE_GROUP 46 |
Definition at line 172 of file bsd_socket.h.
◆ MCAST_LEAVE_GROUP
#define MCAST_LEAVE_GROUP 45 |
Definition at line 171 of file bsd_socket.h.
◆ MCAST_LEAVE_SOURCE_GROUP
#define MCAST_LEAVE_SOURCE_GROUP 47 |
Definition at line 173 of file bsd_socket.h.
◆ MCAST_UNBLOCK_SOURCE
#define MCAST_UNBLOCK_SOURCE 44 |
Definition at line 170 of file bsd_socket.h.
◆ MSG_CTRUNC
#define MSG_CTRUNC 0x0008 |
Definition at line 122 of file bsd_socket.h.
◆ MSG_DONTROUTE
#define MSG_DONTROUTE 0x0004 |
Definition at line 121 of file bsd_socket.h.
◆ MSG_DONTWAIT
#define MSG_DONTWAIT 0x0040 |
Definition at line 123 of file bsd_socket.h.
◆ MSG_PEEK
#define MSG_PEEK 0x0002 |
Definition at line 120 of file bsd_socket.h.
◆ MSG_WAITALL
#define MSG_WAITALL 0x0100 |
Definition at line 124 of file bsd_socket.h.
◆ NETDB_SUCCESS
#define NETDB_SUCCESS 0 |
Definition at line 275 of file bsd_socket.h.
◆ NI_DGRAM
#define NI_DGRAM 0x10 |
Definition at line 234 of file bsd_socket.h.
◆ NI_NAMEREQD
#define NI_NAMEREQD 0x04 |
Definition at line 232 of file bsd_socket.h.
◆ NI_NOFQDN
#define NI_NOFQDN 0x01 |
Definition at line 230 of file bsd_socket.h.
◆ NI_NUMERICHOST
#define NI_NUMERICHOST 0x02 |
Definition at line 231 of file bsd_socket.h.
◆ NI_NUMERICSERV
#define NI_NUMERICSERV 0x08 |
Definition at line 233 of file bsd_socket.h.
◆ NO_ADDRESS
#define NO_ADDRESS 4 |
Definition at line 279 of file bsd_socket.h.
◆ NO_RECOVERY
#define NO_RECOVERY 3 |
Definition at line 278 of file bsd_socket.h.
◆ O_NONBLOCK
#define O_NONBLOCK 0x0004 |
Definition at line 218 of file bsd_socket.h.
◆ PF_INET
#define PF_INET AF_INET |
Definition at line 85 of file bsd_socket.h.
◆ PF_INET6
#define PF_INET6 AF_INET6 |
Definition at line 86 of file bsd_socket.h.
◆ PF_PACKET
#define PF_PACKET AF_PACKET |
Definition at line 87 of file bsd_socket.h.
◆ PF_UNSPEC
#define PF_UNSPEC AF_UNSPEC |
Definition at line 84 of file bsd_socket.h.
◆ SD_BOTH
#define SD_BOTH 2 |
Definition at line 129 of file bsd_socket.h.
◆ SD_RECEIVE
#define SD_RECEIVE 0 |
Definition at line 127 of file bsd_socket.h.
◆ SD_SEND
#define SD_SEND 1 |
Definition at line 128 of file bsd_socket.h.
◆ SHUT_RD
#define SHUT_RD SD_RECEIVE |
Definition at line 132 of file bsd_socket.h.
◆ SHUT_RDWR
#define SHUT_RDWR SD_BOTH |
Definition at line 134 of file bsd_socket.h.
◆ SHUT_WR
#define SHUT_WR SD_SEND |
Definition at line 133 of file bsd_socket.h.
◆ SO_ACCEPTCONN
#define SO_ACCEPTCONN 30 |
Definition at line 150 of file bsd_socket.h.
◆ SO_BINDTODEVICE
#define SO_BINDTODEVICE 25 |
Definition at line 149 of file bsd_socket.h.
◆ SO_BROADCAST
#define SO_BROADCAST 6 |
Definition at line 141 of file bsd_socket.h.
◆ SO_DONTROUTE
#define SO_DONTROUTE 5 |
Definition at line 140 of file bsd_socket.h.
◆ SO_ERROR
#define SO_ERROR 4 |
Definition at line 139 of file bsd_socket.h.
◆ SO_KEEPALIVE
#define SO_KEEPALIVE 9 |
Definition at line 144 of file bsd_socket.h.
◆ SO_LINGER
#define SO_LINGER 13 |
Definition at line 146 of file bsd_socket.h.
◆ SO_NO_CHECK
#define SO_NO_CHECK 11 |
Definition at line 145 of file bsd_socket.h.
◆ SO_RCVBUF
#define SO_RCVBUF 8 |
Definition at line 143 of file bsd_socket.h.
◆ SO_RCVTIMEO
#define SO_RCVTIMEO 21 |
Definition at line 148 of file bsd_socket.h.
◆ SO_REUSEADDR
#define SO_REUSEADDR 2 |
Definition at line 137 of file bsd_socket.h.
◆ SO_SNDBUF
#define SO_SNDBUF 7 |
Definition at line 142 of file bsd_socket.h.
◆ SO_SNDTIMEO
#define SO_SNDTIMEO 20 |
Definition at line 147 of file bsd_socket.h.
◆ SO_TYPE
#define SO_TYPE 3 |
Definition at line 138 of file bsd_socket.h.
◆ SOCK_DGRAM
#define SOCK_DGRAM 2 |
Definition at line 91 of file bsd_socket.h.
◆ SOCK_RAW
#define SOCK_RAW 3 |
Definition at line 92 of file bsd_socket.h.
◆ SOCK_STREAM
#define SOCK_STREAM 1 |
Definition at line 90 of file bsd_socket.h.
◆ SOCKET_ERROR
#define SOCKET_ERROR (-1) |
Definition at line 238 of file bsd_socket.h.
◆ SOCKET_SUCCESS
#define SOCKET_SUCCESS 0 |
Definition at line 237 of file bsd_socket.h.
◆ SOL_SOCKET
#define SOL_SOCKET 0xFFFF |
Definition at line 112 of file bsd_socket.h.
◆ TCP_KEEPCNT
#define TCP_KEEPCNT 6 |
Definition at line 196 of file bsd_socket.h.
◆ TCP_KEEPIDLE
#define TCP_KEEPIDLE 4 |
Definition at line 194 of file bsd_socket.h.
◆ TCP_KEEPINTVL
#define TCP_KEEPINTVL 5 |
Definition at line 195 of file bsd_socket.h.
◆ TCP_MAXSEG
#define TCP_MAXSEG 2 |
Definition at line 193 of file bsd_socket.h.
◆ TCP_NODELAY
#define TCP_NODELAY 1 |
Definition at line 192 of file bsd_socket.h.
◆ TRY_AGAIN
#define TRY_AGAIN 2 |
Definition at line 277 of file bsd_socket.h.
Typedef Documentation
◆ ADDRINFO
◆ CMSGHDR
◆ FD_SET
◆ fd_set
◆ GROUP_REQ
◆ GROUP_SOURCE_REQ
typedef struct group_source_req GROUP_SOURCE_REQ |
Source-specific multicast group information (for IPv4/IPv6)
◆ HOSTENT
◆ IN6_ADDR
◆ IN6_PKTINFO
typedef struct in6_pktinfo IN6_PKTINFO |
IPv6 packet information.
◆ IN_ADDR
◆ in_addr_t
typedef uint32_t in_addr_t |
IPv4 address.
Definition at line 324 of file bsd_socket.h.
◆ IN_PKTINFO
typedef struct in_pktinfo IN_PKTINFO |
IPv4 packet information.
◆ in_port_t
typedef uint16_t in_port_t |
Port number.
Definition at line 317 of file bsd_socket.h.
◆ IP_MREQ
◆ IP_MREQ_SOURCE
typedef struct ip_mreq_source IP_MREQ_SOURCE |
Source-specific multicast group information (for IPv4 only)
◆ IPV6_MREQ
◆ LINGER
◆ MSGHDR
◆ PADDRINFO
◆ PCMSGHDR
◆ PFD_SET
◆ PGROUP_REQ
typedef struct group_req * PGROUP_REQ |
◆ PGROUP_SOURCE_REQ
typedef struct group_source_req * PGROUP_SOURCE_REQ |
◆ PHOSTENT
◆ PIN6_ADDR
◆ PIN6_PKTINFO
typedef struct in6_pktinfo * PIN6_PKTINFO |
◆ PIN_ADDR
◆ PIN_PKTINFO
typedef struct in_pktinfo * PIN_PKTINFO |
◆ PIP_MREQ
◆ PIP_MREQ_SOURCE
typedef struct ip_mreq_source * PIP_MREQ_SOURCE |
◆ PIPV6_MREQ
typedef struct ipv6_mreq * PIPV6_MREQ |
◆ PLINGER
◆ PMSGHDR
◆ PSOCKADDR
◆ PSOCKADDR_IN
typedef struct sockaddr_in * PSOCKADDR_IN |
◆ PSOCKADDR_IN6
typedef struct sockaddr_in6 * PSOCKADDR_IN6 |
◆ PSOCKADDR_STORAGE
typedef struct sockaddr_storage * PSOCKADDR_STORAGE |
◆ PTIMEVAL
◆ sa_family_t
typedef uint16_t sa_family_t |
Address family.
Definition at line 310 of file bsd_socket.h.
◆ SOCKADDR
◆ SOCKADDR_IN
typedef struct sockaddr_in SOCKADDR_IN |
IPv4 address information.
◆ SOCKADDR_IN6
typedef struct sockaddr_in6 SOCKADDR_IN6 |
IPv6 address information.
◆ SOCKADDR_STORAGE
typedef struct sockaddr_storage SOCKADDR_STORAGE |
Socket address storage.
◆ socklen_t
Length type.
Definition at line 303 of file bsd_socket.h.
◆ TIMEVAL
Function Documentation
◆ accept()
Permit an incoming connection attempt on a socket.
- Parameters
-
[in] s Descriptor that identifies a socket in the listening state [out] addr Address of the connecting entity (optional) [in,out] addrlen Length in bytes of the address (optional)
- Returns
- If no error occurs, accept returns a descriptor for the new socket. Otherwise, it returns SOCKET_ERROR
Definition at line 360 of file bsd_socket.c.
◆ bind()
Associate a local address with a socket.
- Parameters
-
[in] s Descriptor identifying an unbound socket [in] addr Local address to assign to the bound socket [in] addrlen Length in bytes of the address
- Returns
- If no error occurs, bind returns SOCKET_SUCCESS. Otherwise, it returns SOCKET_ERROR
Definition at line 107 of file bsd_socket.c.
◆ closesocket()
The closesocket function closes an existing socket.
- Parameters
-
[in] s Descriptor that identifies a socket
- Returns
- If no error occurs, closesocket returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 3027 of file bsd_socket.c.
◆ connect()
Establish a connection to a specified socket.
- Parameters
-
[in] s Descriptor identifying an unconnected socket [in] addr Address to which the connection should be established [in] addrlen Length in bytes of the address
- Returns
- If no error occurs, connect returns SOCKET_SUCCESS. Otherwise, it returns SOCKET_ERROR
Definition at line 204 of file bsd_socket.c.
◆ fcntl()
Perform specific operation.
- Parameters
-
[in] s Descriptor that identifies a socket [in] cmd A command to perform on the socket [in] arg Argument value
- Returns
- If no error occurs, setsockopt returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 2933 of file bsd_socket.c.
◆ freeaddrinfo()
void freeaddrinfo | ( | struct addrinfo * | res | ) |
Free socket address structures.
- Parameters
-
[in] res Dynamically allocated list of socket address structures
Definition at line 3629 of file bsd_socket.c.
◆ getaddrinfo()
int_t getaddrinfo | ( | const char_t * | node, |
const char_t * | service, | ||
const struct addrinfo * | hints, | ||
struct addrinfo ** | res | ||
) |
Convert host and service names to socket address.
- Parameters
-
[in] node Host name or numerical network address [in] service Service name or decimal number [in] hints Criteria for selecting the socket address structures [out] res Dynamically allocated list of socket address structures
- Returns
- On success, zero is returned. On error, a non-zero value is returned
Definition at line 3389 of file bsd_socket.c.
◆ gethostbyname()
Host name resolution.
- Parameters
-
[in] name Name of the host to resolve
- Returns
- Pointer to the hostent structure or a NULL if an error occurs
Definition at line 3292 of file bsd_socket.c.
◆ gethostbyname_r()
struct hostent* gethostbyname_r | ( | const char_t * | name, |
struct hostent * | result, | ||
char_t * | buf, | ||
size_t | buflen, | ||
int_t * | h_errnop | ||
) |
Host name resolution (reentrant version)
- Parameters
-
[in] name Name of the host to resolve [in] result Pointer to a hostent structure where the function can store the host entry [out] buf Pointer to a temporary work buffer [in] buflen Length of the temporary work buffer [out] h_errnop Pointer to a location where the function can store an h_errno value if an error occurs
- Returns
- Pointer to the hostent structure or a NULL if an error occurs
Definition at line 3315 of file bsd_socket.c.
◆ gethostname()
Get system host name.
- Parameters
-
[out] name Output buffer where to store the system host name [in] len Length of the buffer, in bytes
- Returns
- On success, zero is returned. On error, -1 is returned
Definition at line 3251 of file bsd_socket.c.
◆ getipv4sourcefilter()
int_t getipv4sourcefilter | ( | int_t | s, |
struct in_addr | interface, | ||
struct in_addr | group, | ||
uint32_t * | fmode, | ||
uint_t * | numsrc, | ||
struct in_addr * | slist | ||
) |
Get multicast source filter (IPv4 only)
- Parameters
-
[in] s Descriptor that identifies a socket [in] interface Local IP address of the interface [in] group IP multicast address of the group [out] fmode Multicast filter mode (MCAST_INCLUDE or MCAST_EXCLUDE) [out] numsrc On input, the numsrc argument holds the number of source addresses that will fit in the slist array. On output, the numsrc argument will hold the total number of sources in the filter [out] slist Buffer into which an array of IP addresses of included or excluded (depending on the filter mode) sources will be written. If numsrc was 0 on input, a NULL pointer may be supplied
- Returns
- If no error occurs, setipv4sourcefilter returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 2414 of file bsd_socket.c.
◆ getnameinfo()
int_t getnameinfo | ( | const struct sockaddr * | addr, |
socklen_t | addrlen, | ||
char_t * | host, | ||
size_t | hostlen, | ||
char_t * | serv, | ||
size_t | servlen, | ||
int | flags | ||
) |
Convert a socket address to a corresponding host and service.
- Parameters
-
[in] addr Generic socket address structure [in] addrlen Length in bytes of the address [out] host Output buffer where to store the host name [in] hostlen Length of the host name buffer, in bytes [out] serv Output buffer where to store the service name [in] servlen Length of the service name buffer, in bytes [in] flags Set of flags that influences the behavior of this function
- Returns
- On success, zero is returned. On error, a non-zero value is returned
Definition at line 3658 of file bsd_socket.c.
◆ getpeername()
Retrieves the address of the peer to which a socket is connected.
- Parameters
-
[in] s Descriptor identifying a socket [out] addr Address of the peer [in,out] addrlen Length in bytes of the address
- Returns
- If no error occurs, getpeername returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 1572 of file bsd_socket.c.
◆ getsockname()
Retrieves the local name for a socket.
- Parameters
-
[in] s Descriptor identifying a socket [out] addr Address of the socket [in,out] addrlen Length in bytes of the address
- Returns
- If no error occurs, getsockname returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 1476 of file bsd_socket.c.
◆ getsockopt()
The getsockopt function retrieves a socket option.
- Parameters
-
[in] s Descriptor that identifies a socket [in] level The level at which the option is defined [in] optname The socket option for which the value is to be retrieved [out] optval A pointer to the buffer in which the value for the requested option is to be returned [in,out] optlen The size, in bytes, of the buffer pointed to by the optval parameter
- Returns
- If no error occurs, getsockopt returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 2024 of file bsd_socket.c.
◆ getsourcefilter()
int_t getsourcefilter | ( | int_t | s, |
uint32_t | interface, | ||
struct sockaddr * | group, | ||
socklen_t | grouplen, | ||
uint32_t * | fmode, | ||
uint_t * | numsrc, | ||
struct sockaddr_storage * | slist | ||
) |
Get multicast source filter.
- Parameters
-
[in] s Descriptor that identifies a socket [in] interface Local IP address of the interface [in] group IP multicast address of the group [out] fmode Multicast filter mode (MCAST_INCLUDE or MCAST_EXCLUDE) [out] numsrc On input, the numsrc argument holds the number of source addresses that will fit in the slist array. On output, the numsrc argument will hold the total number of sources in the filter [out] slist Buffer into which an array of IP addresses of included or excluded (depending on the filter mode) sources will be written. If numsrc was 0 on input, a NULL pointer may be supplied
- Returns
- If no error occurs, setipv4sourcefilter returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 2673 of file bsd_socket.c.
◆ if_indextoname()
Map an interface index into its corresponding name.
- Parameters
-
[in] ifindex Interface index [in] ifname Buffer of at least IF_NAMESIZE bytes
- Returns
- If ifindex is an interface index, then the function returns the value supplied in ifname, which points to a buffer now containing the interface name. Otherwise, the function returns a NULL pointer
Definition at line 3795 of file bsd_socket.c.
◆ if_nametoindex()
Map an interface name into its corresponding index.
- Parameters
-
[in] ifname Name of the interface
- Returns
- If ifname is the name of an interface, then the function returns the interface index corresponding to name ifname. Otherwise, the function returns zero
Definition at line 3756 of file bsd_socket.c.
◆ inet_addr()
Convert a dot-decimal string into binary data in network byte order.
- Parameters
-
[in] cp NULL-terminated string representing the IPv4 address
- Returns
- Binary data in network byte order
Definition at line 3833 of file bsd_socket.c.
◆ inet_aton()
Convert a dot-decimal string into binary form.
- Parameters
-
[in] cp NULL-terminated string representing the IPv4 address [out] inp Binary data in network byte order
- Returns
- The function returns non-zero if the address is valid, zero if not
Definition at line 3867 of file bsd_socket.c.
◆ inet_ntoa()
Convert a binary IPv4 address to dot-decimal notation.
- Parameters
-
[in] in Binary representation of the IPv4 address
- Returns
- Pointer to the formatted string
Definition at line 3902 of file bsd_socket.c.
◆ inet_ntoa_r()
Convert a binary IPv4 address to dot-decimal notation (reentrant version)
- Parameters
-
[in] in Binary representation of the IPv4 address [out] buf Pointer to the buffer where to format the string [in] buflen Number of bytes available in the buffer
- Returns
- Pointer to the formatted string
Definition at line 3919 of file bsd_socket.c.
◆ inet_ntop()
Convert an IPv4 or IPv6 address from binary to text.
- Parameters
-
[in] af Address family [in] src Binary representation of the IP address [out] dst NULL-terminated string representing the IP address [in] size Number of bytes available in the buffer
- Returns
- On success, the function returns a pointer to the formatted string. NULL is returned if there was an error
Definition at line 4019 of file bsd_socket.c.
◆ inet_pton()
Convert an IPv4 or IPv6 address from text to binary form.
- Parameters
-
[in] af Address family [in] src NULL-terminated string representing the IP address [out] dst Binary representation of the IP address
- Returns
- The function returns 1 on success. 0 is returned if the address is not valid. If the address family is not valid, -1 is returned
Definition at line 3947 of file bsd_socket.c.
◆ ioctlsocket()
Control the I/O mode of a socket.
- Parameters
-
[in] s Descriptor that identifies a socket [in] cmd A command to perform on the socket [in,out] arg A pointer to a parameter
- Returns
- If no error occurs, setsockopt returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 2833 of file bsd_socket.c.
◆ listen()
Place a socket in the listening state.
Place a socket in a state in which it is listening for an incoming connection
- Parameters
-
[in] s Descriptor identifying a bound, unconnected socket [in] backlog Maximum length of the queue of pending connections
- Returns
- If no error occurs, listen returns SOCKET_SUCCESS. Otherwise, it returns SOCKET_ERROR
Definition at line 322 of file bsd_socket.c.
◆ recv()
Receive data from a connected socket.
- Parameters
-
[in] s Descriptor that identifies a connected socket [out] data Buffer where to store the incoming data [in] size Maximum number of bytes that can be received [in] flags Set of flags that influences the behavior of this function
- Returns
- If no error occurs, recv returns the number of bytes received. If the connection has been gracefully closed, the return value is zero. Otherwise, a value of SOCKET_ERROR is returned
Definition at line 917 of file bsd_socket.c.
◆ recvfrom()
int_t recvfrom | ( | int_t | s, |
void * | data, | ||
size_t | size, | ||
int_t | flags, | ||
struct sockaddr * | addr, | ||
socklen_t * | addrlen | ||
) |
Receive a datagram.
- Parameters
-
[in] s Descriptor that identifies a socket [out] data Buffer where to store the incoming data [in] size Maximum number of bytes that can be received [in] flags Set of flags that influences the behavior of this function [out] addr Source address upon return (optional) [in,out] addrlen Length in bytes of the address (optional)
- Returns
- If no error occurs, recvfrom returns the number of bytes received. Otherwise, a value of SOCKET_ERROR is returned
Definition at line 989 of file bsd_socket.c.
◆ recvmsg()
Receive a message.
- Parameters
-
[in] s Descriptor that identifies a socket [in,out] msg Pointer to the structure describing the message [in] flags Set of flags that influences the behavior of this function
- Returns
- If no error occurs, recvmsg returns the number of bytes received. Otherwise, a value of SOCKET_ERROR is returned
Definition at line 1115 of file bsd_socket.c.
◆ select()
int_t select | ( | int_t | nfds, |
fd_set * | readfds, | ||
fd_set * | writefds, | ||
fd_set * | exceptfds, | ||
const struct timeval * | timeout | ||
) |
Determine the status of one or more sockets.
The select function determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O
- Parameters
-
[in] nfds Unused parameter included only for compatibility with Berkeley socket [in,out] readfds An optional pointer to a set of sockets to be checked for readability [in,out] writefds An optional pointer to a set of sockets to be checked for writability [in,out] exceptfds An optional pointer to a set of sockets to be checked for errors [in] timeout The maximum time for select to wait. Set the timeout parameter to null for blocking operations
- Returns
- The select function returns the total number of socket handles that are ready and contained in the fd_set structures, zero if the time limit expired, or SOCKET_ERROR if an error occurred
Definition at line 3069 of file bsd_socket.c.
◆ send()
Send data to a connected socket.
- Parameters
-
[in] s Descriptor that identifies a connected socket [in] data Pointer to a buffer containing the data to be transmitted [in] length Number of bytes to be transmitted [in] flags Set of flags that influences the behavior of this function
- Returns
- If no error occurs, send returns the total number of bytes sent, which can be less than the number requested to be sent in the length parameter. Otherwise, a value of SOCKET_ERROR is returned
Definition at line 459 of file bsd_socket.c.
◆ sendmsg()
Send a message.
- Parameters
-
[in] s Descriptor that identifies a socket [in] msg Pointer to the structure describing the message [in] flags Set of flags that influences the behavior of this function
- Returns
- If no error occurs, sendmsg returns the total number of bytes sent, which can be less than the number requested to be sent in the length parameter. Otherwise, a value of SOCKET_ERROR is returned
Definition at line 661 of file bsd_socket.c.
◆ sendto()
int_t sendto | ( | int_t | s, |
const void * | data, | ||
size_t | length, | ||
int_t | flags, | ||
const struct sockaddr * | addr, | ||
socklen_t | addrlen | ||
) |
Send a datagram to a specific destination.
- Parameters
-
[in] s Descriptor that identifies a socket [in] data Pointer to a buffer containing the data to be transmitted [in] length Number of bytes to be transmitted [in] flags Set of flags that influences the behavior of this function [in] addr Destination address [in] addrlen Length in bytes of the destination address
- Returns
- If no error occurs, sendto returns the total number of bytes sent, which can be less than the number requested to be sent in the length parameter. Otherwise, a value of SOCKET_ERROR is returned
Definition at line 535 of file bsd_socket.c.
◆ setipv4sourcefilter()
int_t setipv4sourcefilter | ( | int_t | s, |
struct in_addr | interface, | ||
struct in_addr | group, | ||
uint32_t | fmode, | ||
uint_t | numsrc, | ||
struct in_addr * | slist | ||
) |
Set multicast source filter (IPv4 only)
- Parameters
-
[in] s Descriptor that identifies a socket [in] interface Local IP address of the interface [in] group IP multicast address of the group [in] fmode Multicast filter mode (MCAST_INCLUDE or MCAST_EXCLUDE) [in] numsrc Number of source addresses in the slist array [in] slist Array of IP addresses of sources to include or exclude depending on the filter mode
- Returns
- If no error occurs, setipv4sourcefilter returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 2313 of file bsd_socket.c.
◆ setsockopt()
The setsockopt function sets a socket option.
- Parameters
-
[in] s Descriptor that identifies a socket [in] level The level at which the option is defined [in] optname The socket option for which the value is to be set [in] optval A pointer to the buffer in which the value for the requested option is specified [in] optlen The size, in bytes, of the buffer pointed to by the optval parameter
- Returns
- If no error occurs, setsockopt returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 1672 of file bsd_socket.c.
◆ setsourcefilter()
int_t setsourcefilter | ( | int_t | s, |
uint32_t | interface, | ||
struct sockaddr * | group, | ||
socklen_t | grouplen, | ||
uint32_t | fmode, | ||
uint_t | numsrc, | ||
struct sockaddr_storage * | slist | ||
) |
Set multicast source filter.
- Parameters
-
[in] s Descriptor that identifies a socket [in] interface Local IP address of the interface [in] group IP multicast address of the group [in] fmode Multicast filter mode (MCAST_INCLUDE or MCAST_EXCLUDE) [in] numsrc Number of source addresses in the slist array [in] slist Array of IP addresses of sources to include or exclude depending on the filter mode
- Returns
- If no error occurs, setipv4sourcefilter returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 2508 of file bsd_socket.c.
◆ shutdown()
The shutdown function disables sends or receives on a socket.
- Parameters
-
[in] s Descriptor that identifies a socket [in] how A flag that describes what types of operation will no longer be allowed
- Returns
- If no error occurs, shutdown returns SOCKET_SUCCESS Otherwise, it returns SOCKET_ERROR
Definition at line 2991 of file bsd_socket.c.
◆ socket()
Create a socket that is bound to a specific transport service provider.
- Parameters
-
[in] family Address family [in] type Type specification for the new socket [in] protocol Protocol to be used
- Returns
- On success, a file descriptor for the new socket is returned. On failure, SOCKET_ERROR is returned
Definition at line 65 of file bsd_socket.c.
◆ socketCmsgFirstHdr()
Get first ancillary data header.
- Parameters
-
[in] msg Pointer to the message header
- Returns
- Pointer to the first ancillary data header
Definition at line 50 of file bsd_socket_misc.c.
◆ socketCmsgNextHdr()
Get next ancillary data header.
- Parameters
-
[in] msg Pointer to the message header [in] cmsg Pointer to the current ancillary data header
- Returns
- Pointer to the next ancillary data header
Definition at line 80 of file bsd_socket_misc.c.
◆ socketFdClr()
Remove a descriptor from an existing set.
- Parameters
-
[in] fds Pointer to a descriptor set [in] s Descriptor that identifies the socket to remove
Definition at line 160 of file bsd_socket_misc.c.
◆ socketFdIsSet()
Check whether a descriptor is set.
- Parameters
-
[in] fds Pointer to a descriptor set [in] s Descriptor that identifies the socket to test
- Returns
- Nonzero if s is a member of the set. Otherwise, zero
Definition at line 194 of file bsd_socket_misc.c.
◆ socketFdSet()
Add a descriptor to an existing set.
- Parameters
-
[in] fds Pointer to a descriptor set [in] s Descriptor that identifies the socket to add
Definition at line 131 of file bsd_socket_misc.c.
◆ socketFdZero()
void socketFdZero | ( | fd_set * | fds | ) |
Initializes a descriptor set.
- Parameters
-
[in] fds Pointer to a descriptor set
Definition at line 118 of file bsd_socket_misc.c.
Variable Documentation
◆ in6addr_any
|
extern |
Definition at line 1 of file bsd_socket.c.
◆ in6addr_loopback
|
extern |
Definition at line 1 of file bsd_socket.c.