Core networking libraries including LwIP implementation
Dependencies: DebugLib lwip_ppp_ethernet
Dependents: EthernetNetworkLib
socket.h
00001 /* socket.h */ 00002 /* 00003 Copyright (C) 2012 ARM Limited. 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a copy of 00006 this software and associated documentation files (the "Software"), to deal in 00007 the Software without restriction, including without limitation the rights to 00008 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 00009 of the Software, and to permit persons to whom the Software is furnished to do 00010 so, subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in all 00013 copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00021 SOFTWARE. 00022 */ 00023 00024 00025 #ifndef SOCKET_H_ 00026 #define SOCKET_H_ 00027 00028 #include "lwip/sockets.h" 00029 #include "lwip/netdb.h" 00030 00031 namespace socket 00032 { 00033 00034 extern "C" 00035 { 00036 00037 //Sockets 00038 00039 inline int accept(int s, struct sockaddr *addr, socklen_t *addrlen) 00040 { 00041 return lwip_accept(s, addr, addrlen); 00042 } 00043 00044 inline int bind(int s, const struct sockaddr *name, socklen_t namelen) 00045 { 00046 return lwip_bind(s, name, namelen); 00047 } 00048 00049 inline int shutdown(int s, int how) 00050 { 00051 return lwip_shutdown(s, how); 00052 } 00053 00054 inline int getsockname (int s, struct sockaddr *name, socklen_t *namelen) 00055 { 00056 return lwip_getsockname(s, name, namelen); 00057 } 00058 00059 inline int getpeername (int s, struct sockaddr *name, socklen_t *namelen) 00060 { 00061 return lwip_getpeername(s, name, namelen); 00062 } 00063 00064 inline int getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen) 00065 { 00066 return lwip_getsockopt(s, level, optname, optval, optlen); 00067 } 00068 00069 inline int setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen) 00070 { 00071 return lwip_setsockopt(s, level, optname, optval, optlen); 00072 } 00073 00074 inline int connect(int s, const struct sockaddr *name, socklen_t namelen) 00075 { 00076 return lwip_connect(s, name, namelen); 00077 } 00078 00079 inline int listen(int s, int backlog) 00080 { 00081 return lwip_listen(s, backlog); 00082 } 00083 00084 inline int recv(int s, void *mem, size_t len, int flags) 00085 { 00086 return lwip_recv(s, mem, len, flags); 00087 } 00088 00089 inline int recvfrom(int s, void *mem, size_t len, int flags, 00090 struct sockaddr *from, socklen_t *fromlen) 00091 { 00092 return lwip_recvfrom(s, mem, len, flags, from, fromlen); 00093 } 00094 00095 inline int send(int s, const void *dataptr, size_t size, int flags) 00096 { 00097 return lwip_send(s, dataptr, size, flags); 00098 } 00099 00100 inline int sendto(int s, const void *dataptr, size_t size, int flags, 00101 const struct sockaddr *to, socklen_t tolen) 00102 { 00103 return lwip_sendto(s, dataptr, size, flags, to, tolen); 00104 } 00105 00106 inline int socket(int domain, int type, int protocol) 00107 { 00108 return lwip_socket(domain, type, protocol); 00109 } 00110 00111 inline int select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, 00112 struct timeval *timeout) 00113 { 00114 return lwip_select(maxfdp1, readset, writeset, exceptset, timeout); 00115 } 00116 00117 inline int ioctlsocket(int s, long cmd, void *argp) 00118 { 00119 return lwip_ioctl(s, cmd, argp); 00120 } 00121 00122 inline int read(int s, void *mem, size_t len) 00123 { 00124 return lwip_read(s, mem, len); 00125 } 00126 00127 inline int write(int s, const void *dataptr, size_t size) 00128 { 00129 return lwip_write(s, dataptr, size); 00130 } 00131 00132 inline int close(int s) 00133 { 00134 return lwip_close(s); 00135 } 00136 00137 //DNS 00138 00139 inline struct hostent *gethostbyname(const char *name) 00140 { 00141 return lwip_gethostbyname(name); 00142 } 00143 00144 inline int gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop) 00145 { 00146 return lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop); 00147 } 00148 00149 inline void freeaddrinfo(struct addrinfo *ai) 00150 { 00151 return lwip_freeaddrinfo(ai); 00152 } 00153 00154 inline int getaddrinfo(const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res) 00155 { 00156 return lwip_getaddrinfo(nodename, servname, hints, res); 00157 } 00158 00159 } 00160 }; 00161 00162 #endif /* SOCKET_H_ */
Generated on Sun Jul 17 2022 01:35:55 by 1.7.2