28#ifndef SWILIB_LINUX_SIMULATOR
34#define INADDR_ANY (uint32_t) 0x00000000
35#define INADDR_BROADCAST (uint32_t) 0xffffffff
37#define INET_ADDRSTRLEN 16
38#define MAX_IPv4_STR_LEN 16
39#define MAX_IPv6_STR_LEN 64
44#define IP_ADDR(A, B, C, D) (((unsigned long)A << 24) | ((unsigned long)B << 16) | ((unsigned long) C << 8) | ((unsigned long) D << 0))
202int
socket(
int domain,
int type,
int protocol)
345int getsockopt(
int sock,
int level,
int option,
void *value,
int *len)
#define __swi_end(number, func, call)
#define __swi_begin(number)
#define ioctlsocket(a, b, c)
struct ENIP_SOCKET ENIP_SOCKET
ENIP socket.
uint16_t sa_family
address family
char * h_name
Official name of host.
short h_addrtype
Always AF_INET.
struct in_addr sin_addr
IP value, use htonl or inet_addr (old name: ip)
char ** h_addr_list
List of addresses.
sa_family_t sin_family
AF_INET (old name: family)
char ** h_aliases
Alias list.
in_port_t sin_port
Port value, use htons (old name: port)
char sa_data[14]
address value
int shutdown(int socket, int how)
Shutdown.
int * socklasterr(void)
Pointer to the last socket error.
int setsockopt(int sock, int level, int option, const void *value, int len)
Set a socket option.
uint16_t sa_family_t
Address family.
uint16_t htons(uint16_t p)
Convert host to network order (unsigned short).
int send(int socket, const void *buf, int len, int flags)
Send a message on a socket.
static uint16_t ntohs(uint16_t p)
Convert network to host order.
int available0(int socket)
Get available bytes for reading in the socket.
uint32_t socklen_t
Socket address length type definition.
int getsockname(int sock, SOCK_ADDR *addr, int *len)
Read the local address of a socket.
in_addr_t inet_addr(const char *ip)
Convert the string IP address to the numeric format.
int bind(int socket, const struct sockaddr *address, socklen_t address_len)
Bind socket to the address.
SockFamilyID
Socket family types.
int recv(int socket, void *buf, int len, int flags)
Receive data on a socket.
int listen(int sock, int backlog)
Start listening for incoming TCP connections.
int getsockopt(int sock, int level, int option, void *value, int *len)
Read a socket option.
int async_gethostbyname(const char *name, void *response, int *req_id)
Resolve domain name.
uint32_t htonl(uint32_t p)
Convert host to network order (unsigned int).
uint16_t in_port_t
Port value.
uint32_t in_addr_t
Internet address.
int ENIP_GetNativeSocket(int sock, ENIP_SOCKET **native)
Look up the native ENIP object for a socket descriptor.
SockShutdownTypeID
Socket shutdown types.
int getpeername(int sock, SOCK_ADDR *addr, int *len)
Read the remote address of a connected socket.
struct hostent * gethostbyname(const char *name)
Resolve a host name synchronously.
uint32_t str2ip(const char *ip)
Convert the string IP address to the numeric format.
int connect(int socket, const struct sockaddr *address, socklen_t address_len)
Connect socket to the address.
int socket(int domain, int type, int protocol)
static uint32_t ntohl(uint32_t p)
SockProtocolID
Internet protocols.
@ AF_INET
Internet IP Protocol.
@ SHUT_RD
shut down the reading side
@ SHUT_WR
shut down the writing side
@ SHUT_RDWR
shut down both sides
@ IPPROTO_IP
Dummy for IP.
Internet address (a structure for historical reasons)
Socket address, internet style.