usbmodeswitch: Updated to v.1.2.6 from shibby's branch.
[tomato.git] / release / src / router / shared / wlif_utils.h
blobc1aa9638e2b4b6e2b02133158e037dc3bf56f26b
1 /*
2 * Shell-like utility functions
4 * Copyright (C) 2008, 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.
12 * $Id: wlif_utils.h,v 1.3 2008/09/17 23:10:05 Exp $
15 #ifndef _wlif_utils_h_
16 #define _wlif_utils_h_
18 #ifndef IFNAMSIZ
19 #define IFNAMSIZ 16
20 #endif
22 #ifndef ETHER_ADDR_LEN
23 #define ETHER_ADDR_LEN 6
24 #endif
26 #define WLIFU_MAX_NO_BRIDGE 4
27 #define WLIFU_MAX_NO_WAN 2
29 #define MAX_USER_KEY_LEN 80 /* same as NAS_WKSP_MAX_USER_KEY_LEN */
30 #define MAX_SSID_LEN 32 /* same as DOT11_MAX_SSID_LEN */
32 typedef struct wsec_info_s {
33 int unit; /* interface unit */
34 int ibss; /* IBSS vs. Infrastructure mode */
35 int gtk_rekey_secs; /* group key rekey interval */
36 int wep_index; /* wep key index */
37 int ssn_to; /* ssn timeout value */
38 int debug; /* verbose - 0:no | others:yes */
39 int preauth; /* preauth */
40 int auth_blockout_time; /* update auth blockout retry interval */
41 unsigned int auth; /* shared key authentication optional (0) or required (1) */
42 unsigned int akm; /* authentication mode */
43 unsigned int wsec; /* encryption */
44 unsigned int flags; /* flags */
45 char osifname[IFNAMSIZ]; /* interface name */
46 unsigned char ea[ETHER_ADDR_LEN]; /* interface hw address */
47 unsigned char remote[ETHER_ADDR_LEN]; /* wds remote address */
48 unsigned short radius_port; /* radius server port number */
49 char ssid[MAX_SSID_LEN + 1]; /* ssid info */
50 char psk[MAX_USER_KEY_LEN + 1]; /* user-supplied psk passphrase */
51 char *secret; /* user-supplied radius secret */
52 char *wep_key; /* user-supplied wep key */
53 char *radius_addr; /* radius server address */
54 char *nas_id; /* nas mac address */
55 } wsec_info_t;
57 #define WLIFU_WSEC_SUPPL 0x00000001 /* role is supplicant */
58 #define WLIFU_WSEC_AUTH 0x00000002 /* role is authenticator */
59 #define WLIFU_WSEC_WDS 0x00000004 /* WDS mode */
61 #define WLIFU_AUTH_RADIUS 0x20 /* same as nas_mode_t RADIUS in nas.h */
63 /* get wsec return code */
64 #define WLIFU_WSEC_SUCCESS 0
65 #define WLIFU_ERR_INVALID_PARAMETER 1
66 #define WLIFU_ERR_NOT_WL_INTERFACE 2
67 #define WLIFU_ERR_NOT_SUPPORT_MODE 4
68 #define WLIFU_ERR_WL_REMOTE_HWADDR 3
69 #define WLIFU_ERR_WL_WPA_ROLE 5
71 extern int get_spoof_mac(const char *osifname, char *mac, int maclen);
72 extern int get_spoof_ifname(char *mac, char *osifname, int osifnamelen);
73 extern int get_real_mac(char *mac, int maclen);
74 extern int get_lan_mac(unsigned char *mac);
75 extern unsigned char *get_wlmacstr_by_unit(char *unit);
76 extern int get_wlname_by_mac(unsigned char *mac, char *wlname);
77 extern char *get_ifname_by_wlmac(unsigned char *mac, char *name);
79 extern int get_wsec(wsec_info_t *info, char *mac, char *osifname);
81 #endif /* _wlif_utils_h_ */