Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add network configuration API #217

Closed
michaelrsweet opened this issue Aug 23, 2022 · 3 comments · Fixed by #220
Closed

Add network configuration API #217

michaelrsweet opened this issue Aug 23, 2022 · 3 comments · Fixed by #220
Assignees
Labels
enhancement New feature or request priority-high
Milestone

Comments

@michaelrsweet
Copy link
Owner

Some users of PAPPL need greater control over the network configuration:

  • Configuration mode: full manual (IP + netmask + router), manual IP + DHCP, and DHCP for IPv4 and IPv6
  • Enable/disable network interfaces
  • Auto/manual DNS servers and domains

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.

@michaelrsweet michaelrsweet added this to the v1.3 milestone Aug 23, 2022
@michaelrsweet michaelrsweet self-assigned this Aug 23, 2022
@michaelrsweet michaelrsweet added enhancement New feature or request priority-high labels Aug 23, 2022
@michaelrsweet
Copy link
Owner Author

Created a new network branch to develop this on...

@michaelrsweet
Copy link
Owner Author

michaelrsweet commented Aug 28, 2022

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;

@michaelrsweet
Copy link
Owner Author

[network 21936d9] Initial network configuration API (Issue #217)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority-high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant