1194869Sjamie/*-
2194869Sjamie * Copyright (c) 2009 James Gritton.
3194869Sjamie * All rights reserved.
4194869Sjamie *
5194869Sjamie * Redistribution and use in source and binary forms, with or without
6194869Sjamie * modification, are permitted provided that the following conditions
7194869Sjamie * are met:
8194869Sjamie * 1. Redistributions of source code must retain the above copyright
9194869Sjamie *    notice, this list of conditions and the following disclaimer.
10194869Sjamie * 2. Redistributions in binary form must reproduce the above copyright
11194869Sjamie *    notice, this list of conditions and the following disclaimer in the
12194869Sjamie *    documentation and/or other materials provided with the distribution.
13194869Sjamie *
14194869Sjamie * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15194869Sjamie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16194869Sjamie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17194869Sjamie * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18194869Sjamie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19194869Sjamie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20194869Sjamie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21194869Sjamie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22194869Sjamie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23194869Sjamie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24194869Sjamie * SUCH DAMAGE.
25194869Sjamie *
26194869Sjamie * $FreeBSD$
27194869Sjamie */
28194869Sjamie
29194869Sjamie#ifndef _JAIL_H
30194869Sjamie#define _JAIL_H
31194869Sjamie
32194869Sjamie#define	JP_RAWVALUE	0x01
33194869Sjamie#define	JP_BOOL		0x02
34194869Sjamie#define	JP_NOBOOL	0x04
35195870Sjamie#define	JP_JAILSYS	0x08
36194869Sjamie
37194869Sjamie#define JAIL_ERRMSGLEN	1024
38194869Sjamie
39194869Sjamieextern char jail_errmsg[];
40194869Sjamie
41194869Sjamiestruct jailparam {
42194869Sjamie	char		*jp_name;
43194869Sjamie	void		*jp_value;
44194869Sjamie	size_t		 jp_valuelen;
45194869Sjamie	size_t		 jp_elemlen;
46194869Sjamie	int		 jp_ctltype;
47194869Sjamie	int		 jp_structtype;
48194869Sjamie	unsigned	 jp_flags;
49194869Sjamie};
50194869Sjamie
51194869Sjamie__BEGIN_DECLS
52194869Sjamieextern int jail_getid(const char *name);
53194869Sjamieextern char *jail_getname(int jid);
54194869Sjamieextern int jail_setv(int flags, ...);
55194869Sjamieextern int jail_getv(int flags, ...);
56194869Sjamieextern int jailparam_all(struct jailparam **jpp);
57194869Sjamieextern int jailparam_init(struct jailparam *jp, const char *name);
58194869Sjamieextern int jailparam_import(struct jailparam *jp, const char *value);
59194869Sjamieextern int jailparam_import_raw(struct jailparam *jp, void *value,
60194869Sjamie	       size_t valuelen);
61194869Sjamieextern int jailparam_set(struct jailparam *jp, unsigned njp, int flags);
62194869Sjamieextern int jailparam_get(struct jailparam *jp, unsigned njp, int flags);
63194869Sjamieextern char *jailparam_export(struct jailparam *jp);
64194869Sjamieextern void jailparam_free(struct jailparam *jp, unsigned njp);
65194869Sjamie__END_DECLS
66194869Sjamie
67194869Sjamie#endif /* _JAIL_H  */
68194869Sjamie
69194869Sjamie
70