• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*	$NetBSD: isakmp_var.h,v 1.6.6.1 2007/02/20 09:08:49 vanhu Exp $	*/
2 
3 /* Id: isakmp_var.h,v 1.12 2005/05/07 14:45:31 manubsd Exp */
4 
5 /*
6  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. Neither the name of the project nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33 
34 #ifndef _ISAKMP_VAR_H
35 #define _ISAKMP_VAR_H
36 
37 #include "vmbuf.h"
38 
39 #define PORT_ISAKMP 500
40 #define PORT_ISAKMP_NATT 4500
41 
42 #define DEFAULT_NONCE_SIZE	16
43 
44 typedef u_char cookie_t[8];
45 typedef u_char msgid_t[4];
46 
47 typedef struct { /* i_cookie + r_cookie */
48 	cookie_t i_ck;
49 	cookie_t r_ck;
50 } isakmp_index;
51 
52 struct isakmp_gen;
53 struct sched;
54 
55 struct sockaddr;
56 struct ph1handle;
57 struct ph2handle;
58 struct remoteconf;
59 struct isakmp_gen;
60 struct ipsecdoi_pl_id;	/* XXX */
61 struct isakmp_pl_ke;	/* XXX */
62 struct isakmp_pl_nonce;	/* XXX */
63 
64 extern int isakmp_handler __P((int));
65 extern int isakmp_ph1begin_i __P((struct remoteconf *, struct sockaddr *,
66 	struct sockaddr *));
67 
68 extern vchar_t *isakmp_parsewoh __P((int, struct isakmp_gen *, int));
69 extern vchar_t *isakmp_parse __P((vchar_t *));
70 
71 extern int isakmp_init __P((void));
72 extern const char *isakmp_pindex __P((const isakmp_index *, const u_int32_t));
73 extern int isakmp_open __P((void));
74 extern void isakmp_close __P((void));
75 extern int isakmp_send __P((struct ph1handle *, vchar_t *));
76 
77 extern void isakmp_ph1resend_stub __P((void *));
78 extern int isakmp_ph1resend __P((struct ph1handle *));
79 extern void isakmp_ph2resend_stub __P((void *));
80 extern int isakmp_ph2resend __P((struct ph2handle *));
81 extern void isakmp_ph1expire_stub __P((void *));
82 extern void isakmp_ph1expire __P((struct ph1handle *));
83 extern void isakmp_ph1delete_stub __P((void *));
84 extern void isakmp_ph1delete __P((struct ph1handle *));
85 extern void isakmp_ph2expire_stub __P((void *));
86 extern void isakmp_ph2expire __P((struct ph2handle *));
87 extern void isakmp_ph2delete_stub __P((void *));
88 extern void isakmp_ph2delete __P((struct ph2handle *));
89 
90 extern int isakmp_post_acquire __P((struct ph2handle *));
91 extern int isakmp_post_getspi __P((struct ph2handle *));
92 extern void isakmp_chkph1there_stub __P((void *));
93 extern void isakmp_chkph1there __P((struct ph2handle *));
94 
95 extern caddr_t isakmp_set_attr_v __P((caddr_t, int, caddr_t, int));
96 extern caddr_t isakmp_set_attr_l __P((caddr_t, int, u_int32_t));
97 extern vchar_t *isakmp_add_attr_v __P((vchar_t *, int, caddr_t, int));
98 extern vchar_t *isakmp_add_attr_l __P((vchar_t *, int, u_int32_t));
99 
100 extern int isakmp_newcookie __P((caddr_t, struct sockaddr *, struct sockaddr *));
101 
102 extern int isakmp_p2ph __P((vchar_t **, struct isakmp_gen *));
103 
104 extern u_int32_t isakmp_newmsgid2 __P((struct ph1handle *));
105 extern caddr_t set_isakmp_header1 __P((vchar_t *, struct ph1handle *, int));
106 extern caddr_t set_isakmp_header2 __P((vchar_t *, struct ph2handle *, int));
107 extern caddr_t set_isakmp_payload __P((caddr_t, vchar_t *, int));
108 
109 extern struct payload_list *isakmp_plist_append __P((struct payload_list *plist,
110 	vchar_t *payload, int payload_type));
111 extern vchar_t *isakmp_plist_set_all __P((struct payload_list **plist,
112 	struct ph1handle *iph1));
113 
114 #ifdef HAVE_PRINT_ISAKMP_C
115 extern void isakmp_printpacket __P((vchar_t *, struct sockaddr *,
116 	struct sockaddr *, int));
117 #endif
118 
119 extern int copy_ph1addresses __P(( struct ph1handle *,
120 	struct remoteconf *, struct sockaddr *, struct sockaddr *));
121 extern void log_ph1established __P((const struct ph1handle *));
122 
123 extern void script_hook __P((struct ph1handle *, int));
124 extern int script_env_append __P((char ***, int *, char *, char *));
125 extern int script_exec __P((char *, int, char * const *));
126 
127 void purge_remote __P((struct ph1handle *));
128 void delete_spd __P((struct ph2handle *, u_int64_t));
129 #ifdef INET6
130 u_int32_t setscopeid __P((struct sockaddr *, struct sockaddr *));
131 #endif
132 #endif /* _ISAKMP_VAR_H */
133