You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.4 KiB
61 lines
1.4 KiB
/* -*- P4_16 -*- */ |
|
#include <core.p4> |
|
#include <v1model.p4> |
|
|
|
#include "headers.p4" |
|
|
|
parser MyParser(packet_in packet, |
|
out headers hdr, |
|
inout metadata meta, |
|
inout standard_metadata_t standard_metadata) { |
|
|
|
#include "parsers.p4" |
|
} |
|
|
|
control MyDeparser(packet_out packet, in headers hdr) { |
|
#include "deparser.p4" |
|
} |
|
|
|
control MyIngress(inout headers hdr, |
|
inout metadata meta, |
|
inout standard_metadata_t standard_metadata) { |
|
|
|
/********************** APPLYING TABLES ***********************************/ |
|
apply { |
|
if(hdr.tcp.isValid()) { |
|
/* test wrap around */ |
|
hdr.tcp.checksum = 0xffff; |
|
hdr.tcp.checksum = hdr.tcp.checksum + 2; |
|
} |
|
standard_metadata.egress_spec = 1; |
|
} |
|
} |
|
|
|
control MyEgress(inout headers hdr, |
|
inout metadata meta, |
|
inout standard_metadata_t standard_metadata) { |
|
apply { |
|
} |
|
} |
|
|
|
control MyVerifyChecksum(inout headers hdr, inout metadata meta) { |
|
apply {} |
|
} |
|
|
|
|
|
control MyComputeChecksum(inout headers hdr, inout metadata meta) { |
|
apply {} |
|
} |
|
|
|
/************************************************************************* |
|
*********************** S W I T C H ******************************* |
|
*************************************************************************/ |
|
|
|
V1Switch( |
|
MyParser(), |
|
MyVerifyChecksum(), |
|
MyIngress(), |
|
MyEgress(), |
|
MyComputeChecksum(), |
|
MyDeparser() |
|
) main; |