blob: 635f63476944d934d4f9a1a7fa41f222f9a7a4ed [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * CAPI encode/decode prototypes and defines
3 *
4 * Copyright (C) 1996 Universidade de Lisboa
Joe Perches475be4d2012-02-19 19:52:38 -08005 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
7 *
Joe Perches475be4d2012-02-19 19:52:38 -08008 * This software may be used and distributed according to the terms of
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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
Joe Perches475be4d2012-02-19 19:52:38 -080018#define REQ_USER_TO_USER 0x08
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Joe Perches475be4d2012-02-19 19:52:38 -080020#define AppInfoMask REQ_CAUSE | REQ_DISPLAY | REQ_USER_TO_USER
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
22/* Connection Setup */
Joe Perches475be4d2012-02-19 19:52:38 -080023extern int capi_conn_req(const char *calledPN, struct sk_buff **buf,
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 int proto);
Joe Perches475be4d2012-02-19 19:52:38 -080025extern int capi_decode_conn_conf(struct pcbit_chan *chan, struct sk_buff *skb,
26 int *complete);
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Joe Perches475be4d2012-02-19 19:52:38 -080028extern int capi_decode_conn_ind(struct pcbit_chan *chan, struct sk_buff *skb,
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 struct callb_data *info);
Joe Perches475be4d2012-02-19 19:52:38 -080030extern int capi_conn_resp(struct pcbit_chan *chan, struct sk_buff **skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
Joe Perches475be4d2012-02-19 19:52:38 -080032extern int capi_conn_active_req(struct pcbit_chan *chan, struct sk_buff **skb);
33extern int capi_decode_conn_actv_conf(struct pcbit_chan *chan,
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 struct sk_buff *skb);
35
Joe Perches475be4d2012-02-19 19:52:38 -080036extern int capi_decode_conn_actv_ind(struct pcbit_chan *chan,
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 struct sk_buff *skb);
Joe Perches475be4d2012-02-19 19:52:38 -080038extern int capi_conn_active_resp(struct pcbit_chan *chan,
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 struct sk_buff **skb);
40
41/* Data */
42extern int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb,
43 int outgoing);
Joe Perches475be4d2012-02-19 19:52:38 -080044extern int capi_decode_sel_proto_conf(struct pcbit_chan *chan,
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 struct sk_buff *skb);
46
Joe Perches475be4d2012-02-19 19:52:38 -080047extern int capi_activate_transp_req(struct pcbit_chan *chan,
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 struct sk_buff **skb);
Joe Perches475be4d2012-02-19 19:52:38 -080049extern int capi_decode_actv_trans_conf(struct pcbit_chan *chan,
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 struct sk_buff *skb);
51
Joe Perches475be4d2012-02-19 19:52:38 -080052extern int capi_tdata_req(struct pcbit_chan *chan, struct sk_buff *skb);
53extern int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff **skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55/* Connection Termination */
56extern int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause);
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
58extern int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb);
59extern int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb);
60
61#ifdef DEBUG
62extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen);
63#endif
64
Joe Perches475be4d2012-02-19 19:52:38 -080065static inline struct pcbit_chan *
Linus Torvalds1da177e2005-04-16 15:20:36 -070066capi_channel(struct pcbit_dev *dev, struct sk_buff *skb)
67{
68 ushort callref;
69
Joe Perches475be4d2012-02-19 19:52:38 -080070 callref = *((ushort *)skb->data);
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 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