Deparsing engines (Deparsers) are used for manipulating packets. They cannot read directly from the packet data bus but they can write to the packet datapath to insert, replace, or remove data from packets. Deparsers typically have metadata input containing data to be written into packets.
Deparsers manipulate packet data contents. This includes:
- Header field modification
- Header removal
- Header insertion
Deparsers support the following interfaces:
- Packet data input and output
- Standard metadata out
- User-defined metadata in
Deparsers only modify packet data and do not read nor parse it. Deparsers do not support the following features:
- Implicit re-ordering of headers, by re-ordering the headers as they are emitted in the Deparsers section of the P4 program
- Implicit duplication of headers, by multiple emit statements in the deparser section of the P4 program
- Conditional deparsing with 'if' statements
An example of a simple deparsing engine is provided in: Sample P416 Program.