1 #ifndef LIBSOCKET_DGRAMOVERSTREAM_H_7854202d13e741e98bb3b084eb3d6bc0 2 #define LIBSOCKET_DGRAMOVERSTREAM_H_7854202d13e741e98bb3b084eb3d6bc0 13 #include <netinet/ip.h> 14 #include <netinet/tcp.h> 89 ssize_t
sndmsg(
const void* buf,
size_t len);
90 ssize_t
rcvmsg(
void* dst,
size_t len);
92 ssize_t
sndmsg(
const std::string& msg);
93 ssize_t
rcvmsg(std::string* dst);
95 ssize_t
sndmsg(
const std::vector<uint8_t>& msg);
96 ssize_t
rcvmsg(std::vector<uint8_t>* dst);
99 static const size_t RECV_BUF_SIZE = 256;
102 std::unique_ptr<stream_client_socket> inner;
103 char prefix_buffer[FRAMING_PREFIX_LENGTH];
104 char RECV_BUF[RECV_BUF_SIZE];
106 ssize_t receive_bytes(
size_t);
Contains libsocket elements.
void enable_nagle(bool enable) const
Set TCP_NODELAY to !enabled on the underlying socket.
uint32_t receive_header(void)
Receive and decode length header.
ssize_t rcvmsg(void *dst, size_t len)
Receive a message and store the first len bytes into buf.
Declarations of framing functions.
Wraps a stream socket and provides a message-based API on top of it.
Generic socket for active stream sockets (TCP client sockets, UNIX Stream clients)
ssize_t sndmsg(const void *buf, size_t len)
Send the message in buf with length len as one frame.