]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - iw.h
iw: fix various static checker warnings
[thirdparty/iw.git] / iw.h
diff --git a/iw.h b/iw.h
index 2837bd338d7c887c6344a5a1ec19e65542859e51..b0166da941ba751ad7771d9dcc988bc6d9150e6a 100644 (file)
--- a/iw.h
+++ b/iw.h
 #include "nl80211.h"
 #include "ieee80211.h"
 
+/* support for extack if compilation headers are too old */
+#ifndef NETLINK_EXT_ACK
+#define NETLINK_EXT_ACK 11
+enum nlmsgerr_attrs {
+       NLMSGERR_ATTR_UNUSED,
+       NLMSGERR_ATTR_MSG,
+       NLMSGERR_ATTR_OFFS,
+       NLMSGERR_ATTR_COOKIE,
+
+       __NLMSGERR_ATTR_MAX,
+       NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1
+};
+#endif
+#ifndef NLM_F_CAPPED
+#define NLM_F_CAPPED 0x100
+#endif
+#ifndef NLM_F_ACK_TLVS
+#define NLM_F_ACK_TLVS 0x200
+#endif
+#ifndef SOL_NETLINK
+#define SOL_NETLINK 270
+#endif
+
 #define ETH_ALEN 6
 #define VHT_MUMIMO_GROUP_LEN 24
 
@@ -70,6 +93,14 @@ struct chanmode {
        int chantype; /* for older kernel */
 };
 
+struct chandef {
+       enum nl80211_chan_width width;
+
+       unsigned int control_freq;
+       unsigned int center_freq1;
+       unsigned int center_freq2;
+};
+
 #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
 #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
 
@@ -99,6 +130,7 @@ struct chanmode {
        __COMMAND(&(__section ## _ ## section), name, #name, args, cmd, flags, 1, idby, handler, NULL, NULL)
 
 #define TOPLEVEL(_name, _args, _nlcmd, _flags, _idby, _handler, _help) \
+       extern struct cmd __section ## _ ## _name; /* sparse */         \
        struct cmd                                                      \
        __section ## _ ## _name                                         \
        __attribute__((used)) __attribute__((section("__cmd"))) = {     \
@@ -111,6 +143,7 @@ struct chanmode {
                .help = (_help),                                        \
         }
 #define SECTION(_name)                                                 \
+       extern struct cmd __section ## _ ## _name; /* sparse */         \
        struct cmd __section ## _ ## _name                              \
        __attribute__((used)) __attribute__((section("__cmd"))) = {     \
                .name = (#_name),                                       \
@@ -144,12 +177,17 @@ int valid_handler(struct nl_msg *msg, void *arg);
 void register_handler(int (*handler)(struct nl_msg *, void *), void *data);
 
 int mac_addr_a2n(unsigned char *mac_addr, char *arg);
-void mac_addr_n2a(char *mac_addr, unsigned char *arg);
+void mac_addr_n2a(char *mac_addr, const unsigned char *arg);
 int parse_hex_mask(char *hexmask, unsigned char **result, size_t *result_len,
                   unsigned char **mask);
 unsigned char *parse_hex(char *hex, size_t *outlen);
 
 int parse_keys(struct nl_msg *msg, char **argv, int argc);
+int parse_freqchan(struct chandef *chandef, bool chan, int argc, char **argv, int *parsed);
+enum nl80211_chan_width str_to_bw(const char *str);
+int parse_txq_stats(char *buf, int buflen, struct nlattr *tid_stats_attr, int header,
+                   int tid, const char *indent);
+int put_chandef(struct nl_msg *msg, struct chandef *chandef);
 
 void print_ht_mcs(const __u8 *mcs);
 void print_ampdu_length(__u8 exponent);
@@ -192,7 +230,10 @@ int get_cf1(const struct chanmode *chanmode, unsigned long freq);
        "[randomise[=<addr>/<mask>]]"
 int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
 
+DECLARE_SECTION(switch);
 DECLARE_SECTION(set);
 DECLARE_SECTION(get);
 
+char *hex2bin(const char *hex, char *buf);
+
 #endif /* __IW_H */