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
//! Generic Routing Encapsulation (GRE, RFC 2784 / RFC 2890) Layer 3 wire builder.
//!
//! Serializes a [`GreSpec`] into an RFC 2784 and RFC 2890 compliant GRE tunnel header encapsulated
//! directly over IPv4 or IPv6 using IP protocol number `47` (`0x2F`). The builder dynamically sets
//! the 16-bit GRE Flags word (`0x8000` Checksum Present `C` bit when `CHECKSUM` is specified,
//! `0x2000` Key Present `K` bit when `GRE_KEY` is present, and `0x1000` Sequence Number Present `S`
//! bit when `GRE_SEQ` is present), appends the 16-bit EtherType `Protocol Type` (`GRE_PROTO`,
//! default `0x0800`), optional 32-bit Checksum/Reserved, Key, and Sequence words, and the inner packet.
//!
//! Canonical `.fasm` syntax:
//! `a -> b GRE [GRE_KEY <u32>] [GRE_SEQ <u32>] [GRE_PROTO <u16>] [CHECKSUM] [PAYLOAD "<str>" | HEXPAYLOAD "<hex>"]`
use crate*;
use crateWireContext;
use Vec;
/// Builds an RFC 2784 / RFC 2890 GRE tunnel payload and returns `(bytes, 47)` for IP encapsulation.