From ee8558283d2a37dac1f4e34f7ed611bb0fb79f0c Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 31 Aug 2014 13:37:21 +0300 Subject: [PATCH] Split ethernet support to new file ethernet.hh --- ethernet.hh | 27 +++++++++++++++++++++++++++ ip.hh | 12 ------------ net.hh | 1 + 3 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 ethernet.hh 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 {