aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/isdn_ppp.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/isdn_ppp.h')
-rw-r--r--include/linux/isdn_ppp.h249
1 files changed, 249 insertions, 0 deletions
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
new file mode 100644
index 000000000000..26b00a76e135
--- /dev/null
+++ b/include/linux/isdn_ppp.h
@@ -0,0 +1,249 @@
1/* Linux ISDN subsystem, sync PPP, interface to ipppd
2 *
3 * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
4 * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
5 * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
6 * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name)
7 *
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
10 *
11 */
12
13#ifndef _LINUX_ISDN_PPP_H
14#define _LINUX_ISDN_PPP_H
15
16#define CALLTYPE_INCOMING 0x1
17#define CALLTYPE_OUTGOING 0x2
18#define CALLTYPE_CALLBACK 0x4
19
20#define IPPP_VERSION "2.2.0"
21
22struct pppcallinfo
23{
24 int calltype;
25 unsigned char local_num[64];
26 unsigned char remote_num[64];
27 int charge_units;
28};
29
30#define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo)
31#define PPPIOCBUNDLE _IOW('t',129,int)
32#define PPPIOCGMPFLAGS _IOR('t',130,int)
33#define PPPIOCSMPFLAGS _IOW('t',131,int)
34#define PPPIOCSMPMTU _IOW('t',132,int)
35#define PPPIOCSMPMRU _IOW('t',133,int)
36#define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8])
37#define PPPIOCSCOMPRESSOR _IOW('t',135,int)
38#define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] )
39
40
41#define SC_MP_PROT 0x00000200
42#define SC_REJ_MP_PROT 0x00000400
43#define SC_OUT_SHORT_SEQ 0x00000800
44#define SC_IN_SHORT_SEQ 0x00004000
45
46#define SC_DECOMP_ON 0x01
47#define SC_COMP_ON 0x02
48#define SC_DECOMP_DISCARD 0x04
49#define SC_COMP_DISCARD 0x08
50#define SC_LINK_DECOMP_ON 0x10
51#define SC_LINK_COMP_ON 0x20
52#define SC_LINK_DECOMP_DISCARD 0x40
53#define SC_LINK_COMP_DISCARD 0x80
54
55#define ISDN_PPP_COMP_MAX_OPTIONS 16
56
57#define IPPP_COMP_FLAG_XMIT 0x1
58#define IPPP_COMP_FLAG_LINK 0x2
59
60struct isdn_ppp_comp_data {
61 int num;
62 unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
63 int optlen;
64 int flags;
65};
66
67#ifdef __KERNEL__
68
69
70#include <linux/config.h>
71
72#ifdef CONFIG_IPPP_FILTER
73#include <linux/filter.h>
74#endif
75
76#define DECOMP_ERR_NOMEM (-10)
77
78#define MP_END_FRAG 0x40
79#define MP_BEGIN_FRAG 0x80
80
81#define MP_MAX_QUEUE_LEN 16
82
83/*
84 * We need a way for the decompressor to influence the generation of CCP
85 * Reset-Requests in a variety of ways. The decompressor is already returning
86 * a lot of information (generated skb length, error conditions) so we use
87 * another parameter. This parameter is a pointer to a structure which is
88 * to be marked valid by the decompressor and only in this case is ever used.
89 * Furthermore, the only case where this data is used is when the decom-
90 * pressor returns DECOMP_ERROR.
91 *
92 * We use this same struct for the reset entry of the compressor to commu-
93 * nicate to its caller how to deal with sending of a Reset Ack. In this
94 * case, expra is not used, but other options still apply (suppressing
95 * sending with rsend, appending arbitrary data, etc).
96 */
97
98#define IPPP_RESET_MAXDATABYTES 32
99
100struct isdn_ppp_resetparams {
101 unsigned char valid:1; /* rw Is this structure filled at all ? */
102 unsigned char rsend:1; /* rw Should we send one at all ? */
103 unsigned char idval:1; /* rw Is the id field valid ? */
104 unsigned char dtval:1; /* rw Is the data field valid ? */
105 unsigned char expra:1; /* rw Is an Ack expected for this Req ? */
106 unsigned char id; /* wo Send CCP ResetReq with this id */
107 unsigned short maxdlen; /* ro Max bytes to be stored in data field */
108 unsigned short dlen; /* rw Bytes stored in data field */
109 unsigned char *data; /* wo Data for ResetReq info field */
110};
111
112/*
113 * this is an 'old friend' from ppp-comp.h under a new name
114 * check the original include for more information
115 */
116struct isdn_ppp_compressor {
117 struct isdn_ppp_compressor *next, *prev;
118 struct module *owner;
119 int num; /* CCP compression protocol number */
120
121 void *(*alloc) (struct isdn_ppp_comp_data *);
122 void (*free) (void *state);
123 int (*init) (void *state, struct isdn_ppp_comp_data *,
124 int unit,int debug);
125
126 /* The reset entry needs to get more exact information about the
127 ResetReq or ResetAck it was called with. The parameters are
128 obvious. If reset is called without a Req or Ack frame which
129 could be handed into it, code MUST be set to 0. Using rsparm,
130 the reset entry can control if and how a ResetAck is returned. */
131
132 void (*reset) (void *state, unsigned char code, unsigned char id,
133 unsigned char *data, unsigned len,
134 struct isdn_ppp_resetparams *rsparm);
135
136 int (*compress) (void *state, struct sk_buff *in,
137 struct sk_buff *skb_out, int proto);
138
139 int (*decompress) (void *state,struct sk_buff *in,
140 struct sk_buff *skb_out,
141 struct isdn_ppp_resetparams *rsparm);
142
143 void (*incomp) (void *state, struct sk_buff *in,int proto);
144 void (*stat) (void *state, struct compstat *stats);
145};
146
147extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
148extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
149extern int isdn_ppp_dial_slave(char *);
150extern int isdn_ppp_hangup_slave(char *);
151
152typedef struct {
153 unsigned long seqerrs;
154 unsigned long frame_drops;
155 unsigned long overflows;
156 unsigned long max_queue_len;
157} isdn_mppp_stats;
158
159typedef struct {
160 int mp_mrru; /* unused */
161 struct sk_buff * frags; /* fragments sl list -- use skb->next */
162 long frames; /* number of frames in the frame list */
163 unsigned int seq; /* last processed packet seq #: any packets
164 * with smaller seq # will be dropped
165 * unconditionally */
166 spinlock_t lock;
167 int ref_ct;
168 /* statistics */
169 isdn_mppp_stats stats;
170} ippp_bundle;
171
172#define NUM_RCV_BUFFS 64
173
174struct ippp_buf_queue {
175 struct ippp_buf_queue *next;
176 struct ippp_buf_queue *last;
177 char *buf; /* NULL here indicates end of queue */
178 int len;
179};
180
181/* The data structure for one CCP reset transaction */
182enum ippp_ccp_reset_states {
183 CCPResetIdle,
184 CCPResetSentReq,
185 CCPResetRcvdReq,
186 CCPResetSentAck,
187 CCPResetRcvdAck
188};
189
190struct ippp_ccp_reset_state {
191 enum ippp_ccp_reset_states state; /* State of this transaction */
192 struct ippp_struct *is; /* Backlink to device stuff */
193 unsigned char id; /* Backlink id index */
194 unsigned char ta:1; /* The timer is active (flag) */
195 unsigned char expra:1; /* We expect a ResetAck at all */
196 int dlen; /* Databytes stored in data */
197 struct timer_list timer; /* For timeouts/retries */
198 /* This is a hack but seems sufficient for the moment. We do not want
199 to have this be yet another allocation for some bytes, it is more
200 memory management overhead than the whole mess is worth. */
201 unsigned char data[IPPP_RESET_MAXDATABYTES];
202};
203
204/* The data structure keeping track of the currently outstanding CCP Reset
205 transactions. */
206struct ippp_ccp_reset {
207 struct ippp_ccp_reset_state *rs[256]; /* One per possible id */
208 unsigned char lastid; /* Last id allocated by the engine */
209};
210
211struct ippp_struct {
212 struct ippp_struct *next_link;
213 int state;
214 spinlock_t buflock;
215 struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
216 struct ippp_buf_queue *first; /* pointer to (current) first packet */
217 struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
218 wait_queue_head_t wq;
219 struct task_struct *tk;
220 unsigned int mpppcfg;
221 unsigned int pppcfg;
222 unsigned int mru;
223 unsigned int mpmru;
224 unsigned int mpmtu;
225 unsigned int maxcid;
226 struct isdn_net_local_s *lp;
227 int unit;
228 int minor;
229 unsigned int last_link_seqno;
230 long mp_seqno;
231#ifdef CONFIG_ISDN_PPP_VJ
232 unsigned char *cbuf;
233 struct slcompress *slcomp;
234#endif
235#ifdef CONFIG_IPPP_FILTER
236 struct sock_filter *pass_filter; /* filter for packets to pass */
237 struct sock_filter *active_filter; /* filter for pkts to reset idle */
238 unsigned pass_len, active_len;
239#endif
240 unsigned long debug;
241 struct isdn_ppp_compressor *compressor,*decompressor;
242 struct isdn_ppp_compressor *link_compressor,*link_decompressor;
243 void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat;
244 struct ippp_ccp_reset *reset; /* Allocated on demand, may never be needed */
245 unsigned long compflags;
246};
247
248#endif /* __KERNEL__ */
249#endif /* _LINUX_ISDN_PPP_H */