24 #include <netcomm/fawkes/message.h>
25 #include <netcomm/fawkes/message_queue.h>
26 #include <netcomm/fawkes/transceiver.h>
27 #include <netcomm/socket/stream.h>
28 #include <netcomm/utils/exceptions.h>
29 #include <netinet/in.h>
55 while (!msgq->empty()) {
87 unsigned int max_num_msgs)
92 unsigned int num_msgs = 0;
93 while (s->
available() && (num_msgs++ < max_num_msgs)) {
99 if (payload_size > 0) {
100 msg.
payload = malloc(payload_size);
Thrown if the connection died during an operation.
A LockQueue of FawkesNetworkMessage to hold messages in inbound and outbound queues.
Representation of a message that is sent over the network.
const fawkes_message_t & fmsg() const
Get message reference.
size_t payload_size() const
Get payload size.
void pack()
Pack data for sending.
static void send(StreamSocket *s, FawkesNetworkMessageQueue *msgq)
Send messages.
static void recv(StreamSocket *s, FawkesNetworkMessageQueue *msgq, unsigned int max_num_msgs=8)
Receive data.
void lock() const
Lock queue.
void unlock() const
Unlock list.
void unref()
Decrement reference count and conditionally delete this instance.
virtual bool available()
Check if data is available.
virtual size_t read(void *buf, size_t count, bool read_all=true)
Read from socket.
virtual void write(const void *buf, size_t count)
Write to the socket.
TCP stream socket over IP.
Fawkes library namespace.
Message as stored in local queues.
fawkes_message_header_t header
message header
void * payload
message payload