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