23#if __has_include(<Print.h>)
26#elif __has_include("Print.h")
40 #define UIP_CLIENT_CONNECTED 0x10
41 #define UIP_CLIENT_CLOSE 0x20
42 #define UIP_CLIENT_REMOTECLOSED 0x40
43 #define UIP_CLIENT_RESTART 0x80
44 #define UIP_CLIENT_STATEFLAGS (UIP_CLIENT_CONNECTED | UIP_CLIENT_CLOSE | UIP_CLIENT_REMOTECLOSED | UIP_CLIENT_RESTART)
45 #define UIP_CLIENT_SOCKETS ~UIP_CLIENT_STATEFLAGS
56} uip_userdata_closed_t;
62typedef struct __attribute__((__packed__))
72 #if UIP_CLIENT_TIMER >= 0
76 uint32_t restartInterval;
77 #if UIP_CONNECTION_TIMEOUT > 0
78 uint32_t connectTimeout;
79 uint32_t connectTimer;
84 #include "RF24Network_config.h"
85 #define INCOMING_DATA_SIZE MAX_PAYLOAD_SIZE * 2
88 #ifndef ETHERNET_USING_LWIP_ARDUINO
92 #include "lwip/tcpip.h"
96 #include <lwIP_Arduino.h>
97 #include "lwip/include/lwip/tcp.h"
98 #include "lwip/include/lwip/raw.h"
110 int connect(IPAddress ip, uint16_t port);
120 int connect(
const char* host, uint16_t port);
129 int read(uint8_t* buf,
size_t size);
155 size_t write(uint8_t);
158 size_t write(
const uint8_t* buf,
size_t size);
197 static uip_userdata_t all_data[UIP_CONNS];
230 static err_t
recv_callback(
void* arg,
struct tcp_pcb* tpcb,
struct pbuf* p, err_t err);
232 static err_t
srecv_callback(
void* arg,
struct tcp_pcb* tpcb,
struct pbuf* p, err_t err);
250 uip_userdata_t* data;
252 static int _available(uip_userdata_t*);
253 static uip_userdata_t* _allocateData();
254 static size_t _write(uip_userdata_t*,
const uint8_t* buf,
size_t size);
257 friend void uip_log(
char* msg);
263 static size_t _write(uint8_t* data,
const uint8_t* buf,
size_t size);
264 static int _available(uint8_t* data);
266 static err_t accept(
void* arg,
struct tcp_pcb* tpcb, err_t err);
267 static err_t closed(
void* arg,
struct tcp_pcb* tpcb, err_t err);
268 static err_t closed_port(
void* arg,
struct tcp_pcb* tpcb);
269 static err_t closeConn(
void* arg,
struct tcp_pcb* tpcb);
270 static err_t serverTimeouts(
void* arg,
struct tcp_pcb* tpcb);
271 static err_t clientTimeouts(
void* arg,
struct tcp_pcb* tpcb);
272 static err_t on_connected(
void* arg,
struct tcp_pcb* tpcb, err_t err);
273 static err_t blocking_write(
struct tcp_pcb* pcb,
ConnectState* fstate,
const char* data,
size_t len);
274 static void dnsCallback(
const char* name,
const ip_addr_t* ipaddr,
void* callback_arg);
277 static uint32_t clientConnectionTimeout;
278 static uint32_t serverConnectionTimeout;
279 static uint16_t dataSize[2];
280 static struct tcp_pcb* myPcb;
282 static char* incomingData[2];
283 static uint32_t simpleCounter;
284 static int32_t accepts;
virtual bool operator==(const EthernetClient &)
int connect(IPAddress ip, uint16_t port)
friend class RF24EthernetClass
static void error_callback(void *arg, err_t err)
struct RF24Client::ConnectState __attribute__((packed))
static err_t srecv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
int waitAvailable(uint32_t timeout=750)
static ConnectState * gState[2]
virtual bool operator!=(const EthernetClient &rhs)
static err_t recv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
static err_t sent_callback(void *arg, struct tcp_pcb *tpcb, uint16_t len)
#define OUTPUT_BUFFER_SIZE
volatile bool backlogWasClosed
volatile uint32_t clientTimer
volatile uint32_t sConnectionTimeout
volatile bool backlogWasAccepted
volatile bool clientPollingSetup
volatile uint32_t identifier
volatile uint32_t closeTimer
volatile uint32_t cConnectionTimeout
volatile bool waiting_for_ack
volatile bool stateActiveID
volatile uint32_t connectTimestamp
volatile uint32_t serverTimer
void serialip_appcall(void)
#define UIP_SOCKET_NUMPACKETS