netconfig.h (3030B)
1 /* 2 * 3 * Wireless daemon for Linux 4 * 5 * Copyright (C) 2019 Intel Corporation. All rights reserved. 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 */ 22 23 struct netdev; 24 struct netconfig; 25 struct ie_fils_ip_addr_request_info; 26 struct ie_fils_ip_addr_response_info; 27 28 enum netconfig_event { 29 NETCONFIG_EVENT_CONNECTED, 30 NETCONFIG_EVENT_FAILED, 31 }; 32 33 typedef void (*netconfig_notify_func_t)(enum netconfig_event event, 34 void *user_data); 35 36 struct netconfig { 37 struct l_netconfig *nc; 38 struct netdev *netdev; 39 40 char *mdns; 41 struct ie_fils_ip_addr_response_info *fils_override; 42 bool enabled[2]; 43 bool static_config[2]; 44 bool gateway_overridden[2]; 45 bool dns_overridden[2]; 46 bool started; 47 bool connected[2]; 48 char **dns_list; 49 char **domains; 50 51 const struct l_settings *active_settings; 52 53 netconfig_notify_func_t notify; 54 void *user_data; 55 56 struct resolve *resolve; 57 58 void *commit_data; 59 }; 60 61 /* 0 for AF_INET, 1 for AF_INET6 */ 62 #define INDEX_FOR_AF(af) ((af) != AF_INET) 63 64 bool netconfig_load_settings(struct netconfig *netconfig, 65 const struct l_settings *active_settings); 66 bool netconfig_configure(struct netconfig *netconfig, 67 netconfig_notify_func_t notify, 68 void *user_data); 69 bool netconfig_reconfigure(struct netconfig *netconfig, bool set_arp_gw); 70 bool netconfig_reset(struct netconfig *netconfig); 71 char *netconfig_get_dhcp_server_ipv4(struct netconfig *netconfig); 72 bool netconfig_get_fils_ip_req(struct netconfig *netconfig, 73 struct ie_fils_ip_addr_request_info *info); 74 void netconfig_handle_fils_ip_resp(struct netconfig *netconfig, 75 const struct ie_fils_ip_addr_response_info *info); 76 bool netconfig_use_fils_addr(struct netconfig *netconfig, int af); 77 78 struct netconfig *netconfig_new(uint32_t ifindex); 79 void netconfig_destroy(struct netconfig *netconfig); 80 81 bool netconfig_enabled(void); 82 83 void netconfig_commit_init(struct netconfig *netconfig); 84 void netconfig_commit_free(struct netconfig *netconfig, const char *reasonstr); 85 void netconfig_commit(struct netconfig *netconfig, uint8_t family, 86 enum l_netconfig_event event); 87 int netconfig_register_agent(const char *name, const char *path); 88 int netconfig_unregister_agent(const char *name, const char *path); 89 90 void netconfig_dhcp_gateway_to_arp(struct netconfig *netconfig); 91 void netconfig_commit_fils_macs(struct netconfig *netconfig, uint8_t family);