xref: /dragonfly/sbin/dhclient/privsep.h (revision 86d7f5d3)
1*86d7f5d3SJohn Marino /*	$OpenBSD: privsep.h,v 1.5 2007/02/13 21:54:22 stevesk Exp $ */
2*86d7f5d3SJohn Marino /*	$DragonFly: src/sbin/dhclient/privsep.h,v 1.1 2008/08/30 16:07:58 hasso Exp $	*/
3*86d7f5d3SJohn Marino 
4*86d7f5d3SJohn Marino /*
5*86d7f5d3SJohn Marino  * Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
6*86d7f5d3SJohn Marino  *
7*86d7f5d3SJohn Marino  * Permission to use, copy, modify, and distribute this software for any
8*86d7f5d3SJohn Marino  * purpose with or without fee is hereby granted, provided that the above
9*86d7f5d3SJohn Marino  * copyright notice and this permission notice appear in all copies.
10*86d7f5d3SJohn Marino  *
11*86d7f5d3SJohn Marino  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12*86d7f5d3SJohn Marino  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13*86d7f5d3SJohn Marino  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14*86d7f5d3SJohn Marino  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15*86d7f5d3SJohn Marino  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
16*86d7f5d3SJohn Marino  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
17*86d7f5d3SJohn Marino  * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE.
18*86d7f5d3SJohn Marino  */
19*86d7f5d3SJohn Marino 
20*86d7f5d3SJohn Marino #include <sys/types.h>
21*86d7f5d3SJohn Marino 
22*86d7f5d3SJohn Marino struct buf {
23*86d7f5d3SJohn Marino 	u_char			*buf;
24*86d7f5d3SJohn Marino 	size_t			 size;
25*86d7f5d3SJohn Marino 	size_t			 wpos;
26*86d7f5d3SJohn Marino 	size_t			 rpos;
27*86d7f5d3SJohn Marino };
28*86d7f5d3SJohn Marino 
29*86d7f5d3SJohn Marino enum imsg_code {
30*86d7f5d3SJohn Marino 	IMSG_NONE,
31*86d7f5d3SJohn Marino 	IMSG_SCRIPT_INIT,
32*86d7f5d3SJohn Marino 	IMSG_SCRIPT_WRITE_PARAMS,
33*86d7f5d3SJohn Marino 	IMSG_SCRIPT_GO,
34*86d7f5d3SJohn Marino 	IMSG_SCRIPT_GO_RET
35*86d7f5d3SJohn Marino };
36*86d7f5d3SJohn Marino 
37*86d7f5d3SJohn Marino struct imsg_hdr {
38*86d7f5d3SJohn Marino 	enum imsg_code	code;
39*86d7f5d3SJohn Marino 	size_t		len;
40*86d7f5d3SJohn Marino };
41*86d7f5d3SJohn Marino 
42*86d7f5d3SJohn Marino struct buf	*buf_open(size_t);
43*86d7f5d3SJohn Marino void		 buf_add(struct buf *, void *, size_t);
44*86d7f5d3SJohn Marino void		 buf_close(int, struct buf *);
45*86d7f5d3SJohn Marino void		 buf_read(int, void *, size_t);
46*86d7f5d3SJohn Marino void		 dispatch_imsg(int);
47