diff options
author | brian <brian@FreeBSD.org> | 1997-10-26 01:04:02 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-10-26 01:04:02 +0000 |
commit | 486b8925ecb0d408e403474828e20c1cce8aaec8 (patch) | |
tree | cca66974908224bf517868aaafb2e4acd1abe88d /usr.sbin/ppp/phase.c | |
parent | 1d2927c9fac7bcfe68bf6ab502c716adc91d6f09 (diff) | |
download | FreeBSD-src-486b8925ecb0d408e403474828e20c1cce8aaec8.zip FreeBSD-src-486b8925ecb0d408e403474828e20c1cce8aaec8.tar.gz |
Cosmetic (no functional changes):
o Add missing $Id$s
o Move extern decls from .c -> .h files
o Staticize
o Remove #includes from .h files
o style(9)ify includes
o bcopy -> memcpy
bzero -> memset
bcmp -> memcmp
index -> strchr
rindex -> strrchr
o Move timeout.h -> timer.h (making it consistent w/ timer.c)
o Add -Wmissing-prototypes
Diffstat (limited to 'usr.sbin/ppp/phase.c')
-rw-r--r-- | usr.sbin/ppp/phase.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/usr.sbin/ppp/phase.c b/usr.sbin/ppp/phase.c new file mode 100644 index 0000000..b1dc7e9 --- /dev/null +++ b/usr.sbin/ppp/phase.c @@ -0,0 +1,66 @@ +/* + * $Id: $ + */ + +#include <sys/param.h> +#include <netinet/in.h> + +#include <stdio.h> + +#include "mbuf.h" +#include "log.h" +#include "lcp.h" +#include "lcpproto.h" +#include "timer.h" +#include "auth.h" +#include "pap.h" +#include "chap.h" +#include "ipcp.h" +#include "ccp.h" +#include "defs.h" +#include "main.h" +#include "loadalias.h" +#include "command.h" +#include "vars.h" +#include "phase.h" + +int phase = 0; /* Curent phase */ + +static char *PhaseNames[] = { + "Dead", "Establish", "Authenticate", "Network", "Terminate" +}; + +void +NewPhase(int new) +{ + struct lcpstate *lcp = &LcpInfo; + + phase = new; + LogPrintf(LogPHASE, "NewPhase: %s\n", PhaseNames[phase]); + switch (phase) { + case PHASE_AUTHENTICATE: + lcp->auth_ineed = lcp->want_auth; + lcp->auth_iwait = lcp->his_auth; + if (lcp->his_auth || lcp->want_auth) { + LogPrintf(LogPHASE, " his = %x, mine = %x\n", lcp->his_auth, lcp->want_auth); + if (lcp->his_auth == PROTO_PAP) + StartAuthChallenge(&AuthPapInfo); + if (lcp->want_auth == PROTO_CHAP) + StartAuthChallenge(&AuthChapInfo); + } else + NewPhase(PHASE_NETWORK); + break; + case PHASE_NETWORK: + IpcpUp(); + IpcpOpen(); + CcpUp(); + CcpOpen(); + break; + case PHASE_TERMINATE: + if (mode & MODE_DIRECT) + Cleanup(EX_DEAD); + if (mode & MODE_BACKGROUND && reconnectState != RECON_TRUE) + Cleanup(EX_DEAD); + break; + } +} |