1*cd6bf844Sho /* $OpenBSD: isakmp.h,v 1.7 2004/06/20 15:24:05 ho Exp $ */ 29c1b9974Sniklas /* $EOM: isakmp.h,v 1.11 2000/07/05 10:48:43 ho Exp $ */ 32040585eSniklas 42040585eSniklas /* 52040585eSniklas * Copyright (c) 1998 Niklas Hallqvist. All rights reserved. 6*cd6bf844Sho * Copyright (c) 2004 H�kan Olsson. All rights reserved. 72040585eSniklas * 82040585eSniklas * Redistribution and use in source and binary forms, with or without 92040585eSniklas * modification, are permitted provided that the following conditions 102040585eSniklas * are met: 112040585eSniklas * 1. Redistributions of source code must retain the above copyright 122040585eSniklas * notice, this list of conditions and the following disclaimer. 132040585eSniklas * 2. Redistributions in binary form must reproduce the above copyright 142040585eSniklas * notice, this list of conditions and the following disclaimer in the 152040585eSniklas * documentation and/or other materials provided with the distribution. 162040585eSniklas * 172040585eSniklas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 182040585eSniklas * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 192040585eSniklas * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 202040585eSniklas * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 212040585eSniklas * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 222040585eSniklas * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232040585eSniklas * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242040585eSniklas * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252040585eSniklas * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 262040585eSniklas * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272040585eSniklas */ 282040585eSniklas 292040585eSniklas /* 302040585eSniklas * This code was written under funding by Ericsson Radio Systems. 312040585eSniklas */ 322040585eSniklas 332040585eSniklas #ifndef _ISAKMP_H_ 342040585eSniklas #define _ISAKMP_H_ 352040585eSniklas 362040585eSniklas #include "isakmp_fld.h" 372040585eSniklas #include "isakmp_num.h" 382040585eSniklas 392040585eSniklas /* IANA assigned port */ 402040585eSniklas #define UDP_DEFAULT_PORT 500 41*cd6bf844Sho #define UDP_DEFAULT_PORT_STR "500" 42*cd6bf844Sho 43*cd6bf844Sho #define ISAKMP_DEFAULT_TRANSPORT "udp" 44*cd6bf844Sho 45*cd6bf844Sho /* draft-ietf-ipsec-nat-t-ike-07.txt */ 46*cd6bf844Sho #define UDP_ENCAP_DEFAULT_PORT 4500 47*cd6bf844Sho #define UDP_ENCAP_DEFAULT_PORT_STR "4500" 482040585eSniklas 492040585eSniklas /* ISAKMP header extras defines */ 502040585eSniklas #define ISAKMP_HDR_COOKIES_OFF ISAKMP_HDR_ICOOKIE_OFF 512040585eSniklas #define ISAKMP_HDR_COOKIES_LEN (ISAKMP_HDR_ICOOKIE_LEN \ 522040585eSniklas + ISAKMP_HDR_ICOOKIE_LEN) 532040585eSniklas 542040585eSniklas /* ISAKMP attribute utilitiy macros. */ 552040585eSniklas #define ISAKMP_ATTR_FORMAT(x) ((x) >> 15) 562040585eSniklas #define ISAKMP_ATTR_TYPE(x) ((x) & 0x7fff) 572040585eSniklas #define ISAKMP_ATTR_MAKE(fmt, type) (((fmt) << 15) | (type)) 582040585eSniklas 592040585eSniklas /* Version number handling. */ 602040585eSniklas #define ISAKMP_VERSION_MAJOR(x) ((x) >> 4) 612040585eSniklas #define ISAKMP_VERSION_MINOR(x) ((x) & 0xf) 622040585eSniklas #define ISAKMP_VERSION_MAKE(maj, min) ((maj) << 4 | (min)) 632040585eSniklas 642040585eSniklas #endif /* _ISAKMP_H_ */ 65