📄 vjhc.h
字号:
/***********************************************************************//* *//* Module: tcp_ip/ppp/vjhc.h *//* Release: 2001.3 *//* Version: 2001.0 *//* Purpose: Include file for Van Jacobson header compression *//* *//*---------------------------------------------------------------------*//* *//* Copyright 2001, Blunk Microsystems *//* ALL RIGHTS RESERVED *//* *//* Licensees have the non-exclusive right to use, modify, or extract *//* this computer program for software development at a single site. *//* This program may be resold or disseminated in executable format *//* only. The source code may not be redistributed or resold. *//* *//*---------------------------------------------------------------------*//* *//* Copyright (c) 1989 Regents of the University of California. *//* All rights reserved. *//* *//* 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 University of California, Berkeley. The name of the *//* University 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. *//* *//***********************************************************************/#ifndef _VJHC_H#define _VJHC_H#include "../ip/ip.h"#include "../tcp/tcp.h"/***********************************************************************//* Configuration *//***********************************************************************/#define VJ_SLOT_HI 16 /* maximum # of slots */#define VJ_SLOT_DEF 16 /* default # of slots */#define VJ_SLOT_LO 2 /* minimum # of slots */#if (VJ_SLOT_DEF < 2) || (VJ_SLOT_HI < 2) || (VJ_SLOT_LO < 2) || \ (VJ_SLOT_DEF > 256) || (VJ_SLOT_HI > 256) || (VJ_SLOT_LO > 256)#error Slots must be in range 2 to 256#endif/***********************************************************************//* Symbol Definitions *//***********************************************************************/#define MAX_HDR 128 /* max TCP+IP hdr length (by protocol def) *//***********************************************************************//* Type Definitions *//***********************************************************************//*** "state" data for each active TCP conversation on the wire. This is** basically a copy of the entire IP/TCP header from the last packet** together with a small identifier the transmit & receive ends of the** line use to locate saved header.*/struct cstate{ struct cstate *cs_next; /* next MRU cstate (xmit only) */ ui16 cs_hlen; /* size of hdr (receive only) */ ui8 cs_id; /* connection # associated with this state */ ui8 cs_filler; union { char hdr[MAX_HDR]; Ip csu_ip; /* IP/TCP hdr from most recent packet */ } vjcs_u;};#define cs_ip vjcs_u.csu_ip#define cs_hdr vjcs_u.csu_hdr/*** All the state data for one serial line (need one of these per line).*/struct vjcompress{ struct cstate *last_cs; /* most recently used tstate */ ui8 last_recv; /* last rcvd conn. id */ ui8 last_xmit; /* last sent conn. id */ ui8 tslot_limit; /* highest transmit slot id (0-l) */ ui8 rslot_limit; /* highest receive slot id (0-l) */ ui16 flags; struct cstate tstate[VJ_SLOT_HI]; /* xmit connection states */ struct cstate rstate[VJ_SLOT_HI]; /* receive connection states */};/***********************************************************************//* Function Prototypes *//***********************************************************************/void vjhc_init(struct vjcompress *comp, int rslots, int tslots);uint vjhc_compress(NetBuf *buf, struct vjcompress *comp, int comp_cid);int vjhc_uncompress(struct vjcompress *comp, NetBuf *buf);int vjhc_remember(struct vjcompress *comp, const NetBuf *buf);void vjhc_toss(struct vjcompress *comp);#endif /* _VJHC_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -