CyaSSL example using x509 certs and DTLS over ethernet.
Dependencies: EthernetInterface NTPClient cyassl-lib mbed-rtos mbed-src CyaSSL_DTLS_Ethernet
Dependents: CyaSSL_DTLS_Ethernet
bsd_socket.h
00001 #ifndef BSD_SOCKET_H_ 00002 #define BSD_SOCKET_H_ 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 #include "lwip/sockets.h" 00009 00010 #include "lwip/inet.h" 00011 00012 #include "lwip/netdb.h" 00013 00014 //Sockets 00015 00016 inline int accept(int s, struct sockaddr *addr, socklen_t *addrlen) 00017 { 00018 return lwip_accept(s, addr, addrlen); 00019 } 00020 00021 inline int bind(int s, const struct sockaddr *name, socklen_t namelen) 00022 { 00023 return lwip_bind(s, name, namelen); 00024 } 00025 00026 inline int shutdown(int s, int how) 00027 { 00028 return lwip_shutdown(s, how); 00029 } 00030 00031 inline int getsockname (int s, struct sockaddr *name, socklen_t *namelen) 00032 { 00033 return lwip_getsockname(s, name, namelen); 00034 } 00035 00036 inline int getpeername (int s, struct sockaddr *name, socklen_t *namelen) 00037 { 00038 return lwip_getpeername(s, name, namelen); 00039 } 00040 00041 inline int getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen) 00042 { 00043 return lwip_getsockopt(s, level, optname, optval, optlen); 00044 } 00045 00046 inline int setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen) 00047 { 00048 return lwip_setsockopt(s, level, optname, optval, optlen); 00049 } 00050 00051 inline int connect(int s, const struct sockaddr *name, socklen_t namelen) 00052 { 00053 return lwip_connect(s, name, namelen); 00054 } 00055 00056 inline int listen(int s, int backlog) 00057 { 00058 return lwip_listen(s, backlog); 00059 } 00060 00061 inline int recv(int s, void *mem, size_t len, int flags) 00062 { 00063 return lwip_recv(s, mem, len, flags); 00064 } 00065 00066 inline int recvfrom(int s, void *mem, size_t len, int flags, 00067 struct sockaddr *from, socklen_t *fromlen) 00068 { 00069 return lwip_recvfrom(s, mem, len, flags, from, fromlen); 00070 } 00071 00072 inline int send(int s, const void *dataptr, size_t size, int flags) 00073 { 00074 return lwip_send(s, dataptr, size, flags); 00075 } 00076 00077 inline int sendto(int s, const void *dataptr, size_t size, int flags, 00078 const struct sockaddr *to, socklen_t tolen) 00079 { 00080 return lwip_sendto(s, dataptr, size, flags, to, tolen); 00081 } 00082 00083 inline int socket(int domain, int type, int protocol) 00084 { 00085 return lwip_socket(domain, type, protocol); 00086 } 00087 00088 inline int select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, 00089 struct timeval *timeout) 00090 { 00091 return lwip_select(maxfdp1, readset, writeset, exceptset, timeout); 00092 } 00093 00094 inline int ioctlsocket(int s, long cmd, void *argp) 00095 { 00096 return lwip_ioctl(s, cmd, argp); 00097 } 00098 00099 inline int read(int s, void *mem, size_t len) 00100 { 00101 return lwip_read(s, mem, len); 00102 } 00103 00104 inline int write(int s, const void *dataptr, size_t size) 00105 { 00106 return lwip_write(s, dataptr, size); 00107 } 00108 00109 inline int close(int s) 00110 { 00111 return lwip_close(s); 00112 } 00113 00114 //DNS 00115 /* 00116 inline struct hostent *gethostbyname(const char *name) 00117 { 00118 return lwip_gethostbyname(name); 00119 } 00120 00121 inline int gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop) 00122 { 00123 return lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop); 00124 }*/ 00125 00126 inline void freeaddrinfo(struct addrinfo *ai) 00127 { 00128 return lwip_freeaddrinfo(ai); 00129 } 00130 00131 inline int getaddrinfo(const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res) 00132 { 00133 return lwip_getaddrinfo(nodename, servname, hints, res); 00134 } 00135 00136 #ifdef __cplusplus 00137 } 00138 #endif 00139 00140 #endif
Generated on Tue Jul 12 2022 12:46:43 by 1.7.2