]> arthur.barton.de Git - netatalk.git/blob - libatalk/dsi/dsi_tickle.c
implemented config.h
[netatalk.git] / libatalk / dsi / dsi_tickle.c
1 /*
2  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
3  * All rights reserved. See COPYRIGHT.
4  */
5
6 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif
9
10 #include <stdio.h>
11 #include <sys/types.h>
12 #include <string.h>
13 #include <signal.h>
14
15 #include <atalk/dsi.h>
16 #include <netatalk/endian.h>
17
18 /* server generated tickles. as this is only called by the tickle handler,
19  * we don't need to block signals. well, actually, we might get it during
20  * a SIGHUP. */
21 void dsi_tickle(DSI *dsi)
22 {
23   char block[DSI_BLOCKSIZ];
24   sigset_t oldset;
25   u_int16_t id;
26
27   id = htons(dsi_serverID(dsi));
28
29   memset(block, 0, sizeof(block));
30   block[0] = DSIFL_REQUEST;
31   block[1] = DSIFUNC_TICKLE;
32   memcpy(block + 2, &id, sizeof(id));
33   /* code = len = reserved = 0 */
34
35   sigprocmask(SIG_BLOCK, &dsi->sigblockset, &oldset);
36   dsi_stream_write(dsi, block, DSI_BLOCKSIZ);
37   sigprocmask(SIG_SETMASK, &oldset, NULL);
38 }
39