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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors