1/* $OpenBSD: isakmp.h,v 1.7 2004/06/20 15:24:05 ho Exp $	 */
2/* $EOM: isakmp.h,v 1.11 2000/07/05 10:48:43 ho Exp $	 */
3
4/*
5 * Copyright (c) 1998 Niklas Hallqvist.  All rights reserved.
6 * Copyright (c) 2004 H�kan Olsson.  All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/*
30 * This code was written under funding by Ericsson Radio Systems.
31 */
32
33#ifndef _ISAKMP_H_
34#define _ISAKMP_H_
35
36#include "isakmp_fld.h"
37#include "isakmp_num.h"
38
39/* IANA assigned port */
40#define UDP_DEFAULT_PORT		500
41#define UDP_DEFAULT_PORT_STR		"500"
42
43#define ISAKMP_DEFAULT_TRANSPORT	"udp"
44
45/* draft-ietf-ipsec-nat-t-ike-07.txt */
46#define UDP_ENCAP_DEFAULT_PORT		4500
47#define UDP_ENCAP_DEFAULT_PORT_STR	"4500"
48
49/* ISAKMP header extras defines */
50#define ISAKMP_HDR_COOKIES_OFF	ISAKMP_HDR_ICOOKIE_OFF
51#define ISAKMP_HDR_COOKIES_LEN	(ISAKMP_HDR_ICOOKIE_LEN \
52				 + ISAKMP_HDR_ICOOKIE_LEN)
53
54/* ISAKMP attribute utilitiy macros.  */
55#define ISAKMP_ATTR_FORMAT(x)		((x) >> 15)
56#define ISAKMP_ATTR_TYPE(x)		((x) & 0x7fff)
57#define ISAKMP_ATTR_MAKE(fmt, type)	(((fmt) << 15) | (type))
58
59/* Version number handling.  */
60#define ISAKMP_VERSION_MAJOR(x)		((x) >> 4)
61#define ISAKMP_VERSION_MINOR(x)		((x) & 0xf)
62#define ISAKMP_VERSION_MAKE(maj, min)	((maj) << 4 | (min))
63
64#endif				/* _ISAKMP_H_ */
65