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