2 * $Id: pap_close.c,v 1.3 2001-06-29 14:14:47 rufustfirefly Exp $
9 #endif /* HAVE_CONFIG_H */
11 int pap_close(PAP pap)
13 struct atp_block atpb;
15 unsigned char buf[PAP_HDRSIZ];
18 buf[ 0 ] = pap->pap_connid;
20 buf[ 2 ] = buf[ 3 ] = 0;
22 atpb.atp_saddr = &pap->pap_sat;
23 atpb.atp_sreqdata = buf;
24 atpb.atp_sreqdlen = sizeof(buf); /* bytes in CloseConn request */
25 atpb.atp_sreqto = 2; /* retry timer */
26 atpb.atp_sreqtries = 5; /* retry count */
27 if (atp_sreq( atp, &atpb, 1, ATP_XO ) < 0) {
31 /* check for CloseConnReply */
32 iov.iov_base = pap->pap_data;
33 iov.iov_len = sizeof( pap->pap_data );
34 atpb.atp_rresiov = &iov;
35 atpb.atp_rresiovcnt = 1;
36 if ( atp_rresp( pap->pap_atp, &atpb ) < 0 ) {
41 if ( iov.iov_len != 4 || pap->pap_data[ 0 ] != pap->pap_connid ||
42 pap->pap_data[ 1 ] != PAP_CLOSEREPLY ) {
43 syslog(LOG_ERR, "pap_close: Bad response!");
49 atp_close(pap->pap_atp);