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