Lines Matching defs:dsi
15 #include <atalk/dsi.h>
19 static void dsi_init_buffer(DSI *dsi)
21 size_t quantum = dsi->server_quantum ? dsi->server_quantum : DSI_SERVQUANT_DEF;
24 if ((dsi->buffer = malloc(dsi->dsireadbuf * quantum)) == NULL) {
28 dsi->start = dsi->buffer;
29 dsi->eof = dsi->buffer;
30 dsi->end = dsi->buffer + (dsi->dsireadbuf * quantum);
34 void dsi_opensession(DSI *dsi)
39 dsi_init_buffer(dsi);
40 if (setnonblock(dsi->socket, 1) < 0) {
46 while (i < dsi->cmdlen) {
47 switch (dsi->commands[i++]) {
49 memcpy(&dsi->attn_quantum, dsi->commands + i + 1, dsi->commands[i]);
50 dsi->attn_quantum = ntohl(dsi->attn_quantum);
54 i += dsi->commands[i] + 1; /* forward past length tag + length */
61 dsi->header.dsi_flags = DSIFL_REPLY;
62 dsi->header.dsi_code = 0;
63 /* dsi->header.dsi_command = DSIFUNC_OPEN;*/
65 dsi->cmdlen = 2 * (2 + sizeof(i)); /* length of data. dsi_send uses it. */
68 dsi->commands[0] = DSIOPT_SERVQUANT;
69 dsi->commands[1] = sizeof(i);
70 i = htonl(( dsi->server_quantum < DSI_SERVQUANT_MIN ||
71 dsi->server_quantum > DSI_SERVQUANT_MAX ) ?
72 DSI_SERVQUANT_DEF : dsi->server_quantum);
73 memcpy(dsi->commands + 2, &i, sizeof(i));
77 dsi->commands[offs] = DSIOPT_REPLCSIZE;
78 dsi->commands[offs+1] = sizeof(i);
80 memcpy(dsi->commands + offs + 2, &i, sizeof(i));
81 dsi_send(dsi);