summaryrefslogtreecommitdiff
path: root/usr.sbin/lpd/proc.h
blob: 12648c5d427e6630b0bbdaf2d011772647032706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*	$OpenBSD: proc.h,v 1.1.1.1 2018/04/27 16:14:37 eric Exp $	*/

/*
 * Copyright (c) 2017 Eric Faurot <eric@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

struct imsgproc;

struct imsgproc *proc_bypid(pid_t);
struct imsgproc *proc_exec(int, char **);
struct imsgproc *proc_attach(int, int);
void	         proc_enable(struct imsgproc *);
void	         proc_free(struct imsgproc *);
pid_t		 proc_getpid(struct imsgproc *);
int		 proc_gettype(struct imsgproc *);
int		 proc_getinstance(struct imsgproc *);
const char 	*proc_gettitle(struct imsgproc *);
void		 proc_setpid(struct imsgproc *, pid_t);
void		 proc_settitle(struct imsgproc *, const char *);
void		 proc_setinstance(struct imsgproc *, int);
void		 proc_setcallback(struct imsgproc *,
    void(*)(struct imsgproc *, struct imsg *, void *), void *);

void m_compose(struct imsgproc *, uint32_t, uint32_t, pid_t, int, const void *,
    size_t);
void m_create(struct imsgproc *, uint32_t, uint32_t, pid_t, int);
void m_close(struct imsgproc *);
void m_add(struct imsgproc *, const void *, size_t);
void m_add_int(struct imsgproc *, int);
void m_add_u32(struct imsgproc *, uint32_t);
void m_add_u64(struct imsgproc *, uint64_t);
void m_add_size(struct imsgproc *, size_t);
void m_add_time(struct imsgproc *, time_t);
void m_add_string(struct imsgproc *, const char *);
void m_add_sockaddr(struct imsgproc *, const struct sockaddr *);
void m_end(struct imsgproc *);
int  m_is_eom(struct imsgproc *);
void m_get(struct imsgproc *, void *, size_t);
void m_get_int(struct imsgproc *, int *);
void m_get_u32(struct imsgproc *, uint32_t *);
void m_get_u64(struct imsgproc *, uint64_t *);
void m_get_size(struct imsgproc *, size_t *);
void m_get_time(struct imsgproc *, time_t *);
void m_get_string(struct imsgproc *, const char **);
void m_get_sockaddr(struct imsgproc *, struct sockaddr *);