]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/Port.h
Completed protos.h split and code refactoring
[thirdparty/squid.git] / src / ipc / Port.h
1 /*
2 * DEBUG: section 54 Interprocess Communication
3 *
4 */
5
6 #ifndef SQUID_IPC_PORT_H
7 #define SQUID_IPC_PORT_H
8
9 #include "SquidString.h"
10 #include "ipc/UdsOp.h"
11
12 namespace Ipc
13 {
14
15 /// Waits for and receives incoming IPC messages; kids handle the messages
16 class Port: public UdsOp
17 {
18 public:
19 Port(const String &aListenAddr);
20 /// calculates IPC message address for strand #id at path
21 static String MakeAddr(const char *path, int id);
22
23 protected:
24 virtual void start() = 0; // UdsOp (AsyncJob) API; has body
25 virtual bool doneAll() const; // UdsOp (AsyncJob) API
26
27 /// read the next incoming message
28 void listen();
29
30 /// handle IPC message just read
31 virtual void receive(const TypedMsgHdr& message) = 0;
32
33 private:
34 void noteRead(const CommIoCbParams &params); // Comm callback API
35
36 private:
37 TypedMsgHdr buf; ///< msghdr struct filled by Comm
38 };
39
40 extern const char coordinatorAddr[]; ///< where coordinator listens
41 extern const char strandAddrPfx[]; ///< strand's listening address prefix
42
43 } // namespace Ipc
44
45 #endif /* SQUID_IPC_PORT_H */