hotplug2: fix "MALLOC FAILURE!" message caused by a missing return code check on...
[openwrt.git] / package / broadcom-wl / src / include / wlutils.h
1 /*
2 * Broadcom wireless network adapter utility functions
3 *
4 * Copyright 2006, 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 */
13
14 #ifndef _wlutils_h_
15 #define _wlutils_h_
16
17 #include <typedefs.h>
18 #include <wlioctl.h>
19
20 /*
21 * Pass a wlioctl request to the specified interface.
22 * @param name interface name
23 * @param cmd WLC_GET_MAGIC <= cmd < WLC_LAST
24 * @param buf buffer for passing in and/or receiving data
25 * @param len length of buf
26 * @return >= 0 if successful or < 0 otherwise
27 */
28 extern int wl_ioctl(char *name, int cmd, void *buf, int len);
29
30 /*
31 * Probe the specified interface.
32 * @param name interface name
33 * @return >= 0 if a Broadcom wireless device or < 0 otherwise
34 */
35 extern int wl_probe(char *name);
36
37 extern int wl_iovar_set(char *ifname, char *iovar, void *param, int paramlen);
38 extern int wl_iovar_get(char *ifname, char *iovar, void *bufptr, int buflen);
39 /*
40 * Set/Get named variable.
41 * @param ifname interface name
42 * @param iovar variable name
43 * @param param input param value/buffer
44 * @param paramlen input param value/buffer length
45 * @param bufptr io buffer
46 * @param buflen io buffer length
47 * @param val val or val pointer for int routines
48 * @return success == 0, failure != 0
49 */
50 /*
51 * set named driver variable to int value
52 * calling example: wl_iovar_setint(ifname, "arate", rate)
53 */
54 static inline int
55 wl_iovar_setint(char *ifname, char *iovar, int val)
56 {
57 return wl_iovar_set(ifname, iovar, &val, sizeof(val));
58 }
59
60 /*
61 * get named driver variable to int value and return error indication
62 * calling example: wl_iovar_getint(ifname, "arate", &rate)
63 */
64 static inline int
65 wl_iovar_getint(char *ifname, char *iovar, int *val)
66 {
67 return wl_iovar_get(ifname, iovar, val, sizeof(int));
68 }
69
70 /*
71 * Set/Get named variable indexed by BSS Configuration
72 * @param ifname interface name
73 * @param iovar variable name
74 * @param bssidx bsscfg index
75 * @param param input param value/buffer
76 * @param paramlen input param value/buffer length
77 * @param bufptr io buffer
78 * @param buflen io buffer length
79 * @param val val or val pointer for int routines
80 * @return success == 0, failure != 0
81 */
82 extern int wl_bssiovar_get(char *ifname, char *iovar, int bssidx, void *outbuf, int len);
83 extern int wl_bssiovar_set(char *ifname, char *iovar, int bssidx, void *param, int paramlen);
84 /*
85 * set named & bss indexed driver variable to int value
86 */
87 static inline int
88 wl_bssiovar_setint(char *ifname, char *iovar, int bssidx, int val)
89 {
90 return wl_bssiovar_set(ifname, iovar, bssidx, &val, sizeof(int));
91 }
92
93 static inline int
94 wl_bssiovar_getint(char *ifname, char *iovar, int bssidx, int *val)
95 {
96 return wl_bssiovar_get(ifname, iovar, bssidx, val, sizeof(int));
97 }
98
99 extern int wl_bssiovar_setint(char *ifname, char *iovar, int bssidx, int val);
100
101 #endif /* _wlutils_h_ */
This page took 0.045804 seconds and 5 git commands to generate.