ccp.c (46828) | ccp.c (47061) |
---|---|
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 * | 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 * $Id: ccp.c,v 1.47 1999/05/08 11:06:12 brian Exp $ | 20 * $Id: ccp.c,v 1.48 1999/05/09 20:02:17 brian Exp $ |
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> --- 560 unchanged lines hidden (view full) --- 589ccp_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, u_short *proto) 590{ 591 /* 592 * If proto isn't PROTO_[I]COMPD, we still want to pass it to the 593 * decompression routines so that the dictionary's updated 594 */ 595 if (l->ccp.fsm.state == ST_OPENED) { 596 if (*proto == PROTO_COMPD || *proto == PROTO_ICOMPD) { | 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> --- 560 unchanged lines hidden (view full) --- 589ccp_LayerPull(struct bundle *b, struct link *l, struct mbuf *bp, u_short *proto) 590{ 591 /* 592 * If proto isn't PROTO_[I]COMPD, we still want to pass it to the 593 * decompression routines so that the dictionary's updated 594 */ 595 if (l->ccp.fsm.state == ST_OPENED) { 596 if (*proto == PROTO_COMPD || *proto == PROTO_ICOMPD) { |
597 log_Printf(LogDEBUG, "ccp_LayerPull: PROTO_%sCOMPDP -> PROTO_IP\n", 598 *proto == PROTO_ICOMPD ? "I" : ""); |
|
597 /* Decompress incoming data */ 598 if (l->ccp.reset_sent != -1) 599 /* Send another REQ and put the packet in the bit bucket */ 600 fsm_Output(&l->ccp.fsm, CODE_RESETREQ, l->ccp.reset_sent, NULL, 0); 601 else if (l->ccp.in.state != NULL) 602 return (*algorithm[l->ccp.in.algorithm]->i.Read) 603 (l->ccp.in.state, &l->ccp, proto, bp); 604 mbuf_Free(bp); 605 bp = NULL; | 599 /* Decompress incoming data */ 600 if (l->ccp.reset_sent != -1) 601 /* Send another REQ and put the packet in the bit bucket */ 602 fsm_Output(&l->ccp.fsm, CODE_RESETREQ, l->ccp.reset_sent, NULL, 0); 603 else if (l->ccp.in.state != NULL) 604 return (*algorithm[l->ccp.in.algorithm]->i.Read) 605 (l->ccp.in.state, &l->ccp, proto, bp); 606 mbuf_Free(bp); 607 bp = NULL; |
606 } else if (PROTO_COMPRESSIBLE(*proto) && l->ccp.in.state != NULL) | 608 } else if (PROTO_COMPRESSIBLE(*proto) && l->ccp.in.state != NULL) { 609 log_Printf(LogDEBUG, "ccp_LayerPull: Ignore packet (dict only)\n"); |
607 /* Add incoming Network Layer traffic to our dictionary */ 608 (*algorithm[l->ccp.in.algorithm]->i.DictSetup) 609 (l->ccp.in.state, &l->ccp, *proto, bp); | 610 /* Add incoming Network Layer traffic to our dictionary */ 611 (*algorithm[l->ccp.in.algorithm]->i.DictSetup) 612 (l->ccp.in.state, &l->ccp, *proto, bp); |
613 } else 614 log_Printf(LogDEBUG, "ccp_LayerPull: Ignore packet\n"); |
|
610 } 611 612 return bp; 613} 614 615u_short 616ccp_Proto(struct ccp *ccp) 617{ --- 25 unchanged lines hidden --- | 615 } 616 617 return bp; 618} 619 620u_short 621ccp_Proto(struct ccp *ccp) 622{ --- 25 unchanged lines hidden --- |