node.h 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: LGPL-2.1-or-later */
  2. /*
  3. *
  4. * BlueZ - Bluetooth protocol stack for Linux
  5. *
  6. * Copyright (C) 2018-2019 Intel Corporation. All rights reserved.
  7. *
  8. *
  9. */
  10. struct mesh_net;
  11. struct mesh_node;
  12. struct mesh_io;
  13. struct mesh_agent;
  14. struct mesh_config;
  15. struct mesh_config_node;
  16. typedef void (*node_ready_func_t) (void *user_data, int status,
  17. struct mesh_node *node);
  18. typedef void (*node_join_ready_func_t) (struct mesh_node *node,
  19. struct mesh_agent *agent);
  20. void node_remove(struct mesh_node *node);
  21. void node_join(const char *app_root, const char *sender, const uint8_t *uuid,
  22. node_join_ready_func_t cb);
  23. uint8_t *node_uuid_get(struct mesh_node *node);
  24. struct mesh_net *node_get_net(struct mesh_node *node);
  25. struct mesh_node *node_find_by_addr(uint16_t addr);
  26. struct mesh_node *node_find_by_uuid(uint8_t uuid[16]);
  27. struct mesh_node *node_find_by_token(uint64_t token);
  28. bool node_is_provisioner(struct mesh_node *node);
  29. bool node_is_busy(struct mesh_node *node);
  30. void node_app_key_delete(struct mesh_node *node, uint16_t net_idx,
  31. uint16_t app_idx);
  32. uint16_t node_get_primary(struct mesh_node *node);
  33. uint16_t node_get_primary_net_idx(struct mesh_node *node);
  34. void node_set_token(struct mesh_node *node, uint8_t token[8]);
  35. const uint8_t *node_get_token(struct mesh_node *node);
  36. const uint8_t *node_get_device_key(struct mesh_node *node);
  37. void node_set_num_elements(struct mesh_node *node, uint8_t num_ele);
  38. uint8_t node_get_num_elements(struct mesh_node *node);
  39. uint8_t node_default_ttl_get(struct mesh_node *node);
  40. bool node_default_ttl_set(struct mesh_node *node, uint8_t ttl);
  41. bool node_set_sequence_number(struct mesh_node *node, uint32_t seq);
  42. uint32_t node_get_sequence_number(struct mesh_node *node);
  43. int node_get_element_idx(struct mesh_node *node, uint16_t ele_addr);
  44. struct l_queue *node_get_element_models(struct mesh_node *node,
  45. uint8_t ele_idx);
  46. uint16_t node_get_crpl(struct mesh_node *node);
  47. bool node_init_from_storage(struct mesh_node *node, const uint8_t uuid[16],
  48. struct mesh_config_node *db_node);
  49. const uint8_t *node_get_comp(struct mesh_node *node, uint8_t page_num,
  50. uint16_t *len);
  51. bool node_replace_comp(struct mesh_node *node, uint8_t retire, uint8_t with);
  52. uint8_t node_lpn_mode_get(struct mesh_node *node);
  53. bool node_relay_mode_set(struct mesh_node *node, bool enable, uint8_t cnt,
  54. uint16_t interval);
  55. uint8_t node_relay_mode_get(struct mesh_node *node, uint8_t *cnt,
  56. uint16_t *interval);
  57. bool node_proxy_mode_set(struct mesh_node *node, bool enable);
  58. uint8_t node_proxy_mode_get(struct mesh_node *node);
  59. bool node_beacon_mode_set(struct mesh_node *node, bool enable);
  60. uint8_t node_beacon_mode_get(struct mesh_node *node);
  61. bool node_friend_mode_set(struct mesh_node *node, bool enable);
  62. uint8_t node_friend_mode_get(struct mesh_node *node);
  63. const char *node_get_element_path(struct mesh_node *node, uint8_t ele_idx);
  64. const char *node_get_owner(struct mesh_node *node);
  65. const char *node_get_app_path(struct mesh_node *node);
  66. bool node_add_pending_local(struct mesh_node *node, void *info);
  67. void node_attach_io_all(struct mesh_io *io);
  68. void node_attach_io(struct mesh_node *node, struct mesh_io *io);
  69. void node_attach(const char *app_root, const char *sender, uint64_t token,
  70. node_ready_func_t cb, void *user_data);
  71. void node_build_attach_reply(struct mesh_node *node,
  72. struct l_dbus_message *reply);
  73. void node_create(const char *app_root, const char *sender, const uint8_t *uuid,
  74. node_ready_func_t cb, void *user_data);
  75. void node_import(const char *app_root, const char *sender, const uint8_t *uuid,
  76. const uint8_t dev_key[16], const uint8_t net_key[16],
  77. uint16_t net_idx, bool kr, bool ivu,
  78. uint32_t iv_index, uint16_t unicast,
  79. node_ready_func_t cb, void *user_data);
  80. bool node_dbus_init(struct l_dbus *bus);
  81. void node_cleanup_all(void);
  82. struct mesh_config *node_config_get(struct mesh_node *node);
  83. struct mesh_agent *node_get_agent(struct mesh_node *node);
  84. const char *node_get_storage_dir(struct mesh_node *node);
  85. bool node_load_from_storage(const char *storage_dir);
  86. void node_finalize_new_node(struct mesh_node *node, struct mesh_io *io);
  87. void node_property_changed(struct mesh_node *node, const char *property);