Integrate existing headers

This commit is contained in:
Nico Schottelius 2019-07-24 12:15:26 +02:00
parent 1177008608
commit 49e1f511b0
2 changed files with 13 additions and 10 deletions

View file

View file

@ -9,7 +9,10 @@
// bit<16> etherType;
// }
typedef struct headers Parsed_packet;
//typedef struct headers Parsed_packet;
#define Parsed_packet headers
#define user_metadata_t metadata
//struct Parsed_packet {
// Ethernet_h ethernet;
@ -17,9 +20,9 @@ typedef struct headers Parsed_packet;
// user defined metadata: can be used to share information between
// TopParser, TopPipe, and TopDeparser
struct user_metadata_t {
bit<8> unused;
}
//struct user_metadata_t {
// bit<8> unused;
//}
// digest_data, MUST be 256 bits -- what is this used for?
struct digest_data_t {
@ -38,7 +41,7 @@ parser RealParser(
state start {
packet.extract(hdr.ethernet);
meta.unused = 0;
// meta.unused = 0;
digest_data.unused = 0;
transition accept;
}
@ -73,9 +76,9 @@ control RealMain(
#include "actions_nat64_generic.p4"
action swap_eth_addresses() {
EthAddr_t temp = hdr.ethernet.dstAddr;
hdr.ethernet.dstAddr = hdr.ethernet.srcAddr;
hdr.ethernet.srcAddr = temp;
mac_addr_t temp = hdr.ethernet.dst_addr;
hdr.ethernet.dst_addr = hdr.ethernet.src_addr;
hdr.ethernet.src_addr = temp;
/* set egress port */
sume_metadata.dst_port = sume_metadata.src_port;
@ -98,12 +101,12 @@ control RealMain(
}
action do_nothing() {
EthAddr_t temp = hdr.ethernet.dstAddr;
mac_addr_t temp = hdr.ethernet.dst_addr;
}
table lookup_table {
key = {
hdr.ethernet.dstAddr: exact;
hdr.ethernet.dst_addr: exact;
}
actions = {