capi.h 2.4 KB

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