|
Revision 50, 1.1 KB
(checked in by follower, 14 months ago)
|
|
Make functions visible to C++ code in Arduino.
|
| Line | |
|---|
| 1 | /* |
|---|
| 2 | * |
|---|
| 3 | @file socket.h |
|---|
| 4 | @brief define function of socket API |
|---|
| 5 | * |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #ifndef _SOCKET_H_ |
|---|
| 9 | #define _SOCKET_H_ |
|---|
| 10 | |
|---|
| 11 | #ifdef __cplusplus |
|---|
| 12 | extern "C" { |
|---|
| 13 | #endif |
|---|
| 14 | |
|---|
| 15 | extern uint8 socket(SOCKET s, uint8 protocol, uint16 port, uint8 flag); // Opens a socket(TCP or UDP or IP_RAW mode) |
|---|
| 16 | extern void close(SOCKET s); // Close socket |
|---|
| 17 | extern uint8 connect(SOCKET s, uint8 * addr, uint16 port); // Establish TCP connection (Active connection) |
|---|
| 18 | extern void disconnect(SOCKET s); // disconnect the connection |
|---|
| 19 | extern uint8 listen(SOCKET s); // Establish TCP connection (Passive connection) |
|---|
| 20 | extern uint16 send(SOCKET s, const uint8 * buf, uint16 len); // Send data (TCP) |
|---|
| 21 | extern uint16 recv(SOCKET s, uint8 * buf, uint16 len); // Receive data (TCP) |
|---|
| 22 | extern uint16 sendto(SOCKET s, const uint8 * buf, uint16 len, uint8 * addr, uint16 port); // Send data (UDP/IP RAW) |
|---|
| 23 | extern uint16 recvfrom(SOCKET s, uint8 * buf, uint16 len, uint8 * addr, uint16 *port); // Receive data (UDP/IP RAW) |
|---|
| 24 | |
|---|
| 25 | extern uint16 igmpsend(SOCKET s, const uint8 * buf, uint16 len); |
|---|
| 26 | |
|---|
| 27 | #ifdef __cplusplus |
|---|
| 28 | } // extern "C" |
|---|
| 29 | #endif |
|---|
| 30 | |
|---|
| 31 | #endif |
|---|
| 32 | /* _SOCKET_H_ */ |
|---|