#include "netif/ppp/ppp_opts.h"
#if PPP_SUPPORT && VJ_SUPPORT
#ifndef VJ_H
#define VJ_H
#include "lwip/ip.h"
#include "lwip/priv/tcp_priv.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_SLOTS 16
#define MAX_HDR 128
#define TYPE_IP 0x40
#define TYPE_UNCOMPRESSED_TCP 0x70
#define TYPE_COMPRESSED_TCP 0x80
#define TYPE_ERROR 0x00
#define NEW_C 0x40
#define NEW_I 0x20
#define NEW_S 0x08
#define NEW_A 0x04
#define NEW_W 0x02
#define NEW_U 0x01
#define SPECIAL_I (NEW_S|NEW_W|NEW_U)
#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U)
#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
#define TCP_PUSH_BIT 0x10
struct cstate {
struct cstate *cs_next;
u16_t cs_hlen;
u8_t cs_id;
u8_t cs_filler;
union {
char csu_hdr[MAX_HDR];
struct ip_hdr csu_ip;
} vjcs_u;
};
#define cs_ip vjcs_u.csu_ip
#define cs_hdr vjcs_u.csu_hdr
struct vjstat {
u32_t vjs_packets;
u32_t vjs_compressed;
u32_t vjs_searches;
u32_t vjs_misses;
u32_t vjs_uncompressedin;
u32_t vjs_compressedin;
u32_t vjs_errorin;
u32_t vjs_tossed;
};
struct vjcompress {
struct cstate *last_cs;
u8_t last_recv;
u8_t last_xmit;
u16_t flags;
u8_t maxSlotIndex;
u8_t compressSlot;
#if LINK_STATS
struct vjstat stats;
#endif
struct cstate tstate[MAX_SLOTS];
struct cstate rstate[MAX_SLOTS];
};
#define VJF_TOSS 1U
extern void vj_compress_init (struct vjcompress *comp);
extern u8_t vj_compress_tcp (struct vjcompress *comp, struct pbuf **pb);
extern void vj_uncompress_err (struct vjcompress *comp);
extern int vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp);
extern int vj_uncompress_tcp (struct pbuf **nb, struct vjcompress *comp);
#ifdef __cplusplus
}
#endif
#endif
#endif