3c25d989f3
The nic_router component can be used to individually route IPv4 packets between multiple NIC sessions. Thereby, it can translate between different IP subnets. The component supports port forwarding, as well as the partitioning of the TCP and UDP port spaces. Fixes #114
26 lines
501 B
C++
26 lines
501 B
C++
/*
|
|
* \brief Allocator for UDP/TCP ports
|
|
* \author Martin Stein
|
|
* \date 2016-08-19
|
|
*/
|
|
|
|
/*
|
|
* 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.
|
|
*/
|
|
|
|
/* local includes */
|
|
#include <port_allocator.h>
|
|
|
|
using namespace Net;
|
|
using namespace Genode;
|
|
|
|
|
|
Port_allocator::Port_allocator()
|
|
{
|
|
try { alloc_index(0); }
|
|
catch (Already_allocated) { throw Failed_to_reserve_port_0(); }
|
|
}
|