]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added a convenience StoreIOBuffer constructor that creates a
authorwessels <>
Tue, 22 Nov 2005 06:14:22 +0000 (06:14 +0000)
committerwessels <>
Tue, 22 Nov 2005 06:14:22 +0000 (06:14 +0000)
StoreIOBuffer from a MemBuf plus an offset.

This was added for ICAP integration.

src/StoreIOBuffer.h

index 863b29d6ebda331043f84d461f7a53d5f00ba94a..da1c2456a7f13e509a82ac41481d3f508b78e075 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: StoreIOBuffer.h,v 1.4 2003/08/10 03:59:19 robertc Exp $
+ * $Id: StoreIOBuffer.h,v 1.5 2005/11/21 23:14:22 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -37,6 +37,7 @@
 
 /* TODO: move this and the range() method into a .cci */
 #include "Range.h"
+#include "MemBuf.h"
 
 class StoreIOBuffer
 {
@@ -50,11 +51,27 @@ public:
         flags.error = 0;
     }
 
+    /* Create a StoreIOBuffer from a MemBuf and offset */
+    /* NOTE that MemBuf still "owns" the pointers, StoreIOBuffer is just borrowing them */
+    StoreIOBuffer(MemBuf *aMemBuf, off_t anOffset) :
+            length(aMemBuf->contentSize()),
+            offset (anOffset),
+            data(aMemBuf->content())
+    {
+        flags.error = 0;
+    }
+
     Range<size_t> range() const
     {
         return Range<size_t>(offset, offset + length);
     }
 
+    void dump() const
+    {
+        fwrite(data, length, 1, stderr);
+        fwrite("\n", 1, 1, stderr);
+    }
+
     struct
     {