DHCPv4.Server (DHCP v0.5.0)
View SourceDHCP Server Core - Pure Elixir DHCP protocol implementation for :abyss integration.
This module provides the core DHCP server logic without networking concerns. It handles lease management, IP allocation, and DHCP message processing.
Summary
Functions
Manually expire leases (for testing/cleanup).
Get current leases for monitoring/debugging.
Initialize DHCP server with configuration.
Process incoming DHCP message and return response messages.
Types
@type config() :: %{ subnet: :inet.ip4_address(), netmask: :inet.ip4_address(), range_start: :inet.ip4_address(), range_end: :inet.ip4_address(), gateway: :inet.ip4_address() | nil, dns_servers: [:inet.ip4_address()], lease_time: integer(), options: [DHCPv4.Message.Option.t()] }
@type lease() :: %{ ip: :inet.ip4_address(), mac: binary(), expires_at: integer(), client_id: binary() | nil, hostname: String.t() | nil, options: [DHCPv4.Message.Option.t()] }
@type state() :: %{ config: config(), leases: %{required(binary()) => lease()}, ip_pool: MapSet.t(:inet.ip4_address()), used_ips: MapSet.t(:inet.ip4_address()) }
Functions
Manually expire leases (for testing/cleanup).
Get current leases for monitoring/debugging.
Initialize DHCP server with configuration.
@spec process_message(state(), DHCPv4.Message.t(), :inet.ip4_address(), integer()) :: {state(), [DHCPv4.Message.t()]}
Process incoming DHCP message and return response messages.