2 * $Id: dsi_tickle.c,v 1.8 2009-10-25 06:13:11 didg Exp $
4 * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
5 * All rights reserved. See COPYRIGHT.
10 #endif /* HAVE_CONFIG_H */
13 #include <sys/types.h>
17 #include <atalk/dsi.h>
18 #include <netatalk/endian.h>
20 /* server generated tickles. as this is only called by the tickle handler,
21 * we don't need to block signals. */
22 int dsi_tickle(DSI *dsi)
24 char block[DSI_BLOCKSIZ];
28 if (dsi->asleep || dsi->in_write)
31 id = htons(dsi_serverID(dsi));
33 memset(block, 0, sizeof(block));
34 block[0] = DSIFL_REQUEST;
35 block[1] = DSIFUNC_TICKLE;
36 memcpy(block + 2, &id, sizeof(id));
37 /* code = len = reserved = 0 */
39 ret = dsi_stream_write(dsi, block, DSI_BLOCKSIZ, DSI_NOWAIT);
40 /* we don't really care if we can't send a tickle, it will fail
43 ret = (ret == -1 || ret == DSI_BLOCKSIZ);