]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/StrandCoord.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / StrandCoord.cc
index 3fdf45a9fc7c9c203cd06d44ebb2ff70c19324cc..cbd99592bbbcf36306c1da75d0682048168d2739 100644 (file)
@@ -5,13 +5,12 @@
  *
  */
 
-
-#include "config.h"
+#include "squid.h"
+#include "Debug.h"
 #include "ipc/Messages.h"
 #include "ipc/StrandCoord.h"
 #include "ipc/TypedMsgHdr.h"
 
-
 Ipc::StrandCoord::StrandCoord(): kidId(-1), pid(0)
 {
 }
@@ -20,14 +19,34 @@ Ipc::StrandCoord::StrandCoord(int aKidId, pid_t aPid): kidId(aKidId), pid(aPid)
 {
 }
 
-Ipc::StrandCoord::StrandCoord(const TypedMsgHdr &hdrMsg): kidId(-1), pid(0)
+void
+Ipc::StrandCoord::unpack(const TypedMsgHdr &hdrMsg)
 {
-    hdrMsg.checkType(mtRegistration);
-    hdrMsg.getPod(*this);
+    hdrMsg.getPod(kidId);
+    hdrMsg.getPod(pid);
+    hdrMsg.getString(tag);
 }
 
 void Ipc::StrandCoord::pack(TypedMsgHdr &hdrMsg) const
+{
+    hdrMsg.putPod(kidId);
+    hdrMsg.putPod(pid);
+    hdrMsg.putString(tag);
+}
+
+Ipc::HereIamMessage::HereIamMessage(const StrandCoord &aStrand):
+        strand(aStrand)
+{
+}
+
+Ipc::HereIamMessage::HereIamMessage(const TypedMsgHdr &hdrMsg)
+{
+    hdrMsg.checkType(mtRegistration);
+    strand.unpack(hdrMsg);
+}
+
+void Ipc::HereIamMessage::pack(TypedMsgHdr &hdrMsg) const
 {
     hdrMsg.setType(mtRegistration);
-    hdrMsg.putPod(*this);
+    strand.pack(hdrMsg);
 }