diff options
author | Brian Somers <brian@FreeBSD.org> | 1998-02-21 01:45:26 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 1998-02-21 01:45:26 +0000 |
commit | 503a7782d83ae95e68461f93e5c0d703bd7e04e0 (patch) | |
tree | 328bccd367d635d0d513800cd9eb9c714f9c8942 /usr.sbin/ppp/lcp.c | |
parent | 7e80369b76d36143c125bdc483843d3420783346 (diff) | |
download | src-503a7782d83ae95e68461f93e5c0d703bd7e04e0.tar.gz src-503a7782d83ae95e68461f93e5c0d703bd7e04e0.zip |
Shuffle around our FSMs a bit. This'll make it
easier to remove the CcpInfo, LcpInfo and IpcpInfo
globals.
Notes
Notes:
svn path=/cvs2svn/branches/MP/; revision=33702
Diffstat (limited to 'usr.sbin/ppp/lcp.c')
-rw-r--r-- | usr.sbin/ppp/lcp.c | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index 86bbe0442a7e..410c0a6545d8 100644 --- a/usr.sbin/ppp/lcp.c +++ b/usr.sbin/ppp/lcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.c,v 1.55.2.17 1998/02/18 19:35:48 brian Exp $ + * $Id: lcp.c,v 1.55.2.18 1998/02/19 19:57:01 brian Exp $ * * TODO: * o Limit data field length by MRU @@ -96,7 +96,9 @@ static struct fsm_callbacks lcp_Callbacks = { LcpSendConfigReq, LcpSendTerminateReq, LcpSendTerminateAck, - LcpDecodeConfig + LcpDecodeConfig, + NullRecvResetReq, + NullRecvResetAck }; struct lcp LcpInfo = { @@ -183,32 +185,43 @@ GenerateMagic(void) } void -LcpInit(struct bundle *bundle, struct physical *physical) +lcp_Init(struct lcp *lcp, struct bundle *bundle, struct physical *physical) { /* Initialise ourselves */ - FsmInit(&LcpInfo.fsm, bundle, physical2link(physical), 10); - hdlc_Init(&physical->hdlc); - async_Init(&physical->async); - - LcpInfo.his_mru = DEF_MRU; - LcpInfo.his_accmap = 0xffffffff; - LcpInfo.his_magic = 0; - LcpInfo.his_lqrperiod = 0; - LcpInfo.his_protocomp = 0; - LcpInfo.his_acfcomp = 0; - LcpInfo.his_auth = 0; - - LcpInfo.want_mru = VarMRU; - LcpInfo.want_accmap = VarAccmap; - LcpInfo.want_magic = GenerateMagic(); - LcpInfo.want_auth = Enabled(ConfChap) ? PROTO_CHAP : - Enabled(ConfPap) ? PROTO_PAP : 0; - LcpInfo.want_lqrperiod = Enabled(ConfLqr) ? VarLqrTimeout * 100 : 0; - LcpInfo.want_protocomp = Enabled(ConfProtocomp) ? 1 : 0; - LcpInfo.want_acfcomp = Enabled(ConfAcfcomp) ? 1 : 0; - - LcpInfo.his_reject = LcpInfo.my_reject = 0; - LcpInfo.auth_iwait = LcpInfo.auth_ineed = 0; + fsm_Init(&lcp->fsm, "LCP", PROTO_LCP, LCP_MAXCODE, 10, LogLCP, bundle, + &physical->link, &lcp_Callbacks); + lcp_Setup(lcp, 1); +} + +void +lcp_Setup(struct lcp *lcp, int openmode) +{ + struct physical *p = link2physical(lcp->fsm.link); + + lcp->fsm.open_mode = openmode; + + hdlc_Init(&p->hdlc); + async_Init(&p->async); + + lcp->his_mru = DEF_MRU; + lcp->his_accmap = 0xffffffff; + lcp->his_magic = 0; + lcp->his_lqrperiod = 0; + lcp->his_protocomp = 0; + lcp->his_acfcomp = 0; + lcp->his_auth = 0; + + lcp->want_mru = VarMRU; + lcp->want_accmap = VarAccmap; + lcp->want_magic = GenerateMagic(); + lcp->want_auth = Enabled(ConfChap) ? PROTO_CHAP : + Enabled(ConfPap) ? PROTO_PAP : 0; + lcp->want_lqrperiod = Enabled(ConfLqr) ? VarLqrTimeout * 100 : 0; + lcp->want_protocomp = Enabled(ConfProtocomp) ? 1 : 0; + lcp->want_acfcomp = Enabled(ConfAcfcomp) ? 1 : 0; + + lcp->his_reject = lcp->my_reject = 0; + lcp->auth_iwait = lcp->auth_ineed = 0; } static void |