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
26 #include <sys/types.h>
31 #include <netatalk/at.h>
32 #include <atalk/atp.h>
33 #include <atalk/util.h>
39 #include "atp_internals.h"
43 ATP ah; /* open atp handle */
44 struct atp_block *atpb; /* parameter block */
49 atp_print_bufuse( ah, "atp_rresp" );
53 if ( atpb->atp_rresiovcnt <= 0 || atpb->atp_rresiovcnt > 8 ) {
58 while (( rc = atp_rsel( ah, atpb->atp_saddr, ATP_TRESP )) == 0 ) {
62 if ( rc != ATP_TRESP ) {
66 for ( i = 0; i < 8; ++i ) {
67 if ( ah->atph_resppkt[ i ] == NULL ) {
70 len = ah->atph_resppkt[ i ]->atpbuf_dlen - ATP_HDRSIZE;
71 if ( i > atpb->atp_rresiovcnt - 1 ||
72 len > atpb->atp_rresiov[ i ].iov_len ) {
77 fprintf( stderr, "atp_rresp copying %d bytes packet %d\n",
79 bprint( (char *)ah->atph_resppkt[ i ]->atpbuf_info.atpbuf_data,
82 memcpy(atpb->atp_rresiov[ i ].iov_base,
83 ah->atph_resppkt[ i ]->atpbuf_info.atpbuf_data + ATP_HDRSIZE,
85 atpb->atp_rresiov[ i ].iov_len = len;
86 atp_free_buf( ah->atph_resppkt[ i ] );
87 ah->atph_resppkt[ i ] = NULL;
89 atpb->atp_rresiovcnt = i;