]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/Coordinator.h
59fc24a7169007da3861a218d222f87b5669436c
4 * DEBUG: section 54 Interprocess Communication
8 #ifndef SQUID_IPC_COORDINATOR_H
9 #define SQUID_IPC_COORDINATOR_H
12 #include "ipc/Messages.h"
14 #include "ipc/SharedListen.h"
15 #include "ipc/StrandCoords.h"
16 #include "ipc/StrandSearch.h"
17 #include "mgr/forward.h"
19 #include "snmp/forward.h"
27 /// Coordinates shared activities of Strands (Squid processes or threads)
28 class Coordinator
: public Port
31 static Coordinator
* Instance();
36 void broadcastSignal(int sig
) const; ///< send sig to registered strands
38 const StrandCoords
&strands() const; ///< currently registered strands
41 virtual void start(); // Port (AsyncJob) API
42 virtual void receive(const TypedMsgHdr
& message
); // Port API
44 StrandCoord
* findStrand(int kidId
); ///< registered strand or NULL
45 void registerStrand(const StrandCoord
&); ///< adds or updates existing
46 void handleRegistrationRequest(const HereIamMessage
&); ///< register,ACK
48 /// answer the waiting search request
49 void notifySearcher(const StrandSearchRequest
&request
, const StrandCoord
&);
50 /// answers or queues the request if the answer is not yet known
51 void handleSearchRequest(const StrandSearchRequest
&request
);
53 /// returns cached socket or calls openListenSocket()
54 void handleSharedListenRequest(const SharedListenRequest
& request
);
55 void handleCacheMgrRequest(const Mgr::Request
& request
);
56 void handleCacheMgrResponse(const Mgr::Response
& response
);
58 void handleSnmpRequest(const Snmp::Request
& request
);
59 void handleSnmpResponse(const Snmp::Response
& response
);
61 /// calls comm_open_listener()
62 Comm::ConnectionPointer
openListenSocket(const SharedListenRequest
& request
, int &errNo
);
65 StrandCoords strands_
; ///< registered processes and threads
67 typedef std::list
<StrandSearchRequest
> Searchers
; ///< search requests
68 Searchers searchers
; ///< yet unanswered search requests in arrival order
70 typedef std::map
<OpenListenerParams
, Comm::ConnectionPointer
> Listeners
; ///< params:connection map
71 Listeners listeners
; ///< cached comm_open_listener() results
73 static Coordinator
* TheInstance
; ///< the only class instance in existence
76 Coordinator(const Coordinator
&); // not implemented
77 Coordinator
& operator =(const Coordinator
&); // not implemented
79 CBDATA_CLASS2(Coordinator
);
84 #endif /* SQUID_IPC_COORDINATOR_H */