TestVirtualRouter

class TestVirtualRouter : VirtualRouter

Test implementation of a VirtualRouter for use with test devices.

Provides dummy routing behavior and predictable network parameters for testing purposes.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val address: InetAddress

Fixed test device address

Link copied to clipboard
open override val localDatagramPort: Int = 4242

Fixed port for local datagram operations

Link copied to clipboard
open override val networkPrefixLength: Int = 16

Fixed network prefix length for testing

Functions

Link copied to clipboard
open override fun allocateUdpPortOrThrow(virtualDatagramSocketImpl: VirtualDatagramSocketImpl, portNum: Int): Int

Allocate a UDP port or throw exception if unavailable.

Link copied to clipboard
open override fun deallocatePort(protocol: Protocol, portNum: Int)

Deallocate a port.

Link copied to clipboard
open override fun lookupNextHopForChainSocket(address: InetAddress, port: Int): ChainSocketNextHop

Look up the next hop for a chain socket.

Link copied to clipboard
open override fun nextMmcpMessageId(): Int

Returns a constant MMCP message ID for testing

Link copied to clipboard
open override fun route(packet: VirtualPacket, datagramPacket: DatagramPacket?, virtualNodeDatagramSocket: VirtualNodeDatagramSocket?)

Route a packet.