cmtp.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. CMTP implementation for Linux Bluetooth stack (BlueZ).
  3. Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License version 2 as
  6. published by the Free Software Foundation;
  7. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  8. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
  10. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
  11. CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
  12. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
  16. COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
  17. SOFTWARE IS DISCLAIMED.
  18. */
  19. #ifndef __CMTP_H
  20. #define __CMTP_H
  21. #include <linux/types.h>
  22. #include <net/bluetooth/bluetooth.h>
  23. #define BTNAMSIZ 18
  24. /* CMTP ioctl defines */
  25. #define CMTPCONNADD _IOW('C', 200, int)
  26. #define CMTPCONNDEL _IOW('C', 201, int)
  27. #define CMTPGETCONNLIST _IOR('C', 210, int)
  28. #define CMTPGETCONNINFO _IOR('C', 211, int)
  29. #define CMTP_LOOPBACK 0
  30. struct cmtp_connadd_req {
  31. int sock; /* Connected socket */
  32. __u32 flags;
  33. };
  34. struct cmtp_conndel_req {
  35. bdaddr_t bdaddr;
  36. __u32 flags;
  37. };
  38. struct cmtp_conninfo {
  39. bdaddr_t bdaddr;
  40. __u32 flags;
  41. __u16 state;
  42. int num;
  43. };
  44. struct cmtp_connlist_req {
  45. __u32 cnum;
  46. struct cmtp_conninfo __user *ci;
  47. };
  48. int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock);
  49. int cmtp_del_connection(struct cmtp_conndel_req *req);
  50. int cmtp_get_connlist(struct cmtp_connlist_req *req);
  51. int cmtp_get_conninfo(struct cmtp_conninfo *ci);
  52. /* CMTP session defines */
  53. #define CMTP_INTEROP_TIMEOUT (HZ * 5)
  54. #define CMTP_INITIAL_MSGNUM 0xff00
  55. struct cmtp_session {
  56. struct list_head list;
  57. struct socket *sock;
  58. bdaddr_t bdaddr;
  59. unsigned long state;
  60. unsigned long flags;
  61. uint mtu;
  62. char name[BTNAMSIZ];
  63. struct task_struct *task;
  64. wait_queue_head_t wait;
  65. int ncontroller;
  66. int num;
  67. struct capi_ctr ctrl;
  68. struct list_head applications;
  69. unsigned long blockids;
  70. int msgnum;
  71. struct sk_buff_head transmit;
  72. struct sk_buff *reassembly[16];
  73. };
  74. struct cmtp_application {
  75. struct list_head list;
  76. unsigned long state;
  77. int err;
  78. __u16 appl;
  79. __u16 mapping;
  80. __u16 msgnum;
  81. };
  82. struct cmtp_scb {
  83. int id;
  84. int data;
  85. };
  86. int cmtp_attach_device(struct cmtp_session *session);
  87. void cmtp_detach_device(struct cmtp_session *session);
  88. void cmtp_recv_capimsg(struct cmtp_session *session, struct sk_buff *skb);
  89. /* CMTP init defines */
  90. int cmtp_init_sockets(void);
  91. void cmtp_cleanup_sockets(void);
  92. #endif /* __CMTP_H */