20 #include <netinet/tcp.h> 38 uint8_t* buf_pos = buf;
39 size_t remainder =
sizeof(int32_t);
47 remainder = be32toh(*(reinterpret_cast<int32_t*>(buf)));
48 if (remainder >= (buf_len -
sizeof(int32_t)))
50 LOG_ERROR(
"Packet size %zd is larger than buffer %zu, discarding.", remainder, buf_len);
61 return remainder == 0;
bool read(char *character)
virtual void setOptions(int socket_fd)
bool write(const uint8_t *buf, size_t buf_len, size_t &written)
bool read(uint8_t *buf, size_t buf_len, size_t &read)
bool write(const uint8_t *buf, size_t buf_len, size_t &written)
#define LOG_ERROR(format,...)