diff --git a/ethernet.hh b/ethernet.hh new file mode 100644 index 0000000000..18c7a7e3f2 --- /dev/null +++ b/ethernet.hh @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2014 Cloudius Systems, Ltd. + */ + +#ifndef ETHERNET_HH_ +#define ETHERNET_HH_ + +#include +#include "byteorder.hh" + +namespace net { + +using ethernet_address = std::array; + +struct eth_hdr { + ethernet_address dst_mac; + ethernet_address src_mac; + packed eth_proto; + template + auto adjust_endianness(Adjuster a) { + return a(eth_proto); + } +} __attribute__((packed)); + +} + +#endif /* ETHERNET_HH_ */ diff --git a/ip.hh b/ip.hh index 7340a7d843..86097d49ea 100644 --- a/ip.hh +++ b/ip.hh @@ -13,20 +13,8 @@ namespace net { -using ethernet_address = std::array; - uint16_t ip_checksum(void* data, size_t len); -struct eth_hdr { - ethernet_address dst_mac; - ethernet_address src_mac; - packed eth_proto; - template - auto adjust_endianness(Adjuster a) { - return a(eth_proto); - } -} __attribute__((packed)); - struct ip_hdr { uint8_t ihl : 4; uint8_t ver : 4; diff --git a/net.hh b/net.hh index 7464ee6523..0261363f9b 100644 --- a/net.hh +++ b/net.hh @@ -7,6 +7,7 @@ #include "reactor.hh" #include "ip.hh" +#include "ethernet.hh" #include namespace net {