3 This file is part of libmspnet
4 Copyright © 2009 Mikkosoft Productions, Mikko Rasa
5 Distributed under the LGPL
8 #ifndef MSP_NET_COMMUNICATOR_H_
9 #define MSP_NET_COMMUNICATOR_H_
12 #include "streamsocket.h"
20 sigc::signal<void> signal_handshake_done;
24 const Protocol &protocol;
25 ReceiverBase &receiver;
34 Communicator(StreamSocket &, const Protocol &, ReceiverBase &);
37 void initiate_handshake();
40 void send(const P &pkt)
42 if(handshake_status!=2)
43 throw InvalidState("Handshaking is not done");
44 unsigned size=protocol.assemble(pkt, out_buf, buf_size);
45 socket.write(out_buf, size);
49 void data_available();
50 bool receive_packet(const Protocol &, ReceiverBase &);
51 void send_handshake();