Mesh: Handle mesh application termination event
[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 void _bt_check_mesh_app_termination(const char *name);
44
45 int _bt_mesh_network_remove_net_configuration(bluetooth_mesh_network_t *net);
46
47 void _bt_mesh_network_unload_net_configuration(_bt_mesh_cdb_t *cdb_cfg);
48
49 int _bt_mesh_network_remove_node_configuration(bluetooth_mesh_node_info_t *node);
50
51 int _bt_mesh_network_create_cdb(int result,
52                 const char *sender, const char *app_creds,
53                         uint8_t uuid[16], uint8_t token[8],
54                                 const char *network);
55
56 int _bt_mesh_network_load(const char *app_cred,
57                 const char *sender, const char *token);
58
59 int _bt_mesh_network_unload(const char *app_cred,
60                 const char *sender, bluetooth_mesh_network_t *network);
61
62 int _bt_mesh_network_load_cdb(int result, const char *sender,
63                 const char *app_creds, uint8_t uuid[16],
64                         uint8_t token[8], char **network);
65
66 int _bt_mesh_network_request_provisioning_data_request(
67                 uint8_t net_uuid[], uint8_t count);
68
69 int _bt_mesh_network_scan(const char *app_cred, const char *sender,
70                 bluetooth_mesh_network_t *network,
71                         bluetooth_mesh_scan_param_t *param);
72
73 int _bt_mesh_network_scan_cancel(const char *app_cred,
74                 const char *sender, bluetooth_mesh_network_t *network);
75
76 bool _bt_mesh_is_scanning(void);
77
78 void _bt_mesh_set_scanning_state(bool state);
79
80 bool _bt_mesh_is_provisioning(void);
81
82 void _bt_mesh_set_provisioning_state(bool state);
83
84 int _bt_mesh_network_set_provisioner_caps(const char *app_cred,
85                 const char *sender, bluetooth_mesh_network_t *network,
86                         bluetooth_mesh_provisioner_caps_t *caps);
87
88 int _bt_mesh_network_provision_device(const char *app_cred,
89                 const char *sender,
90                         bluetooth_mesh_provisioning_request_t *req);
91
92 int _bt_mesh_authentication_reply(int auth_type,
93                 const char *auth_value, gboolean reply);
94
95 int _bt_mesh_network_add_netkey(const char *app_cred,
96                 const char *sender, bluetooth_mesh_network_t *network);
97
98 int _bt_mesh_network_delete_netkey(const char *app_cred,
99                 const char *sender, bluetooth_mesh_network_t *network,
100                         uint16_t index);
101
102 int _bt_mesh_network_update_netkey(const char *app_cred,
103                 const char *sender, bluetooth_mesh_network_t *network,
104                         uint16_t index);
105
106 int _bt_mesh_network_add_appkey(const char *app_cred, const char *sender,
107                 bluetooth_mesh_network_t *network, uint16_t netkey_idx);
108
109 int _bt_mesh_network_delete_appkey(const char *app_cred, const char *sender,
110                 bluetooth_mesh_network_t *network, uint16_t netkey_idx,
111                         uint16_t appkey_idx);
112
113 int _bt_mesh_network_update_appkey(const char *app_cred, const char *sender,
114                 bluetooth_mesh_network_t *network, uint16_t netkey_idx,
115                         uint16_t appkey_idx);
116
117 int _bt_mesh_network_set_name(const char *app_cred, const char *sender,
118                 bluetooth_mesh_network_t *network);
119
120 int _bt_mesh_network_get_netkeys(const char *app_cred, const char *sender,
121                  bluetooth_mesh_network_t *network,  GArray **out_param);
122
123 int _bt_mesh_network_get_appkeys(const char *app_cred, const char *sender,
124                 bluetooth_mesh_network_t *network,  uint16_t net_idx,
125                         GArray **out_param);
126
127 int _bt_mesh_network_handle_netkey_added(uint8_t net_uuid[],
128                 uint16_t netkey_idx);
129
130 int _bt_mesh_network_handle_netkey_deleted(uint8_t net_uuid[],
131                 uint16_t netkey_idx);
132
133 int _bt_mesh_network_handle_netkey_updated(uint8_t net_uuid[],
134                 uint16_t netkey_idx);
135
136 int _bt_mesh_network_handle_appkey_added(uint8_t net_uuid[],
137                 uint16_t netkey_idx, uint16_t appkey_idx);
138
139 int _bt_mesh_network_handle_appkey_deleted(uint8_t net_uuid[],
140                 uint16_t netkey_idx, uint16_t appkey_idx);
141
142 int _bt_mesh_network_get_nodes(const char *app_cred, const char *sender,
143                 bluetooth_mesh_network_t *network,  GArray **out_param);
144
145 int _bt_mesh_element_get_models(const char *app_cred, const char *sender,
146                 bluetooth_mesh_network_t *network,  uint16_t unicast,
147                         int elem_idx, GArray **out_param);
148
149 int _bt_mesh_network_add_remote_node(uint8_t net_uuid[], uint8_t dev_uuid[],
150                 uint16_t unicast, uint8_t count);
151
152 bool _bt_mesh_network_save_remote_node_composition(uint8_t net_uuid[],
153                 uint16_t remote_unicast,
154                         uint8_t *data, uint16_t data_len);
155
156 bool _bt_mesh_network_save_remote_node_netkey(uint8_t net_uuid[],
157                 uint16_t remote_unicast, uint16_t netkey_idx);
158
159 bool _bt_mesh_network_delete_remote_node_netkey(uint8_t net_uuid[],
160                 uint16_t remote_unicast, uint16_t netkey_idx);
161
162 bool _bt_mesh_network_save_remote_node_appkey(uint8_t net_uuid[],
163                 uint16_t remote_unicast, uint16_t netkey_idx,
164                         uint16_t appkey_idx);
165
166 bool _bt_mesh_network_delete_remote_node_appkey(uint8_t net_uuid[],
167                 uint16_t remote_unicast, uint16_t netkey_idx,
168                         uint16_t appkey_idx);
169
170 bool _bt_mesh_network_save_remote_node_ttl(uint8_t net_uuid[],
171                 uint16_t remote_unicast, uint8_t ttl);
172
173 int _bt_mesh_network_node_get_netkeys(const char *app_cred,
174                 bluetooth_mesh_node_discover_t *node,
175                         GArray **out_param);
176
177 int _bt_mesh_network_node_get_appkeys(const char *app_cred, const char *sender,
178                 bluetooth_mesh_node_discover_t *node,  GArray **out_param);
179
180 int _bt_mesh_network_create_group(const char *app_cred, const char *sender,
181                 bluetooth_mesh_network_t *net, bool is_virtual, uint16_t grp_addr,
182                         bluetooth_mesh_network_group_info_t *group);
183
184 int _bt_mesh_network_remove_group(const char *app_cred,
185                 const char *sender, bluetooth_mesh_network_t *net,
186                         bluetooth_mesh_network_group_info_t *req);
187
188 int _bt_mesh_network_get_groups(const char *app_cred, const char *sender,
189                 bluetooth_mesh_network_t *network,  GArray **out_param);
190
191 bool _bt_mesh_network_get_label_uuid_from_sub_addr(uint8_t net_uuid[],
192                 uint16_t sub_addr, uint8_t label[]);
193
194 bool _bt_mesh_node_get_vendor_features(uint8_t net_uuid[],
195                 uint16_t unicast, bluetooth_mesh_node_features_t *feats);
196
197 #ifdef __cplusplus
198 }
199 #endif /* __cplusplus */
200 #endif /* BT_MESH_NETWORK_H_ */