K2.6 patches and update.
[tomato.git] / release / src-rt / wl / exe / wlu.h
blob20b9d18366d7459ae1cee9460def13ad8fd94890
1 /*
2 * Common code for wl command line utility
4 * Copyright 2002, Broadcom Corporation
5 * All Rights Reserved.
7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 * the contents of this file may not be disclosed to third parties, copied or
9 * duplicated in any form, in whole or in part, without the prior written
10 * permission of Broadcom Corporation.
12 * $Id: wlu.h,v 1.42 2008-12-02 20:43:40 Exp $
15 #ifndef _wlu_h_
16 #define _wlu_h_
18 #include "wlu_cmd.h"
20 extern const char *wlu_av0;
22 /* parse common option */
23 extern int wl_option(char ***pargv, char **pifname, int *phelp);
24 extern void wl_cmd_init(void);
25 extern void wlu_init(void);
27 /* print usage */
28 extern void wl_cmd_usage(FILE *fid, cmd_t *cmd);
29 extern void wl_usage(FILE *fid, cmd_t *port_cmds);
30 extern void wl_cmds_usage(FILE *fid, cmd_t *port_cmds);
32 /* print helpers */
33 extern void wl_printlasterror(void *wl);
34 extern void wl_printint(int val);
36 /* pretty print an SSID */
37 extern int wl_format_ssid(char* buf, uint8* ssid, int ssid_len);
39 /* pretty hex print a contiguous buffer */
40 extern void wl_hexdump(uchar *buf, uint nbytes);
42 /* check driver version */
43 extern int wl_check(void *wl);
45 /* wl functions used by the ndis wl. */
46 extern void dump_rateset(uint8 *rates, uint count);
47 extern uint freq2channel(uint freq);
48 extern int wl_ether_atoe(const char *a, struct ether_addr *n);
49 extern char *wl_ether_etoa(const struct ether_addr *n);
50 struct ipv4_addr; /* forward declaration */
51 extern int wl_atoip(const char *a, struct ipv4_addr *n);
52 extern char *wl_iptoa(const struct ipv4_addr *n);
53 extern cmd_func_t wl_int;
54 extern cmd_func_t wl_varint;
55 extern void wl_dump_raw_ie(bcm_tlv_t *ie, uint len);
57 extern void wl_printlasterror(void *wl);
58 extern bool wc_cmd_check(const char *cmd);
61 #ifdef BCMDLL
62 #ifdef LOCAL
63 extern FILE *dll_fd;
64 #else
65 extern void * dll_fd_out;
66 extern void * dll_fd_in;
67 #endif
68 #undef printf
69 #undef fprintf
70 #define printf printf_to_fprintf /* printf to stdout */
71 #define fprintf fprintf_to_fprintf /* fprintf to stderr */
72 extern void fprintf_to_fprintf(FILE * stderror, const char *fmt, ...);
73 extern void printf_to_fprintf(const char *fmt, ...);
74 extern void raw_puts(const char *buf, void *dll_fd_out);
75 #define fputs(buf, stdout) raw_puts(buf, dll_fd_out)
76 #endif /* BCMDLL */
78 /* useful macros */
79 #ifndef ARRAYSIZE
80 #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
81 #endif /* ARRAYSIZE */
83 /* buffer length needed for wl_format_ssid
84 * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL
86 #define SSID_FMT_BUF_LEN 4*32+1 /* Length for SSID format string */
88 #define USAGE_ERROR -1 /* Error code for Usage */
89 #define IOCTL_ERROR -2 /* Error code for Ioctl failure */
90 #define BAD_PARAM -3 /* Error code for bad params, but don't dump cmd_help */
91 #define CMD_DEPRECATED -4 /* Commands that are functionally deprecated or don't provide
92 * a useful value to a specific OS port of wl
95 /* integer output format */
96 #define INT_FMT_DEC 0 /* signed integer */
97 #define INT_FMT_UINT 1 /* unsigned integer */
98 #define INT_FMT_HEX 2 /* hexdecimal */
100 /* command line argument usage */
101 #define CMD_ERR -1 /* Error for command */
102 #define CMD_OPT 0 /* a command line option */
103 #define CMD_WL 1 /* the start of a wl command */
105 #endif /* _wlu_h_ */