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
//! OpenFlow Switch Protocol (ONF OpenFlow v1.0–v1.5) Layer 3 wire builder.
//!
//! Serializes an [`OpenflowSpec`] into an 8-byte `ofp_header` (plus optional message body octets)
//! carried over TCP destination port `6653`. The header writes the 8-bit `version` (`VERSION`,
//! default `4` for OpenFlow 1.3), 8-bit `type` (`0` `HELLO`, `2` `ECHO_REQ`, `3` `ECHO_REPLY`,
//! `5` `FEATURES_REQ`, `6` `FEATURES_REPLY`, `10` `PACKET_IN`, `13` `PACKET_OUT`, `14` `FLOW_MOD`),
//! 16-bit big-endian total `length` (`8 + payload.len()`), and 32-bit big-endian transaction ID (`XID`).
//!
//! Canonical `.fasm` syntax:
//! `a -> b OPENFLOW [HELLO | ECHO_REQ | ECHO_REPLY | FEATURES_REQ | FEATURES_REPLY | PACKET_IN | PACKET_OUT | FLOW_MOD] [VERSION <u8>] [XID <u32>] [DPID <u64>] [TABLE_ID <u8>] [PRIORITY <u16>]`
use crate*;
use Vec;
/// Builds an ONF OpenFlow protocol payload and returns `(bytes, 6653)` for TCP encapsulation.