Deleted Added
sdiff udiff text old ( 67914 ) new ( 68423 )
full compact
1/*
2 * PPP Compression Control Protocol (CCP) Module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1994, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $FreeBSD: head/usr.sbin/ppp/ccp.c 67914 2000-10-30 00:15:33Z brian $
21 *
22 * TODO:
23 * o Support other compression protocols
24 */
25#include <sys/param.h>
26#include <netinet/in.h>
27#include <netinet/in_systm.h>
28#include <netinet/ip.h>

--- 342 unchanged lines hidden (view full) ---

371 }
372 ccp_Setup(ccp);
373}
374
375static void
376CcpLayerFinish(struct fsm *fp)
377{
378 /* We're now down */
379 log_Printf(LogCCP, "%s: LayerFinish.\n", fp->link->name);
380}
381
382/* Called when CCP has reached the OPEN state */
383static int
384CcpLayerUp(struct fsm *fp)
385{
386 /* We're now up */
387 struct ccp *ccp = fsm2ccp(fp);
388
389 log_Printf(LogCCP, "%s: LayerUp.\n", fp->link->name);
390
391 if (ccp->in.state == NULL && ccp->in.algorithm >= 0 &&
392 ccp->in.algorithm < NALGORITHMS) {
393 ccp->in.state = (*algorithm[ccp->in.algorithm]->i.Init)(&ccp->in.opt);
394 if (ccp->in.state == NULL) {
395 log_Printf(LogERROR, "%s: %s (in) initialisation failure\n",
396 fp->link->name, protoname(ccp->his_proto));
397 ccp->his_proto = ccp->my_proto = -1;
398 fsm_Close(fp);
399 return 0;
400 }
401 }
402
403 if (ccp->out.state == NULL && ccp->out.algorithm >= 0 &&
404 ccp->out.algorithm < NALGORITHMS) {
405 ccp->out.state = (*algorithm[ccp->out.algorithm]->o.Init)
406 (&ccp->out.opt->val);
407 if (ccp->out.state == NULL) {
408 log_Printf(LogERROR, "%s: %s (out) initialisation failure\n",
409 fp->link->name, protoname(ccp->my_proto));
410 ccp->his_proto = ccp->my_proto = -1;
411 fsm_Close(fp);
412 return 0;
413 }
414 }

--- 267 unchanged lines hidden ---