55#if LWIP_CHECKSUM_ON_COPY
61#define NUM_SOCKETS MEMP_NUM_NETCONN
86struct lwip_select_cb {
88 struct lwip_select_cb *
next;
90 struct lwip_select_cb *prev;
105struct lwip_setgetsockopt_data {
107 struct lwip_sock *
sock;
126static struct lwip_sock sockets[NUM_SOCKETS];
128static struct lwip_select_cb *select_cb_list;
131static volatile int select_cb_ctr;
135static const int err_to_errno_table[] = {
154#define ERR_TO_ERRNO_TABLE_SIZE \
155 (sizeof(err_to_errno_table)/sizeof(err_to_errno_table[0]))
157#define err_to_errno(err) \
158 ((unsigned)(-(err)) < ERR_TO_ERRNO_TABLE_SIZE ? \
159 err_to_errno_table[-(err)] : EIO)
163#define set_errno(err) errno = (err)
166#define set_errno(err)
169#define sock_set_errno(sk, e) do { \
171 set_errno(sk->err); \
175static void event_callback(
struct netconn *conn,
enum netconn_evt evt,
u16_t len);
176static void lwip_getsockopt_internal(
void *
arg);
177static void lwip_setsockopt_internal(
void *
arg);
184lwip_socket_init(
void)
194static struct lwip_sock *
197 struct lwip_sock *
sock;
199 if ((
s < 0) || (
s >= NUM_SOCKETS)) {
222static struct lwip_sock *
225 if ((
s < 0) || (
s >= NUM_SOCKETS)) {
228 if (!sockets[
s].conn) {
249 for (
i = 0;
i < NUM_SOCKETS; ++
i) {
252 if (!sockets[
i].conn) {
253 sockets[
i].conn = newconn;
257 sockets[
i].lastdata =
NULL;
258 sockets[
i].lastoffset = 0;
259 sockets[
i].rcvevent = 0;
262 sockets[
i].sendevent = (newconn->type == NETCONN_TCP ? (
accepted != 0) : 1);
263 sockets[
i].errevent = 0;
265 sockets[
i].select_waiting = 0;
280free_socket(
struct lwip_sock *
sock,
int is_tcp)
285 lastdata =
sock->lastdata;
287 sock->lastoffset = 0;
296 if (lastdata !=
NULL) {
314 struct lwip_sock *
sock, *nsock;
324 sock = get_socket(
s);
329 if (netconn_is_nonblocking(
sock->conn) && (
sock->rcvevent <= 0)) {
336 err = netconn_accept(
sock->conn, &newconn);
339 if (netconn_type(
sock->conn) != NETCONN_TCP) {
343 sock_set_errno(
sock, err_to_errno(
err));
348 netconn_set_noautorecved(newconn, 1);
351 err = netconn_peer(newconn, &naddr, &
port);
354 netconn_delete(newconn);
355 sock_set_errno(
sock, err_to_errno(
err));
365 sin.sin_len =
sizeof(
sin);
370 if (*addrlen >
sizeof(
sin))
371 *addrlen =
sizeof(
sin);
376 newsock = alloc_socket(newconn, 1);
378 netconn_delete(newconn);
382 LWIP_ASSERT(
"invalid socket index", (newsock >= 0) && (newsock < NUM_SOCKETS));
383 LWIP_ASSERT(
"newconn->callback == event_callback", newconn->callback == event_callback);
384 nsock = &sockets[newsock];
393 newconn->
socket = newsock;
400 sock_set_errno(
sock, 0);
407 struct lwip_sock *
sock;
413 sock = get_socket(
s);
421 sock_set_errno(
sock, err_to_errno(
ERR_ARG));
return -1;);
425 local_port = name_in->sin_port;
431 err = netconn_bind(
sock->conn, &local_addr,
ntohs(local_port));
435 sock_set_errno(
sock, err_to_errno(
err));
440 sock_set_errno(
sock, 0);
447 struct lwip_sock *
sock;
452 sock = get_socket(
s);
458 is_tcp = netconn_type(
sock->conn) == NETCONN_TCP;
463 netconn_delete(
sock->conn);
465 free_socket(
sock, is_tcp);
473 struct lwip_sock *
sock;
477 sock = get_socket(
s);
485 sock_set_errno(
sock, err_to_errno(
ERR_ARG));
return -1;);
490 err = netconn_disconnect(
sock->conn);
496 remote_port = name_in->sin_port;
502 err = netconn_connect(
sock->conn, &remote_addr,
ntohs(remote_port));
507 sock_set_errno(
sock, err_to_errno(
err));
512 sock_set_errno(
sock, 0);
525lwip_listen(
int s,
int backlog)
527 struct lwip_sock *
sock;
532 sock = get_socket(
s);
540 err = netconn_listen_with_backlog(
sock->conn, (
u8_t)backlog);
544 if (netconn_type(
sock->conn) != NETCONN_TCP) {
548 sock_set_errno(
sock, err_to_errno(
err));
552 sock_set_errno(
sock, 0);
560 struct lwip_sock *
sock;
563 u16_t buflen, copylen;
571 sock = get_socket(
s);
579 if (
sock->lastdata) {
583 if (((
flags & MSG_DONTWAIT) || netconn_is_nonblocking(
sock->conn)) &&
584 (
sock->rcvevent <= 0)) {
589 sock_set_errno(
sock, 0);
599 if (netconn_type(
sock->conn) == NETCONN_TCP) {
612 sock_set_errno(
sock, 0);
618 sock_set_errno(
sock, err_to_errno(
err));
629 if (netconn_type(
sock->conn) == NETCONN_TCP) {
636 buflen,
len, off,
sock->lastoffset));
638 buflen -=
sock->lastoffset;
652 if (netconn_type(
sock->conn) == NETCONN_TCP) {
653 LWIP_ASSERT(
"invalid copylen, len would underflow",
len >= copylen);
657 (
sock->rcvevent <= 0) ||
668 if (
from && fromlen) {
671 if (netconn_type(
sock->conn) == NETCONN_TCP) {
680 sin.sin_len =
sizeof(
sin);
685 if (*fromlen >
sizeof(
sin)) {
686 *fromlen =
sizeof(
sin);
696 if (netconn_type(
sock->conn) == NETCONN_TCP) {
716 if ((netconn_type(
sock->conn) == NETCONN_TCP) && (buflen - copylen > 0)) {
718 sock->lastoffset += copylen;
722 sock->lastoffset = 0;
724 if (netconn_type(
sock->conn) == NETCONN_TCP) {
737 sock_set_errno(
sock, 0);
742lwip_read(
int s,
void *
mem,
size_t len)
756 struct lwip_sock *
sock;
764 sock = get_socket(
s);
769 if (
sock->conn->
type != NETCONN_TCP) {
770#if (LWIP_UDP || LWIP_RAW)
778 write_flags = NETCONN_COPY |
779 ((
flags & MSG_MORE) ? NETCONN_MORE : 0) |
780 ((
flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0);
782 err = netconn_write_partly(
sock->conn,
data,
size, write_flags, &written);
785 sock_set_errno(
sock, err_to_errno(
err));
786 return (
err ==
ERR_OK ? (
int)written : -1);
793 struct lwip_sock *
sock;
798#if !LWIP_TCPIP_CORE_LOCKING
802 sock = get_socket(
s);
807 if (
sock->conn->
type == NETCONN_TCP) {
820 LWIP_ERROR(
"lwip_sendto: invalid address", (((to ==
NULL) && (tolen == 0)) ||
823 sock_set_errno(
sock, err_to_errno(
ERR_ARG));
return -1;);
826#if LWIP_TCPIP_CORE_LOCKING
832#if LWIP_NETIF_TX_SINGLE_PBUF
835#if LWIP_CHECKSUM_ON_COPY
837 if (
sock->conn->
type != NETCONN_RAW) {
838 chksum = LWIP_CHKSUM_COPY(
p->payload,
data, short_size);
845 p->payload = (
void*)
data;
850 remote_port =
ntohs(to_in->sin_port);
852 remote_addr = &
sock->conn->pcb.ip->remote_ip;
854 if (NETCONNTYPE_GROUP(
sock->conn->
type) == NETCONN_UDP) {
855 remote_port =
sock->conn->pcb.udp->remote_port;
864 if (netconn_type(
sock->conn) == NETCONN_RAW) {
866 err =
sock->conn->last_err = raw_sendto(
sock->conn->pcb.raw,
p, remote_addr);
871#if LWIP_UDP && LWIP_RAW
876#if LWIP_CHECKSUM_ON_COPY && LWIP_NETIF_TX_SINGLE_PBUF
877 err =
sock->conn->last_err = udp_sendto_chksum(
sock->conn->pcb.udp,
p,
878 remote_addr, remote_port, 1,
chksum);
880 err =
sock->conn->last_err = udp_sendto(
sock->conn->pcb.udp,
p,
881 remote_addr, remote_port);
897#if LWIP_CHECKSUM_ON_COPY
902 remote_port =
ntohs(to_in->sin_port);
916#if LWIP_NETIF_TX_SINGLE_PBUF
921#if LWIP_CHECKSUM_ON_COPY
922 if (
sock->conn->
type != NETCONN_RAW) {
943 sock_set_errno(
sock, err_to_errno(
err));
944 return (
err ==
ERR_OK ? short_size : -1);
958 conn = netconn_new_with_proto_and_callback(NETCONN_RAW, (
u8_t)
protocol, event_callback);
963 conn = netconn_new_with_callback( (
protocol == IPPROTO_UDPLITE) ?
964 NETCONN_UDPLITE : NETCONN_UDP, event_callback);
969 conn = netconn_new_with_callback(NETCONN_TCP, event_callback);
974 netconn_set_noautorecved(conn, 1);
990 i = alloc_socket(conn, 0);
993 netconn_delete(conn);
1004lwip_write(
int s,
const void *
data,
size_t size)
1026lwip_selscan(
int maxfdp1,
fd_set *readset_in,
fd_set *writeset_in,
fd_set *exceptset_in,
1030 fd_set lreadset, lwriteset, lexceptset;
1031 struct lwip_sock *
sock;
1040 for(
i = 0;
i < maxfdp1;
i++) {
1041 void* lastdata =
NULL;
1043 u16_t sendevent = 0;
1047 sock = tryget_socket(
i);
1049 lastdata =
sock->lastdata;
1050 rcvevent =
sock->rcvevent;
1051 sendevent =
sock->sendevent;
1052 errevent =
sock->errevent;
1057 if (readset_in &&
FD_ISSET(
i, readset_in) && ((lastdata !=
NULL) || (rcvevent > 0))) {
1063 if (writeset_in &&
FD_ISSET(
i, writeset_in) && (sendevent != 0)) {
1069 if (exceptset_in &&
FD_ISSET(
i, exceptset_in) && (errevent != 0)) {
1076 *readset_out = lreadset;
1077 *writeset_out = lwriteset;
1078 *exceptset_out = lexceptset;
1093 fd_set lreadset, lwriteset, lexceptset;
1095 struct lwip_select_cb select_cb;
1101 maxfdp1, (
void *)readset, (
void *) writeset, (
void *) exceptset,
1107 nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset);
1115 goto return_copy_fdsets;
1123 select_cb.next =
NULL;
1124 select_cb.prev =
NULL;
1125 select_cb.readset = readset;
1126 select_cb.writeset = writeset;
1127 select_cb.exceptset = exceptset;
1128 select_cb.sem_signalled = 0;
1140 select_cb.next = select_cb_list;
1141 if (select_cb_list !=
NULL) {
1142 select_cb_list->prev = &select_cb;
1144 select_cb_list = &select_cb;
1152 for(
i = 0;
i < maxfdp1;
i++) {
1153 if ((readset &&
FD_ISSET(
i, readset)) ||
1155 (exceptset &&
FD_ISSET(
i, exceptset))) {
1156 struct lwip_sock *
sock = tryget_socket(
i);
1159 sock->select_waiting++;
1167 nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset);
1174 msectimeout = ((
timeout->tv_sec * 1000) + ((
timeout->tv_usec + 500)/1000));
1175 if (msectimeout == 0) {
1184 for(
i = 0;
i < maxfdp1;
i++) {
1185 if ((readset &&
FD_ISSET(
i, readset)) ||
1187 (exceptset &&
FD_ISSET(
i, exceptset))) {
1188 struct lwip_sock *
sock = tryget_socket(
i);
1191 sock->select_waiting--;
1198 if (select_cb.next !=
NULL) {
1199 select_cb.next->prev = select_cb.prev;
1201 if (select_cb_list == &select_cb) {
1203 select_cb_list = select_cb.next;
1206 select_cb.prev->next = select_cb.next;
1218 goto return_copy_fdsets;
1222 nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset);
1229 *readset = lreadset;
1232 *writeset = lwriteset;
1235 *exceptset = lexceptset;
1250 struct lwip_sock *
sock;
1251 struct lwip_select_cb *scb;
1252 int last_select_cb_ctr;
1268 if (evt == NETCONN_EVT_RCVPLUS) {
1278 sock = get_socket(
s);
1289 case NETCONN_EVT_RCVPLUS:
1292 case NETCONN_EVT_RCVMINUS:
1295 case NETCONN_EVT_SENDPLUS:
1296 sock->sendevent = 1;
1298 case NETCONN_EVT_SENDMINUS:
1299 sock->sendevent = 0;
1301 case NETCONN_EVT_ERROR:
1309 if (
sock->select_waiting == 0) {
1322 for (scb = select_cb_list; scb !=
NULL; scb = scb->
next) {
1323 if (scb->sem_signalled == 0) {
1327 if (
sock->rcvevent > 0) {
1328 if (scb->readset &&
FD_ISSET(
s, scb->readset)) {
1332 if (
sock->sendevent != 0) {
1333 if (!do_signal && scb->writeset &&
FD_ISSET(
s, scb->writeset)) {
1337 if (
sock->errevent != 0) {
1338 if (!do_signal && scb->exceptset &&
FD_ISSET(
s, scb->exceptset)) {
1343 scb->sem_signalled = 1;
1350 last_select_cb_ctr = select_cb_ctr;
1354 if (last_select_cb_ctr != select_cb_ctr) {
1367lwip_shutdown(
int s,
int how)
1369 struct lwip_sock *
sock;
1371 u8_t shut_rx = 0, shut_tx = 0;
1375 sock = get_socket(
s);
1381 if (netconn_type(
sock->conn) != NETCONN_TCP) {
1390 if (how == SHUT_RD) {
1392 }
else if (how == SHUT_WR) {
1394 }
else if(how == SHUT_RDWR) {
1401 err = netconn_shutdown(
sock->conn, shut_rx, shut_tx);
1403 sock_set_errno(
sock, err_to_errno(
err));
1410 struct lwip_sock *
sock;
1414 sock = get_socket(
s);
1420 sin.sin_len =
sizeof(
sin);
1424 netconn_getaddr(
sock->conn, &naddr, &
sin.sin_port,
local);
1438 sock_set_errno(
sock, 0);
1455lwip_getsockopt(
int s,
int level,
int optname,
void *optval,
socklen_t *optlen)
1458 struct lwip_sock *
sock = get_socket(
s);
1459 struct lwip_setgetsockopt_data
data;
1465 if ((
NULL == optval) || (
NULL == optlen)) {
1503 if (*optlen <
sizeof(
int)) {
1509 if (*optlen <
sizeof(
int)) {
1513 if ((
sock->conn->
type != NETCONN_UDP) ||
1514 ((udp_flags(
sock->conn->pcb.udp) & UDP_FLAGS_UDPLITE) != 0)) {
1536 if (*optlen <
sizeof(
int)) {
1542 if (*optlen <
sizeof(
u8_t)) {
1547 if (*optlen <
sizeof(
struct in_addr)) {
1552 if (*optlen <
sizeof(
u8_t)) {
1555 if (NETCONNTYPE_GROUP(
sock->conn->
type) != NETCONN_UDP) {
1571 if (*optlen <
sizeof(
int)) {
1577 if (
sock->conn->
type != NETCONN_TCP)
1583#if LWIP_TCP_KEEPALIVE
1597#if LWIP_UDP && LWIP_UDPLITE
1599 case IPPROTO_UDPLITE:
1600 if (*optlen <
sizeof(
int)) {
1606 if (
sock->conn->
type != NETCONN_UDPLITE) {
1611 case UDPLITE_SEND_CSCOV:
1612 case UDPLITE_RECV_CSCOV:
1641 data.optname = optname;
1642 data.optval = optval;
1643 data.optlen = optlen;
1651 return err ? -1 : 0;
1655lwip_getsockopt_internal(
void *
arg)
1657 struct lwip_sock *
sock;
1663 struct lwip_setgetsockopt_data *
data;
1667 data = (
struct lwip_setgetsockopt_data*)
arg;
1673 optname =
data->optname;
1674 optval =
data->optval;
1696 s, optname, (*(
int*)optval?
"on":
"off")));
1700 switch (NETCONNTYPE_GROUP(
sock->conn->
type)) {
1713 (
"lwip_getsockopt(%d, SOL_SOCKET, SO_TYPE): unrecognized socket type %d\n",
1714 s, *(
int *)optval));
1717 s, *(
int *)optval));
1723 sock_set_errno(
sock, err_to_errno(
sock->conn->last_err));
1728 s, *(
int *)optval));
1733 *(
int *)optval = netconn_get_sendtimeout(
sock->conn);
1738 *(
int *)optval = netconn_get_recvtimeout(
sock->conn);
1743 *(
int *)optval = netconn_get_recvbufsize(
sock->conn);
1748 *(
int*)optval = (udp_flags(
sock->conn->pcb.udp) & UDP_FLAGS_NOCHKSUM) ? 1 : 0;
1761 *(
int*)optval =
sock->conn->pcb.ip->ttl;
1763 s, *(
int *)optval));
1766 *(
int*)optval =
sock->conn->pcb.ip->tos;
1768 s, *(
int *)optval));
1772 *(
u8_t*)optval =
sock->conn->pcb.ip->ttl;
1774 s, *(
int *)optval));
1782 if ((
sock->conn->pcb.udp->flags & UDP_FLAGS_MULTICAST_LOOP) != 0) {
1788 s, *(
int *)optval));
1802 *(
int*)optval = tcp_nagle_disabled(
sock->conn->pcb.tcp);
1804 s, (*(
int*)optval)?
"on":
"off") );
1807 *(
int*)optval = (
int)
sock->conn->pcb.tcp->keep_idle;
1809 s, *(
int *)optval));
1812#if LWIP_TCP_KEEPALIVE
1814 *(
int*)optval = (
int)(
sock->conn->pcb.tcp->keep_idle/1000);
1816 s, *(
int *)optval));
1819 *(
int*)optval = (
int)(
sock->conn->pcb.tcp->keep_intvl/1000);
1821 s, *(
int *)optval));
1824 *(
int*)optval = (
int)
sock->conn->pcb.tcp->keep_cnt;
1826 s, *(
int *)optval));
1835#if LWIP_UDP && LWIP_UDPLITE
1837 case IPPROTO_UDPLITE:
1839 case UDPLITE_SEND_CSCOV:
1840 *(
int*)optval =
sock->conn->pcb.udp->chksum_len_tx;
1842 s, (*(
int*)optval)) );
1844 case UDPLITE_RECV_CSCOV:
1845 *(
int*)optval =
sock->conn->pcb.udp->chksum_len_rx;
1847 s, (*(
int*)optval)) );
1863lwip_setsockopt(
int s,
int level,
int optname,
const void *optval,
socklen_t optlen)
1865 struct lwip_sock *
sock = get_socket(
s);
1867 struct lwip_setgetsockopt_data
data;
1873 if (
NULL == optval) {
1908 if (optlen <
sizeof(
int)) {
1913 if (optlen <
sizeof(
int)) {
1917 if ((
sock->conn->
type != NETCONN_UDP) ||
1918 ((udp_flags(
sock->conn->pcb.udp) & UDP_FLAGS_UDPLITE) != 0)) {
1939 if (optlen <
sizeof(
int)) {
1945 if (optlen <
sizeof(
u8_t)) {
1948 if (NETCONNTYPE_GROUP(
sock->conn->
type) != NETCONN_UDP) {
1953 if (optlen <
sizeof(
struct in_addr)) {
1956 if (NETCONNTYPE_GROUP(
sock->conn->
type) != NETCONN_UDP) {
1961 if (optlen <
sizeof(
u8_t)) {
1964 if (NETCONNTYPE_GROUP(
sock->conn->
type) != NETCONN_UDP) {
1970 if (optlen <
sizeof(
struct ip_mreq)) {
1973 if (NETCONNTYPE_GROUP(
sock->conn->
type) != NETCONN_UDP) {
1988 if (optlen <
sizeof(
int)) {
1994 if (
sock->conn->
type != NETCONN_TCP)
2000#if LWIP_TCP_KEEPALIVE
2014#if LWIP_UDP && LWIP_UDPLITE
2016 case IPPROTO_UDPLITE:
2017 if (optlen <
sizeof(
int)) {
2023 if (
sock->conn->
type != NETCONN_UDPLITE)
2027 case UDPLITE_SEND_CSCOV:
2028 case UDPLITE_RECV_CSCOV:
2058 data.optname = optname;
2059 data.optval = (
void*)optval;
2060 data.optlen = &optlen;
2068 return err ? -1 : 0;
2072lwip_setsockopt_internal(
void *
arg)
2074 struct lwip_sock *
sock;
2080 struct lwip_setgetsockopt_data *
data;
2084 data = (
struct lwip_setgetsockopt_data*)
arg;
2090 optname =
data->optname;
2091 optval =
data->optval;
2110 if (*(
int*)optval) {
2116 s, optname, (*(
int*)optval?
"on":
"off")));
2120 netconn_set_sendtimeout(
sock->conn, (
s32_t)*(
int*)optval);
2125 netconn_set_recvtimeout(
sock->conn, *(
int*)optval);
2130 netconn_set_recvbufsize(
sock->conn, *(
int*)optval);
2135 if (*(
int*)optval) {
2136 udp_setflags(
sock->conn->pcb.udp, udp_flags(
sock->conn->pcb.udp) | UDP_FLAGS_NOCHKSUM);
2138 udp_setflags(
sock->conn->pcb.udp, udp_flags(
sock->conn->pcb.udp) & ~UDP_FLAGS_NOCHKSUM);
2152 sock->conn->pcb.ip->ttl = (
u8_t)(*(
int*)optval);
2154 s,
sock->conn->pcb.ip->ttl));
2157 sock->conn->pcb.ip->tos = (
u8_t)(*(
int*)optval);
2159 s,
sock->conn->pcb.ip->tos));
2169 if (*(
u8_t*)optval) {
2170 udp_setflags(
sock->conn->pcb.udp, udp_flags(
sock->conn->pcb.udp) | UDP_FLAGS_MULTICAST_LOOP);
2172 udp_setflags(
sock->conn->pcb.udp, udp_flags(
sock->conn->pcb.udp) & ~UDP_FLAGS_MULTICAST_LOOP);
2185 data->err = igmp_joingroup(&if_addr, &multi_addr);
2187 data->err = igmp_leavegroup(&if_addr, &multi_addr);
2206 if (*(
int*)optval) {
2207 tcp_nagle_disable(
sock->conn->pcb.tcp);
2209 tcp_nagle_enable(
sock->conn->pcb.tcp);
2212 s, (*(
int *)optval)?
"on":
"off") );
2215 sock->conn->pcb.tcp->keep_idle = (
u32_t)(*(
int*)optval);
2217 s,
sock->conn->pcb.tcp->keep_idle));
2220#if LWIP_TCP_KEEPALIVE
2222 sock->conn->pcb.tcp->keep_idle = 1000*(
u32_t)(*(
int*)optval);
2224 s,
sock->conn->pcb.tcp->keep_idle));
2227 sock->conn->pcb.tcp->keep_intvl = 1000*(
u32_t)(*(
int*)optval);
2229 s,
sock->conn->pcb.tcp->keep_intvl));
2232 sock->conn->pcb.tcp->keep_cnt = (
u32_t)(*(
int*)optval);
2234 s,
sock->conn->pcb.tcp->keep_cnt));
2243#if LWIP_UDP && LWIP_UDPLITE
2245 case IPPROTO_UDPLITE:
2247 case UDPLITE_SEND_CSCOV:
2248 if ((*(
int*)optval != 0) && ((*(
int*)optval < 8) || (*(
int*)optval > 0xffff))) {
2250 sock->conn->pcb.udp->chksum_len_tx = 8;
2252 sock->conn->pcb.udp->chksum_len_tx = (
u16_t)*(
int*)optval;
2255 s, (*(
int*)optval)) );
2257 case UDPLITE_RECV_CSCOV:
2258 if ((*(
int*)optval != 0) && ((*(
int*)optval < 8) || (*(
int*)optval > 0xffff))) {
2260 sock->conn->pcb.udp->chksum_len_rx = 8;
2262 sock->conn->pcb.udp->chksum_len_rx = (
u16_t)*(
int*)optval;
2265 s, (*(
int*)optval)) );
2281lwip_ioctl(
int s,
long cmd,
void *argp)
2283 struct lwip_sock *
sock = get_socket(
s);
2303 if (recv_avail < 0) {
2309 if (
sock->lastdata) {
2311 if (netconn_type(
sock->conn) != NETCONN_TCP) {
2314 buflen =
p->tot_len;
2315 buflen -=
sock->lastoffset;
2317 *((
u16_t*)argp) += buflen;
2321 sock_set_errno(
sock, 0);
2327 if (argp && *(
u32_t*)argp) {
2330 netconn_set_nonblocking(
sock->conn,
val);
2332 sock_set_errno(
sock, 0);
2347lwip_fcntl(
int s,
int cmd,
int val)
2349 struct lwip_sock *
sock = get_socket(
s);
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
#define LWIP_UNUSED_ARG(x)
BOOL netconn_recv(struct netconn *conn, void *buf, size_t len, int flags, int *recvd)
BOOL netconn_send(struct netconn *conn, const void *msg, size_t len, int *sent)
#define SYS_ARCH_UNPROTECT(lev)
#define SYS_ARCH_PROTECT(lev)
#define SYS_ARCH_DECL_PROTECT(lev)
#define ip_set_option(pcb, opt)
#define ip_get_option(pcb, opt)
#define ip_reset_option(pcb, opt)
#define LWIP_DEBUGF(debug, message)
#define LWIP_ERROR(message, expression, handler)
#define LWIP_ASSERT(message, assertion)
#define LOCK_TCPIP_CORE()
#define tcpip_callback(f, ctx)
#define UNLOCK_TCPIP_CORE()
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static u32_t chksum(void *dataptr, u16_t len)
#define inet_addr_from_ipaddr(target_inaddr, source_ipaddr)
#define inet_addr_to_ipaddr(target_ipaddr, source_inaddr)
#define inet_addr_to_ipaddr_p(target_ipaddr_p, source_inaddr)
typedefPACK_STRUCT_END struct ip_addr ip_addr_t
#define ip_addr_set_any(ipaddr)
#define ip_addr_debug_print(debug, ipaddr)
#define MEMCPY(DST, SRC, BYTES)
#define netbuf_take(buf, dataptr, len)
void netbuf_free(struct netbuf *buf)
#define netbuf_fromaddr(buf)
void * netbuf_alloc(struct netbuf *buf, u16_t size)
#define netbuf_fromport(buf)
void netbuf_delete(struct netbuf *buf)
err_t netbuf_ref(struct netbuf *buf, const void *dataptr, u16_t size)
struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
u16_t pbuf_copy_partial(struct pbuf *buf, void *dataptr, u16_t len, u16_t offset)
u8_t pbuf_free(struct pbuf *p)
static unsigned __int64 next
static void accepted(enum accept_stat, struct rpc_err *)
struct in_addr imr_interface
struct in_addr imr_multiaddr
#define SYS_ARCH_GET(var, ret)
void sys_sem_free(sys_sem_t *sem)
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
void sys_sem_signal(sys_sem_t *sem)
err_t sys_sem_new(sys_sem_t *sem, u8_t count)
#define FD_ISSET(fd, set)
#define IP_MULTICAST_LOOP
#define IP_ADD_MEMBERSHIP
#define IP_DROP_MEMBERSHIP