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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [ppp/] [current/] [include/] [net/] [ppp_comp.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      include/net/ppp_comp.h
4
//
5
//==========================================================================
6
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
7
// -------------------------------------------                              
8
// This file is part of eCos, the Embedded Configurable Operating System.   
9
// Copyright (C) 2003 Free Software Foundation, Inc.                        
10
//
11
// eCos is free software; you can redistribute it and/or modify it under    
12
// the terms of the GNU General Public License as published by the Free     
13
// Software Foundation; either version 2 or (at your option) any later      
14
// version.                                                                 
15
//
16
// eCos is distributed in the hope that it will be useful, but WITHOUT      
17
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
18
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
19
// for more details.                                                        
20
//
21
// You should have received a copy of the GNU General Public License        
22
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
23
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
24
//
25
// As a special exception, if other files instantiate templates or use      
26
// macros or inline functions from this file, or you compile this file      
27
// and link it with other works to produce a work based on this file,       
28
// this file does not by itself cause the resulting work to be covered by   
29
// the GNU General Public License. However the source code for this file    
30
// must still be made available in accordance with section (3) of the GNU   
31
// General Public License v2.                                               
32
//
33
// This exception does not invalidate any other reasons why a work based    
34
// on this file might be covered by the GNU General Public License.         
35
// -------------------------------------------                              
36
// ####ECOSGPLCOPYRIGHTEND####                                              
37
// ####BSDALTCOPYRIGHTBEGIN####                                             
38
// -------------------------------------------                              
39
// Portions of this software may have been derived from FreeBSD, OpenBSD,   
40
// or other sources, and if so are covered by the appropriate copyright     
41
// and license included herein.                                             
42
// -------------------------------------------                              
43
// ####BSDALTCOPYRIGHTEND####                                               
44
//==========================================================================
45
 
46
/*
47
 * ppp_comp.h - Definitions for doing PPP packet compression.
48
 *
49
 * Copyright (c) 1994 The Australian National University.
50
 * All rights reserved.
51
 *
52
 * Permission to use, copy, modify, and distribute this software and its
53
 * documentation is hereby granted, provided that the above copyright
54
 * notice appears in all copies.  This software is provided without any
55
 * warranty, express or implied. The Australian National University
56
 * makes no representations about the suitability of this software for
57
 * any purpose.
58
 *
59
 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
60
 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
61
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
62
 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
63
 * OF SUCH DAMAGE.
64
 *
65
 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
66
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
67
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
68
 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
69
 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
70
 * OR MODIFICATIONS.
71
 *
72
 * $FreeBSD: src/sys/net/ppp_comp.h,v 1.8 1999/08/28 00:48:25 peter Exp $
73
 */
74
 
75
#ifndef _NET_PPP_COMP_H
76
#define _NET_PPP_COMP_H
77
 
78
#include <cyg/ppp/names.h>
79
 
80
/*
81
 * The following symbols control whether we include code for
82
 * various compression methods.
83
 */
84
#ifndef DO_BSD_COMPRESS
85
#define DO_BSD_COMPRESS 1       /* by default, include BSD-Compress */
86
#endif
87
#ifndef DO_DEFLATE
88
#define DO_DEFLATE      1       /* by default, include Deflate */
89
#endif
90
#define DO_PREDICTOR_1  0
91
#define DO_PREDICTOR_2  0
92
 
93
/*
94
 * Structure giving methods for compression/decompression.
95
 */
96
#ifdef PACKETPTR
97
struct compressor {
98
        int     compress_proto; /* CCP compression protocol number */
99
 
100
        /* Allocate space for a compressor (transmit side) */
101
        void    *(*comp_alloc) __P((u_char *options, int opt_len));
102
        /* Free space used by a compressor */
103
        void    (*comp_free) __P((void *state));
104
        /* Initialize a compressor */
105
        int     (*comp_init) __P((void *state, u_char *options, int opt_len,
106
                                  int unit, int hdrlen, int debug));
107
        /* Reset a compressor */
108
        void    (*comp_reset) __P((void *state));
109
        /* Compress a packet */
110
        int     (*compress) __P((void *state, PACKETPTR *mret,
111
                                 PACKETPTR mp, int orig_len, int max_len));
112
        /* Return compression statistics */
113
        void    (*comp_stat) __P((void *state, struct compstat *stats));
114
 
115
        /* Allocate space for a decompressor (receive side) */
116
        void    *(*decomp_alloc) __P((u_char *options, int opt_len));
117
        /* Free space used by a decompressor */
118
        void    (*decomp_free) __P((void *state));
119
        /* Initialize a decompressor */
120
        int     (*decomp_init) __P((void *state, u_char *options, int opt_len,
121
                                    int unit, int hdrlen, int mru, int debug));
122
        /* Reset a decompressor */
123
        void    (*decomp_reset) __P((void *state));
124
        /* Decompress a packet. */
125
        int     (*decompress) __P((void *state, PACKETPTR mp,
126
                                   PACKETPTR *dmpp));
127
        /* Update state for an incompressible packet received */
128
        void    (*incomp) __P((void *state, PACKETPTR mp));
129
        /* Return decompression statistics */
130
        void    (*decomp_stat) __P((void *state, struct compstat *stats));
131
};
132
#endif /* PACKETPTR */
133
 
134
/*
135
 * Return values for decompress routine.
136
 * We need to make these distinctions so that we can disable certain
137
 * useful functionality, namely sending a CCP reset-request as a result
138
 * of an error detected after decompression.  This is to avoid infringing
139
 * a patent held by Motorola.
140
 * Don't you just lurve software patents.
141
 */
142
#define DECOMP_OK               0        /* everything went OK */
143
#define DECOMP_ERROR            1       /* error detected before decomp. */
144
#define DECOMP_FATALERROR       2       /* error detected after decomp. */
145
 
146
/*
147
 * CCP codes.
148
 */
149
#define CCP_CONFREQ     1
150
#define CCP_CONFACK     2
151
#define CCP_TERMREQ     5
152
#define CCP_TERMACK     6
153
#define CCP_RESETREQ    14
154
#define CCP_RESETACK    15
155
 
156
/*
157
 * Max # bytes for a CCP option
158
 */
159
#define CCP_MAX_OPTION_LENGTH   32
160
 
161
/*
162
 * Parts of a CCP packet.
163
 */
164
#define CCP_CODE(dp)            ((dp)[0])
165
#define CCP_ID(dp)              ((dp)[1])
166
#define CCP_LENGTH(dp)          (((dp)[2] << 8) + (dp)[3])
167
#define CCP_HDRLEN              4
168
 
169
#define CCP_OPT_CODE(dp)        ((dp)[0])
170
#define CCP_OPT_LENGTH(dp)      ((dp)[1])
171
#define CCP_OPT_MINLEN          2
172
 
173
/*
174
 * Definitions for BSD-Compress.
175
 */
176
#define CI_BSD_COMPRESS         21      /* config. option for BSD-Compress */
177
#define CILEN_BSD_COMPRESS      3       /* length of config. option */
178
 
179
/* Macros for handling the 3rd byte of the BSD-Compress config option. */
180
#define BSD_NBITS(x)            ((x) & 0x1F)    /* number of bits requested */
181
#define BSD_VERSION(x)          ((x) >> 5)      /* version of option format */
182
#define BSD_CURRENT_VERSION     1               /* current version number */
183
#define BSD_MAKE_OPT(v, n)      (((v) << 5) | (n))
184
 
185
#define BSD_MIN_BITS            9       /* smallest code size supported */
186
#define BSD_MAX_BITS            15      /* largest code size supported */
187
 
188
/*
189
 * Definitions for Deflate.
190
 */
191
#define CI_DEFLATE              26      /* config option for Deflate */
192
#define CI_DEFLATE_DRAFT        24      /* value used in original draft RFC */
193
#define CILEN_DEFLATE           4       /* length of its config option */
194
 
195
#define DEFLATE_MIN_SIZE        8
196
#define DEFLATE_MAX_SIZE        15
197
#define DEFLATE_METHOD_VAL      8
198
#define DEFLATE_SIZE(x)         (((x) >> 4) + DEFLATE_MIN_SIZE)
199
#define DEFLATE_METHOD(x)       ((x) & 0x0F)
200
#define DEFLATE_MAKE_OPT(w)     ((((w) - DEFLATE_MIN_SIZE) << 4) \
201
                                 + DEFLATE_METHOD_VAL)
202
#define DEFLATE_CHK_SEQUENCE    0
203
 
204
/*
205
 * Definitions for other, as yet unsupported, compression methods.
206
 */
207
#define CI_PREDICTOR_1          1       /* config option for Predictor-1 */
208
#define CILEN_PREDICTOR_1       2       /* length of its config option */
209
#define CI_PREDICTOR_2          2       /* config option for Predictor-2 */
210
#define CILEN_PREDICTOR_2       2       /* length of its config option */
211
 
212
#endif /* _NET_PPP_COMP_H */

powered by: WebSVN 2.1.0

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