2 * Copyright (c) 2005 Andrey Simonenko
3 * Copyright (c) 2016 Maksym Sobolyev <sobomax@FreeBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 const char *sock_type_str;
34 const char *proc_name;
39 struct sockaddr_un serv_addr_sun;
58 extern struct uc_cfg uc_cfg;
60 int uc_check_msghdr(const struct msghdr *msghdr, size_t size);
61 int uc_check_cmsghdr(const struct cmsghdr *cmsghdr, int type, size_t size);
62 void uc_output(const char *format, ...) __printflike(1, 2);
63 void uc_logmsgx(const char *format, ...) __printflike(1, 2);
64 void uc_dbgmsg(const char *format, ...) __printflike(1, 2);
65 void uc_logmsg(const char *format, ...) __printflike(1, 2);
66 void uc_vlogmsgx(const char *format, va_list ap);
67 int uc_message_recv(int fd, struct msghdr *msghdr);
68 int uc_message_send(int fd, const struct msghdr *msghdr);
69 int uc_message_sendn(int fd, struct msghdr *msghdr);
70 void uc_msghdr_init_server(struct msghdr *msghdr, struct iovec *iov,
71 void *cmsg_data, size_t cmsg_size);
72 void uc_msghdr_init_client(struct msghdr *msghdr, struct iovec *iov,
73 void *cmsg_data, size_t cmsg_size, int type, size_t arr_size);
74 int uc_socket_create(void);
75 int uc_socket_accept(int listenfd);
76 int uc_socket_close(int fd);
77 int uc_socket_connect(int fd);
78 int uc_sync_recv(void);
79 int uc_sync_send(void);
80 int uc_client_fork(void);
81 void uc_client_exit(int rv);
82 int uc_client_wait(void);
83 int uc_check_groups(const char *gid_arr_str, const gid_t *gid_arr,
84 const char *gid_num_str, int gid_num, bool all_gids);
85 int uc_check_scm_creds_cmsgcred(struct cmsghdr *cmsghdr);
86 int uc_check_scm_creds_sockcred(struct cmsghdr *cmsghdr);