1255570Strasz/*	$OpenBSD: privsep.h,v 1.2 2004/05/04 18:51:18 henning Exp $ */
2255570Strasz
3255570Strasz/*
4255570Strasz * Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
5255570Strasz *
6255570Strasz * Permission to use, copy, modify, and distribute this software for any
7255570Strasz * purpose with or without fee is hereby granted, provided that the above
8255570Strasz * copyright notice and this permission notice appear in all copies.
9255570Strasz *
10255570Strasz * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11255570Strasz * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12255570Strasz * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13255570Strasz * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14255570Strasz * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
15255570Strasz * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
16255570Strasz * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE.
17255570Strasz *
18255570Strasz * $FreeBSD$
19255570Strasz */
20255570Strasz
21255570Strasz#include <sys/types.h>
22255570Strasz
23255570Strasz#include <poll.h>
24255570Strasz#include <pwd.h>
25255570Strasz
26255570Straszstruct buf {
27255570Strasz	u_char			*buf;
28255570Strasz	size_t			 size;
29255570Strasz	size_t			 wpos;
30255570Strasz	size_t			 rpos;
31255570Strasz};
32255570Strasz
33255570Straszenum imsg_code {
34255570Strasz	IMSG_NONE,
35255570Strasz	IMSG_SCRIPT_INIT,
36255570Strasz	IMSG_SCRIPT_WRITE_PARAMS,
37255570Strasz	IMSG_SCRIPT_GO,
38255570Strasz	IMSG_SCRIPT_GO_RET,
39255570Strasz	IMSG_SEND_PACKET
40255570Strasz};
41255570Strasz
42255570Straszstruct imsg_hdr {
43255570Strasz	enum imsg_code	code;
44255570Strasz	size_t		len;
45255570Strasz};
46255570Strasz
47255570Straszstruct buf	*buf_open(size_t);
48255570Straszint		 buf_add(struct buf *, void *, size_t);
49255570Straszint		 buf_close(int, struct buf *);
50255570Straszssize_t		 buf_read(int sock, void *, size_t);
51255570Strasz