-
Notifications
You must be signed in to change notification settings - Fork 0
Network Device Plugin
Plugin interface for network device drivers that bridges the Plugin system with the network stack.
The Network Device Plugin (NetPlugin) is a JNode plugin that provides the core networking service infrastructure. It serves as the bridge between the Plugin system, device drivers, and the network protocol stack. The plugin initializes network layer management, registers the network API with the InitialNaming service registry, and starts the packet processing thread.
| Class/File | Location | Purpose |
|---|---|---|
NetPlugin |
net/src/net/org/jnode/net/service/NetPlugin.java |
Main plugin class extending Plugin, manages network service lifecycle |
NetDeviceImpl |
net/src/net/org/jnode/net/service/NetDeviceImpl.java |
Wrapper class extending VMNetDevice, bridges JNode Device to Java networking |
NetAPIImpl |
net/src/net/org/jnode/net/service/NetAPIImpl.java |
Implementation of VMNetAPI, provides device enumeration and address resolution |
DefaultNetworkLayerManager |
net/src/net/org/jnode/net/service/DefaultNetworkLayerManager.java |
Registry for network protocol layers (IP, ARP, TCP, UDP) |
The NetPlugin extends JNode's Plugin base class and implements the core networking service:
-
Initialization: During construction, the plugin creates:
- A
DefaultNetworkLayerManagerinstance that loads network layer extensions - A
NetAPIImplinstance providing the network API - A
QueueProcessorThreadfor asynchronous packet processing
- A
-
Startup (
startPlugin):- Binds the
NetworkLayerManagertoInitialNamingfor service discovery - Starts the packet processing thread
- Registers the network API with
VMNetUtils
- Binds the
-
Shutdown (
stopPlugin):- Unregisters the network API from
VMNetUtils - Unbinds the
NetworkLayerManagerfromInitialNaming - Stops the packet processing thread
- Unregisters the network API from
The NetDeviceImpl class wraps a JNode Device (which implements NetDeviceAPI) and presents it as a VMNetDevice to the standard Java networking API:
public final class NetDeviceImpl extends VMNetDevice {
private final Device device;
public NetDeviceImpl(Device device) {
this.device = device;
}
public String getId() {
return device.getId();
}
public Device getDevice() {
return this.device;
}
}The DefaultNetworkLayerManager serves as the central registry for protocol layers:
- Loads network layers from the
networkLayersextension point - Routes incoming packets to appropriate protocol handlers
- Manages the packet queue for async processing
-
Packet processing thread: The
QueueProcessorThreadruns continuously; stopping the plugin requires proper thread termination -
InitialNaming dependency: Other services depend on the
NetworkLayerManagerbeing bound before they can operate -
Extension point required: The
networkLayersextension point must be properly configured for protocol layers to load -
Device API requirement: Network devices must implement
NetDeviceAPIto be recognized by the network stack