2
* $Id: asp_getreq.c,v 1.3 2001/06/29 14:14:46 rufustfirefly Exp $
4
* Copyright (c) 1990,1991 Regents of The University of Michigan.
7
* Permission to use, copy, modify, and distribute this software and
8
* its documentation for any purpose and without fee is hereby granted,
9
* provided that the above copyright notice appears in all copies and
10
* that both that copyright notice and this permission notice appear
11
* in supporting documentation, and that the name of The University
12
* of Michigan not be used in advertising or publicity pertaining to
13
* distribution of the software without specific, written prior
14
* permission. This software is supplied as is without expressed or
15
* implied warranties of any kind.
17
* Research Systems Unix Group
18
* The University of Michigan
20
* 535 W. William Street
23
* netatalk@itd.umich.edu
29
#endif /* HAVE_CONFIG_H */
32
#include <sys/types.h>
35
#include <netatalk/endian.h>
36
#include <netatalk/at.h>
37
#include <atalk/atp.h>
38
#include <atalk/asp.h>
40
int asp_getrequest(ASP asp)
42
struct atp_block atpb;
45
asp->asp_sat.sat_port = ATADDR_ANYPORT;
46
atpb.atp_saddr = &asp->asp_sat;
47
atpb.atp_rreqdata = asp->cmdbuf;
48
atpb.atp_rreqdlen = sizeof(asp->cmdbuf);
50
if ( atp_rreq( asp->asp_atp, &atpb ) < 0 ) {
54
asp->cmdlen = atpb.atp_rreqdlen - 4;
55
asp->read_count += asp->cmdlen;
56
memcpy( &seq, asp->cmdbuf + 2, sizeof(seq));
59
if ((asp->cmdbuf[0] != ASPFUNC_CLOSE) && (seq != asp->asp_seq)) {
62
if ( asp->cmdbuf[1] != asp->asp_sid ) {
66
return( asp->cmdbuf[0] ); /* the command */