Skip to content

Commit 8049c24

Browse files
HaavardReifabiobaltieri
authored andcommitted
Bluetooth: Mesh: Add prefix to Subnet Bridge API
Adds the `bt_mesh_brg_cfg` prefix to the public Subnet Bridge API, and aligns the function and callback naming with the rest of the Bluetooth Mesh API. Signed-off-by: Håvard Reierstad <[email protected]>
1 parent 35c9e54 commit 8049c24

File tree

8 files changed

+215
-234
lines changed

8 files changed

+215
-234
lines changed

doc/connectivity/bluetooth/api/mesh/brg_cfg.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ Enabling or disabling the Subnet Bridge feature
6969

7070
The Bridge Configuration Client (or Configuration Manager) can enable or disable the Subnet Bridge
7171
feature on a node by sending a **Subnet Bridge Set** message to the Bridge Configuration
72-
Server model on the target node, using the :c:func:`bt_mesh_brg_cfg_cli_subnet_bridge_set` function.
72+
Server model on the target node, using the :c:func:`bt_mesh_brg_cfg_cli_set` function.
7373

7474
Adding or removing subnets
7575
**************************
7676

7777
The Bridge Configuration Client can add or remove an entry from the Bridging Table by sending a
7878
**Bridging Table Add** or **Bridging Table Remove** message to the Bridge Configuration
79-
Server model on the target node, calling the :c:func:`bt_mesh_brg_cfg_cli_bridging_table_add` or
80-
:c:func:`bt_mesh_brg_cfg_cli_bridging_table_remove` functions.
79+
Server model on the target node, calling the :c:func:`bt_mesh_brg_cfg_cli_table_add` or
80+
:c:func:`bt_mesh_brg_cfg_cli_table_remove` functions.
8181

8282
.. _bluetooth_mesh_brg_cfg_states:
8383

@@ -89,20 +89,19 @@ The Subnet Bridge has the following states:
8989
- *Subnet Bridge*: This state indicates whether the Subnet Bridge feature is enabled or disabled on
9090
the node.
9191
The Bridge Configuration Client can retrieve this information by sending a **Subnet Bridge Get**
92-
message to the Bridge Configuration Server using the
93-
:c:func:`bt_mesh_brg_cfg_cli_subnet_bridge_get` function.
92+
message to the Bridge Configuration Server using the :c:func:`bt_mesh_brg_cfg_cli_get` function.
9493

9594
- *Bridging Table*: This state holds the bridging table. The Client can request a list of
9695
entries from a Bridging Table by sending a **Bridging Table Get** message to the target node using
97-
the :c:func:`bt_mesh_brg_cfg_cli_bridging_table_get` function.
96+
the :c:func:`bt_mesh_brg_cfg_cli_table_get` function.
9897

9998
The Client can get a list of subnets currently bridged by a Subnet Bridge by sending a
10099
**Bridged Subnets Get** message to the target Server by calling the
101-
:c:func:`bt_mesh_brg_cfg_cli_bridged_subnets_get` function.
100+
:c:func:`bt_mesh_brg_cfg_cli_subnets_get` function.
102101

103102
- *Bridging Table Size*: This state reports the maximum number of entries the Bridging Table can
104103
store. The Client can retrieve this information by sending a **Bridging Table Size Get** message
105-
using the :c:func:`bt_mesh_brg_cfg_cli_bridging_table_size_get` function.
104+
using the :c:func:`bt_mesh_brg_cfg_cli_table_size_get` function.
106105
This is a read-only state.
107106

108107
Subnet bridging and replay protection

include/zephyr/bluetooth/mesh/brg_cfg.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ extern "C" {
2121
*/
2222

2323
/** Subnet Bridge states */
24-
enum bt_mesh_subnet_bridge_state {
24+
enum bt_mesh_brg_cfg_state {
2525
/** Subnet bridge functionality is disabled. */
26-
BT_MESH_SUBNET_BRIDGE_DISABLED,
26+
BT_MESH_BRG_CFG_DISABLED,
2727
/** Subnet bridge state functionality is enabled. */
28-
BT_MESH_SUBNET_BRIDGE_ENABLED,
28+
BT_MESH_BRG_CFG_ENABLED,
2929
};
3030

3131
/* Briding from Addr1 to Addr2. */
32-
#define BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY 1
32+
#define BT_MESH_BRG_CFG_DIR_ONEWAY 1
3333
/* Bidirectional briging between Addr1 and Addr2. */
34-
#define BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY 2
34+
#define BT_MESH_BRG_CFG_DIR_TWOWAY 2
3535

3636
/** Bridging Table state entry corresponding to a entry in the Bridging Table. */
37-
struct bt_mesh_bridging_table_entry {
37+
struct bt_mesh_brg_cfg_table_entry {
3838
/** Allowed directions for the bridged traffic (or bridged traffic not allowed) */
3939
uint8_t directions;
4040
/** NetKey Index of the first subnet */
@@ -48,32 +48,32 @@ struct bt_mesh_bridging_table_entry {
4848
};
4949

5050
/** Bridging Table Status response */
51-
struct bt_mesh_bridging_table_status {
51+
struct bt_mesh_brg_cfg_table_status {
5252
/** Status Code of the requesting message */
5353
uint8_t status;
5454
/** Requested Bridging Table entry */
55-
struct bt_mesh_bridging_table_entry entry;
55+
struct bt_mesh_brg_cfg_table_entry entry;
5656
};
5757

5858
/** Used to filter set of pairs of NetKey Indexes from the Bridging Table */
59-
struct bt_mesh_filter_netkey {
59+
struct bt_mesh_brg_cfg_filter_netkey {
6060
uint16_t filter: 2, /* Filter applied to the set of pairs of NetKey Indexes */
6161
prohibited: 2, /* Prohibited */
6262
net_idx: 12; /* NetKey Index used for filtering or ignored */
6363
};
6464

6565
/** Bridged Subnets List response */
66-
struct bt_mesh_bridged_subnets_list {
66+
struct bt_mesh_brg_cfg_subnets_list {
6767
/** Filter applied NetKey Indexes, and NetKey Index used for filtering. */
68-
struct bt_mesh_filter_netkey net_idx_filter;
68+
struct bt_mesh_brg_cfg_filter_netkey net_idx_filter;
6969
/** Start offset in units of bridges */
7070
uint8_t start_idx;
7171
/** Pointer to allocated buffer for storing filtered of NetKey Indexes */
7272
struct net_buf_simple *list;
7373
};
7474

7575
/** Bridging Table List response */
76-
struct bt_mesh_bridging_table_list {
76+
struct bt_mesh_brg_cfg_table_list {
7777
/** Status Code of the requesting message */
7878
uint8_t status;
7979
/** NetKey Index of the first subnet */

include/zephyr/bluetooth/mesh/brg_cfg_cli.h

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ struct bt_mesh_brg_cfg_cli_cb {
4242
* @param addr Address of the sender.
4343
* @param status Status received from the server.
4444
*/
45-
void (*subnet_bridge_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr,
46-
enum bt_mesh_subnet_bridge_state status);
45+
void (*bridge_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr,
46+
enum bt_mesh_brg_cfg_state status);
4747

4848
/** @brief Optional callback for Bridging Table Size Status message.
4949
*
@@ -54,8 +54,7 @@ struct bt_mesh_brg_cfg_cli_cb {
5454
* @param addr Address of the sender.
5555
* @param size Size received from the server.
5656
*/
57-
void (*bridging_table_size_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr,
58-
uint16_t size);
57+
void (*table_size_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, uint16_t size);
5958

6059
/** @brief Optional callback for Bridging Table Status message.
6160
*
@@ -66,8 +65,8 @@ struct bt_mesh_brg_cfg_cli_cb {
6665
* @param addr Address of the sender.
6766
* @param rsp Response received from the Bridging Configuration Server.
6867
*/
69-
void (*bridging_table_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr,
70-
struct bt_mesh_bridging_table_status *rsp);
68+
void (*table_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr,
69+
struct bt_mesh_brg_cfg_table_status *rsp);
7170

7271
/** @brief Optional callback for Bridged Subnets List message.
7372
*
@@ -78,8 +77,8 @@ struct bt_mesh_brg_cfg_cli_cb {
7877
* @param addr Address of the sender.
7978
* @param rsp Response received from the Bridging Configuration Server.
8079
*/
81-
void (*bridged_subnets_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr,
82-
struct bt_mesh_bridged_subnets_list *rsp);
80+
void (*subnets_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr,
81+
struct bt_mesh_brg_cfg_subnets_list *rsp);
8382

8483
/** @brief Optional callback for Bridging Table List message.
8584
*
@@ -90,8 +89,8 @@ struct bt_mesh_brg_cfg_cli_cb {
9089
* @param addr Address of the sender.
9190
* @param rsp Response received from the Bridging Configuration Server.
9291
*/
93-
void (*bridging_table_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr,
94-
struct bt_mesh_bridging_table_list *rsp);
92+
void (*table_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr,
93+
struct bt_mesh_brg_cfg_table_list *rsp);
9594
};
9695

9796
/** Bridge Configuration Client Model Context */
@@ -121,13 +120,12 @@ struct bt_mesh_brg_cfg_cli {
121120
* @param net_idx Network index to encrypt the message with.
122121
* @param addr Target node address.
123122
* @param status Status response parameter, returns one of
124-
* @ref BT_MESH_SUBNET_BRIDGE_DISABLED or
125-
* @ref BT_MESH_SUBNET_BRIDGE_ENABLED on success.
123+
* @ref BT_MESH_BRG_CFG_DISABLED or
124+
* @ref BT_MESH_BRG_CFG_ENABLED on success.
126125
*
127126
* @return 0 on success, or (negative) error code on failure.
128127
*/
129-
int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr,
130-
enum bt_mesh_subnet_bridge_state *status);
128+
int bt_mesh_brg_cfg_cli_get(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state *status);
131129

132130
/** @brief Sends a Subnet Bridge Set message to the given destination address
133131
* with the given parameters
@@ -145,17 +143,16 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr,
145143
* @param net_idx Network index to encrypt the message with.
146144
* @param addr Target node address.
147145
* @param val Value to set the Subnet Bridge state to. Must be one of
148-
* @ref BT_MESH_SUBNET_BRIDGE_DISABLED or
149-
* @ref BT_MESH_SUBNET_BRIDGE_ENABLED.
146+
* @ref BT_MESH_BRG_CFG_DISABLED or
147+
* @ref BT_MESH_BRG_CFG_ENABLED.
150148
* @param status Status response parameter, returns one of
151-
* @ref BT_MESH_SUBNET_BRIDGE_DISABLED or
152-
* @ref BT_MESH_SUBNET_BRIDGE_ENABLED on success.
149+
* @ref BT_MESH_BRG_CFG_DISABLED or
150+
* @ref BT_MESH_BRG_CFG_ENABLED on success.
153151
*
154152
* @return 0 on success, or (negative) error code on failure.
155153
*/
156-
int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr,
157-
enum bt_mesh_subnet_bridge_state val,
158-
enum bt_mesh_subnet_bridge_state *status);
154+
int bt_mesh_brg_cfg_cli_set(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state val,
155+
enum bt_mesh_brg_cfg_state *status);
159156

160157
/** @brief Sends a Bridging Table Size Get message to the given destination
161158
* address with the given parameters
@@ -176,7 +173,7 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr,
176173
*
177174
* @return 0 on success, or (negative) error code on failure.
178175
*/
179-
int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size);
176+
int bt_mesh_brg_cfg_cli_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size);
180177

181178
/** @brief Sends a Bridging Table Add message to the given destination address
182179
* with the given parameters
@@ -198,9 +195,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr,
198195
*
199196
* @return 0 on success, or (negative) error code on failure.
200197
*/
201-
int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr,
202-
struct bt_mesh_bridging_table_entry *entry,
203-
struct bt_mesh_bridging_table_status *rsp);
198+
int bt_mesh_brg_cfg_cli_table_add(uint16_t net_idx, uint16_t addr,
199+
struct bt_mesh_brg_cfg_table_entry *entry,
200+
struct bt_mesh_brg_cfg_table_status *rsp);
204201

205202
/** @brief Sends a Bridging Table Remove message to the given destination
206203
* address with the given parameters
@@ -226,9 +223,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr,
226223
*
227224
* @return 0 on success, or (negative) error code on failure.
228225
*/
229-
int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1,
230-
uint16_t net_idx2, uint16_t addr1, uint16_t addr2,
231-
struct bt_mesh_bridging_table_status *rsp);
226+
int bt_mesh_brg_cfg_cli_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1,
227+
uint16_t net_idx2, uint16_t addr1, uint16_t addr2,
228+
struct bt_mesh_brg_cfg_table_status *rsp);
232229

233230
/** @brief Sends a Bridged Subnets Get message to the given destination address
234231
* with the given parameters
@@ -244,7 +241,7 @@ int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, u
244241
*
245242
* When @c rsp is set, the user is responsible for providing a buffer for the
246243
* filtered set of N pairs of NetKey Indexes in
247-
* @ref bt_mesh_bridged_subnets_list::list. If a buffer is not provided, the
244+
* @ref bt_mesh_brg_cfg_subnets_list::list. If a buffer is not provided, the
248245
* bridged subnets won't be copied.
249246
250247
* @param net_idx Network index to encrypt the message with.
@@ -256,10 +253,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, u
256253
*
257254
* @return 0 on success, or (negative) error code on failure.
258255
*/
259-
int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr,
260-
struct bt_mesh_filter_netkey filter_net_idx,
261-
uint8_t start_idx,
262-
struct bt_mesh_bridged_subnets_list *rsp);
256+
int bt_mesh_brg_cfg_cli_subnets_get(uint16_t net_idx, uint16_t addr,
257+
struct bt_mesh_brg_cfg_filter_netkey filter_net_idx,
258+
uint8_t start_idx, struct bt_mesh_brg_cfg_subnets_list *rsp);
263259

264260
/** @brief Sends a Bridging Table Get message to the given destination address
265261
* with the given parameters
@@ -276,10 +272,10 @@ int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr,
276272
*
277273
* When @c rsp is set, the user is responsible for providing a buffer for the
278274
* filtered set of N pairs of NetKey Indexes in
279-
* @ref bt_mesh_bridging_table_list::list. If a buffer is not provided, the
280-
* bridged addresses won't be copied. If a buffer size is shorter than received
281-
* list, only those many entries that fit in the buffer will be copied from the
282-
* list, and rest will be discarded.
275+
* @ref bt_mesh_brg_cfg_table_list::list. If a buffer is not provided,
276+
* the bridged addresses won't be copied. If a buffer size is shorter than
277+
* received list, only those many entries that fit in the buffer will be copied
278+
* from the list, and rest will be discarded.
283279
*
284280
* @param net_idx Network index to encrypt the message with.
285281
* @param addr Target node address.
@@ -291,9 +287,9 @@ int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr,
291287
*
292288
* @return 0 on success, or (negative) error code on failure.
293289
*/
294-
int bt_mesh_brg_cfg_cli_bridging_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1,
295-
uint16_t net_idx2, uint16_t start_idx,
296-
struct bt_mesh_bridging_table_list *rsp);
290+
int bt_mesh_brg_cfg_cli_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1,
291+
uint16_t net_idx2, uint16_t start_idx,
292+
struct bt_mesh_brg_cfg_table_list *rsp);
297293

298294
/** @brief Get the current transmission timeout value.
299295
*

0 commit comments

Comments
 (0)