SharedListen.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_SRC_IPC_SHAREDLISTEN_H
12 #define SQUID_SRC_IPC_SHAREDLISTEN_H
13 
14 #include "base/AsyncCall.h"
15 #include "base/Subscription.h"
16 #include "ip/Address.h"
17 #include "ipc/QuestionerId.h"
18 #include "ipc/RequestId.h"
19 #include "ipc/StartListening.h"
20 
21 namespace Ipc
22 {
23 
25 
29 {
30 public:
31  bool operator <(const OpenListenerParams &p) const;
32 
33  // bits to re-create the fde entry
34  int sock_type = 0;
35  int proto = 0;
36  int fdNote = 0;
37 
38  // bits to re-create the listener Comm::Connection descriptor
40  int flags = 0;
41 };
42 
43 class TypedMsgHdr;
44 
47 {
48 public:
50  explicit SharedListenRequest(const TypedMsgHdr &hdrMsg);
51  void pack(TypedMsgHdr &hdrMsg) const;
52 
53 public:
55 
57 
59 };
60 
63 {
64 public:
65  SharedListenResponse(int fd, int errNo, RequestId aMapId);
66  explicit SharedListenResponse(const TypedMsgHdr &hdrMsg);
67  void pack(TypedMsgHdr &hdrMsg) const;
68 
71 
72 public:
73  int fd;
74  int errNo;
76 };
77 
80 
82 void SharedListenJoined(const SharedListenResponse &response);
83 
84 } // namespace Ipc;
85 
86 #endif /* SQUID_SRC_IPC_SHAREDLISTEN_H */
87 
int fd
opened listening socket or -1
Definition: SharedListen.h:73
SharedListenRequest(const OpenListenerParams &, RequestId aMapId)
sender's constructor
Definition: SharedListen.cc:73
QuestionerId intendedRecepient() const
for Mine() tests
Definition: SharedListen.h:70
a request for a listen socket with given parameters
Definition: SharedListen.h:46
int fdNote
index into fd_note() comment strings
Definition: SharedListen.h:36
bool operator<(const OpenListenerParams &p) const
useful for map<>
Definition: SharedListen.cc:60
"shared listen" is when concurrent processes are listening on the same fd
Definition: SharedListen.h:28
int errNo
errno value from comm_open_sharedListen() call
Definition: SharedListen.h:74
void JoinSharedListen(const OpenListenerParams &, StartListeningCallback &)
prepare and send SharedListenRequest to Coordinator
SharedListenResponse(int fd, int errNo, RequestId aMapId)
sender's constructor
Definition: SharedListen.cc:93
void pack(TypedMsgHdr &hdrMsg) const
prepare for sendmsg()
OpenListenerParams params
actual comm_open_sharedListen() parameters
Definition: SharedListen.h:56
RequestId mapId
to map future response to the requestor's callback
Definition: SharedListen.h:75
a response to SharedListenRequest
Definition: SharedListen.h:62
Ip::Address addr
will be memset and memcopied
Definition: SharedListen.h:39
QuestionerId questioner() const
Definition: RequestId.h:44
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:34
void SharedListenJoined(const SharedListenResponse &response)
process Coordinator response to SharedListenRequest
RequestId mapId
to map future response to the requestor's callback
Definition: SharedListen.h:58
int requestorId
kidId of the requestor
Definition: SharedListen.h:54
Definition: IpcIoFile.h:23
void pack(TypedMsgHdr &hdrMsg) const
prepare for sendmsg()
Definition: SharedListen.cc:87

 

Introduction

Documentation

Support

Miscellaneous