]> git.ipfire.org Git - thirdparty/squid.git/blame - src/ipc/Port.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / ipc / Port.h
CommitLineData
10cefb7b 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
10cefb7b 3 *
bbc27441
AJ
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
10cefb7b 7 */
8
bbc27441
AJ
9/* DEBUG: section 54 Interprocess Communication */
10
10cefb7b 11#ifndef SQUID_IPC_PORT_H
12#define SQUID_IPC_PORT_H
13
10cefb7b 14#include "ipc/UdsOp.h"
602d9612 15#include "SquidString.h"
10cefb7b 16
10cefb7b 17namespace Ipc
18{
19
ba568924 20/// Waits for and receives incoming IPC messages; kids handle the messages
10cefb7b 21class Port: public UdsOp
22{
23public:
ba568924 24 Port(const String &aListenAddr);
1ee292b7
AJ
25 /// calculates IPC message address for strand #id of processLabel type
26 static String MakeAddr(const char *proccessLabel, int id);
27
28 /// get the IPC message address for coordinator process
29 static String CoordinatorAddr();
ba568924 30
8822ebee 31protected:
ba568924
AR
32 virtual void start() = 0; // UdsOp (AsyncJob) API; has body
33 virtual bool doneAll() const; // UdsOp (AsyncJob) API
34
35 /// read the next incoming message
c3317fea 36 void doListen();
10cefb7b 37
ba568924 38 /// handle IPC message just read
1bac0258 39 virtual void receive(const TypedMsgHdr& message) = 0;
10cefb7b 40
41private:
ba568924 42 void noteRead(const CommIoCbParams &params); // Comm callback API
10cefb7b 43
44private:
1bac0258 45 TypedMsgHdr buf; ///< msghdr struct filled by Comm
10cefb7b 46};
47
1ee292b7 48extern const char strandAddrLabel[]; ///< strand's listening address unique label
10cefb7b 49
ba568924 50} // namespace Ipc
10cefb7b 51
10cefb7b 52#endif /* SQUID_IPC_PORT_H */
f53969cc 53