| 1 | /* |
|---|
| 2 | * Broadcom wireless network adapter utility functions |
|---|
| 3 | * |
|---|
| 4 | * Copyright 2001-2003, Broadcom Corporation |
|---|
| 5 | * All Rights Reserved. |
|---|
| 6 | * |
|---|
| 7 | * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY |
|---|
| 8 | * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM |
|---|
| 9 | * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS |
|---|
| 10 | * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. |
|---|
| 11 | * |
|---|
| 12 | * $Id: wlutils.h,v 1.3 2005/11/11 09:26:19 seg Exp $ |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | #ifndef _wlutils_h_ |
|---|
| 16 | #define _wlutils_h_ |
|---|
| 17 | |
|---|
| 18 | #include <typedefs.h> |
|---|
| 19 | #include <wlioctl.h> |
|---|
| 20 | #ifndef WLC_IOCTL_SMLEN |
|---|
| 21 | #define WLC_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */ |
|---|
| 22 | #endif |
|---|
| 23 | #ifndef BCME_BUFTOOSHORT |
|---|
| 24 | #define BCME_BUFTOOSHORT -14 /* Buffer too short */ |
|---|
| 25 | #endif |
|---|
| 26 | |
|---|
| 27 | /* get wireless interface */ |
|---|
| 28 | extern char *get_wdev (void); |
|---|
| 29 | |
|---|
| 30 | extern int get_wl_instance (char *ifname); |
|---|
| 31 | extern int get_wl_instances (void); |
|---|
| 32 | extern char *get_wl_instance_name (int instance); |
|---|
| 33 | |
|---|
| 34 | float wifi_getrate (char *ifname); |
|---|
| 35 | int wifi_gettxpower (char *ifname); |
|---|
| 36 | int wifi_gettxpoweroffset (char *ifname); |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | /* |
|---|
| 40 | * Pass a wlioctl request to the specified interface. |
|---|
| 41 | * @param name interface name |
|---|
| 42 | * @param cmd WLC_GET_MAGIC <= cmd < WLC_LAST |
|---|
| 43 | * @param buf buffer for passing in and/or receiving data |
|---|
| 44 | * @param len length of buf |
|---|
| 45 | * @return >= 0 if successful or < 0 otherwise |
|---|
| 46 | */ |
|---|
| 47 | extern int wl_ioctl (char *name, int cmd, void *buf, int len); |
|---|
| 48 | |
|---|
| 49 | /* |
|---|
| 50 | * Get the MAC (hardware) address of the specified interface. |
|---|
| 51 | * @param name interface name |
|---|
| 52 | * @param hwaddr 6-byte buffer for receiving address |
|---|
| 53 | * @return >= 0 if successful or < 0 otherwise |
|---|
| 54 | */ |
|---|
| 55 | extern int wl_hwaddr (char *name, unsigned char *hwaddr); |
|---|
| 56 | |
|---|
| 57 | /* |
|---|
| 58 | * Probe the specified interface. |
|---|
| 59 | * @param name interface name |
|---|
| 60 | * @return >= 0 if a Broadcom wireless device or < 0 otherwise |
|---|
| 61 | */ |
|---|
| 62 | extern int wl_probe (char *name); |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | /* Returns the list of associated stations in the pre-existing buffer list */ |
|---|
| 66 | int getchannels (unsigned int *list, char *ifname); |
|---|
| 67 | int getassoclist (char *name, unsigned char *list); |
|---|
| 68 | int getwdslist (char *name, unsigned char *list); |
|---|
| 69 | int getNoise (char *ifname, unsigned char *name); |
|---|
| 70 | int getRssi (char *ifname, unsigned char *mac); |
|---|
| 71 | |
|---|
| 72 | #ifdef HAVE_MADWIFI |
|---|
| 73 | int get_radiostate (char *ifname); |
|---|
| 74 | |
|---|
| 75 | int isAssociated (char *ifname); |
|---|
| 76 | |
|---|
| 77 | unsigned int getRegDomain (const char *country); |
|---|
| 78 | unsigned int getCountry (const char *country); |
|---|
| 79 | char *getCountryList (void); |
|---|
| 80 | u_int ieee80211_mhz2ieee (u_int freq); |
|---|
| 81 | |
|---|
| 82 | int wifi_getchannel (char *ifname); |
|---|
| 83 | int wifi_getfreq (char *ifname); |
|---|
| 84 | |
|---|
| 85 | #endif |
|---|
| 86 | /* |
|---|
| 87 | * Set/Get named variable. |
|---|
| 88 | * @param name interface name |
|---|
| 89 | * @param var variable name |
|---|
| 90 | * @param val variable value/buffer |
|---|
| 91 | * @param len variable value/buffer length |
|---|
| 92 | * @return success == 0, failure != 0 |
|---|
| 93 | */ |
|---|
| 94 | extern int wl_set_val (char *name, char *var, void *val, int len); |
|---|
| 95 | extern int wl_get_val (char *name, char *var, void *val, int len); |
|---|
| 96 | extern int wl_set_int (char *name, char *var, int val); |
|---|
| 97 | extern int wl_get_int (char *name, char *var, int *val); |
|---|
| 98 | |
|---|
| 99 | /* |
|---|
| 100 | * Get device type. |
|---|
| 101 | * @param name interface name |
|---|
| 102 | * @param buf buffer for passing in and/or receiving data |
|---|
| 103 | * @param len length of buf |
|---|
| 104 | * @return >= 0 if successful or < 0 otherwise |
|---|
| 105 | */ |
|---|
| 106 | #define DEV_TYPE_LEN 3 /* Length for dev type 'et'/'wl' */ |
|---|
| 107 | extern int wl_get_dev_type (char *name, void *buf, int len); |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | /* |
|---|
| 111 | * Set/Get named variable. |
|---|
| 112 | * @param ifname interface name |
|---|
| 113 | * @param iovar variable name |
|---|
| 114 | * @param param input param value/buffer |
|---|
| 115 | * @param paramlen input param value/buffer length |
|---|
| 116 | * @param bufptr io buffer |
|---|
| 117 | * @param buflen io buffer length |
|---|
| 118 | * @param val val or val pointer for int routines |
|---|
| 119 | * @return success == 0, failure != 0 |
|---|
| 120 | */ |
|---|
| 121 | extern int wl_iovar_setbuf (char *ifname, char *iovar, void *param, |
|---|
| 122 | int paramlen, void *bufptr, int buflen); |
|---|
| 123 | extern int wl_iovar_getbuf (char *ifname, char *iovar, void *param, |
|---|
| 124 | int paramlen, void *bufptr, int buflen); |
|---|
| 125 | extern int wl_iovar_set (char *ifname, char *iovar, void *param, |
|---|
| 126 | int paramlen); |
|---|
| 127 | extern int wl_iovar_get (char *ifname, char *iovar, void *bufptr, int buflen); |
|---|
| 128 | extern int wl_iovar_setint (char *ifname, char *iovar, int val); |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | //extern int wl_iovar_getint (char *ifname, char *iovar, int *val); |
|---|
| 132 | |
|---|
| 133 | extern int wl_bssiovar_setbuf (char *ifname, char *iovar, int bssidx, |
|---|
| 134 | void *param, int paramlen, void *bufptr, |
|---|
| 135 | int buflen); |
|---|
| 136 | extern int wl_bssiovar_getbuf (char *ifname, char *iovar, int bssidx, |
|---|
| 137 | void *param, int paramlen, void *bufptr, |
|---|
| 138 | int buflen); |
|---|
| 139 | extern int wl_bssiovar_get (char *ifname, char *iovar, int bssidx, |
|---|
| 140 | void *outbuf, int len); |
|---|
| 141 | extern int wl_bssiovar_set (char *ifname, char *iovar, int bssidx, |
|---|
| 142 | void *param, int paramlen); |
|---|
| 143 | extern int wl_bssiovar_setint (char *ifname, char *iovar, int bssidx, |
|---|
| 144 | int val); |
|---|
| 145 | |
|---|
| 146 | int wl_getbssid(char *wl, char *mac); |
|---|
| 147 | |
|---|
| 148 | #endif /* _wlutils_h_ */ |
|---|