]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/dsi/dsi_opensess.c
AFP replay cache, first shot
[netatalk.git] / libatalk / dsi / dsi_opensess.c
index dfc6f2e421a09cf9e441a9a17eb1919dfa61f365..e8818e6134bd81f5809a80e2b416284005cbbf72 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dsi_opensess.c,v 1.3 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: dsi_opensess.c,v 1.4 2005-09-07 15:27:29 didg Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
@@ -19,6 +19,7 @@
 void dsi_opensession(DSI *dsi)
 {
   u_int32_t i = 0; /* this serves double duty. it must be 4-bytes long */
+  int offs;
 
   /* parse options */
   while (i < dsi->cmdlen) {
@@ -37,8 +38,12 @@ void dsi_opensession(DSI *dsi)
   /* let the client know the server quantum. we don't use the
    * max server quantum due to a bug in appleshare client 3.8.6. */
   dsi->header.dsi_flags = DSIFL_REPLY;
+  dsi->header.dsi_code = 0;
   /* dsi->header.dsi_command = DSIFUNC_OPEN;*/
-  dsi->cmdlen = 2 + sizeof(i); /* length of data. dsi_send uses it. */
+
+  dsi->cmdlen = 2 * (2 + sizeof(i)); /* length of data. dsi_send uses it. */
+
+  /* DSI Option Server Request Quantum */
   dsi->commands[0] = DSIOPT_SERVQUANT;
   dsi->commands[1] = sizeof(i);
   i = htonl(( dsi->server_quantum < DSI_SERVQUANT_MIN || 
@@ -46,5 +51,11 @@ void dsi_opensession(DSI *dsi)
            DSI_SERVQUANT_DEF : dsi->server_quantum);
   memcpy(dsi->commands + 2, &i, sizeof(i));
 
+  /* AFP replaycache size option */
+  offs = 2 + sizeof(i);
+  dsi->commands[offs] = DSIOPT_REPLCSIZE;
+  dsi->commands[offs+1] = sizeof(i);
+  i = htonl(REPLAYCACHE_SIZE);
+  memcpy(dsi->commands + offs + 2, &i, sizeof(i));
   dsi_send(dsi);
 }