]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/StrandCoord.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / StrandCoord.h
1 /*
2 * Copyright (C) 1996-2015 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 #ifndef SQUID_IPC_STRAND_COORD_H
10 #define SQUID_IPC_STRAND_COORD_H
11
12 #include "ipc/forward.h"
13 #include "SquidString.h"
14
15 namespace Ipc
16 {
17
18 /// Strand location details
19 class StrandCoord
20 {
21 public:
22 StrandCoord(); ///< unknown location
23 StrandCoord(int akidId, pid_t aPid);
24
25 void pack(TypedMsgHdr &hdrMsg) const; ///< prepare for sendmsg()
26 void unpack(const TypedMsgHdr &hdrMsg); ///< from recvmsg()
27
28 public:
29 int kidId; ///< internal Squid process number
30 pid_t pid; ///< OS process or thread identifier
31
32 String tag; ///< optional unique well-known key (e.g., cache_dir path)
33 };
34
35 /// strand registration with Coordinator (also used as an ACK)
36 class HereIamMessage
37 {
38 public:
39 explicit HereIamMessage(const StrandCoord &strand); ///< from registrant
40 explicit HereIamMessage(const TypedMsgHdr &hdrMsg); ///< from recvmsg()
41 void pack(TypedMsgHdr &hdrMsg) const; ///< prepare for sendmsg()
42
43 public:
44 StrandCoord strand; ///< registrant coordinates and related details
45 };
46
47 } // namespace Ipc;
48
49 #endif /* SQUID_IPC_STRAND_COORD_H */
50