netdev: Remove redundant typedefs
Unify command specific typedefs which had the same signature into a single netdev_command_cb_t
This commit is contained in:
parent
f6eb571b67
commit
52e0a7ce83
19
src/netdev.c
19
src/netdev.c
|
@ -83,7 +83,7 @@ struct netdev {
|
||||||
netdev_connect_cb_t connect_cb;
|
netdev_connect_cb_t connect_cb;
|
||||||
netdev_disconnect_cb_t disconnect_cb;
|
netdev_disconnect_cb_t disconnect_cb;
|
||||||
netdev_neighbor_report_cb_t neighbor_report_cb;
|
netdev_neighbor_report_cb_t neighbor_report_cb;
|
||||||
netdev_adhoc_cb_t adhoc_cb;
|
netdev_command_cb_t adhoc_cb;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
struct eapol_sm *sm;
|
struct eapol_sm *sm;
|
||||||
struct sae_sm *sae_sm;
|
struct sae_sm *sae_sm;
|
||||||
|
@ -105,7 +105,7 @@ struct netdev {
|
||||||
uint32_t rssi_poll_cmd_id;
|
uint32_t rssi_poll_cmd_id;
|
||||||
|
|
||||||
uint32_t set_powered_cmd_id;
|
uint32_t set_powered_cmd_id;
|
||||||
netdev_set_powered_cb_t set_powered_cb;
|
netdev_command_cb_t set_powered_cb;
|
||||||
void *set_powered_user_data;
|
void *set_powered_user_data;
|
||||||
netdev_destroy_func_t set_powered_destroy;
|
netdev_destroy_func_t set_powered_destroy;
|
||||||
|
|
||||||
|
@ -200,11 +200,6 @@ struct handshake_state *netdev_handshake_state_new(struct netdev *netdev)
|
||||||
return &nhs->super;
|
return &nhs->super;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cb_data {
|
|
||||||
netdev_command_func_t callback;
|
|
||||||
void *user_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct wiphy *netdev_get_wiphy(struct netdev *netdev)
|
struct wiphy *netdev_get_wiphy(struct netdev *netdev)
|
||||||
{
|
{
|
||||||
return netdev->wiphy;
|
return netdev->wiphy;
|
||||||
|
@ -352,7 +347,7 @@ static uint32_t rtnl_set_powered(int ifindex, bool powered,
|
||||||
}
|
}
|
||||||
|
|
||||||
int netdev_set_powered(struct netdev *netdev, bool powered,
|
int netdev_set_powered(struct netdev *netdev, bool powered,
|
||||||
netdev_set_powered_cb_t callback, void *user_data,
|
netdev_command_cb_t callback, void *user_data,
|
||||||
netdev_destroy_func_t destroy)
|
netdev_destroy_func_t destroy)
|
||||||
{
|
{
|
||||||
if (netdev->set_powered_cmd_id)
|
if (netdev->set_powered_cmd_id)
|
||||||
|
@ -2668,7 +2663,7 @@ static void netdev_join_adhoc_cb(struct l_genl_msg *msg, void *user_data)
|
||||||
|
|
||||||
int netdev_join_adhoc(struct netdev *netdev, const char *ssid,
|
int netdev_join_adhoc(struct netdev *netdev, const char *ssid,
|
||||||
struct iovec *extra_ie, size_t extra_ie_elems,
|
struct iovec *extra_ie, size_t extra_ie_elems,
|
||||||
bool control_port, netdev_adhoc_cb_t cb,
|
bool control_port, netdev_command_cb_t cb,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct l_genl_msg *cmd;
|
struct l_genl_msg *cmd;
|
||||||
|
@ -2732,7 +2727,7 @@ static void netdev_leave_adhoc_cb(struct l_genl_msg *msg, void *user_data)
|
||||||
netdev->adhoc_cb = NULL;
|
netdev->adhoc_cb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int netdev_leave_adhoc(struct netdev *netdev, netdev_adhoc_cb_t cb,
|
int netdev_leave_adhoc(struct netdev *netdev, netdev_command_cb_t cb,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct l_genl_msg *cmd;
|
struct l_genl_msg *cmd;
|
||||||
|
@ -3895,7 +3890,7 @@ static void netdev_bridge_port_event(const struct ifinfomsg *ifi, int bytes,
|
||||||
struct set_4addr_cb_data {
|
struct set_4addr_cb_data {
|
||||||
struct netdev *netdev;
|
struct netdev *netdev;
|
||||||
bool value;
|
bool value;
|
||||||
netdev_set_4addr_cb_t callback;
|
netdev_command_cb_t callback;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
netdev_destroy_func_t destroy;
|
netdev_destroy_func_t destroy;
|
||||||
};
|
};
|
||||||
|
@ -3929,7 +3924,7 @@ static void netdev_set_4addr_destroy(void *user_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
int netdev_set_4addr(struct netdev *netdev, bool use_4addr,
|
int netdev_set_4addr(struct netdev *netdev, bool use_4addr,
|
||||||
netdev_set_4addr_cb_t cb, void *user_data,
|
netdev_command_cb_t cb, void *user_data,
|
||||||
netdev_destroy_func_t destroy)
|
netdev_destroy_func_t destroy)
|
||||||
{
|
{
|
||||||
struct set_4addr_cb_data *cb_data = NULL;
|
struct set_4addr_cb_data *cb_data = NULL;
|
||||||
|
|
17
src/netdev.h
17
src/netdev.h
|
@ -64,7 +64,8 @@ enum netdev_iftype {
|
||||||
NETDEV_IFTYPE_AP = 3,
|
NETDEV_IFTYPE_AP = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*netdev_command_func_t) (bool result, void *user_data);
|
typedef void (*netdev_command_cb_t)(struct netdev *netdev, int result,
|
||||||
|
void *user_data);
|
||||||
typedef void (*netdev_connect_cb_t)(struct netdev *netdev,
|
typedef void (*netdev_connect_cb_t)(struct netdev *netdev,
|
||||||
enum netdev_result result,
|
enum netdev_result result,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
@ -73,15 +74,9 @@ typedef void (*netdev_event_func_t)(struct netdev *netdev,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
typedef void (*netdev_disconnect_cb_t)(struct netdev *netdev, bool result,
|
typedef void (*netdev_disconnect_cb_t)(struct netdev *netdev, bool result,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
typedef void (*netdev_adhoc_cb_t)(struct netdev *netdev, int result,
|
|
||||||
void *user_data);
|
|
||||||
typedef void (*netdev_watch_func_t)(struct netdev *netdev,
|
typedef void (*netdev_watch_func_t)(struct netdev *netdev,
|
||||||
enum netdev_watch_event event,
|
enum netdev_watch_event event,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
typedef void (*netdev_set_powered_cb_t)(struct netdev *netdev, int result,
|
|
||||||
void *user_data);
|
|
||||||
typedef void (*netdev_set_4addr_cb_t)(struct netdev *netdev, int result,
|
|
||||||
void *user_data);
|
|
||||||
typedef void (*netdev_destroy_func_t)(void *user_data);
|
typedef void (*netdev_destroy_func_t)(void *user_data);
|
||||||
typedef void (*netdev_eapol_event_func_t)(unsigned int event,
|
typedef void (*netdev_eapol_event_func_t)(unsigned int event,
|
||||||
const void *event_data,
|
const void *event_data,
|
||||||
|
@ -106,7 +101,7 @@ uint32_t netdev_get_ifindex(struct netdev *netdev);
|
||||||
enum netdev_iftype netdev_get_iftype(struct netdev *netdev);
|
enum netdev_iftype netdev_get_iftype(struct netdev *netdev);
|
||||||
int netdev_set_iftype(struct netdev *netdev, enum netdev_iftype type);
|
int netdev_set_iftype(struct netdev *netdev, enum netdev_iftype type);
|
||||||
int netdev_set_4addr(struct netdev *netdev, bool use_4addr,
|
int netdev_set_4addr(struct netdev *netdev, bool use_4addr,
|
||||||
netdev_set_4addr_cb_t cb, void *user_data,
|
netdev_command_cb_t cb, void *user_data,
|
||||||
netdev_destroy_func_t destroy);
|
netdev_destroy_func_t destroy);
|
||||||
bool netdev_get_4addr(struct netdev *netdev);
|
bool netdev_get_4addr(struct netdev *netdev);
|
||||||
const char *netdev_get_name(struct netdev *netdev);
|
const char *netdev_get_name(struct netdev *netdev);
|
||||||
|
@ -143,13 +138,13 @@ int netdev_del_station(struct netdev *netdev, const uint8_t *sta,
|
||||||
|
|
||||||
int netdev_join_adhoc(struct netdev *netdev, const char *ssid,
|
int netdev_join_adhoc(struct netdev *netdev, const char *ssid,
|
||||||
struct iovec *extra_ie, size_t extra_ie_elems,
|
struct iovec *extra_ie, size_t extra_ie_elems,
|
||||||
bool control_port, netdev_adhoc_cb_t cb,
|
bool control_port, netdev_command_cb_t cb,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
int netdev_leave_adhoc(struct netdev *netdev, netdev_adhoc_cb_t cb,
|
int netdev_leave_adhoc(struct netdev *netdev, netdev_command_cb_t cb,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
int netdev_set_powered(struct netdev *netdev, bool powered,
|
int netdev_set_powered(struct netdev *netdev, bool powered,
|
||||||
netdev_set_powered_cb_t cb, void *user_data,
|
netdev_command_cb_t cb, void *user_data,
|
||||||
netdev_destroy_func_t destroy);
|
netdev_destroy_func_t destroy);
|
||||||
|
|
||||||
int netdev_neighbor_report_req(struct netdev *netdev,
|
int netdev_neighbor_report_req(struct netdev *netdev,
|
||||||
|
|
Loading…
Reference in New Issue