pan_int.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /******************************************************************************
  2. *
  3. * Copyright 2001-2012 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * This file contains internally used PAN definitions
  21. *
  22. ******************************************************************************/
  23. #ifndef PAN_INT_H
  24. #define PAN_INT_H
  25. #include "pan_api.h"
  26. /*
  27. * This role is used to shutdown the profile. Used internally
  28. * Applications should call PAN_Deregister to shutdown the profile
  29. */
  30. #define PAN_ROLE_INACTIVE 0
  31. /* Protocols supported by the host internal stack, are registered with SDP */
  32. #define PAN_PROTOCOL_IP 0x0800
  33. #define PAN_PROTOCOL_ARP 0x0806
  34. #define PAN_PROFILE_VERSION 0x0100 /* Version 1.00 */
  35. /* Define the PAN Connection Control Block
  36. */
  37. typedef struct {
  38. #define PAN_STATE_IDLE 0
  39. #define PAN_STATE_CONN_START 1
  40. #define PAN_STATE_CONNECTED 2
  41. uint8_t con_state;
  42. #define PAN_FLAGS_CONN_COMPLETED 0x01
  43. uint8_t con_flags;
  44. uint16_t handle;
  45. RawAddress rem_bda;
  46. uint16_t bad_pkts_rcvd;
  47. uint16_t src_uuid;
  48. uint16_t dst_uuid;
  49. uint16_t prv_src_uuid;
  50. uint16_t prv_dst_uuid;
  51. uint16_t ip_addr_known;
  52. uint32_t ip_addr;
  53. } tPAN_CONN;
  54. /* The main PAN control block
  55. */
  56. typedef struct {
  57. uint8_t role;
  58. uint8_t active_role;
  59. uint8_t prv_active_role;
  60. tPAN_CONN pcb[MAX_PAN_CONNS];
  61. tPAN_CONN_STATE_CB* pan_conn_state_cb; /* Connection state callback */
  62. tPAN_BRIDGE_REQ_CB* pan_bridge_req_cb;
  63. tPAN_DATA_IND_CB* pan_data_ind_cb;
  64. tPAN_DATA_BUF_IND_CB* pan_data_buf_ind_cb;
  65. tPAN_FILTER_IND_CB*
  66. pan_pfilt_ind_cb; /* protocol filter indication callback */
  67. tPAN_MFILTER_IND_CB*
  68. pan_mfilt_ind_cb; /* multicast filter indication callback */
  69. tPAN_TX_DATA_FLOW_CB* pan_tx_data_flow_cb;
  70. char* user_service_name;
  71. char* gn_service_name;
  72. char* nap_service_name;
  73. uint32_t pan_user_sdp_handle;
  74. uint32_t pan_gn_sdp_handle;
  75. uint32_t pan_nap_sdp_handle;
  76. uint8_t num_conns;
  77. uint8_t trace_level;
  78. } tPAN_CB;
  79. /* Global PAN data
  80. */
  81. extern tPAN_CB pan_cb;
  82. /******************************************************************************/
  83. extern void pan_register_with_bnep(void);
  84. extern void pan_conn_ind_cb(uint16_t handle, const RawAddress& p_bda,
  85. const bluetooth::Uuid& remote_uuid,
  86. const bluetooth::Uuid& local_uuid,
  87. bool is_role_change);
  88. extern void pan_connect_state_cb(uint16_t handle, const RawAddress& rem_bda,
  89. tBNEP_RESULT result, bool is_role_change);
  90. extern void pan_data_ind_cb(uint16_t handle, const RawAddress& src,
  91. const RawAddress& dst, uint16_t protocol,
  92. uint8_t* p_data, uint16_t len, bool fw_ext_present);
  93. extern void pan_data_buf_ind_cb(uint16_t handle, const RawAddress& src,
  94. const RawAddress& dst, uint16_t protocol,
  95. BT_HDR* p_buf, bool ext);
  96. extern void pan_tx_data_flow_cb(uint16_t handle, tBNEP_RESULT event);
  97. void pan_proto_filt_ind_cb(uint16_t handle, bool indication,
  98. tBNEP_RESULT result, uint16_t num_filters,
  99. uint8_t* p_filters);
  100. void pan_mcast_filt_ind_cb(uint16_t handle, bool indication,
  101. tBNEP_RESULT result, uint16_t num_filters,
  102. uint8_t* p_filters);
  103. extern uint32_t pan_register_with_sdp(uint16_t uuid, uint8_t sec_mask,
  104. const char* p_name, const char* p_desc);
  105. extern tPAN_CONN* pan_allocate_pcb(const RawAddress& p_bda, uint16_t handle);
  106. extern tPAN_CONN* pan_get_pcb_by_handle(uint16_t handle);
  107. extern tPAN_CONN* pan_get_pcb_by_addr(const RawAddress& p_bda);
  108. extern void pan_close_all_connections(void);
  109. extern void pan_release_pcb(tPAN_CONN* p_pcb);
  110. extern void pan_dump_status(void);
  111. /******************************************************************************/
  112. #endif