Better bounds checking on DNS
[network-sink.git] / include / pipe.hpp
blobf41c06d757eac55f58ca34b28539f1ddda60cd9a
1 #ifndef PIPE_H
2 #define PIPE_H
4 namespace Sinkhole
6 struct PipeData
8 int rfd, wfd;
10 PipeData();
13 class Pipe : public Socket
15 /** The FD of the write pipe
16 * this->Sock is the readfd
18 int WriteFD;
19 public:
20 /** Default constructor
21 * @param d Pipe data for r/w sockets
23 Pipe(PipeData d);
25 /** Destructor, closes WriteFD
27 ~Pipe();
29 /** Allocates and returns a new Pipe
30 * @return the new Pipe
32 static Pipe *Create();
34 /** Called when data is to be read
36 bool ProcessRead();
38 /** Called when data can be written
40 bool ProcessWrite();
42 /** Called when this pipe needs to be woken up
44 void Notify();
46 /** Should be overloaded to do something useful
48 virtual void OnNotify() = 0;
52 #endif // PIPE_H