45#define INCR(counter) ++comp->stats.counter 
   57  memset((
char *)comp, 0, 
sizeof(*comp));
 
   60  comp->compressSlot = 0;    
 
   63    tstate[i].
cs_next = &tstate[i - 1];
 
   67  comp->last_cs = &tstate[0];
 
   68  comp->last_recv = 255;
 
   69  comp->last_xmit = 255;
 
   79  if ((u_short)(n) >= 256) { \ 
   81    cp[1] = (u_char)(n); \ 
   82    cp[0] = (u_char)((n) >> 8); \ 
   85    *cp++ = (u_char)(n); \ 
   89  if ((u_short)(n) >= 256 || (u_short)(n) == 0) { \ 
   91    cp[1] = (u_char)(n); \ 
   92    cp[0] = (u_char)((n) >> 8); \ 
   95    *cp++ = (u_char)(n); \ 
  101    u32_t tmp = ntohl(f) + ((cp[1] << 8) | cp[2]); \ 
  105    u32_t tmp = ntohl(f) + (u32_t)*cp++; \ 
  110#define DECODES(f) { \ 
  112    u_short tmp = ntohs(f) + (((u_short)cp[1] << 8) | cp[2]); \ 
  116    u_short tmp = ntohs(f) + (u_short)*cp++; \ 
  121#define DECODEU(f) { \ 
  123    (f) = htons(((u_short)cp[1] << 8) | cp[2]); \ 
  126    (f) = htons((u_short)*cp++); \ 
  143  register struct tcp_hdr *oth;
 
  144  register struct tcp_hdr *th;
 
  145  register u_short deltaS, deltaA;
 
  146  register u_long deltaL;
 
  147  register u_int changes = 0;
 
  149  register u_char *cp = new_seq;
 
  166  th = (
struct tcp_hdr *)&((
long *)
ip)[hlen];
 
  167  if ((TCPH_FLAGS(th) & (TCP_SYN|TCP_FIN|TCP_RST|TCP_ACK)) != TCP_ACK) {
 
  180      || *(
long *)th != ((
long *)&cs->cs_ip)[
IPH_HL(&cs->cs_ip)]) {
 
  193    register struct cstate *lcs;
 
  201          && *(
long *)th == ((
long *)&cs->cs_ip)[
IPH_HL(&cs->cs_ip)]) {
 
  204    } 
while (cs != lastcs);
 
  216    hlen += TCPH_HDRLEN(th);
 
  219    if (hlen > pb->
len) {
 
  237  oth = (
struct tcp_hdr *)&((
long *)&cs->cs_ip)[hlen];
 
  239  hlen += TCPH_HDRLEN(th);
 
  242  if (hlen > pb->
len) {
 
  243    PPPDEBUG(
LOG_INFO, (
"vj_compress_tcp: header len %d spans buffers\n", hlen));
 
  258  if (((u_short *)
ip)[0] != ((u_short *)&cs->cs_ip)[0] 
 
  259      || ((u_short *)
ip)[3] != ((u_short *)&cs->cs_ip)[3] 
 
  260      || ((u_short *)
ip)[4] != ((u_short *)&cs->cs_ip)[4] 
 
  261      || TCPH_HDRLEN(th) != TCPH_HDRLEN(oth) 
 
  262      || (deltaS > 5 && BCMP(
ip + 1, &cs->cs_ip + 1, (deltaS - 5) << 2)) 
 
  263      || (TCPH_HDRLEN(th) > 5 && BCMP(th + 1, oth + 1, (TCPH_HDRLEN(th) - 5) << 2))) {
 
  273  if (TCPH_FLAGS(th) & TCP_URG) {
 
  274    deltaS = 
ntohs(th->urgp);
 
  277  } 
else if (th->urgp != oth->urgp) {
 
  285  if ((deltaS = (u_short)(
ntohs(th->wnd) - 
ntohs(oth->wnd))) != 0) {
 
  290  if ((deltaL = 
ntohl(th->ackno) - 
ntohl(oth->ackno)) != 0) {
 
  291    if (deltaL > 0xffff) {
 
  294    deltaA = (u_short)deltaL;
 
  299  if ((deltaL = 
ntohl(th->seqno) - 
ntohl(oth->seqno)) != 0) {
 
  300    if (deltaL > 0xffff) {
 
  303    deltaS = (u_short)deltaL;
 
  334    if (deltaS == deltaA && deltaS == 
ntohs(
IPH_LEN(&cs->cs_ip)) - hlen) {
 
  355  if (TCPH_FLAGS(th) & TCP_PSH) {
 
  362  deltaA = 
ntohs(th->chksum);
 
  363  BCOPY(
ip, &cs->cs_ip, hlen);
 
  374  deltaS = (u_short)(cp - new_seq);
 
  383    *cp++ = (u_char)(changes | 
NEW_C);
 
  392    *cp++ = (u_char)changes;
 
  394  *cp++ = (u_char)(deltaA >> 8);
 
  395  *cp++ = (u_char)deltaA;
 
  396  BCOPY(new_seq, cp, deltaS);
 
  397  INCR(vjs_compressed);
 
  406  BCOPY(
ip, &cs->cs_ip, hlen);
 
  430  register struct cstate *cs;
 
  436      || hlen + 
sizeof(
struct tcp_hdr) > nb->len
 
  437      || (hlen += TCPH_HDRLEN(((
struct tcp_hdr *)&((
char *)
ip)[hlen])) << 2)
 
  440    PPPDEBUG(
LOG_INFO, (
"vj_uncompress_uncomp: bad cid=%d, hlen=%d buflen=%d\n", 
 
  447  comp->
flags &=~ VJF_TOSS;
 
  449  BCOPY(
ip, &cs->cs_ip, hlen);
 
  451  INCR(vjs_uncompressedin);
 
  470  struct pbuf *n0 = *nb;
 
  472  u_int vjlen, hlen, changes;
 
  474  INCR(vjs_compressedin);
 
  477  if (changes & 
NEW_C) {
 
  487    comp->
flags &=~ VJF_TOSS;
 
  502  hlen = 
IPH_HL(&cs->cs_ip) << 2;
 
  503  th = (
struct tcp_hdr *)&((u_char *)&cs->cs_ip)[hlen];
 
  504  th->chksum = 
htons((*cp << 8) | cp[1]);
 
  507    TCPH_SET_FLAG(th, TCP_PSH);
 
  509    TCPH_UNSET_FLAG(th, TCP_PSH);
 
  517      tmp = 
ntohl(th->ackno) + i;
 
  518      th->ackno = 
htonl(tmp);
 
  519      tmp = 
ntohl(th->seqno) + i;
 
  520      th->seqno = 
htonl(tmp);
 
  527    th->seqno = 
htonl(tmp);
 
  531    if (changes & 
NEW_U) {
 
  532      TCPH_SET_FLAG(th, TCP_URG);
 
  535      TCPH_UNSET_FLAG(th, TCP_URG);
 
  537    if (changes & 
NEW_W) {
 
  540    if (changes & 
NEW_A) {
 
  543    if (changes & 
NEW_S) {
 
  548  if (changes & 
NEW_I) {
 
  549    DECODES(cs->cs_ip._id);
 
  560  vjlen = (u_short)(cp - (u_char*)n0->
payload);
 
  561  if (n0->
len < vjlen) {
 
  571#if BYTE_ORDER == LITTLE_ENDIAN 
  579  bp = (u_short *) &cs->cs_ip;
 
  581  for (tmp = 0; hlen > 0; hlen -= 2) {
 
  584  tmp = (tmp & 0xffff) + (tmp >> 16);
 
  585  tmp = (tmp & 0xffff) + (tmp >> 16);
 
  612    for(q = np; q != 
NULL; q = q->
next) {
 
#define LWIP_ASSERT(message, assertion)
 
#define IPH_LEN_SET(hdr, len)
 
#define IPH_ID_SET(hdr, id)
 
#define IPH_PROTO_SET(hdr, proto)
 
#define IPH_CHKSUM_SET(hdr, chksum)
 
#define ip_addr_cmp(addr1, addr2)
 
#define LWIP_MEM_ALIGN(addr)
 
#define MEMCPY(dst, src, len)
 
#define PBUF_POOL_BUFSIZE
 
u8_t pbuf_header(struct pbuf *p, s16_t header_size_increment)
 
void pbuf_cat(struct pbuf *h, struct pbuf *t)
 
void pbuf_chain(struct pbuf *h, struct pbuf *t)
 
struct pbuf * pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
 
u8_t pbuf_free(struct pbuf *p)
 
struct pbuf * pbuf_dechain(struct pbuf *p)
 
struct cstate rstate[MAX_SLOTS]
 
struct cstate tstate[MAX_SLOTS]
 
void vj_compress_init(struct vjcompress *comp)
 
int vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp)
 
#define TYPE_UNCOMPRESSED_TCP
 
void vj_uncompress_err(struct vjcompress *comp)
 
#define TYPE_COMPRESSED_TCP
 
int vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp)
 
u_int vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb)