21 #ifndef COSA_SOCKET_HH 22 #define COSA_SOCKET_HH 43 } __attribute__((packed));
93 virtual int write(
const void* buf,
size_t size)
95 return (
write(buf, size,
false));
105 virtual int write_P(
const void* buf,
size_t size)
107 return (
write(buf, size,
true));
118 int res =
recv(&c,
sizeof(c));
119 return (res ==
sizeof(c) ? (c & 0xff) : res);
132 virtual int read(
void* buf,
size_t size)
134 return (
recv(buf, size));
152 virtual int close() = 0;
177 virtual int connect(uint8_t addr[4], uint16_t port) = 0;
187 virtual int connect(
const char* hostname, uint16_t port) = 0;
213 virtual int datagram(uint8_t addr[4], uint16_t port) = 0;
222 int send(
const void* buf,
size_t len)
224 return (
send(buf, len,
false));
238 return (
send(buf, len,
true));
251 virtual int recv(
void* buf,
size_t len) = 0;
264 int send(
const void* buf,
size_t len, uint8_t dest[4], uint16_t port)
266 return (
send(buf, len, dest, port,
false));
281 int send_P(
const void* buf,
size_t len, uint8_t dest[4], uint16_t port)
283 return (
send(buf, len, dest, port,
true));
298 virtual int recv(
void* buf,
size_t len, uint8_t
src[4], uint16_t& port) = 0;
320 virtual int write(
const void* buf,
size_t size,
bool progmem)
322 return (
send(buf, size, progmem));
336 virtual int send(
const void* buf,
size_t len,
bool progmem) = 0;
351 virtual int send(
const void* buf,
size_t len,
352 uint8_t dest[4], uint16_t port,
virtual int recv(void *buf, size_t len)=0
virtual int write(const void *buf, size_t size)
int send_P(const void *buf, size_t len, uint8_t dest[4], uint16_t port)
virtual int write(const void *buf, size_t size)
virtual int read(void *buf, size_t size)
virtual int open(Protocol proto, uint16_t port, uint8_t flag)=0
virtual int connect(uint8_t addr[4], uint16_t port)=0
int send(const void *buf, size_t len)
virtual int write(const void *buf, size_t size, bool progmem)
virtual int datagram(uint8_t addr[4], uint16_t port)=0
int send_P(const void *buf, size_t len)
virtual int write_P(const void *buf, size_t size)
virtual int is_connected()=0
void src(INET::addr_t &addr) const
virtual int disconnect()=0
int send(const void *buf, size_t len, uint8_t dest[4], uint16_t port)
virtual int read(void *buf, size_t size)
static const uint16_t DYNAMIC_PORT