1
2
3
4
5
6
7
8#ifndef _LINUX_ISDN_PPP_H
9#define _LINUX_ISDN_PPP_H
10
11
12#define CALLTYPE_INCOMING 0x1
13#define CALLTYPE_OUTGOING 0x2
14#define CALLTYPE_CALLBACK 0x4
15
16#define IPPP_VERSION "2.2.0"
17
18struct pppcallinfo
19{
20 int calltype;
21 unsigned char local_num[64];
22 unsigned char remote_num[64];
23 int charge_units;
24};
25
26#define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo)
27#define PPPIOCBUNDLE _IOW('t',129,int)
28#define PPPIOCGMPFLAGS _IOR('t',130,int)
29#define PPPIOCSMPFLAGS _IOW('t',131,int)
30#define PPPIOCSMPMTU _IOW('t',132,int)
31#define PPPIOCSMPMRU _IOW('t',133,int)
32#define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8])
33#define PPPIOCSCOMPRESSOR _IOW('t',135,int)
34#define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] )
35
36
37#define SC_MP_PROT 0x00000200
38#define SC_REJ_MP_PROT 0x00000400
39#define SC_OUT_SHORT_SEQ 0x00000800
40#define SC_IN_SHORT_SEQ 0x00004000
41
42#define SC_DECOMP_ON 0x01
43#define SC_COMP_ON 0x02
44#define SC_DECOMP_DISCARD 0x04
45#define SC_COMP_DISCARD 0x08
46#define SC_LINK_DECOMP_ON 0x10
47#define SC_LINK_COMP_ON 0x20
48#define SC_LINK_DECOMP_DISCARD 0x40
49#define SC_LINK_COMP_DISCARD 0x80
50
51#define ISDN_PPP_COMP_MAX_OPTIONS 16
52
53#define IPPP_COMP_FLAG_XMIT 0x1
54#define IPPP_COMP_FLAG_LINK 0x2
55
56struct isdn_ppp_comp_data {
57 int num;
58 unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
59 int optlen;
60 int flags;
61};
62
63#ifdef __KERNEL__
64
65
66#include <linux/config.h>
67
68#ifdef CONFIG_IPPP_FILTER
69#include <linux/filter.h>
70#endif
71
72#define DECOMP_ERR_NOMEM (-10)
73
74#define MP_END_FRAG 0x40
75#define MP_BEGIN_FRAG 0x80
76
77#define MP_MAX_QUEUE_LEN 16
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94#define IPPP_RESET_MAXDATABYTES 32
95
96struct isdn_ppp_resetparams {
97 unsigned char valid:1;
98 unsigned char rsend:1;
99 unsigned char idval:1;
100 unsigned char dtval:1;
101 unsigned char expra:1;
102 unsigned char id;
103 unsigned short maxdlen;
104 unsigned short dlen;
105 unsigned char *data;
106};
107
108
109
110
111
112struct isdn_ppp_compressor {
113 struct isdn_ppp_compressor *next, *prev;
114 int num;
115
116 void *(*alloc) (struct isdn_ppp_comp_data *);
117 void (*free) (void *state);
118 int (*init) (void *state, struct isdn_ppp_comp_data *,
119 int unit,int debug);
120
121
122
123
124
125
126
127 void (*reset) (void *state, unsigned char code, unsigned char id,
128 unsigned char *data, unsigned len,
129 struct isdn_ppp_resetparams *rsparm);
130
131 int (*compress) (void *state, struct sk_buff *in,
132 struct sk_buff *skb_out, int proto);
133
134 int (*decompress) (void *state,struct sk_buff *in,
135 struct sk_buff *skb_out,
136 struct isdn_ppp_resetparams *rsparm);
137
138 void (*incomp) (void *state, struct sk_buff *in,int proto);
139 void (*stat) (void *state, struct compstat *stats);
140};
141
142extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
143extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
144extern int isdn_ppp_dial_slave(char *);
145extern int isdn_ppp_hangup_slave(char *);
146
147typedef struct {
148 unsigned long seqerrs;
149 unsigned long frame_drops;
150 unsigned long overflows;
151 unsigned long max_queue_len;
152} isdn_mppp_stats;
153
154typedef struct {
155 int mp_mrru;
156 struct sk_buff * frags;
157 long frames;
158 unsigned int seq;
159
160
161 spinlock_t lock;
162 int ref_ct;
163
164 isdn_mppp_stats stats;
165} ippp_bundle;
166
167#define NUM_RCV_BUFFS 64
168
169struct ippp_buf_queue {
170 struct ippp_buf_queue *next;
171 struct ippp_buf_queue *last;
172 char *buf;
173 int len;
174};
175
176
177enum ippp_ccp_reset_states {
178 CCPResetIdle,
179 CCPResetSentReq,
180 CCPResetRcvdReq,
181 CCPResetSentAck,
182 CCPResetRcvdAck
183};
184
185struct ippp_ccp_reset_state {
186 enum ippp_ccp_reset_states state;
187 struct ippp_struct *is;
188 unsigned char id;
189 unsigned char ta:1;
190 unsigned char expra:1;
191 int dlen;
192 struct timer_list timer;
193
194
195
196 unsigned char data[IPPP_RESET_MAXDATABYTES];
197};
198
199
200
201struct ippp_ccp_reset {
202 struct ippp_ccp_reset_state *rs[256];
203 unsigned char lastid;
204};
205
206struct ippp_struct {
207 struct ippp_struct *next_link;
208 int state;
209 struct ippp_buf_queue rq[NUM_RCV_BUFFS];
210 struct ippp_buf_queue *first;
211 struct ippp_buf_queue *last;
212 wait_queue_head_t wq;
213 struct task_struct *tk;
214 unsigned int mpppcfg;
215 unsigned int pppcfg;
216 unsigned int mru;
217 unsigned int mpmru;
218 unsigned int mpmtu;
219 unsigned int maxcid;
220 struct isdn_net_local_s *lp;
221 int unit;
222 int minor;
223 unsigned int last_link_seqno;
224 long mp_seqno;
225#ifdef CONFIG_ISDN_PPP_VJ
226 unsigned char *cbuf;
227 struct slcompress *slcomp;
228#endif
229#ifdef CONFIG_IPPP_FILTER
230 struct sock_fprog pass_filter;
231 struct sock_fprog active_filter;
232#endif
233 unsigned long debug;
234 struct isdn_ppp_compressor *compressor,*decompressor;
235 struct isdn_ppp_compressor *link_compressor,*link_decompressor;
236 void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat;
237 struct ippp_ccp_reset *reset;
238 unsigned long compflags;
239};
240
241#endif
242#endif
243