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