-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTCPConnection.hpp
54 lines (31 loc) · 1.09 KB
/
TCPConnection.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef TCPCONNECTION_HPP
#define TCPCONNECTION_HPP
#include <string>
#include <sstream>
#include <boost/circular_buffer.hpp>
using std::string;
using std::istringstream;
#include "Pollable.hpp"
#include "VampAlsaHost.hpp"
class TCPConnection;
class TCPConnection : public Pollable {
public:
string toJSON();
TCPConnection (int fd, string label, CommandHandler handler, bool quiet, double timeNow);
~TCPConnection();
int getNumPollFDs();
int getPollFDs (struct pollfd * pollfds);
int getOutputFD();
void handleEvents (struct pollfd *pollfds, bool timedOut, double timeNow);
void stop(double timeNow);
int start(double timeNow);
void setRawOutput(bool yesno);
static const int RAW_OUTPUT_BUFFER_SIZE = 524288; // size of buffer for receiving commands over TCP
protected:
CommandHandler handler;
char cmdString[VampAlsaHost::MAX_CMD_STRING_LENGTH + 1]; // buffer for input from TCP
string inputBuff; // input from TCP socket which has not been processed yet
boost::weak_ptr < Pollable > outputListener;
double timeConnected;
};
#endif // TCPCONNECTION_HPP