|
ArvernOS
|
This module defines network interfaces and drivers. More...
#include <stdbool.h>#include <stdint.h>Data Structures | |
| struct | net_driver_t |
| struct | net_interface_t |
Functions | |
| void | net_interface_init (uint8_t interface_id, net_driver_t *driver, bool prefer_dhcp, uint8_t ip[4], uint8_t gateway_ip[4], uint8_t dns_ip[4]) |
| net_interface_t * | net_get_interface (uint8_t interface_id) |
This module defines network interfaces and drivers.
In this project, a network driver is an abstraction of a physical device, like an Ethernet card for instance. A network driver defines a set of functions to transmit and receive Layer 2 frames.
A network interface bridges a network driver and configuration together. The current configuration that is needed for a network interface is:
Yep, it is very IP oriented but that's how we can show nice things :)
| net_interface_t * net_get_interface | ( | uint8_t | interface_id | ) |
Returns the network interface for the given ID.
| interface_id | an interface ID |
NULL otherwise | void net_interface_init | ( | uint8_t | interface_id, |
| net_driver_t * | driver, | ||
| bool | prefer_dhcp, | ||
| uint8_t | ip[4], | ||
| uint8_t | gateway_ip[4], | ||
| uint8_t | dns_ip[4] ) |
Initializes a network interface.
When prefer_dhcp is set to true, DHCP is used. If it fails, the static configuration will be used instead.
| interface_id | an interface ID |
| driver | a network driver |
| prefer_dhcp | whether to use DHCP |
| ip | a static IPv4 address for the host |
| gateway_ip | a static IPv4 address for the gateway |
| dns_ip | a static IPv4 address for the primary DNS server |