2 * $Id: atp_rresp.c,v 1.4 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
28 #endif /* HAVE_CONFIG_H */
32 #include <sys/types.h>
36 #include <sys/socket.h>
38 #include <netatalk/at.h>
39 #include <atalk/atp.h>
40 #include <atalk/util.h>
46 #include "atp_internals.h"
50 ATP ah; /* open atp handle */
51 struct atp_block *atpb; /* parameter block */
56 atp_print_bufuse( ah, "atp_rresp" );
60 if ( atpb->atp_rresiovcnt <= 0 || atpb->atp_rresiovcnt > 8 ) {
65 while (( rc = atp_rsel( ah, atpb->atp_saddr, ATP_TRESP )) == 0 ) {
69 if ( rc != ATP_TRESP ) {
73 for ( i = 0; i < 8; ++i ) {
74 if ( ah->atph_resppkt[ i ] == NULL ) {
77 len = ah->atph_resppkt[ i ]->atpbuf_dlen - ATP_HDRSIZE;
78 if ( i > atpb->atp_rresiovcnt - 1 ||
79 len > atpb->atp_rresiov[ i ].iov_len ) {
84 fprintf( stderr, "atp_rresp copying %d bytes packet %d\n",
86 bprint( (char *)ah->atph_resppkt[ i ]->atpbuf_info.atpbuf_data,
89 memcpy(atpb->atp_rresiov[ i ].iov_base,
90 ah->atph_resppkt[ i ]->atpbuf_info.atpbuf_data + ATP_HDRSIZE,
92 atpb->atp_rresiov[ i ].iov_len = len;
93 atp_free_buf( ah->atph_resppkt[ i ] );
94 ah->atph_resppkt[ i ] = NULL;
96 atpb->atp_rresiovcnt = i;