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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors