]>
Commit | Line | Data |
---|---|---|
10cefb7b | 1 | /* |
10cefb7b | 2 | * DEBUG: section 54 Interprocess Communication |
3 | * | |
4 | */ | |
5 | ||
6 | #ifndef SQUID_IPC_PORT_H | |
7 | #define SQUID_IPC_PORT_H | |
8 | ||
10cefb7b | 9 | #include "SquidString.h" |
10 | #include "ipc/UdsOp.h" | |
11 | ||
10cefb7b | 12 | namespace Ipc |
13 | { | |
14 | ||
ba568924 | 15 | /// Waits for and receives incoming IPC messages; kids handle the messages |
10cefb7b | 16 | class Port: public UdsOp |
17 | { | |
18 | public: | |
ba568924 | 19 | Port(const String &aListenAddr); |
ba568924 AR |
20 | /// calculates IPC message address for strand #id at path |
21 | static String MakeAddr(const char *path, int id); | |
22 | ||
8822ebee | 23 | protected: |
ba568924 AR |
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 | |
c3317fea | 28 | void doListen(); |
10cefb7b | 29 | |
ba568924 | 30 | /// handle IPC message just read |
1bac0258 | 31 | virtual void receive(const TypedMsgHdr& message) = 0; |
10cefb7b | 32 | |
33 | private: | |
ba568924 | 34 | void noteRead(const CommIoCbParams ¶ms); // Comm callback API |
10cefb7b | 35 | |
36 | private: | |
1bac0258 | 37 | TypedMsgHdr buf; ///< msghdr struct filled by Comm |
10cefb7b | 38 | }; |
39 | ||
ba568924 AR |
40 | extern const char coordinatorAddr[]; ///< where coordinator listens |
41 | extern const char strandAddrPfx[]; ///< strand's listening address prefix | |
10cefb7b | 42 | |
ba568924 | 43 | } // namespace Ipc |
10cefb7b | 44 | |
10cefb7b | 45 | #endif /* SQUID_IPC_PORT_H */ |