xref: /illumos-gate/usr/src/lib/varpd/libvarpd/common/libvarpd.h (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2015 Joyent, Inc.
14  */
15 
16 #ifndef _LIBVARPD_H
17 #define	_LIBVARPD_H
18 
19 /*
20  * varpd interfaces
21  */
22 
23 #include <sys/types.h>
24 #include <stdint.h>
25 #include <sys/mac.h>
26 #include <libvarpd_client.h>
27 #include <stdio.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 typedef struct __varpd_handle varpd_handle_t;
34 typedef struct __varpd_prop_handle varpd_prop_handle_t;
35 typedef struct __varpd_instance_handle varpd_instance_handle_t;
36 
37 extern int libvarpd_create(varpd_handle_t **);
38 extern void libvarpd_destroy(varpd_handle_t *);
39 
40 extern int libvarpd_persist_enable(varpd_handle_t *, const char *);
41 extern int libvarpd_persist_restore(varpd_handle_t *);
42 extern int libvarpd_persist_disable(varpd_handle_t *);
43 
44 extern int libvarpd_instance_create(varpd_handle_t *, datalink_id_t,
45     const char *, varpd_instance_handle_t **);
46 extern uint64_t libvarpd_instance_id(varpd_instance_handle_t *);
47 extern varpd_instance_handle_t *libvarpd_instance_lookup(varpd_handle_t *,
48     uint64_t);
49 extern void libvarpd_instance_destroy(varpd_instance_handle_t *);
50 extern int libvarpd_instance_activate(varpd_instance_handle_t *);
51 
52 extern int libvarpd_plugin_load(varpd_handle_t *, const char *);
53 typedef int (*libvarpd_plugin_walk_f)(varpd_handle_t *, const char *, void *);
54 extern int libvarpd_plugin_walk(varpd_handle_t *, libvarpd_plugin_walk_f,
55     void *);
56 
57 extern int libvarpd_prop_handle_alloc(varpd_handle_t *,
58     varpd_instance_handle_t *, varpd_prop_handle_t **);
59 extern void libvarpd_prop_handle_free(varpd_prop_handle_t *);
60 extern int libvarpd_prop_nprops(varpd_instance_handle_t *, uint_t *);
61 extern int libvarpd_prop_info_fill(varpd_prop_handle_t *, uint_t);
62 extern int libvarpd_prop_info(varpd_prop_handle_t *, const char **, uint_t *,
63     uint_t *, const void **, uint32_t *, const mac_propval_range_t **);
64 extern int libvarpd_prop_get(varpd_prop_handle_t *, void *, uint32_t *);
65 extern int libvarpd_prop_set(varpd_prop_handle_t *, const void *, uint32_t);
66 
67 extern int libvarpd_door_server_create(varpd_handle_t *, const char *);
68 extern void libvarpd_door_server_destroy(varpd_handle_t *);
69 
70 extern void *libvarpd_overlay_lookup_run(void *);
71 extern void libvarpd_overlay_lookup_quiesce(varpd_handle_t *);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* _LIBVARPD_H */
78