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
//! Internet Key Exchange Protocol Version 2 (IKEv2, RFC 7296) Layer 3 wire builder.
//!
//! Serializes an [`Ikev2Spec`] into a 28-byte RFC 7296 IKEv2 header (plus optional payload octets)
//! encapsulated over UDP destination port `500`. The wire builder writes the 64-bit big-endian
//! `Initiator SPI` (`INITIATOR_SPI`, default `0x0102030405060708`), 64-bit big-endian `Responder SPI`
//! (`RESPONDER_SPI`, default `0`), 8-bit `Next Payload` (`NEXT_HEADER`, default `0`), Version byte
//! `0x20` (v2.0), 8-bit `Exchange Type` (`34` `SA_INIT`, `35` `AUTH`, `36` `CREATE_CHILD_SA`, `37`
//! `INFORMATIONAL`), 8-bit `Flags` (`0x08` Initiator), 32-bit `Message ID` (`MSGID`), and 32-bit `Length`.
//!
//! Canonical `.fasm` syntax:
//! `a -> b IKEV2 [EXCHANGE <SA_INIT|AUTH|CREATE_CHILD_SA|INFORMATIONAL>] [INITIATOR_SPI <u64>] [RESPONDER_SPI <u64>] [MSGID <u32>] [FLAGS <u8>] [NEXT_HEADER <u8>]`
use crate*;
use Vec;
/// Builds an RFC 7296 IKEv2 payload and returns `(bytes, 500)` for UDP encapsulation.