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