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