- Kai Germaschewski: ISDN update (including Makefiles)
[davej-history.git] / include / linux / isdn_ppp.h
blob732daa4535a88868908f03a9ffd89997c78d3f82
1 /* -*- mode: c; c-basic-offset: 2 -*- */
3 #ifndef _LINUX_ISDN_PPP_H
4 #define _LINUX_ISDN_PPP_H
6 #include <linux/config.h>
8 #define CALLTYPE_INCOMING 0x1
9 #define CALLTYPE_OUTGOING 0x2
10 #define CALLTYPE_CALLBACK 0x4
12 #define IPPP_VERSION "2.2.0"
14 struct pppcallinfo
16 int calltype;
17 unsigned char local_num[64];
18 unsigned char remote_num[64];
19 int charge_units;
22 #define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo)
23 #define PPPIOCBUNDLE _IOW('t',129,int)
24 #define PPPIOCGMPFLAGS _IOR('t',130,int)
25 #define PPPIOCSMPFLAGS _IOW('t',131,int)
26 #define PPPIOCSMPMTU _IOW('t',132,int)
27 #define PPPIOCSMPMRU _IOW('t',133,int)
28 #define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8])
29 #define PPPIOCSCOMPRESSOR _IOW('t',135,int)
30 #define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] )
33 #define SC_MP_PROT 0x00000200
34 #define SC_REJ_MP_PROT 0x00000400
35 #define SC_OUT_SHORT_SEQ 0x00000800
36 #define SC_IN_SHORT_SEQ 0x00004000
38 #define SC_DECOMP_ON 0x01
39 #define SC_COMP_ON 0x02
40 #define SC_DECOMP_DISCARD 0x04
41 #define SC_COMP_DISCARD 0x08
42 #define SC_LINK_DECOMP_ON 0x10
43 #define SC_LINK_COMP_ON 0x20
44 #define SC_LINK_DECOMP_DISCARD 0x40
45 #define SC_LINK_COMP_DISCARD 0x80
47 #define DECOMP_ERR_NOMEM (-10)
49 #define MP_END_FRAG 0x40
50 #define MP_BEGIN_FRAG 0x80
52 #define MP_MAX_QUEUE_LEN 16
54 #define ISDN_PPP_COMP_MAX_OPTIONS 16
56 #define IPPP_COMP_FLAG_XMIT 0x1
57 #define IPPP_COMP_FLAG_LINK 0x2
59 struct isdn_ppp_comp_data {
60 int num;
61 unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
62 int optlen;
63 int flags;
66 #ifdef __KERNEL__
69 * We need a way for the decompressor to influence the generation of CCP
70 * Reset-Requests in a variety of ways. The decompressor is already returning
71 * a lot of information (generated skb length, error conditions) so we use
72 * another parameter. This parameter is a pointer to a structure which is
73 * to be marked valid by the decompressor and only in this case is ever used.
74 * Furthermore, the only case where this data is used is when the decom-
75 * pressor returns DECOMP_ERROR.
77 * We use this same struct for the reset entry of the compressor to commu-
78 * nicate to its caller how to deal with sending of a Reset Ack. In this
79 * case, expra is not used, but other options still apply (supressing
80 * sending with rsend, appending arbitrary data, etc).
83 #define IPPP_RESET_MAXDATABYTES 32
85 struct isdn_ppp_resetparams {
86 unsigned char valid:1; /* rw Is this structure filled at all ? */
87 unsigned char rsend:1; /* rw Should we send one at all ? */
88 unsigned char idval:1; /* rw Is the id field valid ? */
89 unsigned char dtval:1; /* rw Is the data field valid ? */
90 unsigned char expra:1; /* rw Is an Ack expected for this Req ? */
91 unsigned char id; /* wo Send CCP ResetReq with this id */
92 unsigned short maxdlen; /* ro Max bytes to be stored in data field */
93 unsigned short dlen; /* rw Bytes stored in data field */
94 unsigned char *data; /* wo Data for ResetReq info field */
98 * this is an 'old friend' from ppp-comp.h under a new name
99 * check the original include for more information
101 struct isdn_ppp_compressor {
102 struct isdn_ppp_compressor *next, *prev;
103 int num; /* CCP compression protocol number */
105 void *(*alloc) (struct isdn_ppp_comp_data *);
106 void (*free) (void *state);
107 int (*init) (void *state, struct isdn_ppp_comp_data *,
108 int unit,int debug);
110 /* The reset entry needs to get more exact information about the
111 ResetReq or ResetAck it was called with. The parameters are
112 obvious. If reset is called without a Req or Ack frame which
113 could be handed into it, code MUST be set to 0. Using rsparm,
114 the reset entry can control if and how a ResetAck is returned. */
116 void (*reset) (void *state, unsigned char code, unsigned char id,
117 unsigned char *data, unsigned len,
118 struct isdn_ppp_resetparams *rsparm);
120 int (*compress) (void *state, struct sk_buff *in,
121 struct sk_buff *skb_out, int proto);
123 int (*decompress) (void *state,struct sk_buff *in,
124 struct sk_buff *skb_out,
125 struct isdn_ppp_resetparams *rsparm);
127 void (*incomp) (void *state, struct sk_buff *in,int proto);
128 void (*stat) (void *state, struct compstat *stats);
131 extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
132 extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
133 extern int isdn_ppp_dial_slave(char *);
134 extern int isdn_ppp_hangup_slave(char *);
136 typedef struct {
137 unsigned long seqerrs;
138 unsigned long frame_drops;
139 unsigned long overflows;
140 unsigned long max_queue_len;
141 } isdn_mppp_stats;
143 typedef struct {
144 int mp_mrru; /* unused */
145 struct sk_buff * frags; /* fragments sl list -- use skb->next */
146 long frames; /* number of frames in the frame list */
147 unsigned int seq; /* last processed packet seq #: any packets
148 * with smaller seq # will be dropped
149 * unconditionally */
150 spinlock_t lock;
151 int ref_ct;
152 /* statistics */
153 isdn_mppp_stats stats;
154 } ippp_bundle;
156 #define NUM_RCV_BUFFS 64
158 struct ippp_buf_queue {
159 struct ippp_buf_queue *next;
160 struct ippp_buf_queue *last;
161 char *buf; /* NULL here indicates end of queue */
162 int len;
165 /* The data structure for one CCP reset transaction */
166 enum ippp_ccp_reset_states {
167 CCPResetIdle,
168 CCPResetSentReq,
169 CCPResetRcvdReq,
170 CCPResetSentAck,
171 CCPResetRcvdAck
174 struct ippp_ccp_reset_state {
175 enum ippp_ccp_reset_states state; /* State of this transaction */
176 struct ippp_struct *is; /* Backlink to device stuff */
177 unsigned char id; /* Backlink id index */
178 unsigned char ta:1; /* The timer is active (flag) */
179 unsigned char expra:1; /* We expect a ResetAck at all */
180 int dlen; /* Databytes stored in data */
181 struct timer_list timer; /* For timeouts/retries */
182 /* This is a hack but seems sufficient for the moment. We do not want
183 to have this be yet another allocation for some bytes, it is more
184 memory management overhead than the whole mess is worth. */
185 unsigned char data[IPPP_RESET_MAXDATABYTES];
188 /* The data structure keeping track of the currently outstanding CCP Reset
189 transactions. */
190 struct ippp_ccp_reset {
191 struct ippp_ccp_reset_state *rs[256]; /* One per possible id */
192 unsigned char lastid; /* Last id allocated by the engine */
195 struct ippp_struct {
196 struct ippp_struct *next_link;
197 int state;
198 struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
199 struct ippp_buf_queue *first; /* pointer to (current) first packet */
200 struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
201 wait_queue_head_t wq;
202 struct task_struct *tk;
203 unsigned int mpppcfg;
204 unsigned int pppcfg;
205 unsigned int mru;
206 unsigned int mpmru;
207 unsigned int mpmtu;
208 unsigned int maxcid;
209 struct isdn_net_local_s *lp;
210 int unit;
211 int minor;
212 unsigned int last_link_seqno;
213 long mp_seqno;
214 #ifdef CONFIG_ISDN_PPP_VJ
215 unsigned char *cbuf;
216 struct slcompress *slcomp;
217 #endif
218 unsigned long debug;
219 struct isdn_ppp_compressor *compressor,*decompressor;
220 struct isdn_ppp_compressor *link_compressor,*link_decompressor;
221 void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat;
222 struct ippp_ccp_reset *reset; /* Allocated on demand, may never be needed */
223 unsigned long compflags;
226 #endif /* __KERNEL__ */
227 #endif /* _LINUX_ISDN_PPP_H */