summaryrefslogtreecommitdiff
path: root/mesh/mesh-io.c
diff options
context:
space:
mode:
authorBrian Gix <brian.gix@intel.com>2020-02-23 10:47:37 -0800
committerBrian Gix <brian.gix@intel.com>2020-02-26 11:20:08 -0800
commit6a6fe856a900fb53ce38dd3584d5d1d417d8aede (patch)
tree365d79ac9d3557d2d8fef133b2e516f8efc1cf48 /mesh/mesh-io.c
parent4ec7da4037ac59102b70e9edb34d429f8af42f4f (diff)
downloadbluez-6a6fe856a900fb53ce38dd3584d5d1d417d8aede.tar.gz
mesh: rework incoming advertisement filtering
Future versions of Mesh will introduce new advertising packets, which do not fit in the limited and rigid filtering currently used. This minor rewrite allows registering and receiving of *any* AD types, including the filtering on multiple octets of the incoming AD parts.
Diffstat (limited to 'mesh/mesh-io.c')
-rw-r--r--mesh/mesh-io.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/mesh/mesh-io.c b/mesh/mesh-io.c
index 1ab173d9c..c4eaecefd 100644
--- a/mesh/mesh-io.c
+++ b/mesh/mesh-io.c
@@ -85,18 +85,6 @@ struct mesh_io *mesh_io_new(enum mesh_io_type type, void *opts,
if (!io_list)
io_list = l_queue_new();
- if (api->set) {
- uint8_t pkt = MESH_AD_TYPE_NETWORK;
- uint8_t prv = MESH_AD_TYPE_PROVISION;
- uint8_t snb[2] = {MESH_AD_TYPE_BEACON, 0x01};
- uint8_t prvb[2] = {MESH_AD_TYPE_BEACON, 0x00};
-
- api->set(io, 1, snb, sizeof(snb), NULL, NULL);
- api->set(io, 2, &prv, 1, NULL, NULL);
- api->set(io, 3, &pkt, 1, NULL, NULL);
- api->set(io, 4, prvb, sizeof(prvb), NULL, NULL);
- }
-
if (l_queue_push_head(io_list, io))
return io;
@@ -133,35 +121,25 @@ bool mesh_io_get_caps(struct mesh_io *io, struct mesh_io_caps *caps)
return false;
}
-bool mesh_io_register_recv_cb(struct mesh_io *io, uint8_t filter_id,
- mesh_io_recv_func_t cb, void *user_data)
+bool mesh_io_register_recv_cb(struct mesh_io *io, const uint8_t *filter,
+ uint8_t len, mesh_io_recv_func_t cb,
+ void *user_data)
{
io = l_queue_find(io_list, match_by_io, io);
if (io && io->api && io->api->reg)
- return io->api->reg(io, filter_id, cb, user_data);
+ return io->api->reg(io, filter, len, cb, user_data);
return false;
}
-bool mesh_io_deregister_recv_cb(struct mesh_io *io, uint8_t filter_id)
+bool mesh_io_deregister_recv_cb(struct mesh_io *io, const uint8_t *filter,
+ uint8_t len)
{
io = l_queue_find(io_list, match_by_io, io);
if (io && io->api && io->api->dereg)
- return io->api->dereg(io, filter_id);
-
- return false;
-}
-
-bool mesh_set_filter(struct mesh_io *io, uint8_t filter_id,
- const uint8_t *data, uint8_t len,
- mesh_io_status_func_t cb, void *user_data)
-{
- io = l_queue_find(io_list, match_by_io, io);
-
- if (io && io->api && io->api->set)
- return io->api->set(io, filter_id, data, len, cb, user_data);
+ return io->api->dereg(io, filter, len);
return false;
}