summaryrefslogtreecommitdiff
path: root/mesh/mesh-io-api.h
blob: ae51cbc55ab90846409a76a0901bcea2c3b963b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 *
 *  BlueZ - Bluetooth protocol stack for Linux
 *
 *  Copyright (C) 2018  Intel Corporation. All rights reserved.
 *
 *
 */

struct mesh_io_private;

typedef bool (*mesh_io_init_t)(struct mesh_io *io, void *opts, void *user_data);
typedef bool (*mesh_io_destroy_t)(struct mesh_io *io);
typedef bool (*mesh_io_caps_t)(struct mesh_io *io, struct mesh_io_caps *caps);
typedef bool (*mesh_io_send_t)(struct mesh_io *io,
					struct mesh_io_send_info *info,
					const uint8_t *data, uint16_t len);
typedef bool (*mesh_io_register_t)(struct mesh_io *io, const uint8_t *filter,
					uint8_t len, mesh_io_recv_func_t cb,
					void *user_data);
typedef bool (*mesh_io_deregister_t)(struct mesh_io *io, const uint8_t *filter,
								uint8_t len);
typedef bool (*mesh_io_tx_cancel_t)(struct mesh_io *io, const uint8_t *pattern,
								uint8_t len);

struct mesh_io_api {
	mesh_io_init_t		init;
	mesh_io_destroy_t	destroy;
	mesh_io_caps_t		caps;
	mesh_io_send_t		send;
	mesh_io_register_t	reg;
	mesh_io_deregister_t	dereg;
	mesh_io_tx_cancel_t	cancel;
};

struct mesh_io_reg {
	mesh_io_recv_func_t cb;
	void *user_data;
	uint8_t len;
	uint8_t filter[];
};

struct mesh_io {
	int				index;
	int				favored_index;
	mesh_io_ready_func_t		ready;
	struct l_queue			*rx_regs;
	struct mesh_io_private		*pvt;
	void				*user_data;
	const struct mesh_io_api	*api;
};

struct mesh_io_table {
	enum mesh_io_type		type;
	const struct mesh_io_api	*api;
};