]>
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 "mgr/forward.h"
19 #include "snmp/forward.h"
26 /// Coordinates shared activities of Strands (Squid processes or threads)
27 class Coordinator
: public Port
30 static Coordinator
* Instance();
35 void broadcastSignal(int sig
) const; ///< send sig to registered strands
37 const StrandCoords
&strands() const; ///< currently registered strands
40 virtual void start(); // Port (AsyncJob) API
41 virtual void receive(const TypedMsgHdr
& message
); // Port API
43 StrandCoord
* findStrand(int kidId
); ///< registered strand or NULL
44 void registerStrand(const StrandCoord
&); ///< adds or updates existing
45 void handleRegistrationRequest(const StrandCoord
&); ///< register,ACK
47 /// returns cached socket or calls openListenSocket()
48 void handleSharedListenRequest(const SharedListenRequest
& request
);
49 void handleCacheMgrRequest(const Mgr::Request
& request
);
50 void handleCacheMgrResponse(const Mgr::Response
& response
);
52 void handleSnmpRequest(const Snmp::Request
& request
);
53 void handleSnmpResponse(const Snmp::Response
& response
);
55 /// calls comm_open_listener()
56 Comm::ConnectionPointer
openListenSocket(const SharedListenRequest
& request
, int &errNo
);
59 StrandCoords strands_
; ///< registered processes and threads
61 typedef std::map
<OpenListenerParams
, Comm::ConnectionPointer
> Listeners
; ///< params:fd map
62 Listeners listeners
; ///< cached comm_open_listener() results
64 static Coordinator
* TheInstance
; ///< the only class instance in existence
67 Coordinator(const Coordinator
&); // not implemented
68 Coordinator
& operator =(const Coordinator
&); // not implemented
70 CBDATA_CLASS2(Coordinator
);
76 #endif /* SQUID_IPC_COORDINATOR_H */