1 /* 2 * iwinfo - Wireless Information Library - Utility Headers 3 * 4 * Copyright (C) 2010 Jo-Philipp Wich <xm@subsignal.org> 5 * 6 * The iwinfo library is free software: you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 2 8 * as published by the Free Software Foundation. 9 * 10 * The iwinfo library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * See the GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with the iwinfo library. If not, see http://www.gnu.org/licenses/. 17 */ 18 19 #ifndef __IWINFO_UTILS_H_ 20 #define __IWINFO_UTILS_H_ 21 22 #include <sys/socket.h> 23 #include <net/if.h> 24 #include <uci.h> 25 #include <libubus.h> 26 27 #include "iwinfo.h" 28 29 #ifndef ARRAY_SIZE 30 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 31 #endif 32 33 #define LOG10_MAGIC 1.25892541179 34 35 extern struct uci_context *uci_ctx; 36 37 int iwinfo_ioctl(int cmd, void *ifr); 38 39 int iwinfo_dbm2mw(int in); 40 int iwinfo_mw2dbm(int in); 41 static inline int iwinfo_mbm2dbm(int gain) 42 { 43 return gain / 100; 44 } 45 46 const char * const iwinfo_band_name(int mask); 47 const char * const iwinfo_htmode_name(int mask); 48 49 uint32_t iwinfo_band2ghz(uint8_t band); 50 uint8_t iwinfo_ghz2band(uint32_t ghz); 51 52 size_t iwinfo_format_hwmodes(int modes, char *buf, size_t len); 53 int iwinfo_htmode_is_ht(int htmode); 54 int iwinfo_htmode_is_vht(int htmode); 55 int iwinfo_htmode_is_he(int htmode); 56 int iwinfo_htmode_is_eht(int htmode); 57 58 int iwinfo_ifup(const char *ifname); 59 int iwinfo_ifdown(const char *ifname); 60 int iwinfo_ifmac(const char *ifname); 61 62 void iwinfo_close(void); 63 64 struct iwinfo_hardware_entry * iwinfo_hardware(struct iwinfo_hardware_id *id); 65 66 int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id); 67 68 void iwinfo_parse_rsn(struct iwinfo_crypto_entry *c, uint8_t *data, uint8_t len, 69 uint16_t defcipher, uint8_t defauth); 70 71 struct uci_section *iwinfo_uci_get_radio(const char *name, const char *type); 72 void iwinfo_uci_free(void); 73 74 int iwinfo_ubus_query(const char *ifname, const char *field, 75 char *buf, size_t len); 76 77 #endif 78
This page was automatically generated by LXR 0.3.1. • OpenWrt