1/*
2 * Simple prototyle Xen Store Daemon providing simple tree-like database.
3 * Copyright (C) 2005 Rusty Russell IBM Corporation
4 *
5 * This file may be distributed separately from the Linux kernel, or
6 * incorporated into other software packages, subject to the following license:
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this source file (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use, copy, modify,
11 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
12 * and to permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * IN THE SOFTWARE.
25 */
26
27#ifndef _XENSTORED_H
28#define _XENSTORED_H
29
30enum xsd_sockmsg_type
31{
32	XS_DEBUG,
33	XS_SHUTDOWN,
34	XS_DIRECTORY,
35	XS_READ,
36	XS_GET_PERMS,
37	XS_WATCH,
38	XS_WATCH_ACK,
39	XS_UNWATCH,
40	XS_TRANSACTION_START,
41	XS_TRANSACTION_END,
42	XS_OP_READ_ONLY = XS_TRANSACTION_END,
43	XS_INTRODUCE,
44	XS_RELEASE,
45	XS_GETDOMAINPATH,
46	XS_WRITE,
47	XS_MKDIR,
48	XS_RM,
49	XS_SET_PERMS,
50	XS_WATCH_EVENT,
51	XS_ERROR,
52};
53
54#define XS_WRITE_NONE "NONE"
55#define XS_WRITE_CREATE "CREATE"
56#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
57
58/* We hand errors as strings, for portability. */
59struct xsd_errors
60{
61	int errnum;
62	const char *errstring;
63};
64#define XSD_ERROR(x) { x, #x }
65static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
66	XSD_ERROR(EINVAL),
67	XSD_ERROR(EACCES),
68	XSD_ERROR(EEXIST),
69	XSD_ERROR(EISDIR),
70	XSD_ERROR(ENOENT),
71	XSD_ERROR(ENOMEM),
72	XSD_ERROR(ENOSPC),
73	XSD_ERROR(EIO),
74	XSD_ERROR(ENOTEMPTY),
75	XSD_ERROR(ENOSYS),
76	XSD_ERROR(EROFS),
77	XSD_ERROR(EBUSY),
78	XSD_ERROR(ETIMEDOUT),
79	XSD_ERROR(EISCONN),
80};
81struct xsd_sockmsg
82{
83	uint32_t type;
84	uint32_t len; 		/* Length of data following this. */
85
86	/* Generally followed by nul-terminated string(s). */
87};
88
89#endif /* _XENSTORED_H */
90