Skip to content

Commit

Permalink
Add required nl80211 callbacks
Browse files Browse the repository at this point in the history
Signed-off-by: Tin Švagelj <[email protected]>
  • Loading branch information
Caellian committed May 2, 2024
1 parent ebc3bdf commit 830dea1
Show file tree
Hide file tree
Showing 6 changed files with 1,450 additions and 196 deletions.
1,255 changes: 1,255 additions & 0 deletions 3rdparty/linux/uapi/linux/nl80211.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/darwin.mm
Original file line number Diff line number Diff line change
Expand Up @@ -703,14 +703,14 @@ void update_wlan_stats(struct net_stat *ns) {
/*
* Setup
*/
memcpy(ns->essid, essid, sizeof(char)*strlen(essid));
ns->essid = std::string(essid);
ns->channel = interface.wlanChannel.channelNumber;
memcpy(ns->freq, freq, sizeof(char)*strlen(freq));
memcpy(ns->bitrate, bitrate, sizeof(char)*strlen(bitrate));
memcpy(ns->mode, mode, sizeof(char)*strlen(mode));
ns->link_qual = 0;
ns->link_qual_max = 0;
memcpy(ns->ap, ap, sizeof(char)*strlen(ap));
ns->ap = std::string(ap);
}

#endif /* BUILD_WLAN */
Expand Down
8 changes: 4 additions & 4 deletions src/net_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,15 @@ void print_wireless_essid(struct text_object *obj, char *p,

if (!ns) {
for (unsigned int i = 0; *(netstats[i].dev) != 0; i++) {
if (*(netstats[i].essid) != 0) {
snprintf(p, p_max_size, "%s", netstats[i].essid);
if (!netstats[i].essid.empty()) {
snprintf(p, p_max_size, "%s", netstats[i].essid.c_str());
return;
}
}
return;
}

snprintf(p, p_max_size, "%s", ns->essid);
snprintf(p, p_max_size, "%s", ns->essid.c_str());
}
void print_wireless_mode(struct text_object *obj, char *p,
unsigned int p_max_size) {
Expand Down Expand Up @@ -435,7 +435,7 @@ void print_wireless_ap(struct text_object *obj, char *p,

if (!ns) return;

snprintf(p, p_max_size, "%s", ns->ap);
snprintf(p, p_max_size, "%s", ns->ap.c_str());
}
void print_wireless_link_qual(struct text_object *obj, char *p,
unsigned int p_max_size) {
Expand Down
6 changes: 4 additions & 2 deletions src/net_stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include <sys/socket.h> /* struct sockaddr */
#include "config.h"

#include <string>

#ifdef BUILD_IPV6
struct v6addr {
struct in6_addr addr;
Expand Down Expand Up @@ -73,14 +75,14 @@ struct net_stat {
* trans_speed */
double net_rec[15], net_trans[15];
// wireless extensions
char essid[35];
std::string essid;
int channel;
char freq[16];
char bitrate[16];
char mode[64];
int link_qual;
int link_qual_max;
char ap[18];
std::string ap;
};

extern struct net_stat netstats[];
Expand Down
Loading

0 comments on commit 830dea1

Please sign in to comment.