OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [net/] [slhc_vj.h] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _SLHC_H
2
#define _SLHC_H
3
/*
4
 * Definitions for tcp compression routines.
5
 *
6
 * $Header: /home/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/rc203soc/sw/uClinux/include/net/slhc_vj.h,v 1.1 2005-12-20 11:33:02 jcastillo Exp $
7
 *
8
 * Copyright (c) 1989 Regents of the University of California.
9
 * All rights reserved.
10
 *
11
 * Redistribution and use in source and binary forms are permitted
12
 * provided that the above copyright notice and this paragraph are
13
 * duplicated in all such forms and that any documentation,
14
 * advertising materials, and other materials related to such
15
 * distribution and use acknowledge that the software was developed
16
 * by the University of California, Berkeley.  The name of the
17
 * University may not be used to endorse or promote products derived
18
 * from this software without specific prior written permission.
19
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
20
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
21
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22
 *
23
 *      Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
24
 *      - Initial distribution.
25
 *
26
 *
27
 * modified for KA9Q Internet Software Package by
28
 * Katie Stevens (dkstevens@ucdavis.edu)
29
 * University of California, Davis
30
 * Computing Services
31
 *      - 01-31-90      initial adaptation
32
 *
33
 *      - Feb 1991      Bill_Simpson@um.cc.umich.edu
34
 *                      variable number of conversation slots
35
 *                      allow zero or one slots
36
 *                      separate routines
37
 *                      status display
38
 */
39
 
40
/*
41
 * Compressed packet format:
42
 *
43
 * The first octet contains the packet type (top 3 bits), TCP
44
 * 'push' bit, and flags that indicate which of the 4 TCP sequence
45
 * numbers have changed (bottom 5 bits).  The next octet is a
46
 * conversation number that associates a saved IP/TCP header with
47
 * the compressed packet.  The next two octets are the TCP checksum
48
 * from the original datagram.  The next 0 to 15 octets are
49
 * sequence number changes, one change per bit set in the header
50
 * (there may be no changes and there are two special cases where
51
 * the receiver implicitly knows what changed -- see below).
52
 *
53
 * There are 5 numbers which can change (they are always inserted
54
 * in the following order): TCP urgent pointer, window,
55
 * acknowledgment, sequence number and IP ID.  (The urgent pointer
56
 * is different from the others in that its value is sent, not the
57
 * change in value.)  Since typical use of SLIP links is biased
58
 * toward small packets (see comments on MTU/MSS below), changes
59
 * use a variable length coding with one octet for numbers in the
60
 * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the
61
 * range 256 - 65535 or 0.  (If the change in sequence number or
62
 * ack is more than 65535, an uncompressed packet is sent.)
63
 */
64
 
65
/*
66
 * Packet types (must not conflict with IP protocol version)
67
 *
68
 * The top nibble of the first octet is the packet type.  There are
69
 * three possible types: IP (not proto TCP or tcp with one of the
70
 * control flags set); uncompressed TCP (a normal IP/TCP packet but
71
 * with the 8-bit protocol field replaced by an 8-bit connection id --
72
 * this type of packet syncs the sender & receiver); and compressed
73
 * TCP (described above).
74
 *
75
 * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and
76
 * is logically part of the 4-bit "changes" field that follows.  Top
77
 * three bits are actual packet type.  For backward compatibility
78
 * and in the interest of conserving bits, numbers are chosen so the
79
 * IP protocol version number (4) which normally appears in this nibble
80
 * means "IP packet".
81
 */
82
 
83
/* SLIP compression masks for len/vers byte */
84
#define SL_TYPE_IP 0x40
85
#define SL_TYPE_UNCOMPRESSED_TCP 0x70
86
#define SL_TYPE_COMPRESSED_TCP 0x80
87
#define SL_TYPE_ERROR 0x00
88
 
89
/* Bits in first octet of compressed packet */
90
#define NEW_C   0x40    /* flag bits for what changed in a packet */
91
#define NEW_I   0x20
92
#define NEW_S   0x08
93
#define NEW_A   0x04
94
#define NEW_W   0x02
95
#define NEW_U   0x01
96
 
97
/* reserved, special-case values of above */
98
#define SPECIAL_I (NEW_S|NEW_W|NEW_U)           /* echoed interactive traffic */
99
#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U)     /* unidirectional data */
100
#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
101
 
102
#define TCP_PUSH_BIT 0x10
103
 
104
/*
105
 * data type and sizes conversion assumptions:
106
 *
107
 *      VJ code         KA9Q style      generic
108
 *      u_char          byte_t          unsigned char    8 bits
109
 *      u_short         int16           unsigned short  16 bits
110
 *      u_int           int16           unsigned short  16 bits
111
 *      u_long          unsigned long   unsigned long   32 bits
112
 *      int             int32           long            32 bits
113
 */
114
 
115
typedef unsigned char byte_t;
116
typedef unsigned long int32;
117
 
118
/*
119
 * "state" data for each active tcp conversation on the wire.  This is
120
 * basically a copy of the entire IP/TCP header from the last packet
121
 * we saw from the conversation together with a small identifier
122
 * the transmit & receive ends of the line use to locate saved header.
123
 */
124
struct cstate {
125
        byte_t  cs_this;        /* connection id number (xmit) */
126
        struct cstate *next;    /* next in ring (xmit) */
127
        struct iphdr cs_ip;     /* ip/tcp hdr from most recent packet */
128
        struct tcphdr cs_tcp;
129
        unsigned char cs_ipopt[64];
130
        unsigned char cs_tcpopt[64];
131
        int cs_hsize;
132
};
133
#define NULLSLSTATE     (struct cstate *)0
134
 
135
/*
136
 * all the state data for one serial line (we need one of these per line).
137
 */
138
struct slcompress {
139
        struct cstate *tstate;  /* transmit connection states (array)*/
140
        struct cstate *rstate;  /* receive connection states (array)*/
141
 
142
        byte_t tslot_limit;     /* highest transmit slot id (0-l)*/
143
        byte_t rslot_limit;     /* highest receive slot id (0-l)*/
144
 
145
        byte_t xmit_oldest;     /* oldest xmit in ring */
146
        byte_t xmit_current;    /* most recent xmit id */
147
        byte_t recv_current;    /* most recent rcvd id */
148
 
149
        byte_t flags;
150
#define SLF_TOSS        0x01    /* tossing rcvd frames until id received */
151
 
152
        int32 sls_o_nontcp;     /* outbound non-TCP packets */
153
        int32 sls_o_tcp;        /* outbound TCP packets */
154
        int32 sls_o_uncompressed;       /* outbound uncompressed packets */
155
        int32 sls_o_compressed; /* outbound compressed packets */
156
        int32 sls_o_searches;   /* searches for connection state */
157
        int32 sls_o_misses;     /* times couldn't find conn. state */
158
 
159
        int32 sls_i_uncompressed;       /* inbound uncompressed packets */
160
        int32 sls_i_compressed; /* inbound compressed packets */
161
        int32 sls_i_error;      /* inbound error packets */
162
        int32 sls_i_tossed;     /* inbound packets tossed because of error */
163
 
164
        int32 sls_i_runt;
165
        int32 sls_i_badcheck;
166
};
167
#define NULLSLCOMPR     (struct slcompress *)0
168
 
169
#define __ARGS(x) x
170
 
171
/* In slhc.c: */
172
struct slcompress *slhc_init __ARGS((int rslots, int tslots));
173
void slhc_free __ARGS((struct slcompress *comp));
174
 
175
int slhc_compress __ARGS((struct slcompress *comp, unsigned char *icp,
176
                          int isize, unsigned char *ocp, unsigned char **cpp,
177
                          int compress_cid));
178
int slhc_uncompress __ARGS((struct slcompress *comp, unsigned char *icp,
179
                            int isize));
180
int slhc_remember __ARGS((struct slcompress *comp, unsigned char *icp,
181
                          int isize));
182
int slhc_toss __ARGS((struct slcompress *comp));
183
 
184
void slhc_i_status __ARGS((struct slcompress *comp));
185
void slhc_o_status __ARGS((struct slcompress *comp));
186
 
187
#endif  /* _SLHC_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.