1 /* $OpenBSD: monitor.h,v 1.17 2005/05/28 18:52:12 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_UI_INIT,
39 	MONITOR_PFKEY_OPEN,
40 	MONITOR_GET_FD,
41 	MONITOR_SETSOCKOPT,
42 	MONITOR_BIND,
43 	MONITOR_REQ_READDIR,
44 	MONITOR_MKFIFO,
45 	MONITOR_INIT_DONE,
46 	MONITOR_SHUTDOWN
47 };
48 
49 pid_t           monitor_init(int);
50 void            monitor_loop(int);
51 
52 int             mm_send_fd(int, int);
53 int             mm_receive_fd(int);
54 
55 FILE           *monitor_fopen(const char *, const char *);
56 int             monitor_open(const char *, int, mode_t);
57 int             monitor_stat(const char *, struct stat *);
58 int             monitor_setsockopt(int, int, int, const void *, socklen_t);
59 int             monitor_bind(int, const struct sockaddr *, socklen_t);
60 int		monitor_req_readdir(const char *);
61 int		monitor_readdir(char *, size_t);
62 void            monitor_init_done(void);
63 
64 void		monitor_ui_init(void);
65 int		monitor_pf_key_v2_open(void);
66 void		monitor_exit(int);
67 
68 #endif				/* _MONITOR_H_ */
69