sockets.c, api_lib.c, api_msg.h, api_msg.c, netifapi.h, netifapi.c, tcpip.c: Include a function pointer instead of a table index in the message to reduce footprint. Disable some part of lwip_send and lwip_sendto if some options are not set (LWIP_TCP, LWIP_UDP, LWIP_RAW).
This commit is contained in:
@@ -469,11 +469,16 @@ lwip_send(int s, const void *data, int size, unsigned int flags)
|
||||
if (!sock)
|
||||
return -1;
|
||||
|
||||
if (sock->conn->type!=NETCONN_TCP)
|
||||
if (sock->conn->type!=NETCONN_TCP)
|
||||
#if (LWIP_UDP || LWIP_RAW)
|
||||
return lwip_sendto( s, data, size, flags, NULL, 0);
|
||||
|
||||
#else
|
||||
sock_set_errno(sock, err_to_errno(ERR_ARG));
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
err = netconn_write( sock->conn, data, size, NETCONN_COPY);
|
||||
|
||||
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_send(%d) err=%d size=%d\n", s, err, size));
|
||||
sock_set_errno(sock, err_to_errno(err));
|
||||
return (err==ERR_OK?size:-1);
|
||||
@@ -494,8 +499,13 @@ lwip_sendto(int s, const void *data, int size, unsigned int flags,
|
||||
return -1;
|
||||
|
||||
if (sock->conn->type==NETCONN_TCP)
|
||||
#if LWIP_TCP
|
||||
return lwip_send( s, data, size, flags);
|
||||
|
||||
#else
|
||||
sock_set_errno(sock, err_to_errno(ERR_ARG));
|
||||
return -1;
|
||||
#endif /* LWIP_TCP */
|
||||
|
||||
LWIP_ASSERT("lwip_sendto: invalid address", (((to==NULL) && (tolen==0)) || ((tolen == sizeof(struct sockaddr_in)) && ((((struct sockaddr_in *)to)->sin_family) == AF_INET))) );
|
||||
|
||||
/* initialize a buffer */
|
||||
|
||||
Reference in New Issue
Block a user