Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * CAPI encode/decode prototypes and defines | |
3 | * | |
4 | * Copyright (C) 1996 Universidade de Lisboa | |
475be4d8 | 5 | * |
1da177e4 LT |
6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
7 | * | |
475be4d8 | 8 | * This software may be used and distributed according to the terms of |
1da177e4 LT |
9 | * the GNU General Public License, incorporated herein by reference. |
10 | */ | |
11 | ||
12 | #ifndef CAPI_H | |
13 | #define CAPI_H | |
14 | ||
15 | ||
16 | #define REQ_CAUSE 0x01 | |
17 | #define REQ_DISPLAY 0x04 | |
475be4d8 | 18 | #define REQ_USER_TO_USER 0x08 |
1da177e4 | 19 | |
475be4d8 | 20 | #define AppInfoMask REQ_CAUSE | REQ_DISPLAY | REQ_USER_TO_USER |
1da177e4 LT |
21 | |
22 | /* Connection Setup */ | |
475be4d8 | 23 | extern int capi_conn_req(const char *calledPN, struct sk_buff **buf, |
1da177e4 | 24 | int proto); |
475be4d8 JP |
25 | extern int capi_decode_conn_conf(struct pcbit_chan *chan, struct sk_buff *skb, |
26 | int *complete); | |
1da177e4 | 27 | |
475be4d8 | 28 | extern int capi_decode_conn_ind(struct pcbit_chan *chan, struct sk_buff *skb, |
1da177e4 | 29 | struct callb_data *info); |
475be4d8 | 30 | extern int capi_conn_resp(struct pcbit_chan *chan, struct sk_buff **skb); |
1da177e4 | 31 | |
475be4d8 JP |
32 | extern int capi_conn_active_req(struct pcbit_chan *chan, struct sk_buff **skb); |
33 | extern int capi_decode_conn_actv_conf(struct pcbit_chan *chan, | |
1da177e4 LT |
34 | struct sk_buff *skb); |
35 | ||
475be4d8 | 36 | extern int capi_decode_conn_actv_ind(struct pcbit_chan *chan, |
1da177e4 | 37 | struct sk_buff *skb); |
475be4d8 | 38 | extern int capi_conn_active_resp(struct pcbit_chan *chan, |
1da177e4 LT |
39 | struct sk_buff **skb); |
40 | ||
41 | /* Data */ | |
42 | extern int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, | |
43 | int outgoing); | |
475be4d8 | 44 | extern int capi_decode_sel_proto_conf(struct pcbit_chan *chan, |
1da177e4 LT |
45 | struct sk_buff *skb); |
46 | ||
475be4d8 | 47 | extern int capi_activate_transp_req(struct pcbit_chan *chan, |
1da177e4 | 48 | struct sk_buff **skb); |
475be4d8 | 49 | extern int capi_decode_actv_trans_conf(struct pcbit_chan *chan, |
1da177e4 LT |
50 | struct sk_buff *skb); |
51 | ||
475be4d8 JP |
52 | extern int capi_tdata_req(struct pcbit_chan *chan, struct sk_buff *skb); |
53 | extern int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff **skb); | |
1da177e4 LT |
54 | |
55 | /* Connection Termination */ | |
56 | extern int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause); | |
1da177e4 LT |
57 | |
58 | extern int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb); | |
59 | extern int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb); | |
60 | ||
61 | #ifdef DEBUG | |
62 | extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen); | |
63 | #endif | |
64 | ||
475be4d8 | 65 | static inline struct pcbit_chan * |
1da177e4 LT |
66 | capi_channel(struct pcbit_dev *dev, struct sk_buff *skb) |
67 | { | |
68 | ushort callref; | |
69 | ||
475be4d8 | 70 | callref = *((ushort *)skb->data); |
1da177e4 LT |
71 | skb_pull(skb, 2); |
72 | ||
73 | if (dev->b1->callref == callref) | |
74 | return dev->b1; | |
75 | else if (dev->b2->callref == callref) | |
76 | return dev->b2; | |
77 | ||
78 | return NULL; | |
79 | } | |
80 | ||
81 | #endif |