1181638Skmacy/*
2181638Skmacy * Simple prototyle Xen Store Daemon providing simple tree-like database.
3181638Skmacy * Copyright (C) 2005 Rusty Russell IBM Corporation
4181638Skmacy *
5181638Skmacy * This file may be distributed separately from the Linux kernel, or
6181638Skmacy * incorporated into other software packages, subject to the following license:
7181638Skmacy *
8181638Skmacy * Permission is hereby granted, free of charge, to any person obtaining a copy
9181638Skmacy * of this source file (the "Software"), to deal in the Software without
10181638Skmacy * restriction, including without limitation the rights to use, copy, modify,
11181638Skmacy * merge, publish, distribute, sublicense, and/or sell copies of the Software,
12181638Skmacy * and to permit persons to whom the Software is furnished to do so, subject to
13181638Skmacy * the following conditions:
14181638Skmacy *
15181638Skmacy * The above copyright notice and this permission notice shall be included in
16181638Skmacy * all copies or substantial portions of the Software.
17181638Skmacy *
18181638Skmacy * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19181638Skmacy * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20181638Skmacy * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21181638Skmacy * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22181638Skmacy * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23181638Skmacy * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24181638Skmacy * IN THE SOFTWARE.
25181638Skmacy */
26181638Skmacy
27181638Skmacy#ifndef _XENSTORED_H
28181638Skmacy#define _XENSTORED_H
29181638Skmacy
30181638Skmacyenum xsd_sockmsg_type
31181638Skmacy{
32181638Skmacy	XS_DEBUG,
33181638Skmacy	XS_SHUTDOWN,
34181638Skmacy	XS_DIRECTORY,
35181638Skmacy	XS_READ,
36181638Skmacy	XS_GET_PERMS,
37181638Skmacy	XS_WATCH,
38181638Skmacy	XS_WATCH_ACK,
39181638Skmacy	XS_UNWATCH,
40181638Skmacy	XS_TRANSACTION_START,
41181638Skmacy	XS_TRANSACTION_END,
42181638Skmacy	XS_OP_READ_ONLY = XS_TRANSACTION_END,
43181638Skmacy	XS_INTRODUCE,
44181638Skmacy	XS_RELEASE,
45181638Skmacy	XS_GETDOMAINPATH,
46181638Skmacy	XS_WRITE,
47181638Skmacy	XS_MKDIR,
48181638Skmacy	XS_RM,
49181638Skmacy	XS_SET_PERMS,
50181638Skmacy	XS_WATCH_EVENT,
51181638Skmacy	XS_ERROR,
52181638Skmacy};
53181638Skmacy
54181638Skmacy#define XS_WRITE_NONE "NONE"
55181638Skmacy#define XS_WRITE_CREATE "CREATE"
56181638Skmacy#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
57181638Skmacy
58181638Skmacy/* We hand errors as strings, for portability. */
59181638Skmacystruct xsd_errors
60181638Skmacy{
61181638Skmacy	int errnum;
62181638Skmacy	const char *errstring;
63181638Skmacy};
64181638Skmacy#define XSD_ERROR(x) { x, #x }
65181638Skmacystatic struct xsd_errors xsd_errors[] __attribute__((unused)) = {
66181638Skmacy	XSD_ERROR(EINVAL),
67181638Skmacy	XSD_ERROR(EACCES),
68181638Skmacy	XSD_ERROR(EEXIST),
69181638Skmacy	XSD_ERROR(EISDIR),
70181638Skmacy	XSD_ERROR(ENOENT),
71181638Skmacy	XSD_ERROR(ENOMEM),
72181638Skmacy	XSD_ERROR(ENOSPC),
73181638Skmacy	XSD_ERROR(EIO),
74181638Skmacy	XSD_ERROR(ENOTEMPTY),
75181638Skmacy	XSD_ERROR(ENOSYS),
76181638Skmacy	XSD_ERROR(EROFS),
77181638Skmacy	XSD_ERROR(EBUSY),
78181638Skmacy	XSD_ERROR(ETIMEDOUT),
79181638Skmacy	XSD_ERROR(EISCONN),
80181638Skmacy};
81181638Skmacystruct xsd_sockmsg
82181638Skmacy{
83181638Skmacy	uint32_t type;
84181638Skmacy	uint32_t len; 		/* Length of data following this. */
85181638Skmacy
86181638Skmacy	/* Generally followed by nul-terminated string(s). */
87181638Skmacy};
88181638Skmacy
89181638Skmacy#endif /* _XENSTORED_H */
90