Merge remote-tracking branch 'origin/master'
[unleashed/lotheac.git] / usr / src / lib / libipd / common / libipd.h
blobebf56aea1e22de10d69145f060cdb759153d0510
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.
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.
13 * Copyright (c) 2012 Joyent, Inc. All rights reserved.
14 * Use is subject to license terms.
17 #ifndef _LIBIPD_H
18 #define _LIBIPD_H
20 #include <sys/types.h>
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
27 * Bitmask values for ic_mask.
29 #define IPDM_CORRUPT 0x1000
30 #define IPDM_DELAY 0x2000
31 #define IPDM_DROP 0x4000
33 typedef enum ipd_errno {
34 EIPD_NOERROR = 0,
35 EIPD_NOMEM,
36 EIPD_ZC_NOENT,
37 EIPD_RANGE,
38 EIPD_PERM,
39 EIPD_FAULT,
40 EIPD_INTERNAL,
41 EIPD_UNKNOWN
42 } ipd_errno_t;
44 typedef struct ipd_config {
45 uint32_t ic_mask;
46 uint32_t ic_corrupt;
47 uint32_t ic_drop;
48 uint32_t ic_delay;
49 } ipd_config_t;
51 struct ipd_stat;
52 typedef struct ipd_stat *ipd_stathdl_t;
54 typedef void (*ipd_status_cb_f)(zoneid_t, const ipd_config_t *, void *);
56 extern __thread ipd_errno_t ipd_errno;
57 extern __thread char ipd_errmsg[];
59 extern const char *ipd_strerror(ipd_errno_t);
60 extern int ipd_open(const char *);
61 extern int ipd_close(int);
62 extern int ipd_status_read(int, ipd_stathdl_t *);
63 extern void ipd_status_foreach_zone(const ipd_stathdl_t,
64 ipd_status_cb_f, void *);
65 extern int ipd_status_get_config(const ipd_stathdl_t,
66 zoneid_t, ipd_config_t **);
67 extern void ipd_status_free(ipd_stathdl_t);
68 extern int ipd_ctl(int, zoneid_t, const ipd_config_t *);
70 #ifdef __cplusplus
72 #endif
74 #endif /* _LIBIPD_H */