1 /*
2  *
3  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
4  * All rights reserved. See COPYRIGHT.
5  */
6 
7 #ifdef HAVE_CONFIG_H
8 #include "config.h"
9 #endif /* HAVE_CONFIG_H */
10 
11 #include <stdio.h>
12 #include <sys/types.h>
13 #include <string.h>
14 #include <signal.h>
15 
16 #include <atalk/dsi.h>
17 
18 /* server generated tickles. as this is only called by the tickle handler,
19  * we don't need to block signals. */
dsi_tickle(DSI * dsi)20 int dsi_tickle(DSI *dsi)
21 {
22   char block[DSI_BLOCKSIZ];
23   uint16_t id;
24 
25   if ((dsi->flags & DSI_SLEEPING) || dsi->in_write)
26       return 1;
27 
28   id = htons(dsi_serverID(dsi));
29 
30   memset(block, 0, sizeof(block));
31   block[0] = DSIFL_REQUEST;
32   block[1] = DSIFUNC_TICKLE;
33   memcpy(block + 2, &id, sizeof(id));
34   /* code = len = reserved = 0 */
35 
36   return dsi_stream_write(dsi, block, DSI_BLOCKSIZ, DSI_NOWAIT);
37 }
38 
39