This is Library using WIZnet Hardware TCP/IP chip, W5500 and WIZnet TCP/IP Offload Engine, W7500.
Dependents: HTTP_SDcard_file_server_WIZwiki-W7500 SSD1306_smart_watch TCPEchoServer-WIZwiki-W7500 httpServer-WIZwiki-W7500 ... more
Fork of WIZnetInterface by
This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500 and TCP/IP Offload Engine, W7500.
[Users » embeddist » Code » WIZnetInterface](https://developer.mbed.org/users/embeddist/code/WIZnetInterface/) -> WIZnetInterface Lib will be released on [Team WIZnet](https://developer.mbed.org/teams/WIZnet/)
- WIZwiki_W7500 : /platforms/WIZwiki-W7500/
- WIZwiki_W7500P : /platforms/WIZwiki-W7500P/
- WIZwiki_W7500ECO : /platforms/WIZwiki-W7500ECO/
- W5500 Ethernet Shield : /components/W5500-Ethernet-Kit-for-IoT/
This library is an Ethernet Interface library port-based on [EthernetInterface](https://developer.mbed.org/users/mbed_official/code/EthernetInterface/docs/tip/).
For more detail, visit http://embeddist.blogspot.kr/2015/06/wiznetinterface-for-armmbed.html
Socket/Socket.h@29:c91884bd2713, 2015-11-17 (annotated)
- Committer:
- embeddist
- Date:
- Tue Nov 17 06:35:55 2015 +0000
- Revision:
- 29:c91884bd2713
- Parent:
- 0:6f28332c466f
Fixed setMAC() functions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Soohwan Kim |
0:6f28332c466f | 1 | /* Copyright (C) 2012 mbed.org, MIT License |
Soohwan Kim |
0:6f28332c466f | 2 | * |
Soohwan Kim |
0:6f28332c466f | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
Soohwan Kim |
0:6f28332c466f | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
Soohwan Kim |
0:6f28332c466f | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
Soohwan Kim |
0:6f28332c466f | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
Soohwan Kim |
0:6f28332c466f | 7 | * furnished to do so, subject to the following conditions: |
Soohwan Kim |
0:6f28332c466f | 8 | * |
Soohwan Kim |
0:6f28332c466f | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
Soohwan Kim |
0:6f28332c466f | 10 | * substantial portions of the Software. |
Soohwan Kim |
0:6f28332c466f | 11 | * |
Soohwan Kim |
0:6f28332c466f | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
Soohwan Kim |
0:6f28332c466f | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
Soohwan Kim |
0:6f28332c466f | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
Soohwan Kim |
0:6f28332c466f | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Soohwan Kim |
0:6f28332c466f | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Soohwan Kim |
0:6f28332c466f | 17 | */ |
Soohwan Kim |
0:6f28332c466f | 18 | #ifndef SOCKET_H_ |
Soohwan Kim |
0:6f28332c466f | 19 | #define SOCKET_H_ |
Soohwan Kim |
0:6f28332c466f | 20 | |
Soohwan Kim |
0:6f28332c466f | 21 | #include "eth_arch.h" |
Soohwan Kim |
0:6f28332c466f | 22 | |
Soohwan Kim |
0:6f28332c466f | 23 | #define htons(x) __REV16(x) |
Soohwan Kim |
0:6f28332c466f | 24 | #define ntohs(x) __REV16(x) |
Soohwan Kim |
0:6f28332c466f | 25 | #define htonl(x) __REV(x) |
Soohwan Kim |
0:6f28332c466f | 26 | #define ntohl(x) __REV(x) |
Soohwan Kim |
0:6f28332c466f | 27 | |
Soohwan Kim |
0:6f28332c466f | 28 | /** Socket file descriptor and select wrapper |
Soohwan Kim |
0:6f28332c466f | 29 | */ |
Soohwan Kim |
0:6f28332c466f | 30 | class Socket { |
Soohwan Kim |
0:6f28332c466f | 31 | public: |
Soohwan Kim |
0:6f28332c466f | 32 | /** Socket |
Soohwan Kim |
0:6f28332c466f | 33 | */ |
Soohwan Kim |
0:6f28332c466f | 34 | Socket(); |
Soohwan Kim |
0:6f28332c466f | 35 | |
Soohwan Kim |
0:6f28332c466f | 36 | /** Set blocking or non-blocking mode of the socket and a timeout on |
Soohwan Kim |
0:6f28332c466f | 37 | blocking socket operations |
Soohwan Kim |
0:6f28332c466f | 38 | \param blocking true for blocking mode, false for non-blocking mode. |
Soohwan Kim |
0:6f28332c466f | 39 | \param timeout timeout in ms [Default: (1500)ms]. |
Soohwan Kim |
0:6f28332c466f | 40 | */ |
Soohwan Kim |
0:6f28332c466f | 41 | void set_blocking(bool blocking, unsigned int timeout=1500); |
Soohwan Kim |
0:6f28332c466f | 42 | |
Soohwan Kim |
0:6f28332c466f | 43 | /** Close the socket file descriptor |
Soohwan Kim |
0:6f28332c466f | 44 | */ |
Soohwan Kim |
0:6f28332c466f | 45 | int close(); |
Soohwan Kim |
0:6f28332c466f | 46 | |
Soohwan Kim |
0:6f28332c466f | 47 | ~Socket(); |
Soohwan Kim |
0:6f28332c466f | 48 | |
Soohwan Kim |
0:6f28332c466f | 49 | protected: |
Soohwan Kim |
0:6f28332c466f | 50 | int _sock_fd; |
Soohwan Kim |
0:6f28332c466f | 51 | bool _blocking; |
Soohwan Kim |
0:6f28332c466f | 52 | int _timeout; |
Soohwan Kim |
0:6f28332c466f | 53 | |
Soohwan Kim |
0:6f28332c466f | 54 | WIZnet_Chip* eth; |
Soohwan Kim |
0:6f28332c466f | 55 | }; |
Soohwan Kim |
0:6f28332c466f | 56 | |
Soohwan Kim |
0:6f28332c466f | 57 | |
Soohwan Kim |
0:6f28332c466f | 58 | #endif /* SOCKET_H_ */ |
Soohwan Kim |
0:6f28332c466f | 59 |