]> git.ipfire.org Git - thirdparty/squid.git/blame - src/ipc/Port.h
Source Maintenance: enforce #include statement block ordering
[thirdparty/squid.git] / src / ipc / Port.h
CommitLineData
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 12namespace Ipc
13{
14
ba568924 15/// Waits for and receives incoming IPC messages; kids handle the messages
10cefb7b 16class Port: public UdsOp
17{
18public:
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 23protected:
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
33private:
ba568924 34 void noteRead(const CommIoCbParams &params); // Comm callback API
10cefb7b 35
36private:
1bac0258 37 TypedMsgHdr buf; ///< msghdr struct filled by Comm
10cefb7b 38};
39
ba568924
AR
40extern const char coordinatorAddr[]; ///< where coordinator listens
41extern const char strandAddrPfx[]; ///< strand's listening address prefix
10cefb7b 42
ba568924 43} // namespace Ipc
10cefb7b 44
10cefb7b 45#endif /* SQUID_IPC_PORT_H */