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
30 #include <sys/types.h>
35 #include <netatalk/at.h>
36 #include <atalk/atp.h>
37 #include <atalk/util.h>
43 #include "atp_internals.h"
47 ATP ah; /* open atp handle */
48 struct atp_block *atpb; /* parameter block */
53 atp_print_bufuse( ah, "atp_rresp" );
57 if ( atpb->atp_rresiovcnt <= 0 || atpb->atp_rresiovcnt > 8 ) {
62 while (( rc = atp_rsel( ah, atpb->atp_saddr, ATP_TRESP )) == 0 ) {
66 if ( rc != ATP_TRESP ) {
70 for ( i = 0; i < 8; ++i ) {
71 if ( ah->atph_resppkt[ i ] == NULL ) {
74 len = ah->atph_resppkt[ i ]->atpbuf_dlen - ATP_HDRSIZE;
75 if ( i > atpb->atp_rresiovcnt - 1 ||
76 len > atpb->atp_rresiov[ i ].iov_len ) {
81 fprintf( stderr, "atp_rresp copying %d bytes packet %d\n",
83 bprint( (char *)ah->atph_resppkt[ i ]->atpbuf_info.atpbuf_data,
86 memcpy(atpb->atp_rresiov[ i ].iov_base,
87 ah->atph_resppkt[ i ]->atpbuf_info.atpbuf_data + ATP_HDRSIZE,
89 atpb->atp_rresiov[ i ].iov_len = len;
90 atp_free_buf( ah->atph_resppkt[ i ] );
91 ah->atph_resppkt[ i ] = NULL;
93 atpb->atp_rresiovcnt = i;