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