Port.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9/* DEBUG: section 54 Interprocess Communication */
10
11#ifndef SQUID_IPC_PORT_H
12#define SQUID_IPC_PORT_H
13
14#include "ipc/UdsOp.h"
15#include "SquidString.h"
16
17namespace Ipc
18{
19
21class Port: public UdsOp
22{
23public:
24 Port(const String &aListenAddr);
26 static String MakeAddr(const char *proccessLabel, int id);
27
29 static String CoordinatorAddr();
30
31protected:
32 void start() override = 0; // UdsOp (AsyncJob) API; has body
33 bool doneAll() const override; // UdsOp (AsyncJob) API
34
36 void doListen();
37
40 virtual void receive(const TypedMsgHdr &) = 0;
41
42private:
43 void noteRead(const CommIoCbParams &params); // Comm callback API
44 void receiveOrIgnore(const TypedMsgHdr& );
45
46private:
48};
49
50extern const char strandAddrLabel[];
51
52} // namespace Ipc
53
54#endif /* SQUID_IPC_PORT_H */
55
Waits for and receives incoming IPC messages; kids handle the messages.
Definition: Port.h:22
void noteRead(const CommIoCbParams &params)
Definition: Port.cc:96
Port(const String &aListenAddr)
Definition: Port.cc:25
bool doneAll() const override
whether positive goal has been reached
Definition: Port.cc:47
void doListen()
read the next incoming message
Definition: Port.cc:37
void start() override=0
called by AsyncStart; do not call directly
Definition: Port.cc:31
void receiveOrIgnore(const TypedMsgHdr &)
receive() but ignore any errors
Definition: Port.cc:85
virtual void receive(const TypedMsgHdr &)=0
Definition: Port.cc:78
TypedMsgHdr buf
msghdr struct filled by Comm
Definition: Port.h:47
static String CoordinatorAddr()
get the IPC message address for coordinator process
Definition: Port.cc:65
static String MakeAddr(const char *proccessLabel, int id)
calculates IPC message address for strand id of processLabel type
Definition: Port.cc:52
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:35
Definition: IpcIoFile.h:24
const char strandAddrLabel[]
strand's listening address unique label
Definition: Port.cc:23

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors