Network Module
Network Module
src/net is the network transport layer. It runs lwIP, brings up the Ethernet-style host interfaces, hosts PPP, runs the UDP service loops that the management interface sits on, and orchestrates the FreeRTOS network task. It is what makes a PacketRF node actually have a network, independent of any specific radio protocol.
The module sits below the management interface and above the platform HAL. Anything radio-specific — NPR framing, MAC state, modulation — lives in src/npr, not here. Anything endpoint-specific — control URIs, payload schemas, auth — lives in src/control, not here. The network module's job is to make sure packets get from one place to another and that the lwIP runtime stays sane while doing it.
Submodules
lwip— lwIP runtime setup, netif state, diagnostics.ppp— PPP-over-serial session management and the USB CDC service loop.services— UDP-based services. The CoAP datagram service and its task runner live here.eth— generic Ethernet netif integration, with the HAL device injected as a dependency and ARP frame hooks plumbed through.pool— the IPv4 pool manager (its own page: IPv4 Pool Module).network_task_runner.*— generic, radio-agnostic network task orchestration that future non-NPR modules can reuse without rewriting their own.
CoAP transport service
src/net/services/coap_service.* is the UDP receive/send loop for CoAP datagrams. It does not define endpoint paths and does not parse CBOR — it simply forwards opaque payload bytes to prf:: and returns whatever encoded response comes back. That keeps the socket runtime in one module and routing logic in src/control, which is where it belongs.
src/net/services/coap_service_task_runner.* carries the FreeRTOS loop policy for transport startup and retries. Scenario composition provides the configured endpoint server and the UDP port to listen on.
The generic network task runner
src/net/network_task_runner.* runs the generic FreeRTOS network task. Its responsibilities: initialize lwIP, apply netif configuration revisions, push downlink packets into lwIP, start PPPoS when its configuration is valid. The runner deliberately knows nothing about NPR or any other radio protocol; scenario composition injects an adapter implementing two small interfaces:
INetworkConfigProvider— a snapshot of the current IPv4 configuration intended for one or more interfaces.Ipv4LinkAdapter— the bridge between the radio runtime and lwIP for packet uplink and downlink.
This is what makes the network transport reusable. When a second radio module joins the system, it does not need to grow its own network task and its own lwIP integration — it implements those two interfaces and lets the existing runner handle the rest.
Relationship with the rest of the system
In the current npr_single scenario the layering is:
src/netbrings up lwIP and the CoAP UDP transport.src/controland the module-owned control adapters expose the/mgmtcommand tree on top of that transport.src/nprandsrc/net/usbprovide the per-interface runtime data that the/interface/<iface>/*commands need.
In other words: networking is infrastructure, the management interface is service, and feature modules supply the data the service needs. None of the three layers reach across each other.