# n-dhcp4-python-binding **Repository Path**: mirrorshq/n-dhcp4-python-binding ## Basic Information - **Project Name**: n-dhcp4-python-binding - **Description**: Python ctypes binding for n-dhcp4 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-13 - **Last Updated**: 2026-03-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # n-dhcp4 Python binding Pure Python `ctypes` bindings for the installed `libndhcp4` shared library. ## Scope The package wraps the public API from `n-dhcp4.h` and exposes Python classes for: - client and server configuration objects - client and server handles - client probes, leases, and events - server lease, IP, and event handles The binding targets the installed system library rather than vendoring or compiling C code. ## Requirements - Python 3.11+ - `net-libs/n-dhcp4` installed on the system ## Example ```python import socket import n_dhcp4 config = n_dhcp4.ClientConfig() config.set_ifindex(socket.if_nametoindex("lo")) config.set_transport(n_dhcp4.Transport.ETHERNET) config.set_mac(b"\x02\x00\x00\x00\x00\x01") config.set_broadcast_mac(b"\xff\xff\xff\xff\xff\xff") config.set_client_id(b"\x01\x02\x00\x00\x00\x00\x01") client = n_dhcp4.Client(config) print(client.fileno()) ```