1
2
3
4
5
6
7
8
9
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
71#ifdef CONFIG_IPPP_FILTER
72#include <linux/filter.h>
73#endif
74
75#define DECOMP_ERR_NOMEM (-10)
76
77#define MP_END_FRAG 0x40
78#define MP_BEGIN_FRAG 0x80
79
80#define MP_MAX_QUEUE_LEN 16
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97#define IPPP_RESET_MAXDATABYTES 32
98
99struct isdn_ppp_resetparams {
100 unsigned char valid:1;
101 unsigned char rsend:1;
102 unsigned char idval:1;
103 unsigned char dtval:1;
104 unsigned char expra:1;
105 unsigned char id;
106 unsigned short maxdlen;
107 unsigned short dlen;
108 unsigned char *data;
109};
110
111
112
113
114
115struct isdn_ppp_compressor {
116 struct isdn_ppp_compressor *next, *prev;
117 struct module *owner;
118 int num;
119
120 void *(*alloc) (struct isdn_ppp_comp_data *);
121 void (*free) (void *state);
122 int (*init) (void *state, struct isdn_ppp_comp_data *,
123 int unit,int debug);
124
125
126
127
128
129
130
131 void (*reset) (void *state, unsigned char code, unsigned char id,
132 unsigned char *data, unsigned len,
133 struct isdn_ppp_resetparams *rsparm);
134
135 int (*compress) (void *state, struct sk_buff *in,
136 struct sk_buff *skb_out, int proto);
137
138 int (*decompress) (void *state,struct sk_buff *in,
139 struct sk_buff *skb_out,
140 struct isdn_ppp_resetparams *rsparm);
141
142 void (*incomp) (void *state, struct sk_buff *in,int proto);
143 void (*stat) (void *state, struct compstat *stats);
144};
145
146extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
147extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
148extern int isdn_ppp_dial_slave(char *);
149extern int isdn_ppp_hangup_slave(char *);
150
151typedef struct {
152 unsigned long seqerrs;
153 unsigned long frame_drops;
154 unsigned long overflows;
155 unsigned long max_queue_len;
156} isdn_mppp_stats;
157
158typedef struct {
159 int mp_mrru;
160 struct sk_buff * frags;
161 long frames;
162 unsigned int seq;
163
164
165 spinlock_t lock;
166 int ref_ct;
167
168 isdn_mppp_stats stats;
169} ippp_bundle;
170
171#define NUM_RCV_BUFFS 64
172
173struct ippp_buf_queue {
174 struct ippp_buf_queue *next;
175 struct ippp_buf_queue *last;
176 char *buf;
177 int len;
178};
179
180
181enum ippp_ccp_reset_states {
182 CCPResetIdle,
183 CCPResetSentReq,
184 CCPResetRcvdReq,
185 CCPResetSentAck,
186 CCPResetRcvdAck
187};
188
189struct ippp_ccp_reset_state {
190 enum ippp_ccp_reset_states state;
191 struct ippp_struct *is;
192 unsigned char id;
193 unsigned char ta:1;
194 unsigned char expra:1;
195 int dlen;
196 struct timer_list timer;
197
198
199
200 unsigned char data[IPPP_RESET_MAXDATABYTES];
201};
202
203
204
205struct ippp_ccp_reset {
206 struct ippp_ccp_reset_state *rs[256];
207 unsigned char lastid;
208};
209
210struct ippp_struct {
211 struct ippp_struct *next_link;
212 int state;
213 spinlock_t buflock;
214 struct ippp_buf_queue rq[NUM_RCV_BUFFS];
215 struct ippp_buf_queue *first;
216 struct ippp_buf_queue *last;
217 wait_queue_head_t wq;
218 struct task_struct *tk;
219 unsigned int mpppcfg;
220 unsigned int pppcfg;
221 unsigned int mru;
222 unsigned int mpmru;
223 unsigned int mpmtu;
224 unsigned int maxcid;
225 struct isdn_net_local_s *lp;
226 int unit;
227 int minor;
228 unsigned int last_link_seqno;
229 long mp_seqno;
230#ifdef CONFIG_ISDN_PPP_VJ
231 unsigned char *cbuf;
232 struct slcompress *slcomp;
233#endif
234#ifdef CONFIG_IPPP_FILTER
235 struct sock_filter *pass_filter;
236 struct sock_filter *active_filter;
237 unsigned pass_len, active_len;
238#endif
239 unsigned long debug;
240 struct isdn_ppp_compressor *compressor,*decompressor;
241 struct isdn_ppp_compressor *link_compressor,*link_decompressor;
242 void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat;
243 struct ippp_ccp_reset *reset;
244 unsigned long compflags;
245};
246
247#endif
248#endif
249