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 Nexenta Systems, Inc. All rights reserved.
14 */
15
16 #ifndef _LIBKRRP_IMPL_H
17 #define _LIBKRRP_IMPL_H
18
19 #include <libsysevent.h>
20 #include <sys/uuid.h>
21
22 #include "krrp_params.h"
23 #include "krrp_ioctl_common.h"
24 #include "libkrrp_error.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 typedef char krrp_sess_id_str_t[UUID_PRINTABLE_STRING_LENGTH];
31
32 struct libkrrp_handle_s {
33 libkrrp_error_t libkrrp_error;
34 krrp_ioctl_cmd_t libkrrp_last_cmd;
35 int libkrrp_fd;
36 libkrrp_error_descr_t libkrrp_error_descr;
37 };
38
39 struct libkrrp_evc_handle_s {
40 libkrrp_error_t libkrrp_error;
41 int (*callback)(libkrrp_event_t *, void *);
42 evchan_t *evchan;
43 void *cookie;
44 int ev_failure_count;
45 libkrrp_error_descr_t libkrrp_error_descr;
46 };
47
48 struct libkrrp_event_s {
49 libkrrp_error_t libkrrp_error;
50 libkrrp_ev_type_t ev_type;
51 libkrrp_ev_data_t ev_data;
52 libkrrp_error_descr_t libkrrp_error_descr;
53 };
54
55 int krrp_ioctl_perform(libkrrp_handle_t *, krrp_ioctl_cmd_t, nvlist_t *,
56 nvlist_t **);
57 void libkrrp_reset(libkrrp_handle_t *);
58
59 #ifdef __cplusplus
60 }
61 #endif
62
63 #endif /* _LIBKRRP_IMPL_H */