2 * Copyright (c) 1990,1991 Regents of The University of Michigan.
5 * Permission to use, copy, modify, and distribute this software and
6 * its documentation for any purpose and without fee is hereby granted,
7 * provided that the above copyright notice appears in all copies and
8 * that both that copyright notice and this permission notice appear
9 * in supporting documentation, and that the name of The University
10 * of Michigan not be used in advertising or publicity pertaining to
11 * distribution of the software without specific, written prior
12 * permission. This software is supplied as is without expressed or
13 * implied warranties of any kind.
15 * Research Systems Unix Group
16 * The University of Michigan
18 * 535 W. William Street
21 * netatalk@itd.umich.edu
25 #include <sys/types.h>
27 #include <atalk/atp.h>
28 #include <atalk/asp.h>
30 #if defined(BSD) || defined(BSD4_3)
31 #define memmove(a, b, n) bcopy((b), (a), (n))
34 int asp_cmdreply( asp, result)
38 struct iovec iov[ ASP_MAXPACKETS ];
39 struct atp_block atpb;
43 /* unpack data into a format that atp likes. it needs to get
44 * 4-byte headers prepended before each ASP_CMDSIZ chunk. */
45 buf = (char *) asp->data;
46 buflen = asp->datalen;
47 asp->write_count += buflen;
48 result = htonl(result);
52 iov[ iovcnt ].iov_base = buf;
53 memmove(buf + ASP_HDRSIZ, buf, buflen);
56 memcpy( iov[ iovcnt ].iov_base, &result, ASP_HDRSIZ );
58 memset( iov[ iovcnt ].iov_base, 0, ASP_HDRSIZ );
61 if ( buflen > ASP_CMDSIZ ) {
64 iov[ iovcnt ].iov_len = ASP_CMDMAXSIZ;
66 iov[ iovcnt ].iov_len = buflen + ASP_HDRSIZ;
70 } while ( buflen > 0 );
72 atpb.atp_saddr = &asp->asp_sat;
73 atpb.atp_sresiov = iov;
74 atpb.atp_sresiovcnt = iovcnt;
75 if ( atp_sresp( asp->asp_atp, &atpb ) < 0 ) {