mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 17:40:34 +00:00
Split ethernet support to new file ethernet.hh
This commit is contained in:
27
ethernet.hh
Normal file
27
ethernet.hh
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Cloudius Systems, Ltd.
|
||||
*/
|
||||
|
||||
#ifndef ETHERNET_HH_
|
||||
#define ETHERNET_HH_
|
||||
|
||||
#include <array>
|
||||
#include "byteorder.hh"
|
||||
|
||||
namespace net {
|
||||
|
||||
using ethernet_address = std::array<uint8_t, 6>;
|
||||
|
||||
struct eth_hdr {
|
||||
ethernet_address dst_mac;
|
||||
ethernet_address src_mac;
|
||||
packed<uint16_t> eth_proto;
|
||||
template <typename Adjuster>
|
||||
auto adjust_endianness(Adjuster a) {
|
||||
return a(eth_proto);
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
}
|
||||
|
||||
#endif /* ETHERNET_HH_ */
|
||||
12
ip.hh
12
ip.hh
@@ -13,20 +13,8 @@
|
||||
|
||||
namespace net {
|
||||
|
||||
using ethernet_address = std::array<uint8_t, 6>;
|
||||
|
||||
uint16_t ip_checksum(void* data, size_t len);
|
||||
|
||||
struct eth_hdr {
|
||||
ethernet_address dst_mac;
|
||||
ethernet_address src_mac;
|
||||
packed<uint16_t> eth_proto;
|
||||
template <typename Adjuster>
|
||||
auto adjust_endianness(Adjuster a) {
|
||||
return a(eth_proto);
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
struct ip_hdr {
|
||||
uint8_t ihl : 4;
|
||||
uint8_t ver : 4;
|
||||
|
||||
Reference in New Issue
Block a user