- fixed bad SVN issues, should all work again now
[strongswan.git] / Source / charon / payloads / ike_header.h
1 /**
2 * @file ike_header.h
3 *
4 * @brief Declaration of the data struct ike_header_t.
5 *
6 * The data of a parsed header are stored in a struct of this type.
7 *
8 */
9
10 /*
11 * Copyright (C) 2005 Jan Hutter, Martin Willi
12 * Hochschule fuer Technik Rapperswil
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
23 */
24
25 #ifndef IKE_HEADER_H_
26 #define IKE_HEADER_H_
27
28 #include "../types.h"
29 #include "payload.h"
30
31 /**
32 * Data structure to hold the data of an IKEv2-Header
33 *
34 * The header format of an IKEv2-Message is compatible to the
35 * ISAKMP-Header format to allow implementations supporting
36 * both versions of the IKE-protocol.
37 *
38 */
39 typedef struct ike_header_s ike_header_t;
40
41 struct ike_header_s {
42 /**
43 * implements payload_t interface
44 */
45 payload_t payload_interface;
46 /**
47 * SPI of the initiator
48 */
49 u_int64_t initiator_spi;
50 /**
51 * SPI of the responder
52 */
53 u_int64_t responder_spi;
54 /**
55 * next payload type
56 */
57 u_int8_t next_payload;
58 /**
59 * IKE major version
60 */
61 u_int8_t maj_version;
62
63 /**
64 * IKE minor version
65 */
66 u_int8_t min_version;
67
68 /**
69 * Exchange type
70 */
71 u_int8_t exchange_type;
72
73 /**
74 * Flags of the Message
75 *
76 */
77 struct {
78 /**
79 * Sender is initiator of the associated IKE_SA_INIT-Exchange
80 */
81 bool initiator;
82 /**
83 * is protocol supporting higher version?
84 */
85 bool version;
86 /**
87 * TRUE, if this is a response, FALSE if its a Request
88 */
89 bool response;
90 } flags;
91 /**
92 * Associated Message-ID
93 */
94 u_int32_t message_id;
95 /**
96 * Length of the whole IKEv2-Message (header and all payloads)
97 */
98 u_int32_t length;
99 };
100
101 /**
102 * @brief Create an empty ike_header
103 *
104 * @return
105 * - created ike_header, or
106 * - NULL if failed
107 */
108
109 ike_header_t *create_ike_header();
110
111 #endif /*IKE_HEADER_H_*/