Skip to content

Header definition

Steffen Lindner edited this page Apr 15, 2019 · 1 revision

The project contains some type definition for more obvious type naming, e.g.

typedef bit<9> egressSpec_t;
typedef bit<48> macAddr_t;
typedef bit<32> ip4Addr_t;
typedef bit<64> bierBitmask;

The type bierBitmask is used for various operations with the Bier BitString, e.g. matching, and-ing or logical or.

Additionally the project defines some (standardized or proprietary) protocol numbers for identification, e.g.

const bit<16> TYPE_IPV4 = 0x800;
const bit<16> TYPE_BIER = 0xBB00;
const bit<16> TYPE_TOP_DISCOVER = 0xDD00;
const bit<8>  TYPE_IP_BIER = 0x8F;
const bit<8> TYPE_IP_IGMP = 0x2;

where TYPE_IP_* is the IPv4 protocol type for BIER and TYPE_IP_IGMPis the standardized protocol number for IGMP inside IP.

Ethernet

For this implementation of BIER a simplified ethernet header is used, only containing src, dst address and the ethernet type of the next protocol.

header ethernet_t {
	macAddr_t dstAddr;
	macAddr_t srcAddr;
	bit<16> etherType;
}

IPv4

The ipv4 header contains all standardized fields, but only the ttl, protocol, src and dst address fields are used outside the checksum verification.

header ipv4_t {
    bit<4>    version;
    bit<4>    ihl;
    bit<8>    diffserv;
    bit<16>   totalLen;
    bit<16>   identification;
    bit<3>    flags;
    bit<13>   fragOffset;
    bit<8>    ttl;
    bit<8>    protocol;
    bit<16>   hdrChecksum;
    ip4Addr_t srcAddr;
    ip4Addr_t dstAddr;
}

Topology-Discover

This implementation uses a simple proprietary topology header to perform neighbor detection.

header topology_discover_t {
    bit<32> identifier;
    bit<16> port;
    bit<32> prefix;
    bit<48> mac;
}

This simple header includes a 32 bit identifier, a 16 bit outgoing port, a 32 bit IPv4 address and a 48 bit mac address.

IGMP

To allow hosts to join multicast groups, parts of the IGMPv2 protocol have been implemented.

header igmp_t {
    bit<8> typ;
    bit<8> max_response_time;
    bit<16> checksum;
    bit<32> mcast_addr;
}

Header naming

The above mentioned header can be accessed with the following names

struct headers {
    ethernet_t          ethernet;
    ipv4_t              ipv4;
    igmp_t              igmp;
    bier_t              bier; 
    ipv4_t              ipv4_inner;
    topology_discover_t topology;
}

ipv4 and ipv4_inner are the outer and inner ipv4 headers when using an IP tunnel and therefore having the structure IP | BIER | IP.