SharedListen.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2020 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 
17 namespace Ipc
18 {
19 
21 
25 {
26 public:
27  bool operator <(const OpenListenerParams &p) const;
28 
29  // bits to re-create the fde entry
30  int sock_type = 0;
31  int proto = 0;
32  int fdNote = 0;
33 
34  // bits to re-create the listener Comm::Connection descriptor
36  int flags = 0;
37 
40 };
41 
42 class TypedMsgHdr;
43 
46 {
47 public:
49  explicit SharedListenRequest(const TypedMsgHdr &hdrMsg);
50  void pack(TypedMsgHdr &hdrMsg) const;
51 
52 public:
54 
56 
57  int mapId;
58 };
59 
62 {
63 public:
64  SharedListenResponse(int fd, int errNo, int mapId);
65  explicit SharedListenResponse(const TypedMsgHdr &hdrMsg);
66  void pack(TypedMsgHdr &hdrMsg) const;
67 
68 public:
69  int fd;
70  int errNo;
71  int mapId;
72 };
73 
76 
78 void SharedListenJoined(const SharedListenResponse &response);
79 
80 } // namespace Ipc;
81 
82 #endif /* SQUID_IPC_SHARED_LISTEN_H */
83 
int fd
opened listening socket or -1
Definition: SharedListen.h:69
int mapId
to map future response to the requestor's callback
Definition: SharedListen.h:57
a request for a listen socket with given parameters
Definition: SharedListen.h:45
int fdNote
index into fd_note() comment strings
Definition: SharedListen.h:32
bool operator<(const OpenListenerParams &p) const
useful for map<>
Definition: SharedListen.cc:58
Subscription::Pointer handlerSubscription
handler to subscribe to Comm::ConnAcceptor when we get the response
Definition: SharedListen.h:39
"shared listen" is when concurrent processes are listening on the same fd
Definition: SharedListen.h:24
int mapId
to map future response to the requestor's callback
Definition: SharedListen.h:71
void JoinSharedListen(const OpenListenerParams &, AsyncCall::Pointer &)
prepare and send SharedListenRequest to Coordinator
int errNo
errno value from comm_open_sharedListen() call
Definition: SharedListen.h:70
SharedListenRequest()
from OpenSharedListen() which then sets public data
Definition: SharedListen.cc:71
SharedListenResponse(int fd, int errNo, int mapId)
Definition: SharedListen.cc:88
void pack(TypedMsgHdr &hdrMsg) const
prepare for sendmsg()
OpenListenerParams params
actual comm_open_sharedListen() parameters
Definition: SharedListen.h:55
a response to SharedListenRequest
Definition: SharedListen.h:61
Ip::Address addr
will be memset and memcopied
Definition: SharedListen.h:35
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:31
void SharedListenJoined(const SharedListenResponse &response)
process Coordinator response to SharedListenRequest
int requestorId
kidId of the requestor
Definition: SharedListen.h:53
Definition: IpcIoFile.h:23
void pack(TypedMsgHdr &hdrMsg) const
prepare for sendmsg()
Definition: SharedListen.cc:82

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors