Files
scylladb/net/udp.hh
Gleb Natapov b824790798 net: move udp_v4 from network_stack into ipv4 class
ipv4 class manages tcp and icmp, but for some reason udp is managed by
network_stack. Fix this and make all L4 protocol handling to be the same.
2015-01-08 11:33:19 +02:00

39 lines
698 B
C++

/*
* Copyright (C) 2014 Cloudius Systems, Ltd.
*
*/
#ifndef UDP_HH_
#define UDP_HH_
#include <unordered_map>
#include <assert.h>
#include "core/reactor.hh"
#include "core/shared_ptr.hh"
#include "net/api.hh"
#include "const.hh"
#include "net.hh"
namespace net {
struct udp_hdr {
packed<uint16_t> src_port;
packed<uint16_t> dst_port;
packed<uint16_t> len;
packed<uint16_t> cksum;
template<typename Adjuster>
auto adjust_endianness(Adjuster a) {
return a(src_port, dst_port, len, cksum);
}
} __attribute__((packed));
struct udp_channel_state {
queue<udp_datagram> _queue;
udp_channel_state(size_t queue_size) : _queue(queue_size) {}
};
}
#endif