Core networking libraries including LwIP implementation
Dependencies: DebugLib Socket lwip lwip-sys
Fork of NetworkingCoreLib by
main/socket/sys/socket.h@15:cf5f669a30bc, 2012-06-22 (annotated)
- Committer:
- donatien
- Date:
- Fri Jun 22 16:18:09 2012 +0000
- Revision:
- 15:cf5f669a30bc
- Parent:
- 13:f7d8c8088289
DebugLib up
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:013f5d54248c | 1 | /* socket.h */ |
donatien | 13:f7d8c8088289 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
donatien | 13:f7d8c8088289 | 3 | * |
donatien | 13:f7d8c8088289 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
donatien | 13:f7d8c8088289 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
donatien | 13:f7d8c8088289 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
donatien | 13:f7d8c8088289 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
donatien | 13:f7d8c8088289 | 8 | * furnished to do so, subject to the following conditions: |
donatien | 13:f7d8c8088289 | 9 | * |
donatien | 13:f7d8c8088289 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
donatien | 13:f7d8c8088289 | 11 | * substantial portions of the Software. |
donatien | 13:f7d8c8088289 | 12 | * |
donatien | 13:f7d8c8088289 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
donatien | 13:f7d8c8088289 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
donatien | 13:f7d8c8088289 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
donatien | 13:f7d8c8088289 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 13:f7d8c8088289 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
donatien | 13:f7d8c8088289 | 18 | */ |
donatien | 0:013f5d54248c | 19 | |
donatien | 0:013f5d54248c | 20 | |
donatien | 0:013f5d54248c | 21 | #ifndef SOCKET_H_ |
donatien | 0:013f5d54248c | 22 | #define SOCKET_H_ |
donatien | 0:013f5d54248c | 23 | |
donatien | 0:013f5d54248c | 24 | #include "lwip/sockets.h" |
donatien | 0:013f5d54248c | 25 | |
donatien | 0:013f5d54248c | 26 | //Sockets |
donatien | 0:013f5d54248c | 27 | |
donatien | 0:013f5d54248c | 28 | inline int accept(int s, struct sockaddr *addr, socklen_t *addrlen) |
donatien | 0:013f5d54248c | 29 | { |
donatien | 0:013f5d54248c | 30 | return lwip_accept(s, addr, addrlen); |
donatien | 0:013f5d54248c | 31 | } |
donatien | 0:013f5d54248c | 32 | |
donatien | 0:013f5d54248c | 33 | inline int bind(int s, const struct sockaddr *name, socklen_t namelen) |
donatien | 0:013f5d54248c | 34 | { |
donatien | 0:013f5d54248c | 35 | return lwip_bind(s, name, namelen); |
donatien | 0:013f5d54248c | 36 | } |
donatien | 0:013f5d54248c | 37 | |
donatien | 0:013f5d54248c | 38 | inline int shutdown(int s, int how) |
donatien | 0:013f5d54248c | 39 | { |
donatien | 0:013f5d54248c | 40 | return lwip_shutdown(s, how); |
donatien | 0:013f5d54248c | 41 | } |
donatien | 0:013f5d54248c | 42 | |
donatien | 0:013f5d54248c | 43 | inline int getsockname (int s, struct sockaddr *name, socklen_t *namelen) |
donatien | 0:013f5d54248c | 44 | { |
donatien | 0:013f5d54248c | 45 | return lwip_getsockname(s, name, namelen); |
donatien | 0:013f5d54248c | 46 | } |
donatien | 0:013f5d54248c | 47 | |
donatien | 0:013f5d54248c | 48 | inline int getpeername (int s, struct sockaddr *name, socklen_t *namelen) |
donatien | 0:013f5d54248c | 49 | { |
donatien | 0:013f5d54248c | 50 | return lwip_getpeername(s, name, namelen); |
donatien | 0:013f5d54248c | 51 | } |
donatien | 0:013f5d54248c | 52 | |
donatien | 0:013f5d54248c | 53 | inline int getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen) |
donatien | 0:013f5d54248c | 54 | { |
donatien | 0:013f5d54248c | 55 | return lwip_getsockopt(s, level, optname, optval, optlen); |
donatien | 0:013f5d54248c | 56 | } |
donatien | 0:013f5d54248c | 57 | |
donatien | 0:013f5d54248c | 58 | inline int setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen) |
donatien | 0:013f5d54248c | 59 | { |
donatien | 0:013f5d54248c | 60 | return lwip_setsockopt(s, level, optname, optval, optlen); |
donatien | 0:013f5d54248c | 61 | } |
donatien | 0:013f5d54248c | 62 | |
donatien | 0:013f5d54248c | 63 | inline int connect(int s, const struct sockaddr *name, socklen_t namelen) |
donatien | 0:013f5d54248c | 64 | { |
donatien | 0:013f5d54248c | 65 | return lwip_connect(s, name, namelen); |
donatien | 0:013f5d54248c | 66 | } |
donatien | 0:013f5d54248c | 67 | |
donatien | 0:013f5d54248c | 68 | inline int listen(int s, int backlog) |
donatien | 0:013f5d54248c | 69 | { |
donatien | 0:013f5d54248c | 70 | return lwip_listen(s, backlog); |
donatien | 0:013f5d54248c | 71 | } |
donatien | 0:013f5d54248c | 72 | |
donatien | 0:013f5d54248c | 73 | inline int recv(int s, void *mem, size_t len, int flags) |
donatien | 0:013f5d54248c | 74 | { |
donatien | 0:013f5d54248c | 75 | return lwip_recv(s, mem, len, flags); |
donatien | 0:013f5d54248c | 76 | } |
donatien | 0:013f5d54248c | 77 | |
donatien | 0:013f5d54248c | 78 | inline int recvfrom(int s, void *mem, size_t len, int flags, |
donatien | 0:013f5d54248c | 79 | struct sockaddr *from, socklen_t *fromlen) |
donatien | 0:013f5d54248c | 80 | { |
donatien | 0:013f5d54248c | 81 | return lwip_recvfrom(s, mem, len, flags, from, fromlen); |
donatien | 0:013f5d54248c | 82 | } |
donatien | 0:013f5d54248c | 83 | |
donatien | 0:013f5d54248c | 84 | inline int send(int s, const void *dataptr, size_t size, int flags) |
donatien | 0:013f5d54248c | 85 | { |
donatien | 0:013f5d54248c | 86 | return lwip_send(s, dataptr, size, flags); |
donatien | 0:013f5d54248c | 87 | } |
donatien | 0:013f5d54248c | 88 | |
donatien | 0:013f5d54248c | 89 | inline int sendto(int s, const void *dataptr, size_t size, int flags, |
donatien | 0:013f5d54248c | 90 | const struct sockaddr *to, socklen_t tolen) |
donatien | 0:013f5d54248c | 91 | { |
donatien | 0:013f5d54248c | 92 | return lwip_sendto(s, dataptr, size, flags, to, tolen); |
donatien | 0:013f5d54248c | 93 | } |
donatien | 0:013f5d54248c | 94 | |
donatien | 0:013f5d54248c | 95 | inline int socket(int domain, int type, int protocol) |
donatien | 0:013f5d54248c | 96 | { |
donatien | 0:013f5d54248c | 97 | return lwip_socket(domain, type, protocol); |
donatien | 0:013f5d54248c | 98 | } |
donatien | 0:013f5d54248c | 99 | |
donatien | 0:013f5d54248c | 100 | inline int select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, |
donatien | 0:013f5d54248c | 101 | struct timeval *timeout) |
donatien | 0:013f5d54248c | 102 | { |
donatien | 0:013f5d54248c | 103 | return lwip_select(maxfdp1, readset, writeset, exceptset, timeout); |
donatien | 0:013f5d54248c | 104 | } |
donatien | 0:013f5d54248c | 105 | |
donatien | 0:013f5d54248c | 106 | inline int ioctlsocket(int s, long cmd, void *argp) |
donatien | 0:013f5d54248c | 107 | { |
donatien | 0:013f5d54248c | 108 | return lwip_ioctl(s, cmd, argp); |
donatien | 0:013f5d54248c | 109 | } |
donatien | 0:013f5d54248c | 110 | |
donatien | 0:013f5d54248c | 111 | inline int read(int s, void *mem, size_t len) |
donatien | 0:013f5d54248c | 112 | { |
donatien | 0:013f5d54248c | 113 | return lwip_read(s, mem, len); |
donatien | 0:013f5d54248c | 114 | } |
donatien | 0:013f5d54248c | 115 | |
donatien | 0:013f5d54248c | 116 | inline int write(int s, const void *dataptr, size_t size) |
donatien | 0:013f5d54248c | 117 | { |
donatien | 0:013f5d54248c | 118 | return lwip_write(s, dataptr, size); |
donatien | 0:013f5d54248c | 119 | } |
donatien | 0:013f5d54248c | 120 | |
donatien | 0:013f5d54248c | 121 | inline int close(int s) |
donatien | 0:013f5d54248c | 122 | { |
donatien | 0:013f5d54248c | 123 | return lwip_close(s); |
donatien | 0:013f5d54248c | 124 | } |
donatien | 0:013f5d54248c | 125 | |
donatien | 0:013f5d54248c | 126 | #endif /* SOCKET_H_ */ |