This source file includes following definitions.
- cb_out_1
- cb_out_2
- cb_out_3
- cb_in_1
- cb_in_2
- cb_in_3
- cb_disc_1
- cb_disc_2
- cb_disc_3
- cb_notdone
- cb_selp_1
- cb_open
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #define __NO_VERSION__
15
16 #include <linux/module.h>
17
18 #include <linux/sched.h>
19 #include <linux/string.h>
20 #include <linux/kernel.h>
21
22 #include <linux/types.h>
23 #include <linux/malloc.h>
24 #include <linux/mm.h>
25 #include <linux/tqueue.h>
26 #include <linux/skbuff.h>
27
28 #include <asm/io.h>
29
30 #include <linux/isdnif.h>
31
32 #include "pcbit.h"
33 #include "layer2.h"
34 #include "edss1.h"
35 #include "callbacks.h"
36 #include "capi.h"
37
38 ushort last_ref_num = 1;
39
40
41
42
43
44
45 void cb_out_1(struct pcbit_dev * dev, struct pcbit_chan* chan,
46 struct callb_data *cbdata)
47 {
48 struct sk_buff *skb;
49 int len;
50 ushort refnum;
51
52
53 #ifdef DEBUG
54 printk(KERN_DEBUG "Called Party Number: %s\n",
55 cbdata->data.setup.CalledPN);
56 #endif
57
58
59
60
61
62 if ((len = capi_conn_req(cbdata->data.setup.CalledPN, &skb)) < 0)
63 {
64 printk("capi_conn_req failed\n");
65 return;
66 }
67
68
69 refnum = last_ref_num++ & 0x7fffU;
70
71 chan->callref = 0;
72 chan->layer2link = 0;
73 chan->snum = 0;
74 chan->s_refnum = refnum;
75
76 pcbit_l2_write(dev, MSG_CONN_REQ, refnum, skb, len);
77 }
78
79
80
81
82
83
84
85
86 void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan,
87 struct callb_data *data)
88 {
89 isdn_ctrl ictl;
90 struct sk_buff *skb;
91 int len;
92 ushort refnum;
93
94 if ((len=capi_conn_active_resp(chan, &skb)) < 0)
95 {
96 printk("capi_conn_active_req failed\n");
97 return;
98 }
99
100 refnum = last_ref_num++ & 0x7fffU;
101 chan->s_refnum = refnum;
102
103 pcbit_l2_write(dev, MSG_CONN_ACTV_RESP, refnum, skb, len);
104
105
106 ictl.command = ISDN_STAT_DCONN;
107 ictl.driver=dev->id;
108 ictl.arg=chan->id;
109 dev->dev_if->statcallb(&ictl);
110
111
112
113
114
115 if ((len=capi_select_proto_req(chan, &skb, 1 )) < 0) {
116 printk("capi_select_proto_req failed\n");
117 return;
118 }
119
120 refnum = last_ref_num++ & 0x7fffU;
121 chan->s_refnum = refnum;
122
123 pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len);
124 }
125
126
127
128
129
130
131
132 void cb_out_3(struct pcbit_dev * dev, struct pcbit_chan* chan,
133 struct callb_data *data)
134 {
135 isdn_ctrl ictl;
136
137 ictl.command = ISDN_STAT_DHUP;
138 ictl.driver=dev->id;
139 ictl.arg=chan->id;
140 dev->dev_if->statcallb(&ictl);
141 }
142
143
144
145
146
147
148
149 void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan,
150 struct callb_data *cbdata)
151 {
152 isdn_ctrl ictl;
153 unsigned short refnum;
154 struct sk_buff *skb;
155 int len;
156
157
158 ictl.command = ISDN_STAT_ICALL;
159 ictl.driver=dev->id;
160 ictl.arg=chan->id;
161
162
163
164
165
166 if (cbdata->data.setup.CalledPN)
167 sprintf(ictl.num, "%s,%d,%d,%s",
168 cbdata->data.setup.CallingPN,
169 7, 0,
170 cbdata->data.setup.CalledPN);
171
172 else
173 sprintf(ictl.num, "%s,%d,%d,%s",
174 cbdata->data.setup.CallingPN,
175 7, 0,
176 "0");
177
178
179 #ifdef DEBUG
180 printk(KERN_DEBUG "statstr: %s\n", ictl.num);
181 #endif
182
183 dev->dev_if->statcallb(&ictl);
184
185
186 if ((len=capi_conn_resp(chan, &skb)) < 0) {
187 printk(KERN_DEBUG "capi_conn_resp failed\n");
188 return;
189 }
190
191 refnum = last_ref_num++ & 0x7fffU;
192 chan->s_refnum = refnum;
193
194 pcbit_l2_write(dev, MSG_CONN_RESP, refnum, skb, len);
195 }
196
197
198
199
200
201
202
203 void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan,
204 struct callb_data *data)
205 {
206 unsigned short refnum;
207 struct sk_buff *skb;
208 int len;
209
210 if ((len = capi_conn_active_req(chan, &skb)) < 0) {
211 printk(KERN_DEBUG "capi_conn_active_req failed\n");
212 return;
213 }
214
215
216 refnum = last_ref_num++ & 0x7fffU;
217 chan->s_refnum = refnum;
218
219 printk(KERN_DEBUG "sending MSG_CONN_ACTV_REQ\n");
220 pcbit_l2_write(dev, MSG_CONN_ACTV_REQ, refnum, skb, len);
221 }
222
223
224
225
226
227
228
229 void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan,
230 struct callb_data *data)
231 {
232 unsigned short refnum;
233 struct sk_buff *skb;
234 int len;
235
236 if ((len = capi_select_proto_req(chan, &skb, 0 )) < 0)
237 {
238 printk("capi_select_proto_req failed\n");
239 return;
240 }
241
242 refnum = last_ref_num++ & 0x7fffU;
243 chan->s_refnum = refnum;
244
245 pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len);
246
247 }
248
249
250
251
252
253
254
255 void cb_disc_1(struct pcbit_dev * dev, struct pcbit_chan* chan,
256 struct callb_data *data)
257 {
258 struct sk_buff *skb;
259 int len;
260 ushort refnum;
261 isdn_ctrl ictl;
262
263 if ((len = capi_disc_resp(chan, &skb)) < 0) {
264 printk("capi_disc_resp failed\n");
265 return;
266 }
267
268 refnum = last_ref_num++ & 0x7fffU;
269 chan->s_refnum = refnum;
270
271 pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len);
272
273 ictl.command = ISDN_STAT_BHUP;
274 ictl.driver=dev->id;
275 ictl.arg=chan->id;
276 dev->dev_if->statcallb(&ictl);
277 }
278
279
280
281
282
283
284 void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan,
285 struct callb_data *data)
286 {
287 struct sk_buff *skb;
288 int len;
289 ushort refnum;
290
291 if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0)
292 {
293 printk("capi_disc_req failed\n");
294 return;
295 }
296
297 refnum = last_ref_num++ & 0x7fffU;
298 chan->s_refnum = refnum;
299
300 pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len);
301 }
302
303
304
305
306
307
308 void cb_disc_3(struct pcbit_dev * dev, struct pcbit_chan* chan,
309 struct callb_data *data)
310 {
311 isdn_ctrl ictl;
312
313 ictl.command = ISDN_STAT_BHUP;
314 ictl.driver=dev->id;
315 ictl.arg=chan->id;
316 dev->dev_if->statcallb(&ictl);
317 }
318
319 void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan,
320 struct callb_data *data)
321 {
322 }
323
324
325
326
327 void cb_selp_1(struct pcbit_dev * dev, struct pcbit_chan* chan,
328 struct callb_data *data)
329 {
330 struct sk_buff *skb;
331 int len;
332 ushort refnum;
333
334 if ((len = capi_activate_transp_req(chan, &skb)) < 0)
335 {
336 printk("capi_conn_activate_transp_req failed\n");
337 return;
338 }
339
340 refnum = last_ref_num++ & 0x7fffU;
341 chan->s_refnum = refnum;
342
343 pcbit_l2_write(dev, MSG_ACT_TRANSP_REQ, refnum, skb, len);
344 }
345
346
347
348
349 void cb_open(struct pcbit_dev * dev, struct pcbit_chan* chan,
350 struct callb_data *data)
351 {
352 isdn_ctrl ictl;
353
354 ictl.command = ISDN_STAT_BCONN;
355 ictl.driver=dev->id;
356 ictl.arg=chan->id;
357 dev->dev_if->statcallb(&ictl);
358 }
359
360
361