xref: /openbsd/sbin/isakmpd/monitor.h (revision 37e8f898)
1 /* $OpenBSD: monitor.h,v 1.19 2008/12/22 14:30:04 hshoexer Exp $	 */
2 
3 /*
4  * Copyright (c) 2003 H�kan Olsson.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
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.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #ifndef _MONITOR_H_
28 #define _MONITOR_H_
29 
30 #include <sys/types.h>
31 #include <sys/stat.h>
32 
33 #define ISAKMPD_PRIVSEP_USER "_isakmpd"
34 
35 #define ISAKMP_PORT_DEFAULT	500
36 
37 enum monitor_reqtypes {
38 	MONITOR_PFKEY_OPEN,
39 	MONITOR_GET_FD,
40 	MONITOR_SETSOCKOPT,
41 	MONITOR_BIND,
42 	MONITOR_REQ_READDIR,
43 	MONITOR_MKFIFO,
44 	MONITOR_INIT_DONE,
45 	MONITOR_SHUTDOWN
46 };
47 
48 pid_t           monitor_init(int);
49 void            monitor_loop(int);
50 
51 int             mm_send_fd(int, int);
52 int             mm_receive_fd(int);
53 
54 FILE           *monitor_fopen(const char *, const char *);
55 int             monitor_open(const char *, int, mode_t);
56 int             monitor_stat(const char *, struct stat *);
57 int             monitor_setsockopt(int, int, int, const void *, socklen_t);
58 int             monitor_bind(int, const struct sockaddr *, socklen_t);
59 int		monitor_req_readdir(const char *);
60 int		monitor_readdir(char *, size_t);
61 void            monitor_init_done(void);
62 
63 int		monitor_pf_key_v2_open(void);
64 void		monitor_exit(int) __dead;
65 
66 #endif				/* _MONITOR_H_ */
67