Mesh: Handle Multi-application init & deinit logic
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / services / include / bt-service-mesh-network.h
1 /*
2  * Bluetooth-frwk
3  *
4  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
5  *
6  * @author: Anupam Roy <anupam.r@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *              http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef BT_SERVICE_MESH_NETWORK_H_
23 #define BT_SERVICE_MESH_NETWORK_H_
24
25 #include <glib.h>
26 #include <sys/types.h>
27 #include "bluetooth-api.h"
28 #include "bluetooth-mesh-api.h"
29
30 #include "bt-service-mesh-cdb.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 int _bt_mesh_network_create(const char *app_key,
37                 const char *sender, const char *network_name,
38                         bluetooth_mesh_node_t *node, GSList *model_list);
39
40 int _bt_mesh_network_destroy(const char *app_cred,
41                 const char *sender, bluetooth_mesh_network_t *network);
42
43 int _bt_mesh_network_remove_net_configuration(bluetooth_mesh_network_t *net);
44
45 void _bt_mesh_network_unload_net_configuration(_bt_mesh_cdb_t *cdb_cfg);
46
47 int _bt_mesh_network_remove_node_configuration(bluetooth_mesh_node_info_t *node);
48
49 int _bt_mesh_network_create_cdb(int result,
50                 const char *sender, const char *app_creds,
51                         uint8_t uuid[16], uint8_t token[8],
52                                 const char *network);
53
54 int _bt_mesh_network_load(const char *app_cred,
55                 const char *sender, const char *token);
56
57 int _bt_mesh_network_unload(const char *app_cred,
58                 const char *sender, bluetooth_mesh_network_t *network);
59
60 int _bt_mesh_network_load_cdb(int result, const char *sender,
61                 const char *app_creds, uint8_t uuid[16],
62                         uint8_t token[8], char **network);
63
64 int _bt_mesh_network_request_provisioning_data_request(
65                 uint8_t net_uuid[], uint8_t count);
66
67 int _bt_mesh_network_scan(const char *app_cred, const char *sender,
68                 bluetooth_mesh_network_t *network,
69                         bluetooth_mesh_scan_param_t *param);
70
71 int _bt_mesh_network_scan_cancel(const char *app_cred,
72                 const char *sender, bluetooth_mesh_network_t *network);
73
74 bool _bt_mesh_is_scanning(void);
75
76 void _bt_mesh_set_scanning_state(bool state);
77
78 bool _bt_mesh_is_provisioning(void);
79
80 void _bt_mesh_set_provisioning_state(bool state);
81
82 int _bt_mesh_network_set_provisioner_caps(const char *app_cred,
83                 const char *sender, bluetooth_mesh_network_t *network,
84                         bluetooth_mesh_provisioner_caps_t *caps);
85
86 int _bt_mesh_network_provision_device(const char *app_cred,
87                 const char *sender,
88                         bluetooth_mesh_provisioning_request_t *req);
89
90 int _bt_mesh_authentication_reply(int auth_type,
91                 const char *auth_value, gboolean reply);
92
93 int _bt_mesh_network_add_netkey(const char *app_cred,
94                 const char *sender, bluetooth_mesh_network_t *network);
95
96 int _bt_mesh_network_delete_netkey(const char *app_cred,
97                 const char *sender, bluetooth_mesh_network_t *network,
98                         uint16_t index);
99
100 int _bt_mesh_network_update_netkey(const char *app_cred,
101                 const char *sender, bluetooth_mesh_network_t *network,
102                         uint16_t index);
103
104 int _bt_mesh_network_add_appkey(const char *app_cred, const char *sender,
105                 bluetooth_mesh_network_t *network, uint16_t netkey_idx);
106
107 int _bt_mesh_network_delete_appkey(const char *app_cred, const char *sender,
108                 bluetooth_mesh_network_t *network, uint16_t netkey_idx,
109                         uint16_t appkey_idx);
110
111 int _bt_mesh_network_update_appkey(const char *app_cred, const char *sender,
112                 bluetooth_mesh_network_t *network, uint16_t netkey_idx,
113                         uint16_t appkey_idx);
114
115 int _bt_mesh_network_set_name(const char *app_cred, const char *sender,
116                 bluetooth_mesh_network_t *network);
117
118 int _bt_mesh_network_get_netkeys(const char *app_cred, const char *sender,
119                  bluetooth_mesh_network_t *network,  GArray **out_param);
120
121 int _bt_mesh_network_get_appkeys(const char *app_cred, const char *sender,
122                 bluetooth_mesh_network_t *network,  uint16_t net_idx,
123                         GArray **out_param);
124
125 int _bt_mesh_network_handle_netkey_added(uint8_t net_uuid[],
126                 uint16_t netkey_idx);
127
128 int _bt_mesh_network_handle_netkey_deleted(uint8_t net_uuid[],
129                 uint16_t netkey_idx);
130
131 int _bt_mesh_network_handle_netkey_updated(uint8_t net_uuid[],
132                 uint16_t netkey_idx);
133
134 int _bt_mesh_network_handle_appkey_added(uint8_t net_uuid[],
135                 uint16_t netkey_idx, uint16_t appkey_idx);
136
137 int _bt_mesh_network_handle_appkey_deleted(uint8_t net_uuid[],
138                 uint16_t netkey_idx, uint16_t appkey_idx);
139
140 int _bt_mesh_network_get_nodes(const char *app_cred, const char *sender,
141                 bluetooth_mesh_network_t *network,  GArray **out_param);
142
143 int _bt_mesh_element_get_models(const char *app_cred, const char *sender,
144                 bluetooth_mesh_network_t *network,  uint16_t unicast,
145                         int elem_idx, GArray **out_param);
146
147 int _bt_mesh_network_add_remote_node(uint8_t net_uuid[], uint8_t dev_uuid[],
148                 uint16_t unicast, uint8_t count);
149
150 bool _bt_mesh_network_save_remote_node_composition(uint8_t net_uuid[],
151                 uint16_t remote_unicast,
152                         uint8_t *data, uint16_t data_len);
153
154 bool _bt_mesh_network_save_remote_node_netkey(uint8_t net_uuid[],
155                 uint16_t remote_unicast, uint16_t netkey_idx);
156
157 bool _bt_mesh_network_delete_remote_node_netkey(uint8_t net_uuid[],
158                 uint16_t remote_unicast, uint16_t netkey_idx);
159
160 bool _bt_mesh_network_save_remote_node_appkey(uint8_t net_uuid[],
161                 uint16_t remote_unicast, uint16_t netkey_idx,
162                         uint16_t appkey_idx);
163
164 bool _bt_mesh_network_delete_remote_node_appkey(uint8_t net_uuid[],
165                 uint16_t remote_unicast, uint16_t netkey_idx,
166                         uint16_t appkey_idx);
167
168 bool _bt_mesh_network_save_remote_node_ttl(uint8_t net_uuid[],
169                 uint16_t remote_unicast, uint8_t ttl);
170
171 int _bt_mesh_network_node_get_netkeys(const char *app_cred,
172                 bluetooth_mesh_node_discover_t *node,
173                         GArray **out_param);
174
175 int _bt_mesh_network_node_get_appkeys(const char *app_cred, const char *sender,
176                 bluetooth_mesh_node_discover_t *node,  GArray **out_param);
177
178 int _bt_mesh_network_create_group(const char *app_cred, const char *sender,
179                 bluetooth_mesh_network_t *net, bool is_virtual, uint16_t grp_addr,
180                         bluetooth_mesh_network_group_info_t *group);
181
182 int _bt_mesh_network_remove_group(const char *app_cred,
183                 const char *sender, bluetooth_mesh_network_t *net,
184                         bluetooth_mesh_network_group_info_t *req);
185
186 int _bt_mesh_network_get_groups(const char *app_cred, const char *sender,
187                 bluetooth_mesh_network_t *network,  GArray **out_param);
188
189 bool _bt_mesh_network_get_label_uuid_from_sub_addr(uint8_t net_uuid[],
190                 uint16_t sub_addr, uint8_t label[]);
191
192 bool _bt_mesh_node_get_vendor_features(uint8_t net_uuid[],
193                 uint16_t unicast, bluetooth_mesh_node_features_t *feats);
194
195 #ifdef __cplusplus
196 }
197 #endif /* __cplusplus */
198 #endif /* BT_MESH_NETWORK_H_ */