[DFS] export more symbols for dfs_lwip.

This commit is contained in:
Bernard Xiong 2015-10-11 15:38:35 +08:00
parent f4248a95c3
commit d859e3e8b8
4 changed files with 90 additions and 71 deletions

View File

@ -29,6 +29,7 @@ struct hostent *gethostbyname(const char *name)
{
return lwip_gethostbyname(name);
}
RTM_EXPORT(gethostbyname);
int gethostbyname_r(const char *name, struct hostent *ret, char *buf,
size_t buflen, struct hostent **result, int *h_errnop)
@ -40,6 +41,7 @@ void freeaddrinfo(struct addrinfo *ai)
{
lwip_freeaddrinfo(ai);
}
RTM_EXPORT(freeaddrinfo);
int getaddrinfo(const char *nodename,
const char *servname,
@ -48,3 +50,4 @@ int getaddrinfo(const char *nodename,
{
return lwip_getaddrinfo(nodename, servname, hints, res);
}
RTM_EXPORT(getaddrinfo);

View File

@ -118,5 +118,6 @@ select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
return result;
}
RTM_EXPORT(select);
#endif

View File

@ -49,7 +49,7 @@ int accept(int s, struct sockaddr *addr, socklen_t *addrlen)
rt_set_errno(-DFS_STATUS_ENOMEM);
lwip_close(sock);
printf("no fd yet!\n");
rt_kprintf("no fd yet!\n");
return -1;
}
d = fd_get(fd);
@ -65,7 +65,7 @@ int accept(int s, struct sockaddr *addr, socklen_t *addrlen)
d->pos = 0;
/* set socket to the data of dfs_fd */
d->data = (void*) new_client;
d->data = (void *) new_client;
/* release the ref-count of fd */
fd_put(d);
@ -75,6 +75,7 @@ int accept(int s, struct sockaddr *addr, socklen_t *addrlen)
return new_client;
}
RTM_EXPORT(accept);
int bind(int s, const struct sockaddr *name, socklen_t namelen)
{
@ -82,6 +83,7 @@ int bind(int s, const struct sockaddr *name, socklen_t namelen)
return lwip_bind(sock, name, namelen);
}
RTM_EXPORT(bind);
int shutdown(int s, int how)
{
@ -108,34 +110,39 @@ int shutdown(int s, int how)
return -1;
}
RTM_EXPORT(shutdown);
int getpeername (int s, struct sockaddr *name, socklen_t *namelen)
int getpeername(int s, struct sockaddr *name, socklen_t *namelen)
{
int sock = dfs_lwip_getsocket(s);
return lwip_getpeername(sock, name, namelen);
}
RTM_EXPORT(getpeername);
int getsockname (int s, struct sockaddr *name, socklen_t *namelen)
int getsockname(int s, struct sockaddr *name, socklen_t *namelen)
{
int sock = dfs_lwip_getsocket(s);
return lwip_getsockname(sock, name, namelen);
}
RTM_EXPORT(getsockname);
int getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen)
int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
{
int sock = dfs_lwip_getsocket(s);
return lwip_getsockopt(sock, level, optname, optval, optlen);
}
RTM_EXPORT(getsockopt);
int setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen)
int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen)
{
int sock = dfs_lwip_getsocket(s);
return lwip_setsockopt(sock, level, optname, optval, optlen);
}
RTM_EXPORT(setsockopt);
int connect(int s, const struct sockaddr *name, socklen_t namelen)
{
@ -143,6 +150,7 @@ int connect(int s, const struct sockaddr *name, socklen_t namelen)
return lwip_connect(sock, name, namelen);
}
RTM_EXPORT(connect);
int listen(int s, int backlog)
{
@ -150,6 +158,7 @@ int listen(int s, int backlog)
return lwip_listen(sock, backlog);
}
RTM_EXPORT(listen);
int recv(int s, void *mem, size_t len, int flags)
{
@ -157,6 +166,7 @@ int recv(int s, void *mem, size_t len, int flags)
return lwip_recv(sock, mem, len, flags);
}
RTM_EXPORT(recv);
int recvfrom(int s, void *mem, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen)
@ -165,6 +175,7 @@ int recvfrom(int s, void *mem, size_t len, int flags,
return lwip_recvfrom(sock, mem, len, flags, from, fromlen);
}
RTM_EXPORT(recvfrom);
int send(int s, const void *dataptr, size_t size, int flags)
{
@ -172,6 +183,7 @@ int send(int s, const void *dataptr, size_t size, int flags)
return lwip_send(sock, dataptr, size, flags);
}
RTM_EXPORT(send);
int sendto(int s, const void *dataptr, size_t size, int flags,
const struct sockaddr *to, socklen_t tolen)
@ -180,6 +192,7 @@ int sendto(int s, const void *dataptr, size_t size, int flags,
return lwip_sendto(sock, dataptr, size, flags, to, tolen);
}
RTM_EXPORT(sendto);
int socket(int domain, int type, int protocol)
{
@ -213,7 +226,7 @@ int socket(int domain, int type, int protocol)
d->pos = 0;
/* set socket to the data of dfs_fd */
d->data = (void*) sock;
d->data = (void *) sock;
}
/* release the ref-count of fd */
@ -221,4 +234,4 @@ int socket(int domain, int type, int protocol)
return fd;
}
RTM_EXPORT(socket);

View File

@ -29,9 +29,11 @@
extern "C" {
#endif
#include <inttypes.h>
#include <lwip/sockets.h>
typedef uint16_t sa_family_t;
typedef uint16_t in_port_t;
struct sockaddr_storage
{