genode/repos/os/src/server/nic_router/port_allocator.cc
Martin Stein 3c25d989f3 os: NIC router
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
2016-08-30 17:17:20 +02:00

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(); }
}