]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - sbin/dhclient/privsep.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / sbin / dhclient / privsep.h
1 /*      $OpenBSD: privsep.h,v 1.2 2004/05/04 18:51:18 henning Exp $ */
2
3 /*
4  * Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
15  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
16  * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE.
17  *
18  * $FreeBSD$
19  */
20
21 #include <sys/types.h>
22
23 #include <poll.h>
24 #include <pwd.h>
25
26 struct buf {
27         u_char                  *buf;
28         size_t                   size;
29         size_t                   wpos;
30         size_t                   rpos;
31 };
32
33 enum imsg_code {
34         IMSG_NONE,
35         IMSG_SCRIPT_INIT,
36         IMSG_SCRIPT_WRITE_PARAMS,
37         IMSG_SCRIPT_GO,
38         IMSG_SCRIPT_GO_RET,
39         IMSG_SEND_PACKET
40 };
41
42 struct imsg_hdr {
43         enum imsg_code  code;
44         size_t          len;
45 };
46
47 struct buf      *buf_open(size_t);
48 int              buf_add(struct buf *, void *, size_t);
49 int              buf_close(int, struct buf *);
50 ssize_t          buf_read(int sock, void *, size_t);