]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/StrandCoord.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / StrandCoord.cc
1 /*
2 * Copyright (C) 1996-2017 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 /* DEBUG: section 54 Interprocess Communication */
10
11 #include "squid.h"
12 #include "Debug.h"
13 #include "ipc/Messages.h"
14 #include "ipc/StrandCoord.h"
15 #include "ipc/TypedMsgHdr.h"
16
17 Ipc::StrandCoord::StrandCoord(): kidId(-1), pid(0)
18 {
19 }
20
21 Ipc::StrandCoord::StrandCoord(int aKidId, pid_t aPid): kidId(aKidId), pid(aPid)
22 {
23 }
24
25 void
26 Ipc::StrandCoord::unpack(const TypedMsgHdr &hdrMsg)
27 {
28 hdrMsg.getPod(kidId);
29 hdrMsg.getPod(pid);
30 hdrMsg.getString(tag);
31 }
32
33 void Ipc::StrandCoord::pack(TypedMsgHdr &hdrMsg) const
34 {
35 hdrMsg.putPod(kidId);
36 hdrMsg.putPod(pid);
37 hdrMsg.putString(tag);
38 }
39
40 Ipc::HereIamMessage::HereIamMessage(const StrandCoord &aStrand):
41 strand(aStrand)
42 {
43 }
44
45 Ipc::HereIamMessage::HereIamMessage(const TypedMsgHdr &hdrMsg)
46 {
47 hdrMsg.checkType(mtRegistration);
48 strand.unpack(hdrMsg);
49 }
50
51 void Ipc::HereIamMessage::pack(TypedMsgHdr &hdrMsg) const
52 {
53 hdrMsg.setType(mtRegistration);
54 strand.pack(hdrMsg);
55 }
56