summaryrefslogtreecommitdiff
path: root/usr/src/lib/libvnd/common/libvnd.h
blob: ea92f113b6ba099c1ed27f412cf3ea6a62fd2892 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * This file and its contents are supplied under the terms of the
 * Common Development and Distribution License ("CDDL"), version 1.0.
 * You may only use this file in accordance with the terms of version
 * 1.0 of the CDDL.
 *
 * A full copy of the text of the CDDL should have accompanied this
 * source.  A copy of the CDDL is also available via the Internet at
 * http://www.illumos.org/license/CDDL.
 */

/*
 * Copyright (c) 2014 Joyent, Inc.  All rights reserved.
 */

#ifndef _LIBVND_H
#define	_LIBVND_H

/*
 * libvnd interfaces
 */

#include <stdint.h>
#include <sys/vnd_errno.h>
#include <sys/frameio.h>

#ifdef __cplusplus
extern "C" {
#endif

#define	LIBVND_NAMELEN	32

typedef struct vnd_handle vnd_handle_t;

extern vnd_handle_t *vnd_create(const char *, const char *, const char *,
    vnd_errno_t *, int *);
extern vnd_handle_t *vnd_open(const char *, const char *, vnd_errno_t *, int *);
extern int vnd_unlink(vnd_handle_t *);
extern void vnd_close(vnd_handle_t *);
extern vnd_errno_t vnd_errno(vnd_handle_t *);
extern int vnd_syserrno(vnd_handle_t *);
extern const char *vnd_strerror(vnd_errno_t);
extern const char *vnd_strsyserror(int);

extern int vnd_pollfd(vnd_handle_t *);

typedef struct vnd_info {
	uint32_t vi_version;
	zoneid_t vi_zone;
	char vi_name[LIBVND_NAMELEN];
	char vi_datalink[LIBVND_NAMELEN];
} vnd_info_t;

typedef int (*vnd_walk_cb_t)(vnd_info_t *, void *);
extern int vnd_walk(vnd_walk_cb_t, void *, vnd_errno_t *, int *);

typedef enum vnd_prop {
	VND_PROP_RXBUF = 0,
	VND_PROP_TXBUF,
	VND_PROP_MAXBUF,
	VND_PROP_MINTU,
	VND_PROP_MAXTU,
	VND_PROP_MAX
} vnd_prop_t;

typedef struct vnd_prop_buf {
	uint64_t vpb_size;
} vnd_prop_buf_t;

extern int vnd_prop_get(vnd_handle_t *, vnd_prop_t, void *, size_t);
extern int vnd_prop_set(vnd_handle_t *, vnd_prop_t, void *, size_t);
extern int vnd_prop_writeable(vnd_prop_t, boolean_t *);

typedef int (*vnd_prop_iter_f)(vnd_handle_t *, vnd_prop_t, void *);
extern int vnd_prop_iter(vnd_handle_t *, vnd_prop_iter_f, void *);

extern int vnd_frameio_read(vnd_handle_t *, frameio_t *);
extern int vnd_frameio_write(vnd_handle_t *, frameio_t *);

#ifdef __cplusplus
}
#endif

#endif /* _LIBVND_H */