xref: /freebsd/contrib/libfido2/src/netlink.h (revision 9768746b)
1 /*
2  * Copyright (c) 2020 Yubico AB. All rights reserved.
3  * Use of this source code is governed by a BSD-style
4  * license that can be found in the LICENSE file.
5  */
6 
7 #ifndef _FIDO_NETLINK_H
8 #define _FIDO_NETLINK_H
9 
10 #include <sys/socket.h>
11 
12 #include <linux/genetlink.h>
13 #include <linux/netlink.h>
14 #include <linux/nfc.h>
15 
16 #include <stdlib.h>
17 #include <stdint.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif /* __cplusplus */
22 
23 typedef struct fido_nl {
24 	int                fd;
25 	uint16_t           nfc_type;
26 	uint32_t           nfc_mcastgrp;
27 	struct sockaddr_nl saddr;
28 } fido_nl_t;
29 
30 fido_nl_t *fido_nl_new(void);
31 void fido_nl_free(struct fido_nl **);
32 int fido_nl_power_nfc(struct fido_nl *, uint32_t);
33 int fido_nl_get_nfc_target(struct fido_nl *, uint32_t , uint32_t *);
34 
35 #ifdef FIDO_FUZZ
36 void set_netlink_io_functions(ssize_t (*)(int, void *, size_t),
37     ssize_t (*)(int, const void *, size_t));
38 #endif
39 
40 #ifdef __cplusplus
41 } /* extern "C" */
42 #endif /* __cplusplus */
43 
44 #endif /* !_FIDO_NETLINK_H */
45