mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
parent
da925b9cd7
commit
4281471a34
@ -195,31 +195,31 @@ class Net::Arp_packet
|
||||
/**
|
||||
* \return operation code (Arp_packet::Opcode).
|
||||
*/
|
||||
Genode::uint16_t opcode() { return host_to_big_endian(_opcode); }
|
||||
Genode::uint16_t opcode() const { return host_to_big_endian(_opcode); }
|
||||
|
||||
/**
|
||||
* \return source MAC address.
|
||||
*/
|
||||
Mac_address src_mac() {
|
||||
return Mac_address(&_src_mac_addr); }
|
||||
Mac_address src_mac() const {
|
||||
return Mac_address((void *)&_src_mac_addr); }
|
||||
|
||||
/**
|
||||
* \return source IP address.
|
||||
*/
|
||||
Ipv4_address src_ip() {
|
||||
return Ipv4_address(&_src_ip_addr); }
|
||||
Ipv4_address src_ip() const {
|
||||
return Ipv4_address((void *)&_src_ip_addr); }
|
||||
|
||||
/**
|
||||
* \return destination MAC address.
|
||||
*/
|
||||
Mac_address dst_mac() {
|
||||
return Mac_address(&_dst_mac_addr); }
|
||||
Mac_address dst_mac() const {
|
||||
return Mac_address((void *)&_dst_mac_addr); }
|
||||
|
||||
/**
|
||||
* \return destination IP address.
|
||||
*/
|
||||
Ipv4_address dst_ip() {
|
||||
return Ipv4_address(&_dst_ip_addr); }
|
||||
Ipv4_address dst_ip() const {
|
||||
return Ipv4_address((void *)&_dst_ip_addr); }
|
||||
|
||||
|
||||
/******************************
|
||||
@ -297,7 +297,7 @@ class Net::Arp_packet
|
||||
* \return true when ARP packet really targets ethernet
|
||||
* address resolution with respect to IPv4 addresses.
|
||||
*/
|
||||
bool ethernet_ipv4() {
|
||||
bool ethernet_ipv4() const {
|
||||
return ( host_to_big_endian(_hw_addr_type) == ETHERNET
|
||||
&& host_to_big_endian(_prot_addr_type) == Ethernet_frame::IPV4
|
||||
&& _hw_addr_sz == Ethernet_frame::ADDR_LEN
|
||||
@ -314,6 +314,13 @@ class Net::Arp_packet
|
||||
*/
|
||||
void * operator new(__SIZE_TYPE__ size, void* addr) { return addr; }
|
||||
|
||||
|
||||
/*********
|
||||
** Log **
|
||||
*********/
|
||||
|
||||
void print(Genode::Output &output) const;
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif /* _NET__ARP_H_ */
|
||||
|
@ -185,12 +185,12 @@ class Net::Dhcp_packet
|
||||
** DHCP field read-accessors **
|
||||
*******************************/
|
||||
|
||||
Genode::uint8_t op() { return _op; }
|
||||
Genode::uint8_t htype() { return _htype; }
|
||||
Genode::uint8_t hlen() { return _hlen; }
|
||||
Genode::uint8_t hops() { return _hops; }
|
||||
Genode::uint32_t xid() { return host_to_big_endian(_xid); }
|
||||
Genode::uint16_t secs() { return host_to_big_endian(_secs); }
|
||||
Genode::uint8_t op() const { return _op; }
|
||||
Genode::uint8_t htype() const { return _htype; }
|
||||
Genode::uint8_t hlen() const { return _hlen; }
|
||||
Genode::uint8_t hops() const { return _hops; }
|
||||
Genode::uint32_t xid() const { return host_to_big_endian(_xid); }
|
||||
Genode::uint16_t secs() const { return host_to_big_endian(_secs); }
|
||||
|
||||
bool broadcast() { return _flags & BROADCAST; }
|
||||
|
||||
@ -198,13 +198,13 @@ class Net::Dhcp_packet
|
||||
return Ipv4_address(&_ciaddr); }
|
||||
Ipv4_address yiaddr() {
|
||||
return Ipv4_address(&_yiaddr); }
|
||||
Ipv4_address siaddr() {
|
||||
return Ipv4_address(&_siaddr); }
|
||||
Ipv4_address siaddr() const {
|
||||
return Ipv4_address((void *)&_siaddr); }
|
||||
Ipv4_address giaddr() {
|
||||
return Ipv4_address(&_giaddr); }
|
||||
|
||||
Mac_address client_mac() {
|
||||
return Mac_address(&_chaddr); }
|
||||
Mac_address client_mac() const {
|
||||
return Mac_address((void *)&_chaddr); }
|
||||
|
||||
const char* server_name() { return (const char*) &_sname; }
|
||||
const char* file() { return (const char*) &_file; }
|
||||
@ -255,7 +255,7 @@ class Net::Dhcp_packet
|
||||
** Convenience methods **
|
||||
*************************/
|
||||
|
||||
static bool is_dhcp(Udp_packet *udp)
|
||||
static bool is_dhcp(Udp_packet const *udp)
|
||||
{
|
||||
return ((udp->src_port() == Dhcp_packet::BOOTPC ||
|
||||
udp->src_port() == Dhcp_packet::BOOTPS) &&
|
||||
@ -273,6 +273,13 @@ class Net::Dhcp_packet
|
||||
*/
|
||||
void * operator new(__SIZE_TYPE__ size, void* addr) { return addr; }
|
||||
|
||||
|
||||
/*********
|
||||
** log **
|
||||
*********/
|
||||
|
||||
void print(Genode::Output &output) const;
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif /* _DHCP_H_ */
|
||||
|
@ -1,155 +0,0 @@
|
||||
/*
|
||||
* \brief Dump header info of network packets
|
||||
* \author Martin Stein
|
||||
* \date 2016-08-15
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _NET__DUMP_H_
|
||||
#define _NET__DUMP_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
#include <net/arp.h>
|
||||
#include <net/dhcp.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/ipv4.h>
|
||||
#include <net/udp.h>
|
||||
#include <net/tcp.h>
|
||||
|
||||
namespace Net
|
||||
{
|
||||
void dump_tcp(void * const base, Genode::size_t const size)
|
||||
{
|
||||
Tcp_packet * tcp = new (base) Tcp_packet(size);
|
||||
Genode::printf(
|
||||
"\033[32mTCP\033[0m %u > %u flags '",
|
||||
tcp->src_port(),
|
||||
tcp->dst_port());
|
||||
|
||||
if (tcp->fin()) { Genode::printf("f"); }
|
||||
if (tcp->syn()) { Genode::printf("s"); }
|
||||
if (tcp->rst()) { Genode::printf("r"); }
|
||||
if (tcp->psh()) { Genode::printf("p"); }
|
||||
if (tcp->ack()) { Genode::printf("a"); }
|
||||
if (tcp->urg()) { Genode::printf("u"); }
|
||||
Genode::printf("' ");
|
||||
}
|
||||
|
||||
void dump_dhcp(void * const base, Genode::size_t const size)
|
||||
{
|
||||
Dhcp_packet * dhcp = new (base) Dhcp_packet(size);
|
||||
Genode::printf(
|
||||
"\033[32mDHCP\033[0m %x:%x:%x:%x:%x:%x > %u.%u.%u.%u cmd %u ",
|
||||
dhcp->client_mac().addr[0],
|
||||
dhcp->client_mac().addr[1],
|
||||
dhcp->client_mac().addr[2],
|
||||
dhcp->client_mac().addr[3],
|
||||
dhcp->client_mac().addr[4],
|
||||
dhcp->client_mac().addr[5],
|
||||
dhcp->siaddr().addr[0],
|
||||
dhcp->siaddr().addr[1],
|
||||
dhcp->siaddr().addr[2],
|
||||
dhcp->siaddr().addr[3],
|
||||
dhcp->op());
|
||||
}
|
||||
|
||||
void dump_udp(void * const base, Genode::size_t const size)
|
||||
{
|
||||
Udp_packet * udp = new (base) Udp_packet(size);
|
||||
Genode::printf(
|
||||
"\033[32mUDP\033[0m %u > %u ",
|
||||
udp->src_port(),
|
||||
udp->dst_port());
|
||||
|
||||
Genode::size_t data_size = size - sizeof(Udp_packet);
|
||||
void * data = udp->data<void>();
|
||||
if (Dhcp_packet::is_dhcp(udp)) { dump_dhcp(data, data_size); }
|
||||
}
|
||||
|
||||
void dump_ipv4(void * const base, Genode::size_t const size)
|
||||
{
|
||||
Ipv4_packet * ipv4 = new (base) Ipv4_packet(size);
|
||||
Genode::printf(
|
||||
"\033[32mIPV4\033[0m %u.%u.%u.%u > %u.%u.%u.%u ",
|
||||
ipv4->src().addr[0],
|
||||
ipv4->src().addr[1],
|
||||
ipv4->src().addr[2],
|
||||
ipv4->src().addr[3],
|
||||
ipv4->dst().addr[0],
|
||||
ipv4->dst().addr[1],
|
||||
ipv4->dst().addr[2],
|
||||
ipv4->dst().addr[3]);
|
||||
|
||||
void * data = ipv4->data<void>();
|
||||
Genode::size_t data_size = size - sizeof(Ipv4_packet);
|
||||
switch (ipv4->protocol()) {
|
||||
case Tcp_packet::IP_ID: dump_tcp(data, data_size); break;
|
||||
case Udp_packet::IP_ID: dump_udp(data, data_size); break;
|
||||
default: ; }
|
||||
}
|
||||
|
||||
void dump_arp(void * const base, Genode::size_t const size)
|
||||
{
|
||||
Arp_packet * arp = new (base) Arp_packet(size);
|
||||
if (!arp->ethernet_ipv4()) { return; }
|
||||
Genode::printf(
|
||||
"\033[32mARP\033[0m %x:%x:%x:%x:%x:%x %u.%u.%u.%u "
|
||||
"> %x:%x:%x:%x:%x:%x %u.%u.%u.%u cmd %u ",
|
||||
arp->src_mac().addr[0],
|
||||
arp->src_mac().addr[1],
|
||||
arp->src_mac().addr[2],
|
||||
arp->src_mac().addr[3],
|
||||
arp->src_mac().addr[4],
|
||||
arp->src_mac().addr[5],
|
||||
arp->src_ip().addr[0],
|
||||
arp->src_ip().addr[1],
|
||||
arp->src_ip().addr[2],
|
||||
arp->src_ip().addr[3],
|
||||
arp->dst_mac().addr[0],
|
||||
arp->dst_mac().addr[1],
|
||||
arp->dst_mac().addr[2],
|
||||
arp->dst_mac().addr[3],
|
||||
arp->dst_mac().addr[4],
|
||||
arp->dst_mac().addr[5],
|
||||
arp->dst_ip().addr[0],
|
||||
arp->dst_ip().addr[1],
|
||||
arp->dst_ip().addr[2],
|
||||
arp->dst_ip().addr[3],
|
||||
arp->opcode());
|
||||
}
|
||||
|
||||
void dump_eth(void * const base, Genode::size_t const size)
|
||||
{
|
||||
Ethernet_frame * eth = new (base) Ethernet_frame(size);
|
||||
Genode::printf(
|
||||
"\033[32mETH\033[0m %x:%x:%x:%x:%x:%x > %x:%x:%x:%x:%x:%x ",
|
||||
eth->src().addr[0],
|
||||
eth->src().addr[1],
|
||||
eth->src().addr[2],
|
||||
eth->src().addr[3],
|
||||
eth->src().addr[4],
|
||||
eth->src().addr[5],
|
||||
eth->dst().addr[0],
|
||||
eth->dst().addr[1],
|
||||
eth->dst().addr[2],
|
||||
eth->dst().addr[3],
|
||||
eth->dst().addr[4],
|
||||
eth->dst().addr[5]);
|
||||
|
||||
void * data = eth->data<void>();
|
||||
Genode::size_t data_size = size - sizeof(Ethernet_frame);
|
||||
switch (eth->type()) {
|
||||
case Ethernet_frame::ARP: dump_arp(data, data_size); break;
|
||||
case Ethernet_frame::IPV4: dump_ipv4(data, data_size); break;
|
||||
default: ; }
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _NET__DUMP_H_ */
|
@ -128,17 +128,17 @@ class Net::Ethernet_frame
|
||||
/**
|
||||
* \return destination MAC address of frame.
|
||||
*/
|
||||
Mac_address dst() { return Mac_address(&_dst_mac); }
|
||||
Mac_address dst() const { return Mac_address((void *)&_dst_mac); }
|
||||
|
||||
/**
|
||||
* \return source MAC address of frame.
|
||||
*/
|
||||
Mac_address src() { return Mac_address(&_src_mac); }
|
||||
Mac_address src() const { return Mac_address((void *)&_src_mac); }
|
||||
|
||||
/**
|
||||
* \return EtherType - type of encapsulated protocol.
|
||||
*/
|
||||
Genode::uint16_t type() { return host_to_big_endian(_type); }
|
||||
Genode::uint16_t type() const { return host_to_big_endian(_type); }
|
||||
|
||||
/**
|
||||
* \return payload data.
|
||||
@ -182,6 +182,13 @@ class Net::Ethernet_frame
|
||||
*/
|
||||
void * operator new(__SIZE_TYPE__ size, void* addr) { return addr; }
|
||||
|
||||
|
||||
/*********
|
||||
** log **
|
||||
*********/
|
||||
|
||||
void print(Genode::Output &output) const;
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
|
@ -172,12 +172,12 @@ class Net::Ipv4_packet
|
||||
|
||||
Genode::size_t fragment_offset() { return _fragment_offset; }
|
||||
Genode::uint8_t time_to_live() { return _time_to_live; }
|
||||
Genode::uint8_t protocol() { return _protocol; }
|
||||
Genode::uint8_t protocol() const { return _protocol; }
|
||||
|
||||
Genode::uint16_t checksum() { return host_to_big_endian(_header_checksum); }
|
||||
|
||||
Ipv4_address dst() { return Ipv4_address(&_dst_addr); }
|
||||
Ipv4_address src() { return Ipv4_address(&_src_addr); }
|
||||
Ipv4_address dst() const { return Ipv4_address((void *)&_dst_addr); }
|
||||
Ipv4_address src() const { return Ipv4_address((void *)&_src_addr); }
|
||||
|
||||
template <typename T> T const * header() const { return (T const *)(this); }
|
||||
template <typename T> T * data() { return (T *)(_data); }
|
||||
@ -207,6 +207,13 @@ class Net::Ipv4_packet
|
||||
*/
|
||||
void * operator new(__SIZE_TYPE__ size, void* addr) { return addr; }
|
||||
|
||||
|
||||
/*********
|
||||
** log **
|
||||
*********/
|
||||
|
||||
void print(Genode::Output &output) const;
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
|
@ -78,9 +78,9 @@ class Net::Tcp_packet
|
||||
void src_port(Genode::uint16_t p) { _src_port = host_to_big_endian(p); }
|
||||
void dst_port(Genode::uint16_t p) { _dst_port = host_to_big_endian(p); }
|
||||
|
||||
uint16_t src_port() { return host_to_big_endian(_src_port); }
|
||||
uint16_t dst_port() { return host_to_big_endian(_dst_port); }
|
||||
uint16_t flags() { return host_to_big_endian(_flags); }
|
||||
uint16_t src_port() const { return host_to_big_endian(_src_port); }
|
||||
uint16_t dst_port() const { return host_to_big_endian(_dst_port); }
|
||||
uint16_t flags() const { return host_to_big_endian(_flags); }
|
||||
|
||||
Tcp_packet(size_t size) {
|
||||
if (size < sizeof(Tcp_packet)) { throw No_tcp_packet(); } }
|
||||
@ -136,6 +136,13 @@ class Net::Tcp_packet
|
||||
*/
|
||||
void * operator new(__SIZE_TYPE__ size, void * addr) { return addr; }
|
||||
|
||||
|
||||
/*********
|
||||
** log **
|
||||
*********/
|
||||
|
||||
void print(Genode::Output &output) const;
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif /* _TCP_H_ */
|
||||
|
@ -75,10 +75,10 @@ class Net::Udp_packet
|
||||
** UDP field read-accessors **
|
||||
******************************/
|
||||
|
||||
Genode::uint16_t src_port() { return host_to_big_endian(_src_port); }
|
||||
Genode::uint16_t dst_port() { return host_to_big_endian(_dst_port); }
|
||||
Genode::uint16_t length() { return host_to_big_endian(_length); }
|
||||
Genode::uint16_t checksum() { return host_to_big_endian(_checksum); }
|
||||
Genode::uint16_t src_port() const { return host_to_big_endian(_src_port); }
|
||||
Genode::uint16_t dst_port() const { return host_to_big_endian(_dst_port); }
|
||||
Genode::uint16_t length() const { return host_to_big_endian(_length); }
|
||||
Genode::uint16_t checksum() const { return host_to_big_endian(_checksum); }
|
||||
|
||||
void src_port(Genode::uint16_t p) { _src_port = host_to_big_endian(p); }
|
||||
void dst_port(Genode::uint16_t p) { _dst_port = host_to_big_endian(p); }
|
||||
@ -155,6 +155,14 @@ class Net::Udp_packet
|
||||
/* one's complement of sum */
|
||||
_checksum = host_to_big_endian((Genode::uint16_t) ~sum);
|
||||
}
|
||||
|
||||
|
||||
/*********
|
||||
** log **
|
||||
*********/
|
||||
|
||||
void print(Genode::Output &output) const;
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif /* _UDP_H_ */
|
||||
|
@ -1,3 +1,3 @@
|
||||
SRC_CC = ethernet.cc ipv4.cc mac_address.cc
|
||||
SRC_CC = ethernet.cc ipv4.cc dhcp.cc arp.cc udp.cc tcp.cc mac_address.cc
|
||||
|
||||
vpath %.cc $(REP_DIR)/src/lib/net
|
||||
|
27
repos/os/src/lib/net/arp.cc
Normal file
27
repos/os/src/lib/net/arp.cc
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* \brief Address resolution protocol
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2010-08-24
|
||||
*
|
||||
* ARP is used to determine a network host's link layer or
|
||||
* hardware address when only its Network Layer address is known.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <net/arp.h>
|
||||
#include <base/output.h>
|
||||
|
||||
|
||||
void Net::Arp_packet::print(Genode::Output &output) const
|
||||
{
|
||||
if (!ethernet_ipv4()) { return; }
|
||||
Genode::print(output, "\033[32mARP\033[0m ", src_mac(), " ", src_ip(),
|
||||
" > ", dst_mac(), " ", dst_ip(), " cmd ", opcode());
|
||||
}
|
23
repos/os/src/lib/net/dhcp.cc
Normal file
23
repos/os/src/lib/net/dhcp.cc
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* \brief DHCP related definitions
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2010-08-19
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode */
|
||||
#include <net/dhcp.h>
|
||||
#include <base/output.h>
|
||||
|
||||
|
||||
void Net::Dhcp_packet::print(Genode::Output &output) const
|
||||
{
|
||||
Genode::print(output, "\033[32mDHCP\033[0m ", client_mac(),
|
||||
" > ", siaddr(), " cmd ", op());
|
||||
}
|
@ -11,6 +11,26 @@
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <net/ethernet.h>
|
||||
#include <net/arp.h>
|
||||
#include <net/ipv4.h>
|
||||
#include <base/output.h>
|
||||
|
||||
const Net::Mac_address Net::Ethernet_frame::BROADCAST(0xFF);
|
||||
|
||||
|
||||
void Net::Ethernet_frame::print(Genode::Output &output) const
|
||||
{
|
||||
Genode::print(output, "\033[32mETH\033[0m ", src(), " > ", dst(), " ");
|
||||
switch (type()) {
|
||||
case Ethernet_frame::ARP:
|
||||
Genode::print(output,
|
||||
*reinterpret_cast<Arp_packet const *>(data<void>()));
|
||||
break;
|
||||
case Ethernet_frame::IPV4:
|
||||
Genode::print(output,
|
||||
*reinterpret_cast<Ipv4_packet const *>(data<void>()));
|
||||
break;
|
||||
default: ; }
|
||||
}
|
||||
|
@ -14,11 +14,30 @@
|
||||
#include <util/token.h>
|
||||
#include <util/string.h>
|
||||
|
||||
#include <net/udp.h>
|
||||
#include <net/tcp.h>
|
||||
#include <net/ipv4.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Net;
|
||||
|
||||
|
||||
void Net::Ipv4_packet::print(Genode::Output &output) const
|
||||
{
|
||||
Genode::print(output, "\033[32mIPV4\033[0m ", src(), " > ", dst(), " ");
|
||||
switch (protocol()) {
|
||||
case Tcp_packet::IP_ID:
|
||||
Genode::print(output,
|
||||
*reinterpret_cast<Tcp_packet const *>(data<void>()));
|
||||
break;
|
||||
case Udp_packet::IP_ID:
|
||||
Genode::print(output,
|
||||
*reinterpret_cast<Udp_packet const *>(data<void>()));
|
||||
break;
|
||||
default: ; }
|
||||
}
|
||||
|
||||
|
||||
struct Scanner_policy_number
|
||||
{
|
||||
static bool identifier_char(char c, unsigned i ) {
|
||||
|
31
repos/os/src/lib/net/tcp.cc
Normal file
31
repos/os/src/lib/net/tcp.cc
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* \brief Transmission Control Protocol
|
||||
* \author Martin Stein
|
||||
* \date 2016-06-15
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <net/tcp.h>
|
||||
#include <base/output.h>
|
||||
|
||||
|
||||
void Net::Tcp_packet::print(Genode::Output &output) const
|
||||
{
|
||||
Genode::print(output, "\033[32mTCP\033[0m ", src_port(),
|
||||
" > ", dst_port(), " flags '");
|
||||
|
||||
if (fin()) { Genode::print(output, "f"); }
|
||||
if (syn()) { Genode::print(output, "s"); }
|
||||
if (rst()) { Genode::print(output, "r"); }
|
||||
if (psh()) { Genode::print(output, "p"); }
|
||||
if (ack()) { Genode::print(output, "a"); }
|
||||
if (urg()) { Genode::print(output, "u"); }
|
||||
Genode::print(output, "' ");
|
||||
}
|
28
repos/os/src/lib/net/udp.cc
Normal file
28
repos/os/src/lib/net/udp.cc
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* \brief User datagram protocol.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2010-08-19
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode */
|
||||
#include <net/udp.h>
|
||||
#include <net/dhcp.h>
|
||||
#include <base/output.h>
|
||||
|
||||
|
||||
void Net::Udp_packet::print(Genode::Output &output) const
|
||||
{
|
||||
Genode::print(output, "\033[32mUDP\033[0m ", src_port(),
|
||||
" > ", dst_port(), " ");
|
||||
if (Dhcp_packet::is_dhcp(this)) {
|
||||
Genode::print(output,
|
||||
*reinterpret_cast<Dhcp_packet const *>(data<void>()));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user