vjcomp.c (31343) | vjcomp.c (31514) |
---|---|
1/* 2 * Input/Output VJ Compressed packets 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 * Input/Output VJ Compressed packets 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: vjcomp.c,v 1.12 1997/11/09 06:22:49 brian Exp $ | 20 * $Id: vjcomp.c,v 1.13 1997/11/22 03:37:54 brian Exp $ |
21 * 22 * TODO: 23 */ 24#include <sys/types.h> 25#include <netinet/in.h> 26#include <netinet/in_systm.h> 27#include <netinet/ip.h> 28 --- 21 unchanged lines hidden (view full) --- 50{ 51 sl_compress_init(&cslc, max_state); 52} 53 54void 55SendPppFrame(struct mbuf * bp) 56{ 57 int type; | 21 * 22 * TODO: 23 */ 24#include <sys/types.h> 25#include <netinet/in.h> 26#include <netinet/in_systm.h> 27#include <netinet/ip.h> 28 --- 21 unchanged lines hidden (view full) --- 50{ 51 sl_compress_init(&cslc, max_state); 52} 53 54void 55SendPppFrame(struct mbuf * bp) 56{ 57 int type; |
58 int proto; 59 int cproto = IpcpInfo.his_compproto >> 16; | 58 u_short proto; 59 u_short cproto = IpcpInfo.his_compproto >> 16; |
60 61 LogPrintf(LogDEBUG, "SendPppFrame: proto = %x\n", IpcpInfo.his_compproto); 62 if (((struct ip *) MBUF_CTOP(bp))->ip_p == IPPROTO_TCP 63 && cproto == PROTO_VJCOMP) { | 60 61 LogPrintf(LogDEBUG, "SendPppFrame: proto = %x\n", IpcpInfo.his_compproto); 62 if (((struct ip *) MBUF_CTOP(bp))->ip_p == IPPROTO_TCP 63 && cproto == PROTO_VJCOMP) { |
64 type = sl_compress_tcp(bp, (struct ip *) MBUF_CTOP(bp), &cslc, IpcpInfo.his_compproto & 0xff); 65 | 64 type = sl_compress_tcp(bp, (struct ip *)MBUF_CTOP(bp), &cslc, 65 IpcpInfo.his_compproto & 0xff); |
66 LogPrintf(LogDEBUG, "SendPppFrame: type = %x\n", type); 67 switch (type) { 68 case TYPE_IP: 69 proto = PROTO_IP; 70 break; 71 case TYPE_UNCOMPRESSED_TCP: 72 proto = PROTO_VJUNCOMP; 73 break; --- 74 unchanged lines hidden (view full) --- 148 break; 149 default: 150 LogPrintf(LogERROR, "VjCompInput...???\n"); 151 return (bp); 152 } 153 bp = VjUncompressTcp(bp, type); 154 return (bp); 155} | 66 LogPrintf(LogDEBUG, "SendPppFrame: type = %x\n", type); 67 switch (type) { 68 case TYPE_IP: 69 proto = PROTO_IP; 70 break; 71 case TYPE_UNCOMPRESSED_TCP: 72 proto = PROTO_VJUNCOMP; 73 break; --- 74 unchanged lines hidden (view full) --- 148 break; 149 default: 150 LogPrintf(LogERROR, "VjCompInput...???\n"); 151 return (bp); 152 } 153 bp = VjUncompressTcp(bp, type); 154 return (bp); 155} |
156 157const char * 158vj2asc(u_long val) 159{ 160 static char asc[50]; 161 162 sprintf(asc, "%ld VJ slots %s slot compression", 163 ((val>>8)&15)+1, val & 1 ? "with" : "without"); 164 return asc; 165} |
|