Deleted Added
full compact
hdlc.c (32284) hdlc.c (32381)
1/*
2 * PPP High Level Link Control (HDLC) Module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, 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 *
1/*
2 * PPP High Level Link Control (HDLC) Module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, 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 * $Id: hdlc.c,v 1.25 1997/12/24 09:29:00 brian Exp $
20 * $Id: hdlc.c,v 1.26 1998/01/06 00:58:31 brian Exp $
21 *
22 * TODO:
23 */
24#include <sys/param.h>
25#include <netinet/in.h>
26
27#include <stdio.h>
28#include <string.h>

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

218 lqr->PeerInDiscards = HisLqrSave.SaveInDiscards;
219 lqr->PeerInErrors = HisLqrSave.SaveInErrors;
220 lqr->PeerInOctets = HisLqrSave.SaveInOctets;
221 lqr->PeerOutLQRs = ++ifOutLQRs;
222 LqrDump("LqrOutput", lqr);
223 LqrChangeOrder(lqr, (struct lqrdata *) (MBUF_CTOP(bp)));
224 }
225 if (!DEV_IS_SYNC) {
21 *
22 * TODO:
23 */
24#include <sys/param.h>
25#include <netinet/in.h>
26
27#include <stdio.h>
28#include <string.h>

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

218 lqr->PeerInDiscards = HisLqrSave.SaveInDiscards;
219 lqr->PeerInErrors = HisLqrSave.SaveInErrors;
220 lqr->PeerInOctets = HisLqrSave.SaveInOctets;
221 lqr->PeerOutLQRs = ++ifOutLQRs;
222 LqrDump("LqrOutput", lqr);
223 LqrChangeOrder(lqr, (struct lqrdata *) (MBUF_CTOP(bp)));
224 }
225 if (!DEV_IS_SYNC) {
226 fcs = HdlcFcs(INITFCS, MBUF_CTOP(mhp), mhp->cnt);
227 fcs = HdlcFcs(fcs, MBUF_CTOP(bp), bp->cnt);
226 mfcs->cnt = 0;
227 fcs = HdlcFcsBuf(INITFCS, mhp);
228 fcs = ~fcs;
229 cp = MBUF_CTOP(mfcs);
230 *cp++ = fcs & 0377; /* Low byte first!! */
231 *cp++ = fcs >> 8;
228 fcs = ~fcs;
229 cp = MBUF_CTOP(mfcs);
230 *cp++ = fcs & 0377; /* Low byte first!! */
231 *cp++ = fcs >> 8;
232 mfcs->cnt = 2;
232 }
233 LogDumpBp(LogHDLC, "HdlcOutput", mhp);
234 for (statp = ProtocolStat; statp->number; statp++)
235 if (statp->number == proto)
236 break;
237 statp->out_count++;
238
239 LogPrintf(LogDEBUG, "HdlcOutput: proto = 0x%04x\n", proto);

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

376 u_char *cp;
377
378 LogPrintf(LogDEBUG, "DecodePacket: proto = 0x%04x\n", proto);
379
380 /*
381 * If proto isn't PROTO_COMPD, we still want to pass it to the
382 * decompression routines so that the dictionary's updated
383 */
233 }
234 LogDumpBp(LogHDLC, "HdlcOutput", mhp);
235 for (statp = ProtocolStat; statp->number; statp++)
236 if (statp->number == proto)
237 break;
238 statp->out_count++;
239
240 LogPrintf(LogDEBUG, "HdlcOutput: proto = 0x%04x\n", proto);

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

377 u_char *cp;
378
379 LogPrintf(LogDEBUG, "DecodePacket: proto = 0x%04x\n", proto);
380
381 /*
382 * If proto isn't PROTO_COMPD, we still want to pass it to the
383 * decompression routines so that the dictionary's updated
384 */
384 if (proto == PROTO_COMPD) {
385 if ((bp = CompdInput(&proto, bp)) == NULL)
386 return;
387 } else if ((proto & 0xfff1) == 0x21) /* Network Layer protocol */
388 if (CcpFsm.state == ST_OPENED)
385 if (CcpFsm.state == ST_OPENED)
386 if (proto == PROTO_COMPD) {
387 if ((bp = CompdInput(&proto, bp)) == NULL)
388 return;
389 } else if ((proto & 0xfff1) == 0x21) /* Network Layer protocol */
389 CcpDictSetup(proto, bp);
390
391 switch (proto) {
392 case PROTO_LCP:
393 LcpInput(bp);
394 break;
395 case PROTO_PAP:
396 PapInput(bp);

--- 184 unchanged lines hidden ---
390 CcpDictSetup(proto, bp);
391
392 switch (proto) {
393 case PROTO_LCP:
394 LcpInput(bp);
395 break;
396 case PROTO_PAP:
397 PapInput(bp);

--- 184 unchanged lines hidden ---