1 /* Linux ISDN subsystem, sync PPP, interface to ipppd
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)
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
12 #ifndef _LINUX_ISDN_PPP_H
13 #define _LINUX_ISDN_PPP_H
18 #ifdef CONFIG_IPPP_FILTER
19 #include <linux/filter.h>
21 #include <uapi/linux/isdn_ppp.h>
23 #define DECOMP_ERR_NOMEM (-10)
25 #define MP_END_FRAG 0x40
26 #define MP_BEGIN_FRAG 0x80
28 #define MP_MAX_QUEUE_LEN 16
31 * We need a way for the decompressor to influence the generation of CCP
32 * Reset-Requests in a variety of ways. The decompressor is already returning
33 * a lot of information (generated skb length, error conditions) so we use
34 * another parameter. This parameter is a pointer to a structure which is
35 * to be marked valid by the decompressor and only in this case is ever used.
36 * Furthermore, the only case where this data is used is when the decom-
37 * pressor returns DECOMP_ERROR.
39 * We use this same struct for the reset entry of the compressor to commu-
40 * nicate to its caller how to deal with sending of a Reset Ack. In this
41 * case, expra is not used, but other options still apply (suppressing
42 * sending with rsend, appending arbitrary data, etc).
45 #define IPPP_RESET_MAXDATABYTES 32
47 struct isdn_ppp_resetparams {
48 unsigned char valid:1; /* rw Is this structure filled at all ? */
49 unsigned char rsend:1; /* rw Should we send one at all ? */
50 unsigned char idval:1; /* rw Is the id field valid ? */
51 unsigned char dtval:1; /* rw Is the data field valid ? */
52 unsigned char expra:1; /* rw Is an Ack expected for this Req ? */
53 unsigned char id; /* wo Send CCP ResetReq with this id */
54 unsigned short maxdlen; /* ro Max bytes to be stored in data field */
55 unsigned short dlen; /* rw Bytes stored in data field */
56 unsigned char *data; /* wo Data for ResetReq info field */
60 * this is an 'old friend' from ppp-comp.h under a new name
61 * check the original include for more information
63 struct isdn_ppp_compressor {
64 struct isdn_ppp_compressor *next, *prev;
66 int num; /* CCP compression protocol number */
68 void *(*alloc) (struct isdn_ppp_comp_data *);
69 void (*free) (void *state);
70 int (*init) (void *state, struct isdn_ppp_comp_data *,
73 /* The reset entry needs to get more exact information about the
74 ResetReq or ResetAck it was called with. The parameters are
75 obvious. If reset is called without a Req or Ack frame which
76 could be handed into it, code MUST be set to 0. Using rsparm,
77 the reset entry can control if and how a ResetAck is returned. */
79 void (*reset) (void *state, unsigned char code, unsigned char id,
80 unsigned char *data, unsigned len,
81 struct isdn_ppp_resetparams *rsparm);
83 int (*compress) (void *state, struct sk_buff *in,
84 struct sk_buff *skb_out, int proto);
86 int (*decompress) (void *state,struct sk_buff *in,
87 struct sk_buff *skb_out,
88 struct isdn_ppp_resetparams *rsparm);
90 void (*incomp) (void *state, struct sk_buff *in,int proto);
91 void (*stat) (void *state, struct compstat *stats);
94 extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
95 extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
96 extern int isdn_ppp_dial_slave(char *);
97 extern int isdn_ppp_hangup_slave(char *);
100 unsigned long seqerrs;
101 unsigned long frame_drops;
102 unsigned long overflows;
103 unsigned long max_queue_len;
107 int mp_mrru; /* unused */
108 struct sk_buff * frags; /* fragments sl list -- use skb->next */
109 long frames; /* number of frames in the frame list */
110 unsigned int seq; /* last processed packet seq #: any packets
111 * with smaller seq # will be dropped
116 isdn_mppp_stats stats;
119 #define NUM_RCV_BUFFS 64
121 struct ippp_buf_queue {
122 struct ippp_buf_queue *next;
123 struct ippp_buf_queue *last;
124 char *buf; /* NULL here indicates end of queue */
128 /* The data structure for one CCP reset transaction */
129 enum ippp_ccp_reset_states {
137 struct ippp_ccp_reset_state {
138 enum ippp_ccp_reset_states state; /* State of this transaction */
139 struct ippp_struct *is; /* Backlink to device stuff */
140 unsigned char id; /* Backlink id index */
141 unsigned char ta:1; /* The timer is active (flag) */
142 unsigned char expra:1; /* We expect a ResetAck at all */
143 int dlen; /* Databytes stored in data */
144 struct timer_list timer; /* For timeouts/retries */
145 /* This is a hack but seems sufficient for the moment. We do not want
146 to have this be yet another allocation for some bytes, it is more
147 memory management overhead than the whole mess is worth. */
148 unsigned char data[IPPP_RESET_MAXDATABYTES];
151 /* The data structure keeping track of the currently outstanding CCP Reset
153 struct ippp_ccp_reset {
154 struct ippp_ccp_reset_state *rs[256]; /* One per possible id */
155 unsigned char lastid; /* Last id allocated by the engine */
159 struct ippp_struct *next_link;
162 struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
163 struct ippp_buf_queue *first; /* pointer to (current) first packet */
164 struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
165 wait_queue_head_t wq;
166 struct task_struct *tk;
167 unsigned int mpppcfg;
173 struct isdn_net_local_s *lp;
176 unsigned int last_link_seqno;
178 #ifdef CONFIG_ISDN_PPP_VJ
180 struct slcompress *slcomp;
182 #ifdef CONFIG_IPPP_FILTER
183 struct sock_filter *pass_filter; /* filter for packets to pass */
184 struct sock_filter *active_filter; /* filter for pkts to reset idle */
185 unsigned pass_len, active_len;
188 struct isdn_ppp_compressor *compressor,*decompressor;
189 struct isdn_ppp_compressor *link_compressor,*link_decompressor;
190 void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat;
191 struct ippp_ccp_reset *reset; /* Allocated on demand, may never be needed */
192 unsigned long compflags;
195 #endif /* _LINUX_ISDN_PPP_H */