xref: /openbsd/usr.sbin/lpd/proc.h (revision 09467b48)
1 /*	$OpenBSD: proc.h,v 1.1.1.1 2018/04/27 16:14:37 eric Exp $	*/
2 
3 /*
4  * Copyright (c) 2017 Eric Faurot <eric@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 USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 struct imsgproc;
20 
21 struct imsgproc *proc_bypid(pid_t);
22 struct imsgproc *proc_exec(int, char **);
23 struct imsgproc *proc_attach(int, int);
24 void	         proc_enable(struct imsgproc *);
25 void	         proc_free(struct imsgproc *);
26 pid_t		 proc_getpid(struct imsgproc *);
27 int		 proc_gettype(struct imsgproc *);
28 int		 proc_getinstance(struct imsgproc *);
29 const char 	*proc_gettitle(struct imsgproc *);
30 void		 proc_setpid(struct imsgproc *, pid_t);
31 void		 proc_settitle(struct imsgproc *, const char *);
32 void		 proc_setinstance(struct imsgproc *, int);
33 void		 proc_setcallback(struct imsgproc *,
34     void(*)(struct imsgproc *, struct imsg *, void *), void *);
35 
36 void m_compose(struct imsgproc *, uint32_t, uint32_t, pid_t, int, const void *,
37     size_t);
38 void m_create(struct imsgproc *, uint32_t, uint32_t, pid_t, int);
39 void m_close(struct imsgproc *);
40 void m_add(struct imsgproc *, const void *, size_t);
41 void m_add_int(struct imsgproc *, int);
42 void m_add_u32(struct imsgproc *, uint32_t);
43 void m_add_u64(struct imsgproc *, uint64_t);
44 void m_add_size(struct imsgproc *, size_t);
45 void m_add_time(struct imsgproc *, time_t);
46 void m_add_string(struct imsgproc *, const char *);
47 void m_add_sockaddr(struct imsgproc *, const struct sockaddr *);
48 void m_end(struct imsgproc *);
49 int  m_is_eom(struct imsgproc *);
50 void m_get(struct imsgproc *, void *, size_t);
51 void m_get_int(struct imsgproc *, int *);
52 void m_get_u32(struct imsgproc *, uint32_t *);
53 void m_get_u64(struct imsgproc *, uint64_t *);
54 void m_get_size(struct imsgproc *, size_t *);
55 void m_get_time(struct imsgproc *, time_t *);
56 void m_get_string(struct imsgproc *, const char **);
57 void m_get_sockaddr(struct imsgproc *, struct sockaddr *);
58