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