]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
WIP
authorwessels <>
Sat, 7 Mar 1998 07:54:49 +0000 (07:54 +0000)
committerwessels <>
Sat, 7 Mar 1998 07:54:49 +0000 (07:54 +0000)
src/htcp.cc

index 379f8c38a1d165e8ffce3e371db96302ac36396a..1cf2735df6527743d7bdef77f4845edf9f57e543 100644 (file)
@@ -88,14 +88,63 @@ enum {
 };
 
 
-char *
-htpcBuildAuth(u_short * len)
+size_t
+htpcBuildAuth(char *buf, size_t buflen)
 {
-    static char buf[2];
-    u_short n_len;
+    htcpAuthHeader auth;
+    size_t copy_sz = 0;
     assert(2 == sizeof(u_short));
-    *len = (u_short) 2;
-    n_len = htons(*len);
-    xmemcpy(buf, &n_len, 2);
-    return buf;
+    auth.length = htons(2);
+    copy_sz += 2;
+    assert(buflen >= copy_sz);
+    xmemcpy(buf, &auth, copy_sz);
+    return copy_sz;
+}
+
+Specifier *
+htcpBuildSpecifier(char *buf, size_t buflen, HtcpStuff *stuff)
+{
+       off_t off = 0;
+       ...
+}
+
+size_t
+htcpBuildTstOpData(char *buf, size_t buflen, HtcpStuff *stuff)
+{
+       return htcpBuildSpecifier(buf, buflen, stuff);
+}
+
+size_t
+htcpBuildOpData(char *buf, size_t buflen, HtcpStuff *stuff)
+{
+       off_t off = 0;
+       switch(stuff->op) {
+       case HTCP_TST:
+               off = htcpBuildTstOpData(buf + off, buflen, stuff);
+               break:
+       default:
+               assert(0);
+               break;
+       }
+       return off;
+}
+
+size_t
+htcpBuildData(char *buf, size_t buflen, HtcpStuff *stuff)
+{
+       off_t off = 0;
+       off += sizeof(htcpDataHeader);  /* skip! */
+       htcpBuildOpData(buf + off, buflen - off, stuff);
+       ...
+}
+
+htcpBuildPacket(HtcpStuff *stuff)
+{
+       size_t buflen = 8192;
+       off_t off = 0;
+       char *buf = xcalloc(buflen, 1);
+       /* skip the header -- we don't know the overall length */
+       off += sizeof(htcpHeader);
+       off += htcpBuildData(buf + off, buflen-off, stuff);
+       ...
 }