merge net into eth lib; ipv4 owns its IP via ipv4::init/get_ip; drop state struct in favor of eth::get_mac/ipv4::get_ip
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
#include <span>
|
||||
#include "wire.h"
|
||||
#include "timer_queue.h"
|
||||
#include "net.h"
|
||||
#include "eth.h"
|
||||
#include "ipv4.h"
|
||||
#include "prepend_buffer.h"
|
||||
#include "udp.h"
|
||||
|
||||
@@ -17,7 +18,6 @@ struct responder {
|
||||
|
||||
template <typename T>
|
||||
void respond(const T& msg) const {
|
||||
const auto& ns = net::get_state();
|
||||
prepend_buffer<4096> buf;
|
||||
span_writer out(buf.payload_ptr(), 2048);
|
||||
auto r = encode_response_into(out, message_id, msg);
|
||||
@@ -25,9 +25,9 @@ struct responder {
|
||||
return;
|
||||
}
|
||||
buf.append(*r);
|
||||
udp::prepend(buf, reply_to.mac, ns.mac, ns.ip, reply_to.ip,
|
||||
udp::prepend(buf, reply_to.mac, eth::get_mac(), ipv4::get_ip(), reply_to.ip,
|
||||
dispatch_listen_port_be(), reply_to.port, *r);
|
||||
net::send_raw(buf.span());
|
||||
eth::send_raw(buf.span());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user