xref: /openbsd-src/usr.sbin/lpd/proc.h (revision 3b188dab47094e37e38dcd2dcd35528ab7a95e4d)
1*3b188dabSeric /*	$OpenBSD: proc.h,v 1.1.1.1 2018/04/27 16:14:37 eric Exp $	*/
2*3b188dabSeric 
3*3b188dabSeric /*
4*3b188dabSeric  * Copyright (c) 2017 Eric Faurot <eric@openbsd.org>
5*3b188dabSeric  *
6*3b188dabSeric  * Permission to use, copy, modify, and distribute this software for any
7*3b188dabSeric  * purpose with or without fee is hereby granted, provided that the above
8*3b188dabSeric  * copyright notice and this permission notice appear in all copies.
9*3b188dabSeric  *
10*3b188dabSeric  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11*3b188dabSeric  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12*3b188dabSeric  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13*3b188dabSeric  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14*3b188dabSeric  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15*3b188dabSeric  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16*3b188dabSeric  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*3b188dabSeric  */
18*3b188dabSeric 
19*3b188dabSeric struct imsgproc;
20*3b188dabSeric 
21*3b188dabSeric struct imsgproc *proc_bypid(pid_t);
22*3b188dabSeric struct imsgproc *proc_exec(int, char **);
23*3b188dabSeric struct imsgproc *proc_attach(int, int);
24*3b188dabSeric void	         proc_enable(struct imsgproc *);
25*3b188dabSeric void	         proc_free(struct imsgproc *);
26*3b188dabSeric pid_t		 proc_getpid(struct imsgproc *);
27*3b188dabSeric int		 proc_gettype(struct imsgproc *);
28*3b188dabSeric int		 proc_getinstance(struct imsgproc *);
29*3b188dabSeric const char 	*proc_gettitle(struct imsgproc *);
30*3b188dabSeric void		 proc_setpid(struct imsgproc *, pid_t);
31*3b188dabSeric void		 proc_settitle(struct imsgproc *, const char *);
32*3b188dabSeric void		 proc_setinstance(struct imsgproc *, int);
33*3b188dabSeric void		 proc_setcallback(struct imsgproc *,
34*3b188dabSeric     void(*)(struct imsgproc *, struct imsg *, void *), void *);
35*3b188dabSeric 
36*3b188dabSeric void m_compose(struct imsgproc *, uint32_t, uint32_t, pid_t, int, const void *,
37*3b188dabSeric     size_t);
38*3b188dabSeric void m_create(struct imsgproc *, uint32_t, uint32_t, pid_t, int);
39*3b188dabSeric void m_close(struct imsgproc *);
40*3b188dabSeric void m_add(struct imsgproc *, const void *, size_t);
41*3b188dabSeric void m_add_int(struct imsgproc *, int);
42*3b188dabSeric void m_add_u32(struct imsgproc *, uint32_t);
43*3b188dabSeric void m_add_u64(struct imsgproc *, uint64_t);
44*3b188dabSeric void m_add_size(struct imsgproc *, size_t);
45*3b188dabSeric void m_add_time(struct imsgproc *, time_t);
46*3b188dabSeric void m_add_string(struct imsgproc *, const char *);
47*3b188dabSeric void m_add_sockaddr(struct imsgproc *, const struct sockaddr *);
48*3b188dabSeric void m_end(struct imsgproc *);
49*3b188dabSeric int  m_is_eom(struct imsgproc *);
50*3b188dabSeric void m_get(struct imsgproc *, void *, size_t);
51*3b188dabSeric void m_get_int(struct imsgproc *, int *);
52*3b188dabSeric void m_get_u32(struct imsgproc *, uint32_t *);
53*3b188dabSeric void m_get_u64(struct imsgproc *, uint64_t *);
54*3b188dabSeric void m_get_size(struct imsgproc *, size_t *);
55*3b188dabSeric void m_get_time(struct imsgproc *, time_t *);
56*3b188dabSeric void m_get_string(struct imsgproc *, const char **);
57*3b188dabSeric void m_get_sockaddr(struct imsgproc *, struct sockaddr *);
58