rfcomm.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. *
  3. * BlueZ - Bluetooth protocol stack for Linux
  4. *
  5. * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
  6. * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. */
  24. #ifndef __RFCOMM_H
  25. #define __RFCOMM_H
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. #include <sys/socket.h>
  30. /* RFCOMM defaults */
  31. #define RFCOMM_DEFAULT_MTU 127
  32. #define RFCOMM_PSM 3
  33. /* RFCOMM socket address */
  34. struct sockaddr_rc {
  35. sa_family_t rc_family;
  36. bdaddr_t rc_bdaddr;
  37. uint8_t rc_channel;
  38. };
  39. /* RFCOMM socket options */
  40. #define RFCOMM_CONNINFO 0x02
  41. struct rfcomm_conninfo {
  42. uint16_t hci_handle;
  43. uint8_t dev_class[3];
  44. };
  45. #define RFCOMM_LM 0x03
  46. #define RFCOMM_LM_MASTER 0x0001
  47. #define RFCOMM_LM_AUTH 0x0002
  48. #define RFCOMM_LM_ENCRYPT 0x0004
  49. #define RFCOMM_LM_TRUSTED 0x0008
  50. #define RFCOMM_LM_RELIABLE 0x0010
  51. #define RFCOMM_LM_SECURE 0x0020
  52. /* RFCOMM TTY support */
  53. #define RFCOMM_MAX_DEV 256
  54. #define RFCOMMCREATEDEV _IOW('R', 200, int)
  55. #define RFCOMMRELEASEDEV _IOW('R', 201, int)
  56. #define RFCOMMGETDEVLIST _IOR('R', 210, int)
  57. #define RFCOMMGETDEVINFO _IOR('R', 211, int)
  58. struct rfcomm_dev_req {
  59. int16_t dev_id;
  60. uint32_t flags;
  61. bdaddr_t src;
  62. bdaddr_t dst;
  63. uint8_t channel;
  64. };
  65. #define RFCOMM_REUSE_DLC 0
  66. #define RFCOMM_RELEASE_ONHUP 1
  67. #define RFCOMM_HANGUP_NOW 2
  68. #define RFCOMM_TTY_ATTACHED 3
  69. struct rfcomm_dev_info {
  70. int16_t id;
  71. uint32_t flags;
  72. uint16_t state;
  73. bdaddr_t src;
  74. bdaddr_t dst;
  75. uint8_t channel;
  76. };
  77. struct rfcomm_dev_list_req {
  78. uint16_t dev_num;
  79. struct rfcomm_dev_info dev_info[0];
  80. };
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif /* __RFCOMM_H */