mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
network: Rework interface auto detection, handle route change events
Last part of the rework of handleEvents(), this time we take the getExternalInterface() function and add it to the handleEvents() function. That way, waybar can react immediately when a new "external interface" is available and doesn't need to probe. Also that avoid to have two different functions consuming from the same socket and we don't need to recode some of the functions that are already available via libnl (to send and receive messages).
This commit is contained in:
@ -3,7 +3,6 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <fmt/format.h>
|
||||
#include <linux/nl80211.h>
|
||||
#include <net/if.h>
|
||||
#include <netlink/genl/ctrl.h>
|
||||
#include <netlink/genl/genl.h>
|
||||
#include <netlink/netlink.h>
|
||||
@ -35,17 +34,12 @@ class Network : public ALabel {
|
||||
void worker();
|
||||
void createInfoSocket();
|
||||
void createEventSocket();
|
||||
int getExternalInterface(int skip_idx = -1) const;
|
||||
int netlinkRequest(void*, uint32_t, uint32_t groups = 0) const;
|
||||
int netlinkResponse(void*, uint32_t, uint32_t groups = 0) const;
|
||||
void parseEssid(struct nlattr**);
|
||||
void parseSignal(struct nlattr**);
|
||||
void parseFreq(struct nlattr**);
|
||||
bool associatedOrJoined(struct nlattr**);
|
||||
bool checkInterface(struct ifinfomsg* rtif, std::string name);
|
||||
int getPreferredIface(int skip_idx = -1, bool wait = true) const;
|
||||
bool checkInterface(std::string name);
|
||||
auto getInfo() -> void;
|
||||
void checkNewInterface(struct ifinfomsg* rtif);
|
||||
const std::string getNetworkState() const;
|
||||
void clearIface();
|
||||
bool wildcardMatch(const std::string& pattern, const std::string& text) const;
|
||||
@ -60,6 +54,7 @@ class Network : public ALabel {
|
||||
int nl80211_id_;
|
||||
std::mutex mutex_;
|
||||
|
||||
bool want_route_dump_;
|
||||
bool want_link_dump_;
|
||||
bool want_addr_dump_;
|
||||
bool dump_in_progress_;
|
||||
|
Reference in New Issue
Block a user