nlm: Ensure callback code also checks that the files match
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / isdn_ppp.h
1 /* Linux ISDN subsystem, sync PPP, interface to ipppd
2 *
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)
7 *
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
10 *
11 */
12 #ifndef _LINUX_ISDN_PPP_H
13 #define _LINUX_ISDN_PPP_H
14
15
16
17
18 #ifdef CONFIG_IPPP_FILTER
19 #include <linux/filter.h>
20 #endif
21 #include <uapi/linux/isdn_ppp.h>
22
23 #define DECOMP_ERR_NOMEM (-10)
24
25 #define MP_END_FRAG 0x40
26 #define MP_BEGIN_FRAG 0x80
27
28 #define MP_MAX_QUEUE_LEN 16
29
30 /*
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.
38 *
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).
43 */
44
45 #define IPPP_RESET_MAXDATABYTES 32
46
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 */
57 };
58
59 /*
60 * this is an 'old friend' from ppp-comp.h under a new name
61 * check the original include for more information
62 */
63 struct isdn_ppp_compressor {
64 struct isdn_ppp_compressor *next, *prev;
65 struct module *owner;
66 int num; /* CCP compression protocol number */
67
68 void *(*alloc) (struct isdn_ppp_comp_data *);
69 void (*free) (void *state);
70 int (*init) (void *state, struct isdn_ppp_comp_data *,
71 int unit,int debug);
72
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. */
78
79 void (*reset) (void *state, unsigned char code, unsigned char id,
80 unsigned char *data, unsigned len,
81 struct isdn_ppp_resetparams *rsparm);
82
83 int (*compress) (void *state, struct sk_buff *in,
84 struct sk_buff *skb_out, int proto);
85
86 int (*decompress) (void *state,struct sk_buff *in,
87 struct sk_buff *skb_out,
88 struct isdn_ppp_resetparams *rsparm);
89
90 void (*incomp) (void *state, struct sk_buff *in,int proto);
91 void (*stat) (void *state, struct compstat *stats);
92 };
93
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 *);
98
99 typedef struct {
100 unsigned long seqerrs;
101 unsigned long frame_drops;
102 unsigned long overflows;
103 unsigned long max_queue_len;
104 } isdn_mppp_stats;
105
106 typedef struct {
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
112 * unconditionally */
113 spinlock_t lock;
114 int ref_ct;
115 /* statistics */
116 isdn_mppp_stats stats;
117 } ippp_bundle;
118
119 #define NUM_RCV_BUFFS 64
120
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 */
125 int len;
126 };
127
128 /* The data structure for one CCP reset transaction */
129 enum ippp_ccp_reset_states {
130 CCPResetIdle,
131 CCPResetSentReq,
132 CCPResetRcvdReq,
133 CCPResetSentAck,
134 CCPResetRcvdAck
135 };
136
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];
149 };
150
151 /* The data structure keeping track of the currently outstanding CCP Reset
152 transactions. */
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 */
156 };
157
158 struct ippp_struct {
159 struct ippp_struct *next_link;
160 int state;
161 spinlock_t buflock;
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;
168 unsigned int pppcfg;
169 unsigned int mru;
170 unsigned int mpmru;
171 unsigned int mpmtu;
172 unsigned int maxcid;
173 struct isdn_net_local_s *lp;
174 int unit;
175 int minor;
176 unsigned int last_link_seqno;
177 long mp_seqno;
178 #ifdef CONFIG_ISDN_PPP_VJ
179 unsigned char *cbuf;
180 struct slcompress *slcomp;
181 #endif
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;
186 #endif
187 unsigned long debug;
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;
193 };
194
195 #endif /* _LINUX_ISDN_PPP_H */