3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 20:12:37 +01:00

wiphy: Rename netdev to device

This commit is contained in:
Denis Kenzior 2016-05-31 12:57:24 -05:00
parent af9ca22360
commit e48ca5a5a6
9 changed files with 325 additions and 323 deletions

View File

@ -88,7 +88,7 @@ bool device_watch_remove(uint32_t id)
return true; return true;
} }
void __device_watch_call_added(struct netdev *device) void __device_watch_call_added(struct device *device)
{ {
const struct l_queue_entry *e; const struct l_queue_entry *e;
@ -100,7 +100,7 @@ void __device_watch_call_added(struct netdev *device)
} }
} }
void __device_watch_call_removed(struct netdev *device) void __device_watch_call_removed(struct device *device)
{ {
const struct l_queue_entry *e; const struct l_queue_entry *e;

View File

@ -22,11 +22,11 @@
#include <stdbool.h> #include <stdbool.h>
struct netdev;
struct scan_bss; struct scan_bss;
struct wiphy; struct wiphy;
struct device;
typedef void (*device_watch_func_t)(struct netdev *device, void *userdata); typedef void (*device_watch_func_t)(struct device *device, void *userdata);
typedef void (*device_destroy_func_t)(void *userdata); typedef void (*device_destroy_func_t)(void *userdata);
uint32_t device_watch_add(device_watch_func_t added, uint32_t device_watch_add(device_watch_func_t added,
@ -34,16 +34,20 @@ uint32_t device_watch_add(device_watch_func_t added,
void *userdata, device_destroy_func_t destroy); void *userdata, device_destroy_func_t destroy);
bool device_watch_remove(uint32_t id); bool device_watch_remove(uint32_t id);
void __device_watch_call_added(struct netdev *device); void __device_watch_call_added(struct device *device);
void __device_watch_call_removed(struct netdev *device); void __device_watch_call_removed(struct device *device);
struct network *device_get_connected_network(struct netdev *device); struct network *device_get_connected_network(struct device *device);
const char *device_get_path(struct netdev *device); const char *device_get_path(struct device *device);
bool device_is_busy(struct netdev *device); bool device_is_busy(struct device *device);
struct wiphy *device_get_wiphy(struct netdev *device); struct wiphy *device_get_wiphy(struct device *device);
void device_connect_network(struct netdev *device, struct network *network, void device_connect_network(struct device *device, struct network *network,
struct scan_bss *bss, struct scan_bss *bss,
struct l_dbus_message *message); struct l_dbus_message *message);
uint32_t device_get_ifindex(struct device *device);
const uint8_t *device_get_address(struct device *device);
bool device_init(void); bool device_init(void);
bool device_exit(void); bool device_exit(void);

View File

@ -28,6 +28,7 @@
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <net/if_arp.h> #include <net/if_arp.h>
#include <net/if.h> #include <net/if.h>
#include <linux/if_ether.h>
#include <ell/ell.h> #include <ell/ell.h>
#include "src/wiphy.h" #include "src/wiphy.h"

View File

@ -30,8 +30,5 @@ void netdev_set_linkmode_and_operstate(uint32_t ifindex,
uint8_t linkmode, uint8_t operstate, uint8_t linkmode, uint8_t operstate,
netdev_command_func_t cb, void *user_data); netdev_command_func_t cb, void *user_data);
uint32_t netdev_get_ifindex(struct netdev *netdev);
const uint8_t *netdev_get_address(struct netdev *netdev);
bool netdev_init(void); bool netdev_init(void);
bool netdev_exit(void); bool netdev_exit(void);

View File

@ -50,7 +50,7 @@ struct network_info {
struct network { struct network {
char *object_path; char *object_path;
struct netdev *netdev; struct device *device;
char ssid[33]; char ssid[33];
unsigned char *psk; unsigned char *psk;
unsigned int agent_request; unsigned int agent_request;
@ -219,14 +219,14 @@ double network_rankmod(uint32_t type, const char *ssid)
return 0.0; return 0.0;
} }
struct network *network_create(struct netdev *device, struct network *network_create(struct device *device,
uint8_t *ssid, uint8_t ssid_len, uint8_t *ssid, uint8_t ssid_len,
enum security security) enum security security)
{ {
struct network *network; struct network *network;
network = l_new(struct network, 1); network = l_new(struct network, 1);
network->netdev = device; network->device = device;
memcpy(network->ssid, ssid, ssid_len); memcpy(network->ssid, ssid, ssid_len);
network->security = security; network->security = security;
@ -240,9 +240,9 @@ const char *network_get_ssid(const struct network *network)
return network->ssid; return network->ssid;
} }
struct netdev *network_get_netdev(const struct network *network) struct device *network_get_device(const struct network *network)
{ {
return network->netdev; return network->device;
} }
const char *network_get_path(const struct network *network) const char *network_get_path(const struct network *network)
@ -311,7 +311,7 @@ void network_settings_close(struct network *network)
int network_autoconnect(struct network *network, struct scan_bss *bss) int network_autoconnect(struct network *network, struct scan_bss *bss)
{ {
struct wiphy *wiphy = device_get_wiphy(network->netdev); struct wiphy *wiphy = device_get_wiphy(network->device);
switch (network_get_security(network)) { switch (network_get_security(network)) {
case SECURITY_NONE: case SECURITY_NONE:
@ -359,7 +359,7 @@ int network_autoconnect(struct network *network, struct scan_bss *bss)
return -ENOTSUP; return -ENOTSUP;
} }
device_connect_network(network->netdev, network, bss, NULL); device_connect_network(network->device, network, bss, NULL);
return 0; return 0;
} }
@ -435,7 +435,7 @@ static void passphrase_callback(enum agent_result result,
void *user_data) void *user_data)
{ {
struct network *network = user_data; struct network *network = user_data;
struct wiphy *wiphy = device_get_wiphy(network->netdev); struct wiphy *wiphy = device_get_wiphy(network->device);
struct scan_bss *bss; struct scan_bss *bss;
l_debug("result %d", result); l_debug("result %d", result);
@ -475,7 +475,7 @@ static void passphrase_callback(enum agent_result result,
*/ */
network->update_psk = true; network->update_psk = true;
device_connect_network(network->netdev, network, bss, message); device_connect_network(network->device, network, bss, message);
return; return;
err: err:
@ -489,7 +489,7 @@ static struct l_dbus_message *network_connect_psk(struct network *network,
struct scan_bss *bss, struct scan_bss *bss,
struct l_dbus_message *message) struct l_dbus_message *message)
{ {
struct netdev *netdev = network->netdev; struct device *device = network->device;
const char *psk; const char *psk;
l_debug(""); l_debug("");
@ -530,7 +530,7 @@ static struct l_dbus_message *network_connect_psk(struct network *network,
if (!network->agent_request) if (!network->agent_request)
return dbus_error_no_agent(message); return dbus_error_no_agent(message);
} else } else
device_connect_network(netdev, network, bss, message); device_connect_network(device, network, bss, message);
return NULL; return NULL;
} }
@ -540,12 +540,12 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
void *user_data) void *user_data)
{ {
struct network *network = user_data; struct network *network = user_data;
struct netdev *netdev = network->netdev; struct device *device = network->device;
struct scan_bss *bss; struct scan_bss *bss;
l_debug(""); l_debug("");
if (device_is_busy(netdev)) if (device_is_busy(device))
return dbus_error_busy(message); return dbus_error_busy(message);
/* /*
@ -553,7 +553,7 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
* agent this may not be the final choice because BSS visibility can * agent this may not be the final choice because BSS visibility can
* change while we wait for the agent. * change while we wait for the agent.
*/ */
bss = network_select_bss(device_get_wiphy(netdev), network); bss = network_select_bss(device_get_wiphy(device), network);
/* None of the BSSes is compatible with our stack */ /* None of the BSSes is compatible with our stack */
if (!bss) if (!bss)
@ -563,11 +563,11 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
case SECURITY_PSK: case SECURITY_PSK:
return network_connect_psk(network, bss, message); return network_connect_psk(network, bss, message);
case SECURITY_NONE: case SECURITY_NONE:
device_connect_network(netdev, network, bss, message); device_connect_network(device, network, bss, message);
return NULL; return NULL;
case SECURITY_8021X: case SECURITY_8021X:
network_settings_load(network); network_settings_load(network);
device_connect_network(netdev, network, bss, message); device_connect_network(device, network, bss, message);
return NULL; return NULL;
default: default:
return dbus_error_not_supported(message); return dbus_error_not_supported(message);
@ -593,7 +593,7 @@ static bool network_property_is_connected(struct l_dbus *dbus,
struct network *network = user_data; struct network *network = user_data;
bool connected; bool connected;
connected = device_get_connected_network(network->netdev) == network; connected = device_get_connected_network(network->device) == network;
l_dbus_message_builder_append_basic(builder, 'b', &connected); l_dbus_message_builder_append_basic(builder, 'b', &connected);
return true; return true;
} }

View File

@ -22,19 +22,19 @@
#include <stdbool.h> #include <stdbool.h>
struct netdev; struct device;
struct network; struct network;
bool network_seen(struct network *network); bool network_seen(struct network *network);
bool network_connected(struct network *network); bool network_connected(struct network *network);
double network_rankmod(uint32_t type, const char *ssid); double network_rankmod(uint32_t type, const char *ssid);
struct network *network_create(struct netdev *device, struct network *network_create(struct device *device,
uint8_t *ssid, uint8_t ssid_len, uint8_t *ssid, uint8_t ssid_len,
enum security security); enum security security);
const char *network_get_ssid(const struct network *network); const char *network_get_ssid(const struct network *network);
struct netdev *network_get_netdev(const struct network *network); struct device *network_get_device(const struct network *network);
const char *network_get_path(const struct network *network); const char *network_get_path(const struct network *network);
enum security network_get_security(const struct network *network); enum security network_get_security(const struct network *network);
const unsigned char *network_get_psk(const struct network *network); const unsigned char *network_get_psk(const struct network *network);

File diff suppressed because it is too large Load Diff

View File

@ -23,10 +23,10 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
struct netdev;
struct wiphy; struct wiphy;
struct device;
typedef void (*iwd_device_foreach_func)(struct netdev *, void *data); typedef void (*iwd_device_foreach_func)(struct device *, void *data);
enum ie_rsn_cipher_suite wiphy_select_cipher(struct wiphy *wiphy, enum ie_rsn_cipher_suite wiphy_select_cipher(struct wiphy *wiphy,
uint16_t mask); uint16_t mask);

View File

@ -52,7 +52,7 @@ struct wsc_sm {
}; };
struct wsc { struct wsc {
struct netdev *netdev; struct device *device;
struct l_dbus_message *pending; struct l_dbus_message *pending;
struct wsc_sm *sm; struct wsc_sm *sm;
}; };
@ -241,8 +241,8 @@ static struct l_dbus_message *wsc_push_button(struct l_dbus *dbus,
return dbus_error_busy(message); return dbus_error_busy(message);
/* TODO: Parse wiphy bands to set the RF Bands properly below */ /* TODO: Parse wiphy bands to set the RF Bands properly below */
wsc->sm = wsc_sm_new_pushbutton(netdev_get_ifindex(wsc->netdev), wsc->sm = wsc_sm_new_pushbutton(device_get_ifindex(wsc->device),
netdev_get_address(wsc->netdev), device_get_address(wsc->device),
SCAN_BAND_2_4_GHZ | SCAN_BAND_5_GHZ); SCAN_BAND_2_4_GHZ | SCAN_BAND_5_GHZ);
wsc->pending = l_dbus_message_ref(message); wsc->pending = l_dbus_message_ref(message);
@ -295,13 +295,13 @@ static void wsc_free(void *userdata)
l_free(wsc); l_free(wsc);
} }
static void device_appeared(struct netdev *device, void *userdata) static void device_appeared(struct device *device, void *userdata)
{ {
struct l_dbus *dbus = dbus_get_bus(); struct l_dbus *dbus = dbus_get_bus();
struct wsc *wsc; struct wsc *wsc;
wsc = l_new(struct wsc, 1); wsc = l_new(struct wsc, 1);
wsc->netdev = device; wsc->device = device;
if (!l_dbus_object_add_interface(dbus, device_get_path(device), if (!l_dbus_object_add_interface(dbus, device_get_path(device),
IWD_WSC_INTERFACE, IWD_WSC_INTERFACE,
@ -311,7 +311,7 @@ static void device_appeared(struct netdev *device, void *userdata)
} }
} }
static void device_disappeared(struct netdev *device, void *userdata) static void device_disappeared(struct device *device, void *userdata)
{ {
} }