1/*
2 * $Id: asp_tickle.c,v 1.7 2002-12-04 10:59:37 didg Exp $
3 */
4
5#ifdef HAVE_CONFIG_H
6#include "config.h"
7#endif /* HAVE_CONFIG_H */
8
9#include <string.h>
10#include <atalk/logger.h>
11#ifdef HAVE_SYS_TYPES_H
12#include <sys/types.h>
13#endif /* HAVE_SYS_TYPES_H */
14#include <errno.h>
15
16#include <sys/socket.h>
17#include <atalk/atp.h>
18#include <atalk/asp.h>
19
20/* send off a tickle */
21int asp_tickle(ASP asp, const u_int8_t sid, struct sockaddr_at *sat)
22{
23  struct atp_block atpb;
24  char buf[ASP_HDRSIZ];
25
26  buf[ 0 ] = ASPFUNC_TICKLE;
27  buf[ 1 ] = sid;
28  buf[ 2 ] = buf[ 3 ] = 0;
29
30  atpb.atp_saddr = sat;
31  atpb.atp_sreqdata = buf;
32  atpb.atp_sreqdlen = sizeof(buf);
33  atpb.atp_sreqto = 0;
34  atpb.atp_sreqtries = 1;
35  if ( atp_sreq( asp->asp_atp, &atpb, 0, 0 ) < 0 ) {
36    LOG(log_error, logtype_default, "atp_sreq: %s", strerror(errno) );
37    return 0;
38  }
39  return 1;
40}
41