a2mp.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved.
  3. Copyright (c) 2011,2012 Intel Corp.
  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 and
  6. only version 2 as published by the Free Software Foundation.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. */
  12. #ifndef __A2MP_H
  13. #define __A2MP_H
  14. #include <net/bluetooth/l2cap.h>
  15. #define A2MP_FEAT_EXT 0x8000
  16. struct amp_mgr {
  17. struct l2cap_conn *l2cap_conn;
  18. struct l2cap_chan *a2mp_chan;
  19. struct kref kref;
  20. __u8 ident;
  21. __u8 handle;
  22. unsigned long flags;
  23. };
  24. struct a2mp_cmd {
  25. __u8 code;
  26. __u8 ident;
  27. __le16 len;
  28. __u8 data[0];
  29. } __packed;
  30. /* A2MP command codes */
  31. #define A2MP_COMMAND_REJ 0x01
  32. struct a2mp_cmd_rej {
  33. __le16 reason;
  34. __u8 data[0];
  35. } __packed;
  36. #define A2MP_DISCOVER_REQ 0x02
  37. struct a2mp_discov_req {
  38. __le16 mtu;
  39. __le16 ext_feat;
  40. } __packed;
  41. struct a2mp_cl {
  42. __u8 id;
  43. __u8 type;
  44. __u8 status;
  45. } __packed;
  46. #define A2MP_DISCOVER_RSP 0x03
  47. struct a2mp_discov_rsp {
  48. __le16 mtu;
  49. __le16 ext_feat;
  50. struct a2mp_cl cl[0];
  51. } __packed;
  52. #define A2MP_CHANGE_NOTIFY 0x04
  53. #define A2MP_CHANGE_RSP 0x05
  54. #define A2MP_GETINFO_REQ 0x06
  55. struct a2mp_info_req {
  56. __u8 id;
  57. } __packed;
  58. #define A2MP_GETINFO_RSP 0x07
  59. struct a2mp_info_rsp {
  60. __u8 id;
  61. __u8 status;
  62. __le32 total_bw;
  63. __le32 max_bw;
  64. __le32 min_latency;
  65. __le16 pal_cap;
  66. __le16 assoc_size;
  67. } __packed;
  68. #define A2MP_GETAMPASSOC_REQ 0x08
  69. struct a2mp_amp_assoc_req {
  70. __u8 id;
  71. } __packed;
  72. #define A2MP_GETAMPASSOC_RSP 0x09
  73. struct a2mp_amp_assoc_rsp {
  74. __u8 id;
  75. __u8 status;
  76. __u8 amp_assoc[0];
  77. } __packed;
  78. #define A2MP_CREATEPHYSLINK_REQ 0x0A
  79. #define A2MP_DISCONNPHYSLINK_REQ 0x0C
  80. struct a2mp_physlink_req {
  81. __u8 local_id;
  82. __u8 remote_id;
  83. __u8 amp_assoc[0];
  84. } __packed;
  85. #define A2MP_CREATEPHYSLINK_RSP 0x0B
  86. #define A2MP_DISCONNPHYSLINK_RSP 0x0D
  87. struct a2mp_physlink_rsp {
  88. __u8 local_id;
  89. __u8 remote_id;
  90. __u8 status;
  91. } __packed;
  92. /* A2MP response status */
  93. #define A2MP_STATUS_SUCCESS 0x00
  94. #define A2MP_STATUS_INVALID_CTRL_ID 0x01
  95. #define A2MP_STATUS_UNABLE_START_LINK_CREATION 0x02
  96. #define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
  97. #define A2MP_STATUS_COLLISION_OCCURED 0x03
  98. #define A2MP_STATUS_DISCONN_REQ_RECVD 0x04
  99. #define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
  100. #define A2MP_STATUS_SECURITY_VIOLATION 0x06
  101. void amp_mgr_get(struct amp_mgr *mgr);
  102. int amp_mgr_put(struct amp_mgr *mgr);
  103. struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
  104. struct sk_buff *skb);
  105. #endif /* __A2MP_H */