1/* 2 * Shell-like utility functions 3 * 4 * Copyright (C) 2015, Broadcom Corporation. All Rights Reserved. 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 * $Id: wlif_utils.h 559751 2015-05-28 12:44:43Z $ 19 */ 20 21#ifndef _wlif_utils_h_ 22#define _wlif_utils_h_ 23 24#ifndef IFNAMSIZ 25#define IFNAMSIZ 16 26#endif 27 28#ifndef ETHER_ADDR_LEN 29#define ETHER_ADDR_LEN 6 30#endif 31 32#define WLIFU_MAX_NO_BRIDGE 2 33#define WLIFU_MAX_NO_WAN 2 34 35#define MAX_USER_KEY_LEN 80 /* same as NAS_WKSP_MAX_USER_KEY_LEN */ 36#define MAX_SSID_LEN 32 /* same as DOT11_MAX_SSID_LEN */ 37 38typedef struct wsec_info_s { 39 int unit; /* interface unit */ 40 int ibss; /* IBSS vs. Infrastructure mode */ 41 int gtk_rekey_secs; /* group key rekey interval */ 42 int wep_index; /* wep key index */ 43 int ssn_to; /* ssn timeout value */ 44 int debug; /* verbose - 0:no | others:yes */ 45 int preauth; /* preauth */ 46 int auth_blockout_time; /* update auth blockout retry interval */ 47 unsigned int auth; /* shared key authentication optional (0) or required (1) */ 48 unsigned int akm; /* authentication mode */ 49 unsigned int wsec; /* encryption */ 50 unsigned int flags; /* flags */ 51 char osifname[IFNAMSIZ]; /* interface name */ 52 unsigned char ea[ETHER_ADDR_LEN]; /* interface hw address */ 53 unsigned char remote[ETHER_ADDR_LEN]; /* wds remote address */ 54 unsigned short radius_port; /* radius server port number */ 55 char ssid[MAX_SSID_LEN + 1]; /* ssid info */ 56 char psk[MAX_USER_KEY_LEN + 1]; /* user-supplied psk passphrase */ 57 char *secret; /* user-supplied radius secret */ 58 char *wep_key; /* user-supplied wep key */ 59 char *radius_addr; /* radius server address */ 60 char *nas_id; /* nas mac address */ 61} wsec_info_t; 62 63#define WLIFU_WSEC_SUPPL 0x00000001 /* role is supplicant */ 64#define WLIFU_WSEC_AUTH 0x00000002 /* role is authenticator */ 65#define WLIFU_WSEC_WDS 0x00000004 /* WDS mode */ 66 67#define WLIFU_AUTH_RADIUS 0x20 /* same as nas_mode_t RADIUS in nas.h */ 68 69/* get wsec return code */ 70#define WLIFU_WSEC_SUCCESS 0 71#define WLIFU_ERR_INVALID_PARAMETER 1 72#define WLIFU_ERR_NOT_WL_INTERFACE 2 73#define WLIFU_ERR_NOT_SUPPORT_MODE 4 74#define WLIFU_ERR_WL_REMOTE_HWADDR 3 75#define WLIFU_ERR_WL_WPA_ROLE 5 76 77extern int get_wlname_by_mac(unsigned char *mac, char *wlname); 78extern char *get_ifname_by_wlmac(unsigned char *mac, char *name); 79extern int get_wsec(wsec_info_t *info, unsigned char *mac, char *osifname); 80extern bool wl_wlif_is_psta(char *ifname); 81extern bool wl_wlif_is_dwds(char *ifname); 82extern bool wl_wlif_is_psr_ap(char *ifname); 83#endif /* _wlif_utils_h_ */ 84