-
Notifications
You must be signed in to change notification settings - Fork 0
/
TCPListener.hpp
44 lines (28 loc) · 967 Bytes
/
TCPListener.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
#ifndef TCPLISTENER_HPP
#define TCPLISTENER_HPP
#include <sys/socket.h>
#include <sys/un.h>
//#include <netinet/in.h>
#include <string.h>
#include <iostream>
#include <sstream>
#include "Pollable.hpp"
/* a class for listening on a port for connections */
class TCPListener : public Pollable {
protected:
struct sockaddr_un serv_addr;
string server_socket_name;
bool quiet;
public:
string toJSON();
bool queueOutput (const char * p, uint32_t len, double timestamp = 0) {return true;};
int getNumPollFDs();
// return number of fds used by this Pollable (negative means error)
int getPollFDs (struct pollfd * pollfds);
int getOutputFD() {return -1;}; // no output FD
void handleEvents (struct pollfd *pollfds, bool timedOut, double timeNow);
TCPListener(string server_socket_name, string label, bool quiet);
void stop(double timeNow) {};
int start(double timeNow) {return 0;};
};
#endif // TCPLISTENER_HPP