1995-01-31 06:29:58 +00:00
|
|
|
/*
|
|
|
|
* PPP Compression Control Protocol (CCP) Module
|
|
|
|
*
|
|
|
|
* Written by Toshiharu OHNO (tony-o@iij.ad.jp)
|
|
|
|
*
|
|
|
|
* Copyright (C) 1994, Internet Initiative Japan, Inc. All rights reserverd.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are permitted
|
|
|
|
* provided that the above copyright notice and this paragraph are
|
|
|
|
* duplicated in all such forms and that any documentation,
|
|
|
|
* advertising materials, and other materials related to such
|
|
|
|
* distribution and use acknowledge that the software was developed
|
|
|
|
* by the Internet Initiative Japan, Inc. The name of the
|
|
|
|
* IIJ may not be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
1995-05-30 03:57:47 +00:00
|
|
|
*
|
1997-12-03 23:28:02 +00:00
|
|
|
* $Id: ccp.c,v 1.21 1997/12/03 10:23:44 brian Exp $
|
1995-05-30 03:57:47 +00:00
|
|
|
*
|
1995-01-31 06:29:58 +00:00
|
|
|
* TODO:
|
|
|
|
* o Support other compression protocols
|
|
|
|
*/
|
1997-10-26 01:04:02 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
1997-11-22 03:37:54 +00:00
|
|
|
#include "command.h"
|
1997-10-26 01:04:02 +00:00
|
|
|
#include "mbuf.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "defs.h"
|
|
|
|
#include "timer.h"
|
1995-01-31 06:29:58 +00:00
|
|
|
#include "fsm.h"
|
|
|
|
#include "lcpproto.h"
|
|
|
|
#include "lcp.h"
|
|
|
|
#include "ccp.h"
|
|
|
|
#include "phase.h"
|
1997-05-26 00:44:10 +00:00
|
|
|
#include "loadalias.h"
|
1995-01-31 06:29:58 +00:00
|
|
|
#include "vars.h"
|
1996-01-11 17:48:59 +00:00
|
|
|
#include "pred.h"
|
1997-12-03 10:23:54 +00:00
|
|
|
#include "deflate.h"
|
1995-05-30 03:57:47 +00:00
|
|
|
|
1995-01-31 06:29:58 +00:00
|
|
|
struct ccpstate CcpInfo;
|
|
|
|
|
1997-06-09 03:27:43 +00:00
|
|
|
static void CcpSendConfigReq(struct fsm *);
|
1997-10-26 01:04:02 +00:00
|
|
|
static void CcpSendTerminateReq(struct fsm *);
|
|
|
|
static void CcpSendTerminateAck(struct fsm *);
|
|
|
|
static void CcpDecodeConfig(u_char *, int, int);
|
1997-06-09 03:27:43 +00:00
|
|
|
static void CcpLayerStart(struct fsm *);
|
|
|
|
static void CcpLayerFinish(struct fsm *);
|
|
|
|
static void CcpLayerUp(struct fsm *);
|
|
|
|
static void CcpLayerDown(struct fsm *);
|
|
|
|
static void CcpInitRestartCounter(struct fsm *);
|
1995-01-31 06:29:58 +00:00
|
|
|
|
|
|
|
struct fsm CcpFsm = {
|
|
|
|
"CCP",
|
|
|
|
PROTO_CCP,
|
|
|
|
CCP_MAXCODE,
|
|
|
|
OPEN_ACTIVE,
|
|
|
|
ST_INITIAL,
|
|
|
|
0, 0, 0,
|
|
|
|
0,
|
1997-08-25 00:29:32 +00:00
|
|
|
{0, 0, 0, NULL, NULL, NULL},
|
|
|
|
{0, 0, 0, NULL, NULL, NULL},
|
1997-08-20 23:47:53 +00:00
|
|
|
LogCCP,
|
1995-01-31 06:29:58 +00:00
|
|
|
|
|
|
|
CcpLayerUp,
|
|
|
|
CcpLayerDown,
|
|
|
|
CcpLayerStart,
|
|
|
|
CcpLayerFinish,
|
|
|
|
CcpInitRestartCounter,
|
|
|
|
CcpSendConfigReq,
|
|
|
|
CcpSendTerminateReq,
|
|
|
|
CcpSendTerminateAck,
|
|
|
|
CcpDecodeConfig,
|
|
|
|
};
|
|
|
|
|
1996-01-30 20:04:34 +00:00
|
|
|
static char const *cftypes[] = {
|
1997-11-14 15:39:15 +00:00
|
|
|
/* Check out the latest ``Compression Control Protocol'' rfc (rfc1962.txt) */
|
1997-12-03 23:28:02 +00:00
|
|
|
"OUI", /* 0: OUI */
|
|
|
|
"PRED1", /* 1: Predictor type 1 */
|
|
|
|
"PRED2", /* 2: Predictor type 2 */
|
|
|
|
"PUDDLE", /* 3: Puddle Jumber */
|
|
|
|
"???", "???", "???", "???", "???", "???",
|
|
|
|
"???", "???", "???", "???", "???", "???",
|
|
|
|
"HWPPC", /* 16: Hewlett-Packard PPC */
|
|
|
|
"STAC", /* 17: Stac Electronics LZS (rfc1974) */
|
|
|
|
"MSPPC", /* 18: Microsoft PPC */
|
|
|
|
"GAND", /* 19: Gandalf FZA (rfc1993) */
|
|
|
|
"V42BIS", /* 20: ARG->DATA.42bis compression */
|
|
|
|
"BSD", /* 21: BSD LZW Compress */
|
|
|
|
"???",
|
|
|
|
"LZS-DCP", /* 23: LZS-DCP Compression Protocol (rfc1967) */
|
|
|
|
"MAGNALINK/DEFLATE", /* 24: Magnalink Variable Resource (rfc1975) */
|
|
|
|
/* 24: Deflate (according to pppd-2.3.1) */
|
|
|
|
"DCE", /* 25: Data Circuit-Terminating Equip (rfc1976) */
|
|
|
|
"DEFLATE", /* 26: Deflate (rfc1979) */
|
1995-01-31 06:29:58 +00:00
|
|
|
};
|
|
|
|
|
1997-11-14 15:39:15 +00:00
|
|
|
#define NCFTYPES (sizeof(cftypes)/sizeof(char *))
|
|
|
|
|
1997-12-03 10:23:54 +00:00
|
|
|
static const char *
|
|
|
|
protoname(int proto)
|
|
|
|
{
|
|
|
|
if (proto < 0 || proto > NCFTYPES)
|
|
|
|
return "none";
|
|
|
|
return cftypes[proto];
|
|
|
|
}
|
|
|
|
|
1997-12-03 23:28:02 +00:00
|
|
|
/* We support these algorithms, and Req them in the given order */
|
1997-12-03 10:23:54 +00:00
|
|
|
static const struct ccp_algorithm *algorithm[] = {
|
1997-12-03 23:28:02 +00:00
|
|
|
&DeflateAlgorithm,
|
1997-12-03 10:23:54 +00:00
|
|
|
&Pred1Algorithm,
|
1997-12-03 23:28:02 +00:00
|
|
|
&PppdDeflateAlgorithm
|
1997-12-03 10:23:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int in_algorithm = -1;
|
|
|
|
static int out_algorithm = -1;
|
|
|
|
#define NALGORITHMS (sizeof(algorithm)/sizeof(algorithm[0]))
|
|
|
|
|
1997-05-10 01:22:19 +00:00
|
|
|
int
|
1997-11-22 03:37:54 +00:00
|
|
|
ReportCcpStatus(struct cmdargs const *arg)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
|
|
|
struct ccpstate *icp = &CcpInfo;
|
|
|
|
struct fsm *fp = &CcpFsm;
|
|
|
|
|
1997-06-09 03:27:43 +00:00
|
|
|
if (VarTerm) {
|
|
|
|
fprintf(VarTerm, "%s [%s]\n", fp->name, StateNames[fp->state]);
|
1997-12-03 10:23:54 +00:00
|
|
|
fprintf(VarTerm, "My protocol = %s, His protocol = %s\n",
|
|
|
|
protoname(icp->my_proto), protoname(icp->his_proto));
|
|
|
|
fprintf(VarTerm, "Output: %ld --> %ld, Input: %ld --> %ld\n",
|
|
|
|
icp->uncompout, icp->compout, icp->compin, icp->uncompin);
|
1997-06-09 03:27:43 +00:00
|
|
|
}
|
1997-05-10 01:22:19 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CcpInit()
|
|
|
|
{
|
|
|
|
struct ccpstate *icp = &CcpInfo;
|
|
|
|
|
|
|
|
FsmInit(&CcpFsm);
|
1997-10-26 01:04:02 +00:00
|
|
|
memset(icp, '\0', sizeof(struct ccpstate));
|
1997-12-03 10:23:54 +00:00
|
|
|
icp->his_proto = icp->my_proto = -1;
|
|
|
|
if (in_algorithm >= 0 && in_algorithm < NALGORITHMS) {
|
|
|
|
(*algorithm[in_algorithm]->i.Term)();
|
|
|
|
in_algorithm = -1;
|
|
|
|
}
|
|
|
|
if (out_algorithm >= 0 && out_algorithm < NALGORITHMS) {
|
|
|
|
(*algorithm[out_algorithm]->o.Term)();
|
|
|
|
out_algorithm = -1;
|
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
CcpFsm.maxconfig = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpInitRestartCounter(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1995-02-26 12:18:08 +00:00
|
|
|
fp->FsmTimer.load = VarRetryTimeout * SECTICKS;
|
1995-01-31 06:29:58 +00:00
|
|
|
fp->restart = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpSendConfigReq(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
|
|
|
u_char *cp;
|
|
|
|
struct ccpstate *icp = &CcpInfo;
|
1997-12-03 10:23:54 +00:00
|
|
|
int f;
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1997-08-20 23:47:53 +00:00
|
|
|
LogPrintf(LogCCP, "CcpSendConfigReq\n");
|
1997-12-03 10:23:54 +00:00
|
|
|
cp = ReqBuff;
|
|
|
|
CcpInfo.my_proto = -1;
|
|
|
|
out_algorithm = -1;
|
|
|
|
for (f = 0; f < NALGORITHMS; f++)
|
|
|
|
if (Enabled(algorithm[f]->Conf) && !REJECTED(icp, algorithm[f]->id)) {
|
|
|
|
struct lcp_opt o;
|
|
|
|
|
|
|
|
(*algorithm[f]->o.Get)(&o);
|
|
|
|
cp += LcpPutConf(LogCCP, cp, &o, cftypes[o.id],
|
|
|
|
(*algorithm[f]->Disp)(&o));
|
|
|
|
CcpInfo.my_proto = o.id;
|
|
|
|
out_algorithm = f;
|
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
FsmOutput(fp, CODE_CONFIGREQ, fp->reqid++, ReqBuff, cp - ReqBuff);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpSendResetReq(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1997-08-20 23:47:53 +00:00
|
|
|
LogPrintf(LogCCP, "CcpSendResetReq\n");
|
1995-01-31 06:29:58 +00:00
|
|
|
FsmOutput(fp, CODE_RESETREQ, fp->reqid, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpSendTerminateReq(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
|
|
|
/* XXX: No code yet */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpSendTerminateAck(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1997-08-20 23:47:53 +00:00
|
|
|
LogPrintf(LogCCP, "CcpSendTerminateAck\n");
|
1995-01-31 06:29:58 +00:00
|
|
|
FsmOutput(fp, CODE_TERMACK, fp->reqid++, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpRecvResetReq(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1997-12-03 10:23:54 +00:00
|
|
|
if (out_algorithm >= 0 && out_algorithm < NALGORITHMS)
|
|
|
|
(*algorithm[out_algorithm]->o.Reset)();
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpLayerStart(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1997-08-20 23:47:53 +00:00
|
|
|
LogPrintf(LogCCP, "CcpLayerStart.\n");
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpLayerFinish(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1997-08-20 23:47:53 +00:00
|
|
|
LogPrintf(LogCCP, "CcpLayerFinish.\n");
|
1997-12-03 10:23:54 +00:00
|
|
|
if (in_algorithm >= 0 && in_algorithm < NALGORITHMS) {
|
|
|
|
(*algorithm[in_algorithm]->i.Term)();
|
|
|
|
in_algorithm = -1;
|
|
|
|
}
|
|
|
|
if (out_algorithm >= 0 && out_algorithm < NALGORITHMS) {
|
|
|
|
(*algorithm[out_algorithm]->o.Term)();
|
|
|
|
out_algorithm = -1;
|
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpLayerDown(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1997-08-20 23:47:53 +00:00
|
|
|
LogPrintf(LogCCP, "CcpLayerDown.\n");
|
1997-12-03 10:23:54 +00:00
|
|
|
if (in_algorithm >= 0 && in_algorithm < NALGORITHMS) {
|
|
|
|
(*algorithm[in_algorithm]->i.Term)();
|
|
|
|
in_algorithm = -1;
|
|
|
|
}
|
|
|
|
if (out_algorithm >= 0 && out_algorithm < NALGORITHMS) {
|
|
|
|
(*algorithm[out_algorithm]->o.Term)();
|
|
|
|
out_algorithm = -1;
|
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1997-12-03 10:23:54 +00:00
|
|
|
* Called when CCP has reached the OPEN state
|
1995-01-31 06:29:58 +00:00
|
|
|
*/
|
|
|
|
static void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpLayerUp(struct fsm *fp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1997-08-20 23:47:53 +00:00
|
|
|
LogPrintf(LogCCP, "CcpLayerUp(%d).\n", fp->state);
|
1997-12-03 10:23:54 +00:00
|
|
|
LogPrintf(LogCCP, "Out = %s[%d], In = %s[%d]\n",
|
|
|
|
protoname(CcpInfo.my_proto), CcpInfo.my_proto,
|
|
|
|
protoname(CcpInfo.his_proto), CcpInfo.his_proto);
|
|
|
|
if (in_algorithm >= 0 && in_algorithm < NALGORITHMS)
|
|
|
|
(*algorithm[in_algorithm]->i.Init)();
|
|
|
|
if (out_algorithm >= 0 && out_algorithm < NALGORITHMS)
|
|
|
|
(*algorithm[out_algorithm]->o.Init)();
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CcpUp()
|
|
|
|
{
|
|
|
|
FsmUp(&CcpFsm);
|
1997-08-20 23:47:53 +00:00
|
|
|
LogPrintf(LogCCP, "CCP Up event!!\n");
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CcpOpen()
|
|
|
|
{
|
1997-12-03 10:23:54 +00:00
|
|
|
int f;
|
|
|
|
|
|
|
|
for (f = 0; f < NALGORITHMS; f++)
|
|
|
|
if (Enabled(algorithm[f]->Conf)) {
|
|
|
|
CcpFsm.open_mode = OPEN_ACTIVE;
|
|
|
|
FsmOpen(&CcpFsm);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (f == NALGORITHMS)
|
|
|
|
for (f = 0; f < NALGORITHMS; f++)
|
|
|
|
if (Acceptable(algorithm[f]->Conf)) {
|
|
|
|
CcpFsm.open_mode = OPEN_PASSIVE;
|
|
|
|
FsmOpen(&CcpFsm);
|
|
|
|
break;
|
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1997-11-08 00:28:11 +00:00
|
|
|
CcpDecodeConfig(u_char *cp, int plen, int mode_type)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1995-02-26 12:18:08 +00:00
|
|
|
int type, length;
|
1997-12-03 10:23:54 +00:00
|
|
|
int f;
|
1995-01-31 06:29:58 +00:00
|
|
|
|
|
|
|
ackp = AckBuff;
|
|
|
|
nakp = NakBuff;
|
|
|
|
rejp = RejBuff;
|
|
|
|
|
|
|
|
while (plen >= sizeof(struct fsmconfig)) {
|
|
|
|
if (plen < 0)
|
|
|
|
break;
|
|
|
|
type = *cp;
|
|
|
|
length = cp[1];
|
1997-11-14 15:39:15 +00:00
|
|
|
if (type < NCFTYPES)
|
1997-12-03 10:23:54 +00:00
|
|
|
LogPrintf(LogCCP, " %s[%d]\n", cftypes[type], length);
|
1995-01-31 06:29:58 +00:00
|
|
|
else
|
1997-12-03 10:23:54 +00:00
|
|
|
LogPrintf(LogCCP, " ???[%d]\n", length);
|
|
|
|
|
|
|
|
for (f = NALGORITHMS-1; f > -1; f--)
|
|
|
|
if (algorithm[f]->id == type)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (f == -1) {
|
|
|
|
/* Don't understand that :-( */
|
|
|
|
if (mode_type == MODE_REQ) {
|
|
|
|
CcpInfo.my_reject |= (1 << type);
|
|
|
|
memcpy(rejp, cp, length);
|
|
|
|
rejp += length;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
struct lcp_opt o;
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1997-11-08 00:28:11 +00:00
|
|
|
switch (mode_type) {
|
1995-01-31 06:29:58 +00:00
|
|
|
case MODE_REQ:
|
1997-12-03 10:23:54 +00:00
|
|
|
if (Acceptable(algorithm[f]->Conf) && in_algorithm == -1) {
|
|
|
|
memcpy(&o, cp, length);
|
|
|
|
switch ((*algorithm[f]->i.Set)(&o)) {
|
|
|
|
case MODE_REJ:
|
|
|
|
memcpy(rejp, &o, o.len);
|
|
|
|
rejp += o.len;
|
|
|
|
break;
|
|
|
|
case MODE_NAK:
|
|
|
|
memcpy(nakp, &o, o.len);
|
|
|
|
nakp += o.len;
|
|
|
|
break;
|
|
|
|
case MODE_ACK:
|
|
|
|
memcpy(ackp, cp, length);
|
|
|
|
ackp += length;
|
|
|
|
CcpInfo.his_proto = type;
|
|
|
|
in_algorithm = f; /* This one'll do ! */
|
|
|
|
break;
|
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
} else {
|
1997-10-26 01:04:02 +00:00
|
|
|
memcpy(rejp, cp, length);
|
1995-01-31 06:29:58 +00:00
|
|
|
rejp += length;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MODE_NAK:
|
1997-12-03 10:23:54 +00:00
|
|
|
memcpy(&o, cp, length);
|
|
|
|
if ((*algorithm[f]->o.Set)(&o) == MODE_ACK)
|
|
|
|
CcpInfo.my_proto = algorithm[f]->id;
|
|
|
|
else {
|
|
|
|
CcpInfo.his_reject |= (1 << type);
|
|
|
|
CcpInfo.my_proto = -1;
|
|
|
|
}
|
|
|
|
break;
|
1995-01-31 06:29:58 +00:00
|
|
|
case MODE_REJ:
|
|
|
|
CcpInfo.his_reject |= (1 << type);
|
1997-12-03 10:23:54 +00:00
|
|
|
CcpInfo.my_proto = -1;
|
1995-01-31 06:29:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1997-12-03 10:23:54 +00:00
|
|
|
|
1995-01-31 06:29:58 +00:00
|
|
|
plen -= length;
|
|
|
|
cp += length;
|
|
|
|
}
|
1997-12-03 10:23:54 +00:00
|
|
|
|
|
|
|
if (rejp != RejBuff) {
|
|
|
|
ackp = AckBuff; /* let's not send both ! */
|
|
|
|
CcpInfo.his_proto = -1;
|
|
|
|
in_algorithm = -1;
|
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1997-10-26 01:04:02 +00:00
|
|
|
CcpInput(struct mbuf *bp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
|
|
|
if (phase == PHASE_NETWORK)
|
|
|
|
FsmInput(&CcpFsm, bp);
|
|
|
|
else {
|
1997-09-10 21:33:32 +00:00
|
|
|
if (phase > PHASE_NETWORK)
|
|
|
|
LogPrintf(LogERROR, "Unexpected CCP in phase %d\n", phase);
|
1995-01-31 06:29:58 +00:00
|
|
|
pfree(bp);
|
|
|
|
}
|
|
|
|
}
|
1997-12-03 10:23:54 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
CcpResetInput()
|
|
|
|
{
|
|
|
|
if (in_algorithm >= 0 && in_algorithm < NALGORITHMS)
|
|
|
|
(*algorithm[in_algorithm]->i.Reset)();
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
CcpOutput(int pri, u_short proto, struct mbuf *m)
|
|
|
|
{
|
|
|
|
if (out_algorithm >= 0 && out_algorithm < NALGORITHMS)
|
|
|
|
return (*algorithm[out_algorithm]->o.Write)(pri, proto, m);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct mbuf *
|
|
|
|
CompdInput(u_short *proto, struct mbuf *m)
|
|
|
|
{
|
|
|
|
if (in_algorithm >= 0 && in_algorithm < NALGORITHMS)
|
|
|
|
return (*algorithm[in_algorithm]->i.Read)(proto, m);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CcpDictSetup(u_short proto, struct mbuf *m)
|
|
|
|
{
|
|
|
|
if (in_algorithm >= 0 && in_algorithm < NALGORITHMS)
|
|
|
|
(*algorithm[in_algorithm]->i.DictSetup)(proto, m);
|
|
|
|
}
|