]> 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
9 #include "config.h"
10 #include "Debug.h"
11 #include "ipc/Messages.h"
12 #include "ipc/StrandCoord.h"
13 #include "ipc/TypedMsgHdr.h"
14
15
16 Ipc::StrandCoord::StrandCoord(): kidId(-1), pid(0)
17 {
18 }
19
20 Ipc::StrandCoord::StrandCoord(int aKidId, pid_t aPid): kidId(aKidId), pid(aPid)
21 {
22 }
23
24 void
25 Ipc::StrandCoord::unpack(const TypedMsgHdr &hdrMsg)
26 {
27 hdrMsg.getPod(kidId);
28 hdrMsg.getPod(pid);
29 hdrMsg.getString(tag);
30 }
31
32 void Ipc::StrandCoord::pack(TypedMsgHdr &hdrMsg) const
33 {
34 hdrMsg.putPod(kidId);
35 hdrMsg.putPod(pid);
36 hdrMsg.putString(tag);
37 }
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 }