xref: /dflybsd-src/contrib/dhcpcd/src/privsep-control.h (revision c80c9bba1b2fa2824af94c686145cb7eb7db2cd5)
17f8103cdSRoy Marples /* SPDX-License-Identifier: BSD-2-Clause */
27f8103cdSRoy Marples /*
37f8103cdSRoy Marples  * Privilege Separation for dhcpcd
4*80aa9461SRoy Marples  * Copyright (c) 2006-2023 Roy Marples <roy@marples.name>
57f8103cdSRoy Marples  * All rights reserved
67f8103cdSRoy Marples 
77f8103cdSRoy Marples  * Redistribution and use in source and binary forms, with or without
87f8103cdSRoy Marples  * modification, are permitted provided that the following conditions
97f8103cdSRoy Marples  * are met:
107f8103cdSRoy Marples  * 1. Redistributions of source code must retain the above copyright
117f8103cdSRoy Marples  *    notice, this list of conditions and the following disclaimer.
127f8103cdSRoy Marples  * 2. Redistributions in binary form must reproduce the above copyright
137f8103cdSRoy Marples  *    notice, this list of conditions and the following disclaimer in the
147f8103cdSRoy Marples  *    documentation and/or other materials provided with the distribution.
157f8103cdSRoy Marples  *
167f8103cdSRoy Marples  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
177f8103cdSRoy Marples  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
187f8103cdSRoy Marples  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
197f8103cdSRoy Marples  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
207f8103cdSRoy Marples  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
217f8103cdSRoy Marples  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
227f8103cdSRoy Marples  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
237f8103cdSRoy Marples  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
247f8103cdSRoy Marples  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
257f8103cdSRoy Marples  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
267f8103cdSRoy Marples  * SUCH DAMAGE.
277f8103cdSRoy Marples  */
287f8103cdSRoy Marples 
297f8103cdSRoy Marples #ifndef PRIVSEP_CTL_H
307f8103cdSRoy Marples #define PRIVSEP_CTL_H
317f8103cdSRoy Marples 
327f8103cdSRoy Marples #define IN_PRIVSEP_CONTROLLER(ctx) \
337f8103cdSRoy Marples     (IN_PRIVSEP((ctx)) && (ctx)->ps_control_pid == getpid())
347f8103cdSRoy Marples 
357f8103cdSRoy Marples pid_t ps_ctl_start(struct dhcpcd_ctx *);
367f8103cdSRoy Marples int ps_ctl_stop(struct dhcpcd_ctx *);
377f8103cdSRoy Marples ssize_t ps_ctl_handleargs(struct fd_list *, char *, size_t);
387f8103cdSRoy Marples ssize_t ps_ctl_sendargs(struct fd_list *, void *, size_t);
397f8103cdSRoy Marples ssize_t ps_ctl_sendeof(struct fd_list *fd);
407f8103cdSRoy Marples 
417f8103cdSRoy Marples #endif
42