get rid of $Id$ - it has never helped us and it has broken too many patches ;)
[openwrt.git] / package / nvram / src / include / wlutils.h
1 /*
2  * Broadcom wireless network adapter utility functions
3  *
4  * Copyright 2004, 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
19 /* check this magic number */
20 #define WLC_IOCTL_MAGIC         0x14e46c77
21
22 /* maximum length buffer required */
23 #define WLC_IOCTL_SMLEN         256
24
25 #define WLC_IOCTL_VERSION       1
26
27 #define WLC_GET_MAGIC                           0
28 #define WLC_GET_VERSION                         1
29 #define WLC_GET_VAR                             262     /* get value of named variable */
30 #define WLC_SET_VAR                             263     /* set named variable to value */
31
32 /* Linux network driver ioctl encoding */
33 typedef struct wl_ioctl {
34         uint cmd;       /* common ioctl definition */
35         void *buf;      /* pointer to user buffer */
36         uint len;       /* length of user buffer */
37         bool set;       /* get or set request (optional) */
38         uint used;      /* bytes read or written (optional) */
39         uint needed;    /* bytes needed (optional) */
40 } wl_ioctl_t;
41
42
43 /*
44  * Pass a wlioctl request to the specified interface.
45  * @param       name    interface name
46  * @param       cmd     WLC_GET_MAGIC <= cmd < WLC_LAST
47  * @param       buf     buffer for passing in and/or receiving data
48  * @param       len     length of buf
49  * @return      >= 0 if successful or < 0 otherwise
50  */
51 extern int wl_ioctl(char *name, int cmd, void *buf, int len);
52
53 /*
54  * Get the MAC (hardware) address of the specified interface.
55  * @param       name    interface name
56  * @param       hwaddr  6-byte buffer for receiving address
57  * @return      >= 0 if successful or < 0 otherwise
58  */
59 extern int wl_hwaddr(char *name, unsigned char *hwaddr);
60
61 /*
62  * Probe the specified interface.
63  * @param       name    interface name
64  * @return      >= 0 if a Broadcom wireless device or < 0 otherwise
65  */
66 extern int wl_probe(char *name);
67
68 /*
69  * Set/Get named variable.
70  * @param       name    interface name
71  * @param       var     variable name
72  * @param       val     variable value/buffer
73  * @param       len     variable value/buffer length
74  * @return      success == 0, failure != 0
75  */
76 extern int wl_set_val(char *name, char *var, void *val, int len);
77 extern int wl_get_val(char *name, char *var, void *val, int len);
78 extern int wl_set_int(char *name, char *var, int val);
79 extern int wl_get_int(char *name, char *var, int *val);
80
81 #endif /* _wlutils_h_ */