Ethernet test for tinydtls-0.5.0

Dependencies:   EthernetInterface mbed-rtos mbed tinydtls

Fork of tinydtls_test_ethernet by Ashley Mills

Committer:
ashleymills
Date:
Fri Oct 18 14:29:21 2013 +0000
Revision:
4:4d466a913c11
Parent:
1:391ec57807fa
Updated to tinydtls v0.5.0;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 1:391ec57807fa 1 #ifndef BSD_SOCKET_H_
ashleymills 1:391ec57807fa 2 #define BSD_SOCKET_H_
ashleymills 1:391ec57807fa 3
ashleymills 1:391ec57807fa 4 #ifdef __cplusplus
ashleymills 1:391ec57807fa 5 extern "C" {
ashleymills 1:391ec57807fa 6 #endif
ashleymills 1:391ec57807fa 7
ashleymills 1:391ec57807fa 8 #include "lwip/sockets.h"
ashleymills 1:391ec57807fa 9
ashleymills 1:391ec57807fa 10 #include "lwip/inet.h"
ashleymills 1:391ec57807fa 11
ashleymills 1:391ec57807fa 12 #include "lwip/netdb.h"
ashleymills 1:391ec57807fa 13
ashleymills 1:391ec57807fa 14 //Sockets
ashleymills 1:391ec57807fa 15
ashleymills 1:391ec57807fa 16 inline int accept(int s, struct sockaddr *addr, socklen_t *addrlen)
ashleymills 1:391ec57807fa 17 {
ashleymills 1:391ec57807fa 18 return lwip_accept(s, addr, addrlen);
ashleymills 1:391ec57807fa 19 }
ashleymills 1:391ec57807fa 20
ashleymills 1:391ec57807fa 21 inline int bind(int s, const struct sockaddr *name, socklen_t namelen)
ashleymills 1:391ec57807fa 22 {
ashleymills 1:391ec57807fa 23 return lwip_bind(s, name, namelen);
ashleymills 1:391ec57807fa 24 }
ashleymills 1:391ec57807fa 25
ashleymills 1:391ec57807fa 26 inline int shutdown(int s, int how)
ashleymills 1:391ec57807fa 27 {
ashleymills 1:391ec57807fa 28 return lwip_shutdown(s, how);
ashleymills 1:391ec57807fa 29 }
ashleymills 1:391ec57807fa 30
ashleymills 1:391ec57807fa 31 inline int getsockname (int s, struct sockaddr *name, socklen_t *namelen)
ashleymills 1:391ec57807fa 32 {
ashleymills 1:391ec57807fa 33 return lwip_getsockname(s, name, namelen);
ashleymills 1:391ec57807fa 34 }
ashleymills 1:391ec57807fa 35
ashleymills 1:391ec57807fa 36 inline int getpeername (int s, struct sockaddr *name, socklen_t *namelen)
ashleymills 1:391ec57807fa 37 {
ashleymills 1:391ec57807fa 38 return lwip_getpeername(s, name, namelen);
ashleymills 1:391ec57807fa 39 }
ashleymills 1:391ec57807fa 40
ashleymills 1:391ec57807fa 41 inline int getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen)
ashleymills 1:391ec57807fa 42 {
ashleymills 1:391ec57807fa 43 return lwip_getsockopt(s, level, optname, optval, optlen);
ashleymills 1:391ec57807fa 44 }
ashleymills 1:391ec57807fa 45
ashleymills 1:391ec57807fa 46 inline int setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen)
ashleymills 1:391ec57807fa 47 {
ashleymills 1:391ec57807fa 48 return lwip_setsockopt(s, level, optname, optval, optlen);
ashleymills 1:391ec57807fa 49 }
ashleymills 1:391ec57807fa 50
ashleymills 1:391ec57807fa 51 inline int connect(int s, const struct sockaddr *name, socklen_t namelen)
ashleymills 1:391ec57807fa 52 {
ashleymills 1:391ec57807fa 53 return lwip_connect(s, name, namelen);
ashleymills 1:391ec57807fa 54 }
ashleymills 1:391ec57807fa 55
ashleymills 1:391ec57807fa 56 inline int listen(int s, int backlog)
ashleymills 1:391ec57807fa 57 {
ashleymills 1:391ec57807fa 58 return lwip_listen(s, backlog);
ashleymills 1:391ec57807fa 59 }
ashleymills 1:391ec57807fa 60
ashleymills 1:391ec57807fa 61 inline int recv(int s, void *mem, size_t len, int flags)
ashleymills 1:391ec57807fa 62 {
ashleymills 1:391ec57807fa 63 return lwip_recv(s, mem, len, flags);
ashleymills 1:391ec57807fa 64 }
ashleymills 1:391ec57807fa 65
ashleymills 1:391ec57807fa 66 inline int recvfrom(int s, void *mem, size_t len, int flags,
ashleymills 1:391ec57807fa 67 struct sockaddr *from, socklen_t *fromlen)
ashleymills 1:391ec57807fa 68 {
ashleymills 1:391ec57807fa 69 return lwip_recvfrom(s, mem, len, flags, from, fromlen);
ashleymills 1:391ec57807fa 70 }
ashleymills 1:391ec57807fa 71
ashleymills 1:391ec57807fa 72 inline int send(int s, const void *dataptr, size_t size, int flags)
ashleymills 1:391ec57807fa 73 {
ashleymills 1:391ec57807fa 74 return lwip_send(s, dataptr, size, flags);
ashleymills 1:391ec57807fa 75 }
ashleymills 1:391ec57807fa 76
ashleymills 1:391ec57807fa 77 inline int sendto(int s, const void *dataptr, size_t size, int flags,
ashleymills 1:391ec57807fa 78 const struct sockaddr *to, socklen_t tolen)
ashleymills 1:391ec57807fa 79 {
ashleymills 1:391ec57807fa 80 return lwip_sendto(s, dataptr, size, flags, to, tolen);
ashleymills 1:391ec57807fa 81 }
ashleymills 1:391ec57807fa 82
ashleymills 1:391ec57807fa 83 inline int socket(int domain, int type, int protocol)
ashleymills 1:391ec57807fa 84 {
ashleymills 1:391ec57807fa 85 return lwip_socket(domain, type, protocol);
ashleymills 1:391ec57807fa 86 }
ashleymills 1:391ec57807fa 87
ashleymills 1:391ec57807fa 88 inline int select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
ashleymills 1:391ec57807fa 89 struct timeval *timeout)
ashleymills 1:391ec57807fa 90 {
ashleymills 1:391ec57807fa 91 return lwip_select(maxfdp1, readset, writeset, exceptset, timeout);
ashleymills 1:391ec57807fa 92 }
ashleymills 1:391ec57807fa 93
ashleymills 1:391ec57807fa 94 inline int ioctlsocket(int s, long cmd, void *argp)
ashleymills 1:391ec57807fa 95 {
ashleymills 1:391ec57807fa 96 return lwip_ioctl(s, cmd, argp);
ashleymills 1:391ec57807fa 97 }
ashleymills 1:391ec57807fa 98
ashleymills 1:391ec57807fa 99 inline int read(int s, void *mem, size_t len)
ashleymills 1:391ec57807fa 100 {
ashleymills 1:391ec57807fa 101 return lwip_read(s, mem, len);
ashleymills 1:391ec57807fa 102 }
ashleymills 1:391ec57807fa 103
ashleymills 1:391ec57807fa 104 inline int write(int s, const void *dataptr, size_t size)
ashleymills 1:391ec57807fa 105 {
ashleymills 1:391ec57807fa 106 return lwip_write(s, dataptr, size);
ashleymills 1:391ec57807fa 107 }
ashleymills 1:391ec57807fa 108
ashleymills 1:391ec57807fa 109 inline int close(int s)
ashleymills 1:391ec57807fa 110 {
ashleymills 1:391ec57807fa 111 return lwip_close(s);
ashleymills 1:391ec57807fa 112 }
ashleymills 1:391ec57807fa 113
ashleymills 1:391ec57807fa 114 //DNS
ashleymills 1:391ec57807fa 115 /*
ashleymills 1:391ec57807fa 116 inline struct hostent *gethostbyname(const char *name)
ashleymills 1:391ec57807fa 117 {
ashleymills 1:391ec57807fa 118 return lwip_gethostbyname(name);
ashleymills 1:391ec57807fa 119 }
ashleymills 1:391ec57807fa 120
ashleymills 1:391ec57807fa 121 inline int gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
ashleymills 1:391ec57807fa 122 {
ashleymills 1:391ec57807fa 123 return lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop);
ashleymills 1:391ec57807fa 124 }*/
ashleymills 1:391ec57807fa 125
ashleymills 1:391ec57807fa 126 inline void freeaddrinfo(struct addrinfo *ai)
ashleymills 1:391ec57807fa 127 {
ashleymills 1:391ec57807fa 128 return lwip_freeaddrinfo(ai);
ashleymills 1:391ec57807fa 129 }
ashleymills 1:391ec57807fa 130
ashleymills 1:391ec57807fa 131 inline int getaddrinfo(const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res)
ashleymills 1:391ec57807fa 132 {
ashleymills 1:391ec57807fa 133 return lwip_getaddrinfo(nodename, servname, hints, res);
ashleymills 1:391ec57807fa 134 }
ashleymills 1:391ec57807fa 135
ashleymills 1:391ec57807fa 136 #ifdef __cplusplus
ashleymills 1:391ec57807fa 137 }
ashleymills 1:391ec57807fa 138 #endif
ashleymills 1:391ec57807fa 139
ashleymills 1:391ec57807fa 140 #endif