![]() |
WE310F5
39.00.000
|
general Socket support More...
Go to the source code of this file.
Data Structures | |
struct | M2MB_SOCKET_BSD_LINGER |
struct | M2MB_SOCKET_BSD_SOCKADDR |
struct | M2MB_SOCKET_BSD_IN_ADDR |
struct | M2MB_SOCKET_BSD_IN6_ADDR |
Structure for storing IPV6. More... | |
struct | M2MB_SOCKET_BSD_IPV6_ADDR |
Structure for storing IPV6. More... | |
struct | M2MB_SOCKET_BSD_SOCKADDR_IN |
struct | M2MB_SOCKET_BSD_SOCKADDR_IN6 |
struct | M2MB_SOCKET_BSD_HOSTENT |
struct | M2MB_SOCKET_BSD_TIMEVAL |
struct | M2MB_SOCKET_BSD_FD_SET |
struct | M2MB_IP6_ADDR |
IPv6 Internet address. More... | |
struct | M2MB_IP_MREQ |
Argument structure for M2MB_SOCKET_BSD_IP_ADD_MEMBERSHIP and M2MB_SOCKET_BSD_IP_DROP_MEMBERSHIP. More... | |
struct | M2MB_IP46_ADDR |
Socket IPv4/IPv6 Internet address union. More... | |
general Socket support
we866e4/epl/inc/nwk/m2mb_socket.h
socket APIs from BSD and Linux
Definition in file m2mb_socket.h.
#define addr16_s v6_v.addr16 |
Definition at line 306 of file m2mb_socket.h.
#define addr32_s v6_v.addr32 |
Definition at line 307 of file m2mb_socket.h.
#define Addr4 a.addr4 |
Definition at line 399 of file m2mb_socket.h.
#define Addr6 a.addr6 |
Definition at line 400 of file m2mb_socket.h.
#define addr8_s v6_v.addr8 |
Definition at line 305 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_AF_INET 2 |
Address Family IPv4
Definition at line 55 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_AF_INET6 3 |
Address Family IPv6
Definition at line 56 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_AF_INET_DUAL46 4 |
Address Family IPv4 and IPv6
Definition at line 57 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_AF_PACKET 5 |
Address family is packet.
Definition at line 58 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_AF_UNSPEC 0 |
M2M Socket Address Families Unspecified Address Family
Definition at line 54 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EADDRINUSE 20 |
Address is already in use.
Definition at line 221 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EADDRNOTAVAIL 19 |
Cannot assign the requested address.
Definition at line 220 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EAFNOSUPPORT 21 |
Address family is not supported by the protocol family.
Definition at line 222 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EALREADY 10 |
Operation is already in progress.
Definition at line 211 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EBADF 9 |
An invalid descriptor was specified.
Definition at line 210 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ECONNABORTED 5 |
Software caused a connection abort.
Definition at line 205 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ECONNREFUSED 7 |
Connection was refused.
Definition at line 207 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ECONNRESET 8 |
Connection was reset by a peer.
Definition at line 208 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EDESTADDRREQ 14 |
Destination address is required.
Definition at line 215 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EFAULT 29 |
Bad address.
Definition at line 228 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EHAVEOOB 17 |
Out of band.
Definition at line 218 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EIEIO 27 |
I/O error.
Definition at line 226 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EINPROGRESS 22 |
Operation is now in progress.
Definition at line 223 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EINVAL 11 |
Invalid argument was passed.
Definition at line 212 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EISCONN 3 |
Socket is already connected.
Definition at line 203 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ELOWER 23 |
Lower layer (IP) error.
Definition at line 224 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EMSGSIZE 12 |
Message is too long.
Definition at line 213 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ENETUNREACH 30 |
Network is unreachable.
Definition at line 229 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ENOBUFS 1 |
No buffer space is available.
Definition at line 201 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ENOMEM 18 |
No memory is available.
Definition at line 219 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ENOPROTOOPT 16 |
Protocol is not available.
Definition at line 217 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ENOTCONN 9 |
Socket is not connected.
Definition at line 209 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ENOTSOCK 24 |
Socket operation is on a nonsocket.
Definition at line 225 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EOPNOTSUPP 4 |
Operation is not supported.
Definition at line 204 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EPIPE 13 |
Local end has been shut down on a connection-oriented socket.
Definition at line 214 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ESHUTDOWN 15 |
Cannot send after a socket shutdown.
Definition at line 216 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ETIMEDOUT 2 |
Operation timed out.
Definition at line 202 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_ETOOMANYREFS 28 |
Too many references.
Definition at line 227 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_EWOULDBLOCK 6 |
The socket is marked nonblocking and the requested operation would block.
Definition at line 206 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_FD_SETSIZE 32 |
FD set size used by M2MB_SOCKET_bsd_select().
Definition at line 252 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_FIONBIO 1 |
command to select the blocking or non-blocking mode
Definition at line 192 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_FIONREAD 0 |
M2MB Socket I/O control options for m2mb_socket_bsd_ioctl() command to get the number of bytes to read
Definition at line 191 of file m2mb_socket.h.
#define m2mb_socket_bsd_htonl | ( | l | ) |
Conversion between host and network byte order.
Converts the unsigned integer x from host byte order to network byte order.
[in] | l | Unsigned integer to be converted |
Example
Definition at line 460 of file m2mb_socket.h.
#define m2mb_socket_bsd_htons | ( | s | ) | ((((s) >> 8) & 0xff) | (((s) << 8) & 0xff00)) |
Conversion between host and network byte order.
Converts the unsigned short integer x from host byte order to network byte order
[in] | s | Unsigned short integer to be converted |
Example
Definition at line 512 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_INADDR_ANY (UINT32) 0x00000000 |
END of M2M Socket Option Flags
M2M Internet address. Any internet address.
Definition at line 174 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_INADDR_BROADCAST (UINT32) 0xffffffff |
Broadcast internet address.
Definition at line 178 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_INADDR_LOOPBACK (UINT32) 0x7f000001 |
Loopback internet address.
Definition at line 176 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_ADD_MEMBERSHIP 3 |
Add an IPv4 group membership.
Definition at line 101 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_DROP_MEMBERSHIP 4 |
Drop an IPv4 group membership.
Definition at line 102 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_HDRINCL 2 |
IP header is included with the data.
Definition at line 160 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_MULTICAST_IF 6 |
Interface multicast datagrams should be sent from
Definition at line 107 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_MULTICAST_LOOP 7 |
Enable/disable loopback for multicast.
Definition at line 108 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_MULTICAST_TTL 5 |
The TTL for subsequent multicast datagrams to be set to any value from 0 to 255
Definition at line 106 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_OPTIONS 1 |
For use with [gs]etsockopt() at IP_OPTIONS 'level'.
Definition at line 163 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_PKTINFO 8 |
Allows an application to enable or disable the return of packet information on an IPv4 socket
Definition at line 109 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_TOS 1 |
IPv4 type of service and precedence.
Definition at line 99 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_TTL 2 |
Changes the default value set by the TCP/IP service provider in the TTL field of the IP header in outgoing datagrams
Definition at line 100 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IP_TTL_OPT 4 |
IPv4 time to live.
Definition at line 161 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPPROTO_DFLT 0 |
M2M Socket Protocols Default protocol
Definition at line 65 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPPROTO_ICMP 1 |
Internet Control Message Protocol
Definition at line 68 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPPROTO_IP 0 |
For use with [gs]etsockopt() at IPPROTO_IP 'level'.
Definition at line 98 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPPROTO_IPV6 41 |
Option level for IPv6
Definition at line 111 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPPROTO_TCP 6 |
Transmission Control Protocol
IPPROTO_TCP option level
Definition at line 122 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPPROTO_TCP 6 |
Transmission Control Protocol
IPPROTO_TCP option level
Definition at line 122 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPPROTO_UDP 17 |
User Datagram Protocol
Definition at line 67 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPPROTO_UDPLITE 136 |
IPPROTO_UDPLITE option level
Definition at line 129 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_ADD_MEMBERSHIP M2MB_SOCKET_BSD_IPV6_JOIN_GROUP |
Add an IPv6 group membership.
Definition at line 119 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_DROP_MEMBERSHIP M2MB_SOCKET_BSD_IPV6_LEAVE_GROUP |
Drop an IPv6 group membership.
Definition at line 120 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_JOIN_GROUP 12 |
Join an IPv6 MC group.
Definition at line 117 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_LEAVE_GROUP 13 |
Leave an IPv6 MC group.
Definition at line 118 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_MULTICAST_HOPS 81 |
Set the number of hops.
Definition at line 157 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_MULTICAST_IF 80 |
Set the egress interface for multicast traffic.
Definition at line 156 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_MULTICAST_LOOP 82 |
Enable/disable loopback for multicast.
Definition at line 158 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_SCOPEID 14 |
IPv6 IF scope ID.
Definition at line 164 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_TCLASS 16 |
IPv6 traffic class.
Definition at line 166 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_IPV6_UNICAST_HOPS 15 |
IPv6 hop limit.
Definition at line 165 of file m2mb_socket.h.
#define m2mb_socket_bsd_ntohl | ( | l | ) | m2mb_socket_bsd_htonl(l) |
Conversion between host and network byte order.
Converts the unsigned integer x from network byte order to host byte order.
[in] | l | Unsigned integer to be converted |
Example
Definition at line 487 of file m2mb_socket.h.
#define m2mb_socket_bsd_ntohs | ( | s | ) | m2mb_socket_bsd_htons(s) |
Conversion between host and network byte order.
Converts the unsigned short integer x from network byte order to host byte order
[in] | s | Unsigned short integer to be converted |
Example
Definition at line 537 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_PF_INET 2 |
Internetwork: UDP, TCP, etc.
Definition at line 62 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_PF_UNSPEC 0 |
M2M Socket Protocol Families Unspecified Protocol Family
Definition at line 61 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SHUT_RD 0x00 |
M2M Socket constants for m2mb_socket_bsd_shutdown() Read socket
Definition at line 184 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SHUT_RDWR 0x02 |
Read Write socket
Definition at line 186 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SHUT_WR 0x01 |
Write socket
Definition at line 185 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_ACCEPTCONN 0x0002 |
Socket has had listen(), supported
Definition at line 76 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_BIGCWND 0x01000 |
Large initial TCP congenstion window.
Definition at line 140 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_BINDTODEVICE 0x100b |
bind to device interface
Definition at line 96 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_BIO 0x1015 |
Set socket to Blocking mode.
Definition at line 151 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_BROADCAST 0x0020 |
Permit sending of broadcast msgs, supported
Definition at line 80 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_CALLBACK 0x1017 |
Set/get the TCP zero_copy callback routine.
Definition at line 153 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_CONTIMEO 0x1009 |
connect timeout, Not supported
Definition at line 94 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_DEBUG 0x0001 |
M2M Socket Option Flags Turn on debugging info recording, Not supported
Definition at line 75 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_DONTLINGER (INT32)(~M2MB_SOCKET_BSD_SO_LINGER) /* Dont Linger, supported */ |
Definition at line 84 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_DONTROUTE 0x0010 |
Just use interface addresses, Not supported
Definition at line 79 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_ERROR 0x1007 |
Get error status and clear
Definition at line 92 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_FULLMSS 0x08000 |
Not used.
Definition at line 143 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_HDRINCL 0x02000 |
User access to the IP header for SOCK_RAW.
Definition at line 141 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_HOPCNT 0x1009 |
Not used.
Definition at line 145 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_KEEPALIVE 0x0008 |
Keep connections alive, not enabled by default
Definition at line 78 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_LINGER 0x0080 |
Linger on close if data present, supported
Definition at line 82 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_MAXMSG 0x1010 |
TCP max segment size (MSS).
Definition at line 146 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_MYADDR 0x1013 |
Return my IP address.
Definition at line 149 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_NBIO 0x1014 |
Set socket to Nonblocking mode.
Definition at line 150 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_NO_CHECK 0x1010 |
don't create UDP checksum
Definition at line 95 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_NONBLOCK 0x1016 |
Set/get the blocking mode via the optval parameter.
Definition at line 152 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_NOSLOWSTART 0x04000 |
Suppress slow start on this socket.
Definition at line 142 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_OOBINLINE 0x0100 |
Leave received OOB data in line, Not supported
Definition at line 83 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_RCVBUF 0x1002 |
Receive buffer size, supported
Definition at line 87 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_RCVLOWAT 0x1004 |
Receive low-water mark, Not supported
Definition at line 89 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_RCVTIMEO 0x1006 |
Receive timeout, supported
Definition at line 91 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_REUSEADDR 0x0004 |
Allow local address reuse, always set
Definition at line 77 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_REUSEPORT 0x0200 /* Unimplemented: allow local address & port reuse */ |
Definition at line 85 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_RXDATA 0x1011 |
Receive buffer size, supported
Definition at line 147 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_SNDBUF 0x1001 |
Send buffer size, Not supported
Definition at line 86 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_SNDLOWAT 0x1003 |
Send low-water mark, Not supported
Definition at line 88 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_SNDTIMEO 0x1005 |
Send timeout, supported
Definition at line 90 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_TCPSACK 0x00200 |
Allow TCP SACK (selective acknowledgment).
Definition at line 137 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_TIMESTAMP 0x00800 |
Set the TCP timestamp option.
Definition at line 139 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_TXDATA 0x1012 |
Send buffer size, supported
Definition at line 148 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_TYPE 0x1008 |
Get socket type, supported
Definition at line 93 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_UDPCALLBACK 0x1019 |
Set/get the UDP zero_copy callback routine. Not supported
Definition at line 154 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_USELOOPBACK 0x0040 |
Permit sending of broadcast msgs, Not supported
Definition at line 81 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SO_WINSCALE 0x00400 |
Set the scaling window option.
Definition at line 138 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SOCK_DGRAM 2 |
Datagram socket type used for UDP
Definition at line 50 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SOCK_RAW 3 |
Raw socket type
Definition at line 51 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SOCK_STREAM 1 |
M2M Socket Types Stream socket type used for TCP
Definition at line 49 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SOCKET_ERROR (-1) |
M2MB Socket Error Types
Errors can be retrieved via the m2mb_socket_errno()
Definition at line 199 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SOCKNOERROR 0 |
Definition at line 200 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_SOL_SOCKET (0xfff) |
Level number for m2mb_socket_bsd_get_sock_opt() and m2mb_socket_bsd_set_sock_opt() to apply to socket itself. options for socket level
Definition at line 73 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_TCP_KEEPALIVE 0x02 /* send KEEPALIVE probes when idle for pcb->keep_idle milliseconds */ |
Definition at line 124 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_TCP_KEEPCNT 0x05 /* Set pcb->keep_cnt - Use number of probes sent for get/setsockopt */ |
Definition at line 127 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_TCP_KEEPIDLE 0x03 /* Set pcb->keep_idle - Same as TCP_KEEPALIVE, but use seconds for get/setsockopt */ |
Definition at line 125 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_TCP_KEEPINTVL 0x04 /* Set pcb->keep_intvl - Use seconds for get/setsockopt */ |
Definition at line 126 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_TCP_NODELAY 0x01 |
Don't delay send to coalesce packets, supported
Definition at line 123 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_UDPLITE_RECV_CSCOV 0x02 /* minimal receiver checksum coverage */ |
Definition at line 134 of file m2mb_socket.h.
#define M2MB_SOCKET_BSD_UDPLITE_SEND_CSCOV 0x01 /* sender checksum coverage */ |
Definition at line 133 of file m2mb_socket.h.
#define M2MB_SOCKET_ERANGE 214 |
Definition at line 239 of file m2mb_socket.h.
#define M2MB_SOCKET_HOST_NOT_FOUND 210 |
Errors used by the DNS API functions, h_errno can be one of them
Definition at line 235 of file m2mb_socket.h.
#define M2MB_SOCKET_IPV6_CHECKSUM 7 /* RFC3542: calculate and insert the ICMPv6 checksum for raw sockets. */ |
Definition at line 115 of file m2mb_socket.h.
#define M2MB_SOCKET_IPV6_V6ONLY 27 /* RFC3493: boolean control to restrict AF_INET6 sockets to IPv6 communications only. */ |
Definition at line 116 of file m2mb_socket.h.
#define M2MB_SOCKET_MAX_SUPPORTED 16 |
Definition at line 258 of file m2mb_socket.h.
#define M2MB_SOCKET_MSG_DONTROUTE 0x14 |
Send without using routing tables.
Definition at line 247 of file m2mb_socket.h.
#define M2MB_SOCKET_MSG_DONTWAIT 0x08 |
Send/receive is nonblocking.
Definition at line 248 of file m2mb_socket.h.
#define M2MB_SOCKET_MSG_OOB 0x04 |
Send/receive out-of-band data.
Definition at line 245 of file m2mb_socket.h.
#define M2MB_SOCKET_MSG_PEEK 0x01 |
Peek at an incoming message.
Definition at line 246 of file m2mb_socket.h.
#define M2MB_SOCKET_MSG_ZEROCOPYSEND 0x1000 |
Send with zero-copy.
Definition at line 249 of file m2mb_socket.h.
#define M2MB_SOCKET_NO_DATA 211 |
Definition at line 236 of file m2mb_socket.h.
#define M2MB_SOCKET_NO_RECOVERY 212 |
Definition at line 237 of file m2mb_socket.h.
#define M2MB_SOCKET_TRY_AGAIN 213 |
Definition at line 238 of file m2mb_socket.h.
making an IP in the integer format.
Definition at line 263 of file m2mb_socket.h.
typedef struct M2MB_IP46_ADDR M2MB_IP46_ADDR_T |
Socket IPv4/IPv6 Internet address union.
typedef unsigned long M2MB_IP4_ADDR_T |
IPv4 Internet address.
Definition at line 371 of file m2mb_socket.h.
typedef struct M2MB_IP6_ADDR M2MB_IP6_ADDR_T |
IPv6 Internet address.
typedef struct M2MB_IP_MREQ M2MB_IP_MREQ_T |
Argument structure for M2MB_SOCKET_BSD_IP_ADD_MEMBERSHIP and M2MB_SOCKET_BSD_IP_DROP_MEMBERSHIP.
TCP zero-copy application RX callback handler.
Definition at line 406 of file m2mb_socket.h.
typedef INT32(* M2MB_NET_UDP_ZEROCOPY_CB) (void *so, void *packet, INT32 errcode, void *from, INT32 family) |
UDP zero-copy application RX callback handler.
Definition at line 420 of file m2mb_socket.h.
typedef struct M2MB_SOCKET_BSD_FD_SET M2MB_SOCKET_BSD_FD_SET_T |
Note: This is already under investigation.
FD set used by m2mb_socket_bsd_select(). Users please do not access to this structure directly, instead use the APIs m2mb_socket_bsd_fd_zero_func, m2mb_socket_bsd_fd_set_func, m2mb_socket_bsd_fd_clr_func,m2mb_socket_bsd_fd_isset_func
typedef struct M2MB_SOCKET_BSD_HOSTENT M2MB_SOCKET_BSD_HOSTENT_T |
Structure returned by network data base library.
typedef struct M2MB_SOCKET_BSD_IN6_ADDR M2MB_SOCKET_BSD_IN6_ADDR_T |
Structure for storing IPV6.
typedef struct M2MB_SOCKET_BSD_IN_ADDR M2MB_SOCKET_BSD_IN_ADDR_T |
typedef struct M2MB_SOCKET_BSD_IPV6_ADDR M2MB_SOCKET_BSD_IPV6_ADDR_T |
Structure for storing IPV6.
typedef struct M2MB_SOCKET_BSD_LINGER M2MB_SOCKET_BSD_LINGER_T |
Structure used for manipulating linger option.
typedef struct M2MB_SOCKET_BSD_SOCKADDR_IN6 M2MB_SOCKET_BSD_SOCKADDR_IN6_T |
IPV6 Socket address, internet style.
typedef struct M2MB_SOCKET_BSD_SOCKADDR_IN M2MB_SOCKET_BSD_SOCKADDR_IN_T |
IPV4Socket address, internet style.
typedef struct M2MB_SOCKET_BSD_SOCKADDR M2MB_SOCKET_BSD_SOCKADDR_T |
Structure used by TCP/IP stack to store most addresses.
typedef iHANDLE M2MB_SOCKET_BSD_SOCKET |
Definition at line 267 of file m2mb_socket.h.
typedef struct M2MB_SOCKET_BSD_TIMEVAL M2MB_SOCKET_BSD_TIMEVAL_T |
Structure used in M2MB_SOCKET_bsd_select() call.
Conversion between host and network byte order.
Converts the unsigned integer x from host byte order to network byte order.
[in] | a | ipv6 address pointer to be converted |
Example
Definition at line 561 of file m2mb_socket.h.
M2MB_SOCKET_BSD_SOCKET m2mb_socket_bsd_accept | ( | M2MB_SOCKET_BSD_SOCKET | s, |
struct M2MB_SOCKET_BSD_SOCKADDR * | name, | ||
INT32 * | namelen | ||
) |
Accept a connection on a socket.
Allows an incoming connection attempt on the specified socket. Accept is used on the server side. It accepts a received incoming attempt to create a new TCP connection from the remote client, and creates a new socket associated with the socket address pair of this connection
[in] | s | Specifies the file descriptor of the socket |
[in] | name | It is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket |
[in] | namelen | It is a value-result argument: the caller must initialize it to contain the size (in bytes) of the structure pointed to by name; on return, it will contain the actual size of the peer address |
Example
INT32 m2mb_socket_bsd_bind | ( | M2MB_SOCKET_BSD_SOCKET | s, |
struct M2MB_SOCKET_BSD_SOCKADDR * | name, | ||
INT32 | namelen | ||
) |
Bind the address with the socket.
Bind is typically used on the server side and associates a socket with a socket address structure, i.e. a specified local port number and IP address
[in] | s | Specifies the file descriptor of the socket to be bound |
[in] | name | Points to a sockaddr structure containing the address to be bound to the socket. The length and format of the address depend on the address family of the socket: M2MB_SOCKET_BSD_SOCKADDR_IN is used for IPv4 Internet protocols M2MB_SOCKET_BSD_SOCKADDR_IN6 is used for IPv6 Internet protocols |
[in] | namelen | Specifies the length of the sockaddr structure pointed to by name |
Example
INT32 m2mb_socket_bsd_close | ( | M2MB_SOCKET_BSD_SOCKET | s | ) |
Close a socket.
Closes a file descriptor, so that it no longer refers to any file and may be reused
[in] | s | Specifies the file descriptor of the socket |
Example
INT32 m2mb_socket_bsd_connect | ( | M2MB_SOCKET_BSD_SOCKET | s, |
const struct M2MB_SOCKET_BSD_SOCKADDR * | name, | ||
INT32 | namelen | ||
) |
connect a socket
Establishes a connection to the specified address
[in] | s | specifies the file descriptor of the socket |
[in] | name | points to a sockaddr structure containing the peer address. The length and format of the address depend on the address family of the socket: M2MB_SOCKET_BSD_SOCKADDR_IN is used for IPv4 Internet protocols M2MB_SOCKET_BSD_SOCKADDR_IN6 is used for IPv6 Internet protocols |
[in] | namelen | specifies the length of the sockaddr structure pointed to by name |
Example
INT32 m2mb_socket_bsd_fd_clr_func | ( | INT32 | fd, |
M2MB_SOCKET_BSD_FD_SET_T * | set | ||
) |
Used for m2mb_socket_bsd_select()
Remove a file descriptor from a set
[in] | fd | File descriptor |
[in] | set | Set of file descriptors |
Example
INT32 m2mb_socket_bsd_fd_isset_func | ( | INT32 | fd, |
M2MB_SOCKET_BSD_FD_SET_T * | set | ||
) |
Used for m2mb_socket_bsd_select()
Tests to see if a file descriptor is part of a set
[in] | fd | File descriptor |
[in] | set | Set of file descriptors |
Example
INT32 m2mb_socket_bsd_fd_set_func | ( | INT32 | fd, |
M2MB_SOCKET_BSD_FD_SET_T * | set | ||
) |
Used for m2mb_socket_bsd_select()
Add a file descriptor to a set
[in] | fd | File descriptor |
[in] | set | Set of file descriptors |
Example
INT32 m2mb_socket_bsd_fd_zero_func | ( | M2MB_SOCKET_BSD_FD_SET_T * | set | ) |
Used for m2mb_socket_bsd_select()
Clears a set of file descriptors
[in] | set | Set of file descriptors |
Example
INT32 m2mb_socket_bsd_get_host_by_name_2_r_cid | ( | const CHAR * | name, |
INT32 | af, | ||
struct M2MB_SOCKET_BSD_HOSTENT * | ret, | ||
CHAR * | buf, | ||
INT32 | buflen, | ||
struct M2MB_SOCKET_BSD_HOSTENT ** | result, | ||
INT32 * | h_errnop, | ||
UINT8 | cid | ||
) |
Get network host entry.
Implements a "standard" Unix version of gethostbyname2_r() but with parameter "cid" to specify the PDP context to be used for transferring data
[in] | name | Either a hostname or an IPv4 address in standard dot notation or an IPv6 address in colon notation |
[in] | af | Address family. M2MB_SOCKET_BSD_AF_INET for IPv4, M2MB_SOCKET_BSD_AF_INET6 for IPv6 |
[in] | ret | Pre-allocated struct where to store the result |
[in] | buf | Pre-allocated buffer where to store additional data |
[in] | buflen | Size of buf |
[in] | result | Pointer to a hostent pointer that is set to ret on success and set to zero on error |
[in] | h_errnop | Pointer to an int where to store errors (instead of modifying the global h_errno) |
[in] | cid | PDP context to be used |
Example
INT32 m2mb_socket_bsd_get_peer_name | ( | M2MB_SOCKET_BSD_SOCKET | s, |
struct M2MB_SOCKET_BSD_SOCKADDR * | name, | ||
INT32 * | namelen | ||
) |
Get the name of the peer socket.
Retrieves the peer address of the specified socket, store this address in the sockaddr structure pointed to by name, and store the length of this address in the object pointed to by namelen
[in] | s | Specifies the file descriptor of the socket |
[in] | name | Pointer to a sockaddr structure. This structure is filled in with the address of the peer socket |
[in] | namelen | It is a value-result argument: the caller must initialize it to contain the size (in bytes) of the structure pointed to by name; on return, it will contain the actual size of the peer address |
Example
INT32 m2mb_socket_bsd_get_sock_name | ( | M2MB_SOCKET_BSD_SOCKET | s, |
struct M2MB_SOCKET_BSD_SOCKADDR * | name, | ||
INT32 * | namelen | ||
) |
Get socket name.
Retrieve the local address of the specified socket, store this address in the sockaddr structure pointed to by name, and store the length of this address in the object pointed to by namelen
[in] | s | Specifies the file descriptor of the socket |
[in] | name | Pointer to a sockaddr structure. This structure is filled in with the local address of the socket |
[in] | namelen | A value-result argument: the caller must initialize it to contain the size (in bytes) of the structure pointed to by name; on return, it will contain the actual size of the peer address |
Example
INT32 m2mb_socket_bsd_get_sock_opt | ( | M2MB_SOCKET_BSD_SOCKET | s, |
INT32 | level, | ||
INT32 | optname, | ||
void * | optval, | ||
INT32 * | optlen | ||
) |
Get options from sockets.
This function is used to retrieve the current value of a particular socket option for the specified socket, see m2mb_socket_option_flags socket options
[in] | s | Specifies the file descriptor of the socket |
[in] | level | Protocol level the option exists at |
[in] | optname | Name of the option |
[in] | optval | Pointer to a buffer in which the value for the requested option is to be returned |
[in] | optlen | This parameter is ignored. |
Example
Converts IPv4 and IPv6 addresses from binary to text form.
this function converts the network address structure src in the af address family into a character string. The resulting string is copied to the buffer pointed to by dst, which must be a non-NULL pointer. The caller specifies the number of bytes available in this buffer in the argument size
[in] | af | Address family. M2MB_SOCKET_BSD_AF_INET for IPv4, M2MB_SOCKET_BSD_AF_INET6 for IPv6 |
[in] | src | Pointer to IPv4 or IPv6 address |
[in] | dst | Pointer to output buffer to contain IPv4/IPv6 address string |
[in] | size | Size of output buffer in bytes |
Example
Converts IPv4 and IPv6 addresses from text to binary form.
Converts the character string src into a network address structure in the af address family, then copies the network address structure to dst
[in] | af | Address family. M2MB_SOCKET_BSD_AF_INET for IPv4, M2MB_SOCKET_BSD_AF_INET6 for IPv6 |
[in] | src | IPv4 or IPv6 address string (null-terminated) |
[in] | dst | Resulting IPv4/IPv6 address: struct M2MB_SOCKET_BSD_IN_ADDR in case of IPv4, struct M2MB_SOCKET_BSD_IPV6_ADDR in case of IPv6 |
Example
INT32 m2mb_socket_bsd_ioctl | ( | M2MB_SOCKET_BSD_SOCKET | s, |
INT32 | cmd, | ||
void * | argp | ||
) |
IO control function.
Used to set a socket to blocking or nonblocking mode (M2MB_SOCKET_BSD_FIONBIO) or to retrieve all pending data (M2MB_SOCKET_BSD_FIONREAD)
[in] | s | Specifies the file descriptor of the socket |
[in] | cmd | Name of the command: M2MB_SOCKET_BSD_FIONREAD,M2MB_SOCKET_BSD_FIONBIO |
[in] | argp | Pointer to the value (input parameter or output parameter) |
Example
INT32 m2mb_socket_bsd_listen | ( | M2MB_SOCKET_BSD_SOCKET | s, |
INT32 | backlog | ||
) |
Listen for connections on a socket.
Marks the socket referred to by sockfd as a passive socket, that is, as a socket that will be used to accept incoming connection requests using m2mb_socket_bsd_accept
[in] | s | Specifies the file descriptor of the socket |
[in] | backlog | Defines the maximum length to which the queue of pending connections for s may grow |
Example
INT32 m2mb_socket_bsd_recv | ( | M2MB_SOCKET_BSD_SOCKET | s, |
void * | buf, | ||
INT32 | len, | ||
INT32 | flags | ||
) |
Receive a message from a socket.
This function should be invoked to receive the data on the specified socket. Depending on the socket configuration, this function can perform in a blocking or non-blocking mode. In case of blocking, this function will not return until data is received (not necessarily all requested data). In case of non-blocking, this function will return the data pending on the specified socket, but will not wait for additional data (in case the size requested is not reached)
[in] | s | Specifies the file descriptor of the socket |
[in] | buf | Pointer to a buffer for received message |
[in] | len | Number of bytes to receive |
[in] | flags | Only 0 supported |
Example
INT32 m2mb_socket_bsd_recv_from | ( | M2MB_SOCKET_BSD_SOCKET | s, |
void * | buf, | ||
INT32 | len, | ||
INT32 | flags, | ||
M2MB_SOCKET_BSD_SOCKADDR_T * | from, | ||
INT32 * | fromlen | ||
) |
Receive a message from a socket.
This function receives the data on the given socket and stores the source address. This function shall be used only for datagram sockets. Depending on the socket configuration, this function can perform in a blocking or non-blocking mode. In case of blocking, this function will not return until data is received (not necessarily all requested data). In case of non-blocking, this function will return the data pending on the specified socket, but will not wait for additional data (in case the size requested is not reached)
[in] | s | Specifies the file descriptor of the socket |
[in] | buf | Pointer to a buffer for received message |
[in] | len | Number of bytes to receive |
[in] | flags | Only 0 supported |
[in] | from | Pointer to a sockaddr structure. This structure is filled in with the address of the peer socket |
[in] | fromlen | A value-result argument: the caller must initialize it to contain the size (in bytes) of the structure pointed to by addr; on return, it will contain the actual size of the peer address |
Example
INT32 m2mb_socket_bsd_select | ( | INT32 | nfds, |
M2MB_SOCKET_BSD_FD_SET_T * | readfds, | ||
M2MB_SOCKET_BSD_FD_SET_T * | writefds, | ||
M2MB_SOCKET_BSD_FD_SET_T * | exceptfds, | ||
const struct M2MB_SOCKET_BSD_TIMEVAL * | timeout | ||
) |
synchronous I/O multiplexing
This function is used to prune a provided list of sockets for those that are: ready to read, ready to write or have any errors.
[in] | nfds | nfds is the highest-numbered file descriptor in any of the three sets, plus 1 |
[in] | readfds | Set of file descriptors that will be watched to see if characters become available for reading. On exit, the set is modified in place to indicate which file descriptors actually changed status. |
[in] | writefds | Set of file descriptors that will be watched to see if a write will not block. On exit, the set is modified in place to indicate which file descriptors actually changed status. |
[in] | exceptfds | Set of file descriptors that will be watched for exceptions. On exit, the set is modified in place to indicate which file descriptors actually changed status. |
[in] | timeout | Specifies the minimum interval that m2mb_socket_bsd_select() should block waiting for a file descriptor to become ready |
Example
INT32 m2mb_socket_bsd_send | ( | M2MB_SOCKET_BSD_SOCKET | s, |
const void * | buf, | ||
INT32 | len, | ||
INT32 | flags | ||
) |
Send a message on a socket.
This function should be invoked to send data using the specified socket. Depending on the socket configuration, this function can perform in a blocking or non-blocking mode. In case of blocking, this function will not return until data is sent (not necessarily all requested data). In case of non-blocking, this function will send the data using only the stack available resources and will not wait for resources to be free
[in] | s | Specifies the file descriptor of the socket |
[in] | buf | Pointer to a buffer containing the message to be sent |
[in] | len | Number of bytes to send |
[in] | flags | Only 0 supported |
Example
INT32 m2mb_socket_bsd_send_to | ( | M2MB_SOCKET_BSD_SOCKET | s, |
const void * | buf, | ||
INT32 | len, | ||
INT32 | flags, | ||
const struct M2MB_SOCKET_BSD_SOCKADDR * | to, | ||
INT32 | tolen | ||
) |
send a message on a socket
This function should be invoked to send data using the specified socket. Depending on the socket configuration, this function can perform in a blocking or non-blocking mode. In case of blocking, this function will not return until data is sent (not necessarily all requested data). In case of non-blocking, this function will send the data using only the stack available resources and will not wait for resources to be free
[in] | s | Specifies the file descriptor of the socket |
[in] | buf | Pointer to a buffer containing message to be sent |
[in] | len | Number of bytes to send |
[in] | flags | only 0 supported |
[in] | to | Points to a sockaddr structure containing the peer address. The length and format of the address depend on the address family of the socket |
[in] | tolen | Specifies the length of the sockaddr structure pointed to by to |
Example
INT32 m2mb_socket_bsd_set_sock_opt | ( | M2MB_SOCKET_BSD_SOCKET | s, |
INT32 | level, | ||
INT32 | optname, | ||
const void * | optval, | ||
INT32 | optlen | ||
) |
Set options on sockets.
This function is used to set a particular socket option for the specified socket, see m2mb_socket_option_flags socket options
[in] | s | Specifies the file descriptor of the socket |
[in] | level | Protocol level the option exists at |
[in] | optname | Name of the option |
[in] | optval | Pointer to a buffer with the requested option to be set |
[in] | optlen | Option length in bytes |
Example
M2MB_SOCKET_BSD_SOCKET m2mb_socket_bsd_socket | ( | INT32 | domain, |
INT32 | type, | ||
INT32 | protocol | ||
) |
Create an endpoint for communication.
Creates an unbound socket in a communications domain, and returns a file descriptor that can be used in later function calls that operate on socket
[in] | domain | Specifies the communications domain in which a socket is to be created: M2MB_SOCKET_BSD_AF_INET - IPv4 Internet protocols M2MB_SOCKET_BSD_AF_INET6 - IPv6 Internet protocols M2MB_SOCKET_BSD_AF_PACKET – Packet socket to receive and send Ethernet frames |
[in] | type | Specifies the type of socket to be created: M2MB_SOCKET_BSD_SOCK_STREAM - TCP M2MB_SOCKET_BSD_SOCK_DGRAM - UDP M2MB_SOCKET_BSD_SOCK_RAW - RAW |
[in] | protocol | Specifies a particular protocol to be used with the socket: M2MB_SOCKET_BSD_IPPROTO_TCP M2MB_SOCKET_BSD_IPPROTO_UDP M2MB_SOCKET_BSD_IPPROTO_DFLT causes m2mb_socket_bsd_socket() to use an unspecified default protocol appropriate for the requested socket type |
Example
Gets the last error occurred.
Gets the last error occurred. Should be on a thread bases
[in] | fd | File descriptor |
Example
INT32 m2mb_socket_set_cid | ( | M2MB_SOCKET_BSD_SOCKET | s, |
UINT8 | cid | ||
) |
Link a socket to a CID.
Specifies the PDP context to be used for transferring data on the socket
[in] | s | Specifies the file descriptor of the socket |
[in] | cid | PDP context to be used |
Example
Get TCP Keepalive parameters.
[in] | idle_Time | Pointer to an int which will contain the initial idle time (in seconds) |
[out] | resp_Timeout | Pointer to an int which will contain the waiting time (in seconds) for the response after TCP Keepalive probe is sent |
Example
Set TCP Keepalive parameters.
The default initial idle time is 7,200 seconds (2 hours). The default waiting time for the response is 75 seconds after a TCP Keepalive probe is sent.
[in] | idle_Time | Initial idle time (in seconds). If idle_Time <= 0, then 7,200 is used. |
[in] | resp_Timeout | Waiting time (in seconds) for the response after a TCP Keepalive probe is sent. If resp_Timeout <= 0, then 75 is used. |
Example