Skip to content

Commit

Permalink
net: add iostream support for net channel tcp connection id
Browse files Browse the repository at this point in the history
Reviewed-by: Nadav Har'El <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
avikivity committed Feb 9, 2014
1 parent c8f7d91 commit b04676e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/net_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
#include <bsd/sys/netinet/tcp.h>
#include <bsd/sys/net/ethernet.h>

#include <osv/debug.hh>

std::ostream& operator<<(std::ostream& os, in_addr ia)
{
auto x = ntohl(ia.s_addr);
return osv::fprintf(os, "%d.%d.%d.%d",
(x >> 24) & 255, (x >> 16) & 255, (x >> 8) & 255, x & 255);
}

std::ostream& operator<<(std::ostream& os, ipv4_tcp_conn_id id)
{
return osv::fprintf(os, "{ ipv4 %s:%d -> %s:%d }", id.src_addr, id.src_port, id.dst_addr, id.dst_port);
}

void net_channel::process_queue()
{
mbuf* m;
Expand Down

0 comments on commit b04676e

Please sign in to comment.