]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/Port.h
SMP support, part 1: Essential non-caching functionality.
[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
26 protected:
27 /// calculates IPC message address for strand #id at path
28 static String MakeAddr(const char *path, int id);
29
30 virtual void start() = 0; // UdsOp (AsyncJob) API; has body
31 virtual bool doneAll() const; // UdsOp (AsyncJob) API
32
33 /// read the next incoming message
34 void listen();
35
36 /// handle IPC message just read
37 virtual void receive(const TypedMsgHdr& message) = 0;
38
39 private:
40 void noteRead(const CommIoCbParams &params); // Comm callback API
41
42 private:
43 TypedMsgHdr buf; ///< msghdr struct filled by Comm
44 };
45
46
47 extern const char coordinatorAddr[]; ///< where coordinator listens
48 extern const char strandAddrPfx[]; ///< strand's listening address prefix
49
50 } // namespace Ipc
51
52
53 #endif /* SQUID_IPC_PORT_H */