]> arthur.barton.de Git - netatalk.git/blob - libatalk/pap/pap_read.c
autoconf POSIX.1 sys/wait.h check
[netatalk.git] / libatalk / pap / pap_read.c
1 /*
2  * $Id: pap_read.c,v 1.3 2001-06-29 14:14:47 rufustfirefly Exp $
3  *
4  * taken from bin/pap/pap.c
5  */
6
7 #ifdef HAVE_CONFIG_H
8 #include "config.h"
9 #endif /* HAVE_CONFIG_H */
10
11 int pap_read(PAP pap)
12 {
13     struct atp_block atpb;
14     u_int16_t seq;
15
16     pap->cmdbuf[0] = pap->pap_connid;
17     pap->cmdbuf[1] = PAP_READ;
18     if ( ++pap->pap_seq == 0 ) 
19       pap->pap_seq = 1;
20
21     seq = htons( pap->pap_seq );
22     memcpy(pap->cmdbuf + 2, &seq, sizeof(seq));
23     atpb.atp_saddr = &pap->pap_sat;
24     atpb.atp_sreqdata = pap->cmdbuf;
25     atpb.atp_sreqdlen = sizeof(pap->cmdbuf);    /* bytes in SendData request */
26     atpb.atp_sreqto = 15;               /* retry timer */
27     atpb.atp_sreqtries = ATP_TRIES_INFINITE;    /* retry count */
28     if ( atp_sreq( pap->pap_atp, &atpb, pap->oquantum, ATP_XO ) < 0 ) {
29       return -1;
30     }
31
32     return 0;
33 }