2019-06-26 00:20:52 +02:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Wireless daemon for Linux
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-08-29 19:35:57 +02:00
|
|
|
struct netdev;
|
2019-09-27 21:52:17 +02:00
|
|
|
struct netconfig;
|
2021-08-27 05:02:04 +02:00
|
|
|
struct ie_fils_ip_addr_request_info;
|
|
|
|
struct ie_fils_ip_addr_response_info;
|
2019-09-27 21:52:17 +02:00
|
|
|
|
2019-10-04 21:48:57 +02:00
|
|
|
enum netconfig_event {
|
|
|
|
NETCONFIG_EVENT_CONNECTED,
|
2022-08-29 19:35:58 +02:00
|
|
|
NETCONFIG_EVENT_FAILED,
|
2019-10-04 21:48:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (*netconfig_notify_func_t)(enum netconfig_event event,
|
|
|
|
void *user_data);
|
|
|
|
|
2022-08-29 19:35:57 +02:00
|
|
|
struct netconfig {
|
|
|
|
struct l_netconfig *nc;
|
|
|
|
struct netdev *netdev;
|
|
|
|
|
|
|
|
char *mdns;
|
|
|
|
struct ie_fils_ip_addr_response_info *fils_override;
|
|
|
|
bool enabled[2];
|
|
|
|
bool static_config[2];
|
|
|
|
bool gateway_overridden[2];
|
|
|
|
bool dns_overridden[2];
|
2022-10-26 19:58:28 +02:00
|
|
|
bool started;
|
2022-08-29 19:35:58 +02:00
|
|
|
bool connected[2];
|
2022-08-29 19:36:01 +02:00
|
|
|
char **dns_list;
|
|
|
|
char **domains;
|
2022-08-29 19:35:57 +02:00
|
|
|
|
|
|
|
const struct l_settings *active_settings;
|
|
|
|
|
|
|
|
netconfig_notify_func_t notify;
|
|
|
|
void *user_data;
|
|
|
|
|
|
|
|
struct resolve *resolve;
|
|
|
|
|
|
|
|
void *commit_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* 0 for AF_INET, 1 for AF_INET6 */
|
|
|
|
#define INDEX_FOR_AF(af) ((af) != AF_INET)
|
|
|
|
|
2021-08-27 05:02:03 +02:00
|
|
|
bool netconfig_load_settings(struct netconfig *netconfig,
|
2021-09-27 18:21:40 +02:00
|
|
|
const struct l_settings *active_settings);
|
2021-08-27 05:02:03 +02:00
|
|
|
bool netconfig_configure(struct netconfig *netconfig,
|
2019-10-04 21:48:57 +02:00
|
|
|
netconfig_notify_func_t notify,
|
|
|
|
void *user_data);
|
2021-11-03 23:15:02 +01:00
|
|
|
bool netconfig_reconfigure(struct netconfig *netconfig, bool set_arp_gw);
|
2019-09-30 18:35:51 +02:00
|
|
|
bool netconfig_reset(struct netconfig *netconfig);
|
2020-07-11 03:00:50 +02:00
|
|
|
char *netconfig_get_dhcp_server_ipv4(struct netconfig *netconfig);
|
2021-08-27 05:02:04 +02:00
|
|
|
bool netconfig_get_fils_ip_req(struct netconfig *netconfig,
|
|
|
|
struct ie_fils_ip_addr_request_info *info);
|
|
|
|
void netconfig_handle_fils_ip_resp(struct netconfig *netconfig,
|
|
|
|
const struct ie_fils_ip_addr_response_info *info);
|
2022-08-29 19:35:57 +02:00
|
|
|
bool netconfig_use_fils_addr(struct netconfig *netconfig, int af);
|
2019-09-30 18:35:51 +02:00
|
|
|
|
2019-09-27 21:52:17 +02:00
|
|
|
struct netconfig *netconfig_new(uint32_t ifindex);
|
|
|
|
void netconfig_destroy(struct netconfig *netconfig);
|
2021-10-21 10:50:30 +02:00
|
|
|
|
|
|
|
bool netconfig_enabled(void);
|
2022-08-29 19:35:57 +02:00
|
|
|
|
|
|
|
void netconfig_commit_init(struct netconfig *netconfig);
|
|
|
|
void netconfig_commit_free(struct netconfig *netconfig, const char *reasonstr);
|
|
|
|
void netconfig_commit(struct netconfig *netconfig, uint8_t family,
|
|
|
|
enum l_netconfig_event event);
|
2022-08-29 19:36:00 +02:00
|
|
|
int netconfig_register_agent(const char *name, const char *path);
|
|
|
|
int netconfig_unregister_agent(const char *name, const char *path);
|
2022-08-29 19:35:57 +02:00
|
|
|
|
|
|
|
void netconfig_dhcp_gateway_to_arp(struct netconfig *netconfig);
|
2022-08-29 19:35:59 +02:00
|
|
|
void netconfig_commit_fils_macs(struct netconfig *netconfig, uint8_t family);
|