2 * $Id: dsi_opensess.c,v 1.4 2005-09-07 15:27:29 didg Exp $
4 * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
5 * All rights reserved. See COPYRIGHT.
10 #endif /* HAVE_CONFIG_H */
14 #include <sys/types.h>
16 #include <atalk/dsi.h>
18 /* OpenSession. set up the connection */
19 void dsi_opensession(DSI *dsi)
21 u_int32_t i = 0; /* this serves double duty. it must be 4-bytes long */
24 while (i < dsi->cmdlen) {
25 switch (dsi->commands[i++]) {
26 case DSIOPT_ATTNQUANT:
27 memcpy(&dsi->attn_quantum, dsi->commands + i + 1, dsi->commands[i]);
28 dsi->attn_quantum = ntohl(dsi->attn_quantum);
30 case DSIOPT_SERVQUANT: /* just ignore these */
32 i += dsi->commands[i] + 1; /* forward past length tag + length */
37 /* let the client know the server quantum. we don't use the
38 * max server quantum due to a bug in appleshare client 3.8.6. */
39 dsi->header.dsi_flags = DSIFL_REPLY;
40 dsi->header.dsi_code = 0;
41 /* dsi->header.dsi_command = DSIFUNC_OPEN;*/
42 dsi->cmdlen = 2 + sizeof(i); /* length of data. dsi_send uses it. */
43 dsi->commands[0] = DSIOPT_SERVQUANT;
44 dsi->commands[1] = sizeof(i);
45 i = htonl(( dsi->server_quantum < DSI_SERVQUANT_MIN ||
46 dsi->server_quantum > DSI_SERVQUANT_MAX ) ?
47 DSI_SERVQUANT_DEF : dsi->server_quantum);
48 memcpy(dsi->commands + 2, &i, sizeof(i));