/libraries/Wirefree/socket.h
C Header | 46 lines | 20 code | 7 blank | 19 comment | 0 complexity | 2c8b0cc0330a47c4b41679405db8f0a2 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
- /*
- socket.h - network socket class
- Copyright (C) 2011 DIYSandbox LLC
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
- #ifndef _socket_h_
- #define _socket_h_
- #include "gs.h"
- extern uint8_t socket(SOCKET s, uint8_t protocol, uint16_t port, uint8_t flag); // Opens a socket(TCP or UDP or IP_RAW mode)
- extern void close(SOCKET s); // Close socket
- extern uint8_t listen(SOCKET s); // Establish TCP connection (Passive connection)
- extern uint16_t recv(SOCKET s, uint8_t * buf, uint16_t len); // Receive data (TCP)
- extern void disconnect(SOCKET s);
- extern uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len); // Send data (TCP)
- extern uint8_t connect(SOCKET s, String addr, String port);
- #if 0
- extern uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port); // Establish TCP connection (Active connection)
- extern void disconnect(SOCKET s); // disconnect the connection
- extern uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len); // Send data (TCP)
- extern uint16_t peek(SOCKET s, uint8_t *buf);
- extern uint16_t sendto(SOCKET s, const uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port); // Send data (UDP/IP RAW)
- extern uint16_t recvfrom(SOCKET s, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port); // Receive data (UDP/IP RAW)
- extern uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len);
- #endif
- #endif // _socket_h_