xref: /openbsd-src/sbin/isakmpd/monitor.h (revision 37e8f898397342566fd84772aa0c04b66381eb7b)
1*37e8f898Shshoexer /* $OpenBSD: monitor.h,v 1.19 2008/12/22 14:30:04 hshoexer Exp $	 */
2da35d433Sho 
3da35d433Sho /*
4da35d433Sho  * Copyright (c) 2003 H�kan Olsson.  All rights reserved.
5da35d433Sho  *
6da35d433Sho  * Redistribution and use in source and binary forms, with or without
7da35d433Sho  * modification, are permitted provided that the following conditions
8da35d433Sho  * are met:
9da35d433Sho  * 1. Redistributions of source code must retain the above copyright
10da35d433Sho  *    notice, this list of conditions and the following disclaimer.
11da35d433Sho  * 2. Redistributions in binary form must reproduce the above copyright
12da35d433Sho  *    notice, this list of conditions and the following disclaimer in the
13da35d433Sho  *    documentation and/or other materials provided with the distribution.
14da35d433Sho  *
15da35d433Sho  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16da35d433Sho  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17da35d433Sho  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18da35d433Sho  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19da35d433Sho  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20da35d433Sho  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21da35d433Sho  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22da35d433Sho  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23da35d433Sho  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24da35d433Sho  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25da35d433Sho  */
26da35d433Sho 
2731516eecShshoexer #ifndef _MONITOR_H_
2831516eecShshoexer #define _MONITOR_H_
2931516eecShshoexer 
3031516eecShshoexer #include <sys/types.h>
3131516eecShshoexer #include <sys/stat.h>
3231516eecShshoexer 
33da35d433Sho #define ISAKMPD_PRIVSEP_USER "_isakmpd"
34da35d433Sho 
3531516eecShshoexer #define ISAKMP_PORT_DEFAULT	500
3631516eecShshoexer 
37fb9475d6Sderaadt enum monitor_reqtypes {
381ec19420Shshoexer 	MONITOR_PFKEY_OPEN,
39da35d433Sho 	MONITOR_GET_FD,
40da35d433Sho 	MONITOR_SETSOCKOPT,
41da35d433Sho 	MONITOR_BIND,
4277033115Smoritz 	MONITOR_REQ_READDIR,
43da35d433Sho 	MONITOR_MKFIFO,
4431516eecShshoexer 	MONITOR_INIT_DONE,
4531516eecShshoexer 	MONITOR_SHUTDOWN
4631516eecShshoexer };
4731516eecShshoexer 
48db6e54dbSho pid_t           monitor_init(int);
49da35d433Sho void            monitor_loop(int);
50da35d433Sho 
5131647fcaSho int             mm_send_fd(int, int);
52da35d433Sho int             mm_receive_fd(int);
53da35d433Sho 
54da35d433Sho FILE           *monitor_fopen(const char *, const char *);
55da35d433Sho int             monitor_open(const char *, int, mode_t);
56da35d433Sho int             monitor_stat(const char *, struct stat *);
57da35d433Sho int             monitor_setsockopt(int, int, int, const void *, socklen_t);
58da35d433Sho int             monitor_bind(int, const struct sockaddr *, socklen_t);
5977033115Smoritz int		monitor_req_readdir(const char *);
6077033115Smoritz int		monitor_readdir(char *, size_t);
6131516eecShshoexer void            monitor_init_done(void);
62ea1948caSho 
631ec19420Shshoexer int		monitor_pf_key_v2_open(void);
64*37e8f898Shshoexer void		monitor_exit(int) __dead;
65b09056b7Shshoexer 
6631516eecShshoexer #endif				/* _MONITOR_H_ */
67