Closed michaelrsweet closed 2 years ago
Created a new network branch to develop this on...
Proposed API:
typedef enum pappl_netconf_e // Network configuration mode
{
PAPPL_NETCONF_OFF, // Turn network interface off
PAPPL_NETCONF_DHCP, // Full DHCP
PAPPL_NETCONF_DHCP_MANUAL, // DHCP with manual IP address
PAPPL_NETCONF_MANUAL // Manual IP, netmask, and router
} pappl_netconf_t;
typedef struct pappl_network_s // Network interface information
{
char name[64]; // Interface name
bool up; // Is this interface up (read-only)?
pappl_netconf_t config4; // IPv4 configuration mode
struct sockaddr_in addr4, // IPv4 address
mask4, // IPv4 netmask
router4, // IPv4 router address
dns4[2]; // IPv4 DNS addresses
pappl_netconf_t config6; // IPv6 configuration mode
struct sockaddr_in6 linkaddr6, // IPv6 link-local address (read-only)
addr6, // IPv6 address
mask6, // IPv6 netmask
router6, // IPv6 router address
dns6[2]; // IPv6 DNS addresses
} pappl_network_t;
// Get networks callback
typedef size_t (*pappl_network_get_cb_t)(pappl_system_t *system, void *cb_data, size_t max_networks, pappl_network_t *networks);
// Set networks callback
typedef bool (*pappl_network_set_cb_t)(pappl_system_t *system, void *cb_data, size_t num_networks, pappl_network_t *networks);
// Set network callbacks
extern void papplSystemSetNetworkCallbacks(pappl_system_t *system, pappl_network_get_cb_t get_cb, pappl_network_set_cb_t set_cb, void *cb_data) _PAPPL_PUBLIC;
[network 21936d9] Initial network configuration API (Issue #217)
Some users of PAPPL need greater control over the network configuration:
Essentially we should provide a similar level of UI as the macOS Network preference pane.
As for Wi-Fi configuration, there should be a new API for getting and setting the current network configuration since the mechanism varies based on OS/distro.