]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added forgotten StrandSearch sources.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 1 Feb 2011 05:17:51 +0000 (22:17 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 1 Feb 2011 05:17:51 +0000 (22:17 -0700)
src/ipc/StrandSearch.cc [new file with mode: 0644]
src/ipc/StrandSearch.h [new file with mode: 0644]

diff --git a/src/ipc/StrandSearch.cc b/src/ipc/StrandSearch.cc
new file mode 100644 (file)
index 0000000..7568ed8
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * $Id$
+ *
+ * DEBUG: section 54    Interprocess Communication
+ *
+ */
+
+
+#include "config.h"
+#include "ipc/Messages.h"
+#include "ipc/StrandSearch.h"
+#include "ipc/TypedMsgHdr.h"
+
+
+Ipc::StrandSearchRequest::StrandSearchRequest(): requestorId(-1), requestId(0)
+{
+}
+
+Ipc::StrandSearchRequest::StrandSearchRequest(const TypedMsgHdr &hdrMsg):
+    requestorId(-1), requestId(0)
+{
+    hdrMsg.checkType(mtStrandSearchRequest);
+    hdrMsg.getPod(requestorId);
+    hdrMsg.getPod(requestId);
+    hdrMsg.getString(tag);
+}
+
+void Ipc::StrandSearchRequest::pack(TypedMsgHdr &hdrMsg) const
+{
+    hdrMsg.setType(mtStrandSearchRequest);
+    hdrMsg.putPod(requestorId);
+    hdrMsg.putPod(requestId);
+    hdrMsg.putString(tag);
+}
+
+
+/* StrandSearchResponse */
+
+Ipc::StrandSearchResponse::StrandSearchResponse(int aRequestId,
+    const Ipc::StrandCoord &aStrand):
+    requestId(aRequestId), strand(aStrand)
+{
+}
+
+Ipc::StrandSearchResponse::StrandSearchResponse(const TypedMsgHdr &hdrMsg):
+    requestId(0)
+{
+    hdrMsg.checkType(mtStrandSearchResponse);
+    hdrMsg.getPod(requestId);
+    strand.unpack(hdrMsg);
+}
+
+void Ipc::StrandSearchResponse::pack(TypedMsgHdr &hdrMsg) const
+{
+    hdrMsg.setType(mtStrandSearchResponse);
+    hdrMsg.putPod(requestId);
+    strand.pack(hdrMsg);
+}
diff --git a/src/ipc/StrandSearch.h b/src/ipc/StrandSearch.h
new file mode 100644 (file)
index 0000000..a249a5d
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * $Id$
+ *
+ */
+
+#ifndef SQUID_IPC_STRAND_SEARCH_H
+#define SQUID_IPC_STRAND_SEARCH_H
+
+#include "ipc/forward.h"
+#include "ipc/StrandCoord.h"
+#include "SquidString.h"
+#include <sys/types.h>
+
+namespace Ipc
+{
+
+/// asynchronous strand search request
+class StrandSearchRequest
+{
+public:
+    StrandSearchRequest();
+    explicit StrandSearchRequest(const TypedMsgHdr &hdrMsg); ///< from recvmsg()
+    void pack(TypedMsgHdr &hdrMsg) const; ///< prepare for sendmsg()
+
+public:
+    int requestorId; ///< sender-provided return address
+    unsigned int requestId; ///< sender-provided for response:request matching
+    String tag; ///< set when looking for a matching StrandCoord::tag
+};
+
+/// asynchronous strand search response
+class StrandSearchResponse
+{
+public:
+    StrandSearchResponse(int requestId, const StrandCoord &strand);
+    explicit StrandSearchResponse(const TypedMsgHdr &hdrMsg); ///< from recvmsg()
+    void pack(TypedMsgHdr &hdrMsg) const; ///< prepare for sendmsg()
+
+public:
+    unsigned int requestId; ///< a copy of the StrandSearchRequest::requestId
+    StrandCoord strand; ///< answer matching StrandSearchRequest criteria
+};
+
+} // namespace Ipc;
+
+#endif /* SQUID_IPC_STRAND_SEARCH_H */