1 /* $NetBSD: evt.h,v 1.6 2008/08/29 00:31:00 gmcgarry Exp $ */
3 /* Id: evt.h,v 1.5 2006/01/19 10:24:09 fredsen Exp */
6 * Copyright (C) 2004 Emmanuel Dreyfus
7 * Copyright (C) 2008 Timo Teras
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the project nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * Old style (deprecated) events which are polled.
44 struct sockaddr_storage src
;
45 struct sockaddr_storage dst
;
49 * Optionnal list of struct isakmp_data
50 * for type EVTT_ISAKMP_CFG_DONE
56 #define EVTT_PHASE1_UP 1
57 #define EVTT_PHASE1_DOWN 2
58 #define EVTT_XAUTH_SUCCESS 3
59 #define EVTT_ISAKMP_CFG_DONE 4
60 #define EVTT_PHASE2_UP 5
61 #define EVTT_PHASE2_DOWN 6
62 #define EVTT_DPD_TIMEOUT 7
63 #define EVTT_PEER_NO_RESPONSE 8
64 #define EVTT_PEER_DELETE 9
65 #define EVTT_RACOON_QUIT 10
66 #define EVTT_XAUTH_FAILED 11
67 #define EVTT_OVERFLOW 12 /* Event queue overflowed */
68 #define EVTT_PEERPH1AUTH_FAILED 13
69 #define EVTT_PEERPH1_NOPROP 14 /* NO_PROPOSAL_CHOSEN & friends */
70 #define EVTT_NO_ISAKMP_CFG 15 /* no need to wait for mode_cfg */
73 * New style, asynchronous events.
80 struct sockaddr_storage ec_ph1src
;
81 struct sockaddr_storage ec_ph1dst
;
82 u_int32_t ec_ph2msgid
;
85 * Optionnal list of struct isakmp_data
86 * for type EVTT_ISAKMP_CFG_DONE
91 #define EVT_RACOON_QUIT 0x0001
93 #define EVT_PHASE1_UP 0x0100
94 #define EVT_PHASE1_DOWN 0x0101
95 #define EVT_PHASE1_NO_RESPONSE 0x0102
96 #define EVT_PHASE1_NO_PROPOSAL 0x0103
97 #define EVT_PHASE1_AUTH_FAILED 0x0104
98 #define EVT_PHASE1_DPD_TIMEOUT 0x0105
99 #define EVT_PHASE1_PEER_DELETED 0x0106
100 #define EVT_PHASE1_MODE_CFG 0x0107
101 #define EVT_PHASE1_XAUTH_SUCCESS 0x0108
102 #define EVT_PHASE1_XAUTH_FAILED 0x0109
104 #define EVT_PHASE2_NO_PHASE1 0x0200
105 #define EVT_PHASE2_UP 0x0201
106 #define EVT_PHASE2_DOWN 0x0202
107 #define EVT_PHASE2_NO_RESPONSE 0x0203
109 #ifdef ENABLE_ADMINPORT
114 struct evt_listener
{
115 LIST_ENTRY(evt_listener
) ll_chain
;
118 LIST_HEAD(evt_listener_list
, evt_listener
);
119 #define EVT_LISTENER_LIST(x) struct evt_listener_list x
121 void evt_generic
__P((int type
, vchar_t
*optdata
));
122 void evt_phase1
__P((const struct ph1handle
*ph1
, int type
, vchar_t
*optdata
));
123 void evt_phase2
__P((const struct ph2handle
*ph2
, int type
, vchar_t
*optdata
));
124 vchar_t
*evt_dump
__P((void));
126 int evt_subscribe
__P((struct evt_listener_list
*list
, int fd
));
127 void evt_list_init
__P((struct evt_listener_list
*list
));
128 void evt_list_cleanup
__P((struct evt_listener_list
*list
));
132 #define EVT_LISTENER_LIST(x)
134 #define evt_generic(type, optdata) ;
135 #define evt_phase1(ph1, type, optdata) ;
136 #define evt_phase2(ph2, type, optdata) ;
138 #define evt_subscribe(eventlist, fd) ;
139 #define evt_list_init(eventlist) ;
140 #define evt_list_cleanup(eventlist) ;
141 #define evt_get_fdmask(nfds, fdset) nfds
142 #define evt_handle_fdmask(fdset) ;
144 #endif /* ENABLE_ADMINPORT */