Port.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
39  virtual void receive(const TypedMsgHdr& message) = 0;
40 
41 private:
42  void noteRead(const CommIoCbParams &params); // Comm callback API
43 
44 private:
46 };
47 
48 extern const char strandAddrLabel[];
49 
50 } // namespace Ipc
51 
52 #endif /* SQUID_IPC_PORT_H */
53 
TypedMsgHdr buf
msghdr struct filled by Comm
Definition: Port.h:45
virtual void start()=0
called by AsyncStart; do not call directly
Definition: Port.cc:30
Port(const String &aListenAddr)
Definition: Port.cc:24
virtual void receive(const TypedMsgHdr &message)=0
handle IPC message just read
virtual bool doneAll() const
whether positive goal has been reached
Definition: Port.cc:46
void doListen()
read the next incoming message
Definition: Port.cc:36
void noteRead(const CommIoCbParams &params)
Definition: Port.cc:76
static String MakeAddr(const char *proccessLabel, int id)
calculates IPC message address for strand id of processLabel type
Definition: Port.cc:51
const char strandAddrLabel[]
strand's listening address unique label
Definition: Port.cc:22
Waits for and receives incoming IPC messages; kids handle the messages.
Definition: Port.h:21
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:31
static String CoordinatorAddr()
get the IPC message address for coordinator process
Definition: Port.cc:64

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors