xref: /netbsd-src/external/bsd/dhcpcd/dist/src/privsep-inet.h (revision 794dfa7744c76b94d06f96c66c5309dbba49b631)
19a245d3eSroy /* SPDX-License-Identifier: BSD-2-Clause */
29a245d3eSroy /*
39a245d3eSroy  * Privilege Separation for dhcpcd
4*794dfa77Sroy  * Copyright (c) 2006-2023 Roy Marples <roy@marples.name>
59a245d3eSroy  * All rights reserved
69a245d3eSroy 
79a245d3eSroy  * Redistribution and use in source and binary forms, with or without
89a245d3eSroy  * modification, are permitted provided that the following conditions
99a245d3eSroy  * are met:
109a245d3eSroy  * 1. Redistributions of source code must retain the above copyright
119a245d3eSroy  *    notice, this list of conditions and the following disclaimer.
129a245d3eSroy  * 2. Redistributions in binary form must reproduce the above copyright
139a245d3eSroy  *    notice, this list of conditions and the following disclaimer in the
149a245d3eSroy  *    documentation and/or other materials provided with the distribution.
159a245d3eSroy  *
169a245d3eSroy  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
179a245d3eSroy  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189a245d3eSroy  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199a245d3eSroy  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
209a245d3eSroy  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219a245d3eSroy  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229a245d3eSroy  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239a245d3eSroy  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249a245d3eSroy  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259a245d3eSroy  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269a245d3eSroy  * SUCH DAMAGE.
279a245d3eSroy  */
289a245d3eSroy 
299a245d3eSroy #ifndef PRIVSEP_INET_H
309a245d3eSroy #define PRIVSEP_INET_H
319a245d3eSroy 
32597ffba2Sroy bool ps_inet_canstart(const struct dhcpcd_ctx *);
339a245d3eSroy pid_t ps_inet_start(struct dhcpcd_ctx *);
349a245d3eSroy int ps_inet_stop(struct dhcpcd_ctx *);
359a245d3eSroy ssize_t ps_inet_cmd(struct dhcpcd_ctx *, struct ps_msghdr *, struct msghdr *);
369a245d3eSroy ssize_t ps_inet_dispatch(void *, struct ps_msghdr *, struct msghdr *);
379a245d3eSroy 
389a245d3eSroy #ifdef INET
399a245d3eSroy struct ipv4_addr;
409a245d3eSroy ssize_t ps_inet_openbootp(struct ipv4_addr *);
419a245d3eSroy ssize_t ps_inet_closebootp(struct ipv4_addr *);
427c187152Sroy ssize_t ps_inet_sendbootp(struct interface *, const struct msghdr *);
439a245d3eSroy #endif
449a245d3eSroy 
459a245d3eSroy #ifdef INET6
469a245d3eSroy struct ipv6_addr;
479a245d3eSroy #ifdef __sun
489a245d3eSroy ssize_t ps_inet_opennd(struct interface *);
499a245d3eSroy ssize_t ps_inet_closend(struct interface *);
509a245d3eSroy #endif
519a245d3eSroy ssize_t ps_inet_sendnd(struct interface *, const struct msghdr *);
529a245d3eSroy #ifdef DHCP6
539a245d3eSroy ssize_t ps_inet_opendhcp6(struct ipv6_addr *);
549a245d3eSroy ssize_t ps_inet_closedhcp6(struct ipv6_addr *);
557c187152Sroy ssize_t ps_inet_senddhcp6(struct interface *, const struct msghdr *);
569a245d3eSroy #endif /* DHCP6 */
579a245d3eSroy #endif /* INET6 */
589a245d3eSroy #endif
59