2 * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
3 * All rights reserved. See COPYRIGHT.
13 #include <sys/types.h>
15 #include <sys/socket.h>
17 #include <atalk/atp.h>
18 #include <atalk/asp.h>
19 #include <atalk/afp.h>
21 /* attentions can get sent at any time. as a consequence, we don't
22 * want to touch anything that might be used elsewhere. */
23 int asp_attention(ASP asp, AFPUserBytes flags)
25 char cmds[ASP_HDRSIZ], data[ASP_HDRSIZ];
26 struct sockaddr_at sat;
27 struct atp_block atpb;
28 struct iovec iov[ 1 ];
30 cmds[0] = ASPFUNC_ATTN;
31 cmds[1] = asp->asp_sid;
33 memcpy(cmds + 2, &flags, sizeof(flags));
36 sat.sat_port = asp->asp_wss;
37 atpb.atp_saddr = &sat;
38 atpb.atp_sreqdata = cmds;
39 atpb.atp_sreqdlen = sizeof(cmds);
41 atpb.atp_sreqtries = 5;
43 if ( atp_sreq( asp->asp_atp, &atpb, 1, 0 ) < 0 ) {
44 syslog( LOG_ERR, "atp_sreq: %m" );
48 iov[ 0 ].iov_base = data;
49 iov[ 0 ].iov_len = sizeof( data );
50 atpb.atp_rresiov = iov;
51 atpb.atp_rresiovcnt = sizeof( iov )/sizeof( iov[ 0 ] );
52 if ( atp_rresp( asp->asp_atp, &atpb ) < 0 ) {
53 syslog( LOG_ERR, "atp_rresp: %m" );