toolchain: switch kernel 2.4 builds to gcc 4.2.4
[tomato.git] / tools / brcm / K24 / hndtools-mipsel-uclibc-4.1.2 / include / linux / isdn_ppp.h
blob8fefbbf407fec31a5f17991d49a3eaccae283ec5
1 /*
2 * This software may be used and distributed according to the terms
3 * of the GNU General Public License, incorporated herein by reference.
5 */
8 #ifndef _LINUX_ISDN_PPP_H
9 #define _LINUX_ISDN_PPP_H
12 #define CALLTYPE_INCOMING 0x1
13 #define CALLTYPE_OUTGOING 0x2
14 #define CALLTYPE_CALLBACK 0x4
16 #define IPPP_VERSION "2.2.0"
18 struct pppcallinfo
20 int calltype;
21 unsigned char local_num[64];
22 unsigned char remote_num[64];
23 int charge_units;
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] )
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
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
51 #define ISDN_PPP_COMP_MAX_OPTIONS 16
53 #define IPPP_COMP_FLAG_XMIT 0x1
54 #define IPPP_COMP_FLAG_LINK 0x2
56 struct isdn_ppp_comp_data {
57 int num;
58 unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
59 int optlen;
60 int flags;
63 #ifdef __KERNEL__
66 #include <linux/config.h>
68 #ifdef CONFIG_IPPP_FILTER
69 #include <linux/filter.h>
70 #endif
72 #define DECOMP_ERR_NOMEM (-10)
74 #define MP_END_FRAG 0x40
75 #define MP_BEGIN_FRAG 0x80
77 #define MP_MAX_QUEUE_LEN 16
80 * We need a way for the decompressor to influence the generation of CCP
81 * Reset-Requests in a variety of ways. The decompressor is already returning
82 * a lot of information (generated skb length, error conditions) so we use
83 * another parameter. This parameter is a pointer to a structure which is
84 * to be marked valid by the decompressor and only in this case is ever used.
85 * Furthermore, the only case where this data is used is when the decom-
86 * pressor returns DECOMP_ERROR.
88 * We use this same struct for the reset entry of the compressor to commu-
89 * nicate to its caller how to deal with sending of a Reset Ack. In this
90 * case, expra is not used, but other options still apply (suppressing
91 * sending with rsend, appending arbitrary data, etc).
94 #define IPPP_RESET_MAXDATABYTES 32
96 struct isdn_ppp_resetparams {
97 unsigned char valid:1; /* rw Is this structure filled at all ? */
98 unsigned char rsend:1; /* rw Should we send one at all ? */
99 unsigned char idval:1; /* rw Is the id field valid ? */
100 unsigned char dtval:1; /* rw Is the data field valid ? */
101 unsigned char expra:1; /* rw Is an Ack expected for this Req ? */
102 unsigned char id; /* wo Send CCP ResetReq with this id */
103 unsigned short maxdlen; /* ro Max bytes to be stored in data field */
104 unsigned short dlen; /* rw Bytes stored in data field */
105 unsigned char *data; /* wo Data for ResetReq info field */
109 * this is an 'old friend' from ppp-comp.h under a new name
110 * check the original include for more information
112 struct isdn_ppp_compressor {
113 struct isdn_ppp_compressor *next, *prev;
114 int num; /* CCP compression protocol number */
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);
121 /* The reset entry needs to get more exact information about the
122 ResetReq or ResetAck it was called with. The parameters are
123 obvious. If reset is called without a Req or Ack frame which
124 could be handed into it, code MUST be set to 0. Using rsparm,
125 the reset entry can control if and how a ResetAck is returned. */
127 void (*reset) (void *state, unsigned char code, unsigned char id,
128 unsigned char *data, unsigned len,
129 struct isdn_ppp_resetparams *rsparm);
131 int (*compress) (void *state, struct sk_buff *in,
132 struct sk_buff *skb_out, int proto);
134 int (*decompress) (void *state,struct sk_buff *in,
135 struct sk_buff *skb_out,
136 struct isdn_ppp_resetparams *rsparm);
138 void (*incomp) (void *state, struct sk_buff *in,int proto);
139 void (*stat) (void *state, struct compstat *stats);
142 extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
143 extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
144 extern int isdn_ppp_dial_slave(char *);
145 extern int isdn_ppp_hangup_slave(char *);
147 typedef struct {
148 unsigned long seqerrs;
149 unsigned long frame_drops;
150 unsigned long overflows;
151 unsigned long max_queue_len;
152 } isdn_mppp_stats;
154 typedef struct {
155 int mp_mrru; /* unused */
156 struct sk_buff * frags; /* fragments sl list -- use skb->next */
157 long frames; /* number of frames in the frame list */
158 unsigned int seq; /* last processed packet seq #: any packets
159 * with smaller seq # will be dropped
160 * unconditionally */
161 spinlock_t lock;
162 int ref_ct;
163 /* statistics */
164 isdn_mppp_stats stats;
165 } ippp_bundle;
167 #define NUM_RCV_BUFFS 64
169 struct ippp_buf_queue {
170 struct ippp_buf_queue *next;
171 struct ippp_buf_queue *last;
172 char *buf; /* NULL here indicates end of queue */
173 int len;
176 /* The data structure for one CCP reset transaction */
177 enum ippp_ccp_reset_states {
178 CCPResetIdle,
179 CCPResetSentReq,
180 CCPResetRcvdReq,
181 CCPResetSentAck,
182 CCPResetRcvdAck
185 struct ippp_ccp_reset_state {
186 enum ippp_ccp_reset_states state; /* State of this transaction */
187 struct ippp_struct *is; /* Backlink to device stuff */
188 unsigned char id; /* Backlink id index */
189 unsigned char ta:1; /* The timer is active (flag) */
190 unsigned char expra:1; /* We expect a ResetAck at all */
191 int dlen; /* Databytes stored in data */
192 struct timer_list timer; /* For timeouts/retries */
193 /* This is a hack but seems sufficient for the moment. We do not want
194 to have this be yet another allocation for some bytes, it is more
195 memory management overhead than the whole mess is worth. */
196 unsigned char data[IPPP_RESET_MAXDATABYTES];
199 /* The data structure keeping track of the currently outstanding CCP Reset
200 transactions. */
201 struct ippp_ccp_reset {
202 struct ippp_ccp_reset_state *rs[256]; /* One per possible id */
203 unsigned char lastid; /* Last id allocated by the engine */
206 struct ippp_struct {
207 struct ippp_struct *next_link;
208 int state;
209 struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
210 struct ippp_buf_queue *first; /* pointer to (current) first packet */
211 struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
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; /* filter for packets to pass */
231 struct sock_fprog active_filter; /* filter for pkts to reset idle */
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; /* Allocated on demand, may never be needed */
238 unsigned long compflags;
241 #endif /* __KERNEL__ */
242 #endif /* _LINUX_ISDN_PPP_H */