]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/Port.h
Sync with trunk rev.13542
[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 "ipc/UdsOp.h"
10 #include "SquidString.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 of processLabel type
21 static String MakeAddr(const char *proccessLabel, int id);
22
23 /// get the IPC message address for coordinator process
24 static String CoordinatorAddr();
25
26 protected:
27 virtual void start() = 0; // UdsOp (AsyncJob) API; has body
28 virtual bool doneAll() const; // UdsOp (AsyncJob) API
29
30 /// read the next incoming message
31 void doListen();
32
33 /// handle IPC message just read
34 virtual void receive(const TypedMsgHdr& message) = 0;
35
36 private:
37 void noteRead(const CommIoCbParams &params); // Comm callback API
38
39 private:
40 TypedMsgHdr buf; ///< msghdr struct filled by Comm
41 };
42
43 extern const char strandAddrLabel[]; ///< strand's listening address unique label
44
45 } // namespace Ipc
46
47 #endif /* SQUID_IPC_PORT_H */