mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-23 22:34:04 +02:00
allow building of kernel-specific stuff in package/ instead of target/linux/package/ and merge target/linux/package/base-files into package/base-files
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3855 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
cb3150bc97
commit
f21c448c6d
9
Makefile
9
Makefile
@ -38,7 +38,7 @@ endif
|
||||
endif
|
||||
export OPENWRTVERSION
|
||||
|
||||
all:
|
||||
all: world
|
||||
|
||||
.pkginfo: FORCE
|
||||
ifneq ($(shell ./scripts/timestamp.pl -p .pkginfo package Makefile),.pkginfo)
|
||||
@ -79,5 +79,12 @@ target/%: .pkginfo
|
||||
toolchain/%:
|
||||
$(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
|
||||
|
||||
world:
|
||||
$(MAKE) toolchain/install
|
||||
$(MAKE) target/compile
|
||||
$(MAKE) package/compile
|
||||
$(MAKE) package/install
|
||||
$(MAKE) target/install
|
||||
|
||||
.PHONY: FORCE
|
||||
FORCE:
|
||||
|
@ -3,14 +3,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=base-files
|
||||
PKG_RELEASE:=7
|
||||
PKG_RELEASE:=8
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/base-files
|
||||
|
||||
BOARD:=$(shell LANG=C grep ^CONFIG_LINUX_2_._ $(TOPDIR)/.config|sed -e "s/=y//" \
|
||||
-e "s/.*_//"| tr "[:upper:]" "[:lower:]")
|
||||
KERNEL:=$(shell LANG=C grep ^CONFIG_LINUX_2_._ $(TOPDIR)/.config|sed -e "s/=y//" \
|
||||
-e "s/CONFIG_LINUX_//" -e "s/_BRCM//" -e "s/_/./"| tr "[:upper:]" "[:lower:]")
|
||||
|
||||
REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
|
||||
ifeq ($(REV),)
|
||||
REV:=0
|
||||
@ -18,16 +13,23 @@ endif
|
||||
|
||||
include $(TOPDIR)/package/rules.mk
|
||||
|
||||
#FIXME: use the version from ./toolchain/uclibc
|
||||
UCLIBC_VERSION:=0.9.28
|
||||
LIBGCC_VERSION:=$(CONFIG_GCC_VERSION)
|
||||
ifneq ($(DUMP),1)
|
||||
include $(BUILD_DIR)/kernel.mk
|
||||
include $(TOPDIR)/target/linux/rules.mk
|
||||
TARGET:=-$(BOARD)-$(KERNEL)
|
||||
|
||||
define Package/base-files
|
||||
UCLIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_version}
|
||||
LIBGCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version}
|
||||
endif
|
||||
|
||||
CONFIG_PACKAGE_base-files$(TARGET):=CONFIG_PACKAGE_base-files
|
||||
|
||||
define Package/base-files$(TARGET)
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
DEFAULT:=y
|
||||
TITLE:=OpenWrt system scripts
|
||||
DESCRIPTION:=OpenWrt system scripts
|
||||
DESCRIPTION:=Base filesystem for OpenWrt
|
||||
endef
|
||||
|
||||
define Package/libgcc
|
||||
@ -40,7 +42,7 @@ define Package/libgcc
|
||||
endef
|
||||
|
||||
define Package/uclibc
|
||||
$(call Package/base-files)
|
||||
$(call Package/base-files$(TARGET))
|
||||
VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE)
|
||||
TITLE:=C library
|
||||
DESCRIPTION:=C library for embedded systems
|
||||
@ -51,11 +53,35 @@ define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
|
||||
define Build/Compile/ar7
|
||||
$(TARGET_CC) -o $(PKG_BUILD_DIR)/adam2patcher src/adam2patcher.c
|
||||
endef
|
||||
|
||||
define Package/base-files/install
|
||||
define Build/Compile/brcm
|
||||
$(TARGET_CC) -o $(PKG_BUILD_DIR)/jffs2root src/jffs2root.c
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/$(BOARD))
|
||||
endef
|
||||
|
||||
|
||||
define Package/base-files$(TARGET)/install-ar7
|
||||
mkdir -p $(1)/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/adam2patcher $(1)/sbin
|
||||
endef
|
||||
define Package/base-files$(TARGET)/install-brcm
|
||||
mkdir -p $(1)/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/jffs2root $(1)/sbin
|
||||
endef
|
||||
|
||||
define Package/base-files$(TARGET)/install
|
||||
$(call Package/base-files$(TARGET)/install-$(BOARD),$(1))
|
||||
$(CP) ./default/* $(1)
|
||||
if [ -d $(BOARD)-$(KERNEL) ]; then \
|
||||
$(CP) $(BOARD)-$(KERNEL)/* $(1)/; \
|
||||
fi
|
||||
$(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner
|
||||
$(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' $(1)/etc/ipkg.conf
|
||||
mkdir -p $(1)/dev
|
||||
@ -92,6 +118,6 @@ define Package/libgcc/install
|
||||
$(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(1)/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,base-files))
|
||||
$(eval $(call BuildPackage,base-files$(TARGET)))
|
||||
$(eval $(call BuildPackage,libgcc))
|
||||
$(eval $(call BuildPackage,uclibc))
|
||||
|
21
scripts/make-ipkg-dir.sh
Executable file
21
scripts/make-ipkg-dir.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
BASE=http://svn.openwrt.org/openwrt/trunk/openwrt
|
||||
TARGET=$1
|
||||
CONTROL=$2
|
||||
VERSION=$3
|
||||
ARCH=$4
|
||||
|
||||
WD=$(pwd)
|
||||
|
||||
mkdir -p "$TARGET/CONTROL"
|
||||
grep '^[^(Version|Architecture)]' "$CONTROL" > "$TARGET/CONTROL/control"
|
||||
grep '^Maintainer' "$CONTROL" 2>&1 >/dev/null || \
|
||||
echo "Maintainer: OpenWrt Developers Team <openwrt-devel@openwrt.org>" >> "$TARGET/CONTROL/control"
|
||||
grep '^Source' "$CONTROL" 2>&1 >/dev/null || {
|
||||
pkgbase=$(echo "$WD" | sed -e "s|^$TOPDIR/||g")
|
||||
[ "$pkgbase" = "$WD" ] && src="N/A" || src="$BASE/$pkgbase"
|
||||
echo "Source: $src" >> "$TARGET/CONTROL/control"
|
||||
}
|
||||
echo "Version: $VERSION" >> "$TARGET/CONTROL/control"
|
||||
echo "Architecture: $ARCH" >> "$TARGET/CONTROL/control"
|
||||
chmod 644 "$TARGET/CONTROL/control"
|
@ -18,8 +18,6 @@ $(DL_DIR)/$(LINUX_SOURCE):
|
||||
$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
|
||||
-mkdir -p $(LINUX_BUILD_DIR)
|
||||
bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
|
||||
rm -f $(BUILD_DIR)/linux
|
||||
ln -s $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
|
||||
touch $@
|
||||
|
||||
ifeq ($(KERNEL),2.4)
|
||||
@ -83,8 +81,13 @@ $(KERNEL_IPKG):
|
||||
fi
|
||||
$(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR)
|
||||
|
||||
$(BUILD_DIR)/kernel.mk: FORCE
|
||||
echo "BOARD:=$(BOARD)" > $@
|
||||
echo "LINUX_VERSION:=$(LINUX_VERSION)" >> $@
|
||||
echo "LINUX_RELEASE:=$(LINUX_RELEASE)" >> $@
|
||||
|
||||
source: $(DL_DIR)/$(LINUX_SOURCE)
|
||||
prepare:
|
||||
prepare: $(BUILD_DIR)/kernel.mk
|
||||
@mkdir -p $(STAMP_DIR) $(PACKAGE_DIR)
|
||||
@$(MAKE) $(LINUX_DIR)/.configured
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include ../rules.mk
|
||||
|
||||
package-y += base-files
|
||||
package-$(CONFIG_PACKAGE_KMOD_ALSA) += alsa
|
||||
package-$(CONFIG_PACKAGE_KMOD_FUSE) += fuse
|
||||
package-$(CONFIG_PACKAGE_KMOD_HOSTAP) += hostap
|
||||
|
@ -1,66 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME := base-files-arch
|
||||
PKG_RELEASE := 2
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(TOPDIR)/package/rules.mk
|
||||
|
||||
IDIR_OPENWRT:=$(PKG_BUILD_DIR)/ipkg
|
||||
IPKG_OPENWRT:=$(PACKAGE_DIR)/base-files-$(BOARD)-$(KERNEL)_$(PKG_RELEASE)_$(ARCH).ipk
|
||||
|
||||
$(PKG_BUILD_DIR)/.prepared:
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
touch $@
|
||||
|
||||
ifeq ($(BOARD),ar7)
|
||||
$(PKG_BUILD_DIR)/adam2patcher: src/adam2patcher.c
|
||||
$(TARGET_CC) -o $@ $<
|
||||
|
||||
$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/adam2patcher
|
||||
|
||||
$(IDIR_OPENWRT)/sbin/adam2patcher: $(PKG_BUILD_DIR)/adam2patcher
|
||||
mkdir -p $(IDIR_OPENWRT)/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/adam2patcher $(IDIR_OPENWRT)/sbin
|
||||
|
||||
$(IPKG_OPENWRT): $(IDIR_OPENWRT)/sbin/adam2patcher
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD),brcm)
|
||||
$(PKG_BUILD_DIR)/jffs2root: src/jffs2root.c
|
||||
$(TARGET_CC) -o $@ $<
|
||||
|
||||
$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/jffs2root
|
||||
|
||||
$(IDIR_OPENWRT)/sbin/jffs2root: $(PKG_BUILD_DIR)/jffs2root
|
||||
mkdir -p $(IDIR_OPENWRT)/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/jffs2root $(IDIR_OPENWRT)/sbin
|
||||
|
||||
$(IPKG_OPENWRT): $(IDIR_OPENWRT)/sbin/jffs2root
|
||||
endif
|
||||
|
||||
$(PKG_BUILD_DIR)/.built:
|
||||
touch $@
|
||||
|
||||
$(IDIR_OPENWRT):
|
||||
$(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_OPENWRT) ipkg/base-files-arch.control $(PKG_RELEASE) $(ARCH)
|
||||
$(SED) s,base-files-arch,base-files-$(BOARD)-$(KERNEL),g $(IDIR_OPENWRT)/CONTROL/control
|
||||
|
||||
$(IPKG_OPENWRT): $(IDIR_OPENWRT)
|
||||
[ -d files/$(BOARD)-$(KERNEL) ] && $(CP) -fpR files/$(BOARD)-$(KERNEL)/* $(IDIR_OPENWRT)/
|
||||
find $(IDIR_OPENWRT) -name CVS | xargs rm -rf
|
||||
find $(IDIR_OPENWRT) -name .svn | xargs rm -rf
|
||||
$(RSTRIP) $(IDIR_OPENWRT)
|
||||
$(IPKG_BUILD) $(IDIR_OPENWRT) $(PACKAGE_DIR)
|
||||
|
||||
install-targets: compile openwrt-install
|
||||
|
||||
openwrt-install:
|
||||
$(IPKG) install $(IPKG_OPENWRT)
|
||||
|
||||
compile-targets: install-dev $(IPKG_OPENWRT)
|
||||
install-dev:
|
||||
mkdir -p $(STAGING_DIR)/usr/include
|
||||
$(CP) ./include/[a-z]* $(STAGING_DIR)/usr/include/
|
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* NVRAM variable manipulation
|
||||
*
|
||||
* Copyright 2004, Broadcom Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
|
||||
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _bcmnvram_h_
|
||||
#define _bcmnvram_h_
|
||||
|
||||
#ifndef _LANGUAGE_ASSEMBLY
|
||||
|
||||
#include <typedefs.h>
|
||||
|
||||
struct nvram_header {
|
||||
uint32 magic;
|
||||
uint32 len;
|
||||
uint32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:27 init, mem. test 28, 29-31 reserved */
|
||||
uint32 config_refresh; /* 0:15 config, 16:31 refresh */
|
||||
uint32 config_ncdl; /* ncdl values for memc */
|
||||
};
|
||||
|
||||
struct nvram_tuple {
|
||||
char *name;
|
||||
char *value;
|
||||
struct nvram_tuple *next;
|
||||
};
|
||||
|
||||
/*
|
||||
* Initialize NVRAM access. May be unnecessary or undefined on certain
|
||||
* platforms.
|
||||
*/
|
||||
extern int nvram_init(void *sbh);
|
||||
|
||||
/*
|
||||
* Disable NVRAM access. May be unnecessary or undefined on certain
|
||||
* platforms.
|
||||
*/
|
||||
extern void nvram_exit(void);
|
||||
|
||||
/*
|
||||
* Get the value of an NVRAM variable. The pointer returned may be
|
||||
* invalid after a set.
|
||||
* @param name name of variable to get
|
||||
* @return value of variable or NULL if undefined
|
||||
*/
|
||||
extern char * nvram_get(const char *name);
|
||||
|
||||
/*
|
||||
* Get the value of an NVRAM variable.
|
||||
* @param name name of variable to get
|
||||
* @return value of variable or NUL if undefined
|
||||
*/
|
||||
#define nvram_safe_get(name) (nvram_get(name) ? : "")
|
||||
|
||||
#define nvram_safe_unset(name) ({ \
|
||||
if(nvram_get(name)) \
|
||||
nvram_unset(name); \
|
||||
})
|
||||
|
||||
#define nvram_safe_set(name, value) ({ \
|
||||
if(!nvram_get(name) || strcmp(nvram_get(name), value)) \
|
||||
nvram_set(name, value); \
|
||||
})
|
||||
|
||||
/*
|
||||
* Match an NVRAM variable.
|
||||
* @param name name of variable to match
|
||||
* @param match value to compare against value of variable
|
||||
* @return TRUE if variable is defined and its value is string equal
|
||||
* to match or FALSE otherwise
|
||||
*/
|
||||
static INLINE int
|
||||
nvram_match(char *name, char *match) {
|
||||
const char *value = nvram_get(name);
|
||||
return (value && !strcmp(value, match));
|
||||
}
|
||||
|
||||
/*
|
||||
* Inversely match an NVRAM variable.
|
||||
* @param name name of variable to match
|
||||
* @param match value to compare against value of variable
|
||||
* @return TRUE if variable is defined and its value is not string
|
||||
* equal to invmatch or FALSE otherwise
|
||||
*/
|
||||
static INLINE int
|
||||
nvram_invmatch(char *name, char *invmatch) {
|
||||
const char *value = nvram_get(name);
|
||||
return (value && strcmp(value, invmatch));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the value of an NVRAM variable. The name and value strings are
|
||||
* copied into private storage. Pointers to previously set values
|
||||
* may become invalid. The new value may be immediately
|
||||
* retrieved but will not be permanently stored until a commit.
|
||||
* @param name name of variable to set
|
||||
* @param value value of variable
|
||||
* @return 0 on success and errno on failure
|
||||
*/
|
||||
extern int nvram_set(const char *name, const char *value);
|
||||
|
||||
/*
|
||||
* Unset an NVRAM variable. Pointers to previously set values
|
||||
* remain valid until a set.
|
||||
* @param name name of variable to unset
|
||||
* @return 0 on success and errno on failure
|
||||
* NOTE: use nvram_commit to commit this change to flash.
|
||||
*/
|
||||
extern int nvram_unset(const char *name);
|
||||
|
||||
/*
|
||||
* Commit NVRAM variables to permanent storage. All pointers to values
|
||||
* may be invalid after a commit.
|
||||
* NVRAM values are undefined after a commit.
|
||||
* @return 0 on success and errno on failure
|
||||
*/
|
||||
extern int nvram_commit(void);
|
||||
|
||||
/*
|
||||
* Get all NVRAM variables (format name=value\0 ... \0\0).
|
||||
* @param buf buffer to store variables
|
||||
* @param count size of buffer in bytes
|
||||
* @return 0 on success and errno on failure
|
||||
*/
|
||||
extern int nvram_getall(char *buf, int count);
|
||||
|
||||
extern int file2nvram(char *filename, char *varname);
|
||||
extern int nvram2file(char *varname, char *filename);
|
||||
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
|
||||
#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
|
||||
#define NVRAM_VERSION 1
|
||||
#define NVRAM_HEADER_SIZE 20
|
||||
#define NVRAM_SPACE 0x8000
|
||||
#define FLASH_BASE 0xbfc00000 /* Extif core */
|
||||
#define FLASH_MIN 0x00100000 /* Minimum flash size */
|
||||
#define FLASH_MAX 0x00400000 /* Maximum flash size with extif */
|
||||
|
||||
#endif /* _bcmnvram_h_ */
|
@ -1,157 +0,0 @@
|
||||
/*
|
||||
* Misc useful os-independent macros and functions.
|
||||
*
|
||||
* Copyright 2004, Broadcom Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
|
||||
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _bcmutils_h_
|
||||
#define _bcmutils_h_
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#define CEIL(x, y) (((x) + ((y)-1)) / (y))
|
||||
#define ROUNDUP(x, y) ((((ulong)(x)+((y)-1))/(y))*(y))
|
||||
#define ISALIGNED(a, x) (((uint)(a) & ((x)-1)) == 0)
|
||||
#define ISPOWEROF2(x) ((((x)-1)&(x))==0)
|
||||
#define OFFSETOF(type, member) ((uint) &((type *)0)->member)
|
||||
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
/* bit map related macros */
|
||||
#ifndef setbit
|
||||
#define NBBY 8 /* 8 bits per byte */
|
||||
#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
|
||||
#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
|
||||
#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
|
||||
#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
|
||||
#endif
|
||||
|
||||
#define NBITS(type) (sizeof (type) * 8)
|
||||
|
||||
#define _BCM_U 0x01 /* upper */
|
||||
#define _BCM_L 0x02 /* lower */
|
||||
#define _BCM_D 0x04 /* digit */
|
||||
#define _BCM_C 0x08 /* cntrl */
|
||||
#define _BCM_P 0x10 /* punct */
|
||||
#define _BCM_S 0x20 /* white space (space/lf/tab) */
|
||||
#define _BCM_X 0x40 /* hex digit */
|
||||
#define _BCM_SP 0x80 /* hard space (0x20) */
|
||||
|
||||
extern unsigned char bcm_ctype[];
|
||||
#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)])
|
||||
|
||||
#define bcm_isalnum(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L|_BCM_D)) != 0)
|
||||
#define bcm_isalpha(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L)) != 0)
|
||||
#define bcm_iscntrl(c) ((bcm_ismask(c)&(_BCM_C)) != 0)
|
||||
#define bcm_isdigit(c) ((bcm_ismask(c)&(_BCM_D)) != 0)
|
||||
#define bcm_isgraph(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D)) != 0)
|
||||
#define bcm_islower(c) ((bcm_ismask(c)&(_BCM_L)) != 0)
|
||||
#define bcm_isprint(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D|_BCM_SP)) != 0)
|
||||
#define bcm_ispunct(c) ((bcm_ismask(c)&(_BCM_P)) != 0)
|
||||
#define bcm_isspace(c) ((bcm_ismask(c)&(_BCM_S)) != 0)
|
||||
#define bcm_isupper(c) ((bcm_ismask(c)&(_BCM_U)) != 0)
|
||||
#define bcm_isxdigit(c) ((bcm_ismask(c)&(_BCM_D|_BCM_X)) != 0)
|
||||
|
||||
/*
|
||||
* Spin at most 'us' microseconds while 'exp' is true.
|
||||
* Caller should explicitly test 'exp' when this completes
|
||||
* and take appropriate error action if 'exp' is still true.
|
||||
*/
|
||||
#define SPINWAIT(exp, us) { \
|
||||
uint countdown = (us) + 9; \
|
||||
while ((exp) && (countdown >= 10)) {\
|
||||
OSL_DELAY(10); \
|
||||
countdown -= 10; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* generic osl packet queue */
|
||||
struct pktq {
|
||||
void *head; /* first packet to dequeue */
|
||||
void *tail; /* last packet to dequeue */
|
||||
uint len; /* number of queued packets */
|
||||
uint maxlen; /* maximum number of queued packets */
|
||||
bool priority; /* enqueue by packet priority */
|
||||
};
|
||||
#define DEFAULT_QLEN 128
|
||||
|
||||
#define pktq_len(q) ((q)->len)
|
||||
#define pktq_avail(q) ((q)->maxlen - (q)->len)
|
||||
#define pktq_head(q) ((q)->head)
|
||||
#define pktq_full(q) ((q)->len >= (q)->maxlen)
|
||||
|
||||
/* crc defines */
|
||||
#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */
|
||||
#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */
|
||||
#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */
|
||||
#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */
|
||||
#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
|
||||
#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
|
||||
|
||||
/* tag_ID/length/value_buffer tuple */
|
||||
typedef struct bcm_tlv {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 data[1];
|
||||
} bcm_tlv_t;
|
||||
|
||||
/* Check that bcm_tlv_t fits into the given buflen */
|
||||
#define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (buflen) >= 2 + (elt)->len)
|
||||
|
||||
/* buffer length for ethernet address from bcm_ether_ntoa() */
|
||||
#define ETHER_ADDR_STR_LEN 18
|
||||
|
||||
/*
|
||||
* load 32-bit value from unaligned byte array
|
||||
*/
|
||||
#ifdef IL_BIGENDIAN
|
||||
#define load32_ua(a) ((((uint8 *)(a))[0] << 24) + (((uint8 *)(a))[1] << 16) + \
|
||||
(((uint8 *)(a))[2] << 8) + ((uint8 *)(a))[3])
|
||||
#else
|
||||
#define load32_ua(a) ((((uint8 *)(a))[3] << 24) + (((uint8 *)(a))[2] << 16) + \
|
||||
(((uint8 *)(a))[1] << 8) + ((uint8 *)(a))[0])
|
||||
#endif
|
||||
|
||||
/* externs */
|
||||
extern uint bcm_atoi(char *s);
|
||||
extern uchar bcm_toupper(uchar c);
|
||||
extern ulong bcm_strtoul(char *cp, char **endp, uint base);
|
||||
extern void deadbeef(char *p, uint len);
|
||||
extern void prhex(char *msg, uchar *buf, uint len);
|
||||
extern void prpkt(char *msg, void *drv, void *p0);
|
||||
extern uint pktcopy(void *drv, void *p, uint offset, int len, uchar *buf);
|
||||
extern uint pkttotlen(void *drv, void *);
|
||||
extern uchar *bcm_ether_ntoa(char *ea, char *buf);
|
||||
extern int bcm_ether_atoe(char *p, char *ea);
|
||||
extern void bcm_mdelay(uint ms);
|
||||
extern char *getvar(char *vars, char *name);
|
||||
extern int getintvar(char *vars, char *name);
|
||||
extern char *bcmstrstr(char *haystack, char *needle);
|
||||
|
||||
extern uint8 crc8(uint8 *p, uint nbytes, uint8 crc);
|
||||
extern uint16 crc16(uint8 *p, uint nbytes, uint16 crc);
|
||||
extern uint32 crc32(uint8 *p, uint nbytes, uint32 crc);
|
||||
extern bcm_tlv_t *bcm_next_tlv(bcm_tlv_t *elt, int *buflen);
|
||||
extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key);
|
||||
extern bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key);
|
||||
extern void pktq_init(struct pktq *q, uint maxlen, bool priority);
|
||||
extern bool pktenq(struct pktq *q, void *p, bool lifo);
|
||||
extern void *pktdeq(struct pktq *q);
|
||||
|
||||
#define bcmlog(fmt, a1, a2)
|
||||
#define bcmdumplog(buf, size) *buf = '\0'
|
||||
#define bcmdumplogent(buf, idx) -1
|
||||
|
||||
#endif /* _bcmutils_h_ */
|
@ -1,69 +0,0 @@
|
||||
|
||||
#define DNSMASQ_SUPPORT 1
|
||||
#define CONFIG_DNSMASQ y
|
||||
#define UDHCPD_SUPPORT 1
|
||||
#define CONFIG_UDHCPD y
|
||||
#define UDHCPC_SUPPORT 1
|
||||
#define CONFIG_UDHCPC y
|
||||
#define PPPOE_SUPPORT 1
|
||||
#define CONFIG_PPPOE y
|
||||
#define PPTP_SUPPORT 1
|
||||
#define CONFIG_PPTP y
|
||||
#define L2TP_SUPPORT 1
|
||||
#define CONFIG_L2TP y
|
||||
#define PPPD_SUPPORT 1
|
||||
#define CONFIG_PPPD y
|
||||
#define ZEBRA_SUPPORT 1
|
||||
#define CONFIG_ZEBRA y
|
||||
#define TFTPD_SUPPORT 1
|
||||
#define CONFIG_TFTPD y
|
||||
#define DDNS_SUPPORT 1
|
||||
#define CONFIG_DDNS y
|
||||
#define CRON_SUPPORT 1
|
||||
#define CONFIG_CRON y
|
||||
#define HTTPD_SUPPORT 1
|
||||
#define CONFIG_HTTPD y
|
||||
#define GET_POST_SUPPORT 1
|
||||
#define CONFIG_GET_POST y
|
||||
|
||||
#if 1
|
||||
#define HEARTBEAT_SUPPORT 1
|
||||
#define CONFIG_HEARTBEAT y
|
||||
#define MULTICAST_SUPPORT 1
|
||||
#define CONFIG_MULTICAST y
|
||||
#define SETUP_WIZARD_SUPPORT 1
|
||||
#define CONFIG_SETUP_WIZARD y
|
||||
#define PARENTAL_CONTROL_SUPPORT 1
|
||||
#define CONFIG_PARENTAL_CONTROL y
|
||||
#define HTTPS_SUPPORT 1
|
||||
#define CONFIG_HTTPS y
|
||||
#define EOU_SUPPORT 1
|
||||
#define CONFIG_EOU y
|
||||
#define EZC_SUPPORT 1
|
||||
#define CONFIG_EZC y
|
||||
#define WRITE_MAC_SUPPORT 1
|
||||
#define CONFIG_WRITE_MAC y
|
||||
#define DIAG_SUPPORT 1
|
||||
#define CONFIG_DIAG y
|
||||
#endif
|
||||
|
||||
#define SPEED_BOOSTER_SUPPORT 1
|
||||
#define CONFIG_SPEED_BOOSTER y
|
||||
#define XBOX_SUPPORT 1
|
||||
#define CONFIG_XBOX y
|
||||
|
||||
#if 0
|
||||
#define MPPPOE_SUPPORT 1
|
||||
#define CONFIG_MPPPOE y
|
||||
#define UNNUMBERIP_SUPPORT 1
|
||||
#define CONFIG_UNNUMBERIP y
|
||||
#endif
|
||||
|
||||
#define WL_STA_SUPPORT 1
|
||||
#define CONFIG_WL_STA y
|
||||
#define BACKUP_RESTORE_SUPPORT 1
|
||||
#define CONFIG_BACKUP_RESTORE y
|
||||
#define PORT_TRIGGER_SUPPORT 1
|
||||
#define CONFIG_PORT_TRIGGER y
|
||||
#define HW_QOS_SUPPORT 1
|
||||
#define CONFIG_HW_QOS y
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004, Broadcom Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
|
||||
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _epivers_h_
|
||||
#define _epivers_h_
|
||||
|
||||
#ifdef linux
|
||||
#include <linux/config.h>
|
||||
#endif
|
||||
|
||||
/* Vendor Name, ASCII, 32 chars max */
|
||||
#ifdef COMPANYNAME
|
||||
#define HPNA_VENDOR COMPANYNAME
|
||||
#else
|
||||
#define HPNA_VENDOR "Broadcom Corporation"
|
||||
#endif
|
||||
|
||||
/* Driver Date, ASCII, 32 chars max */
|
||||
#define HPNA_DRV_BUILD_DATE __DATE__
|
||||
|
||||
/* Hardware Manufacture Date, ASCII, 32 chars max */
|
||||
#define HPNA_HW_MFG_DATE "Not Specified"
|
||||
|
||||
/* See documentation for Device Type values, 32 values max */
|
||||
#ifndef HPNA_DEV_TYPE
|
||||
|
||||
#if defined(CONFIG_BRCM_VJ)
|
||||
#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_DISPLAY }
|
||||
|
||||
#elif defined(CONFIG_BCRM_93725)
|
||||
#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY }
|
||||
|
||||
#else
|
||||
#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_PCINIC }
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !HPNA_DEV_TYPE */
|
||||
|
||||
|
||||
#define EPI_MAJOR_VERSION 3
|
||||
|
||||
#define EPI_MINOR_VERSION 60
|
||||
|
||||
#define EPI_RC_NUMBER 13
|
||||
|
||||
#define EPI_INCREMENTAL_NUMBER 0
|
||||
|
||||
#define EPI_BUILD_NUMBER 0
|
||||
|
||||
#define EPI_VERSION 3,60,13,0
|
||||
|
||||
#define EPI_VERSION_NUM 0x033c0d00
|
||||
|
||||
/* Driver Version String, ASCII, 32 chars max */
|
||||
#define EPI_VERSION_STR "3.60.13.0"
|
||||
#define EPI_ROUTER_VERSION_STR "3.61.13.0"
|
||||
|
||||
#endif /* _epivers_h_ */
|
@ -1,852 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004, Broadcom Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
|
||||
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
|
||||
*
|
||||
* Fundamental types and constants relating to 802.11
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _802_11_H_
|
||||
#define _802_11_H_
|
||||
|
||||
#ifndef _TYPEDEFS_H_
|
||||
#include <typedefs.h>
|
||||
#endif
|
||||
|
||||
#ifndef _NET_ETHERNET_H_
|
||||
#include <proto/ethernet.h>
|
||||
#endif
|
||||
|
||||
/* enable structure packing */
|
||||
#if !defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
/* some platforms require stronger medicine */
|
||||
#if defined(__GNUC__)
|
||||
#define PACKED __attribute__((packed))
|
||||
#else
|
||||
#define PACKED
|
||||
#endif
|
||||
|
||||
|
||||
#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */
|
||||
|
||||
/* Generic 802.11 frame constants */
|
||||
#define DOT11_A3_HDR_LEN 24
|
||||
#define DOT11_A4_HDR_LEN 30
|
||||
#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN
|
||||
#define DOT11_FCS_LEN 4
|
||||
#define DOT11_ICV_LEN 4
|
||||
#define DOT11_ICV_AES_LEN 8
|
||||
#define DOT11_QOS_LEN 2
|
||||
|
||||
#define DOT11_KEY_INDEX_SHIFT 6
|
||||
#define DOT11_IV_LEN 4
|
||||
#define DOT11_IV_TKIP_LEN 8
|
||||
#define DOT11_IV_AES_OCB_LEN 4
|
||||
#define DOT11_IV_AES_CCM_LEN 8
|
||||
|
||||
/* Includes MIC */
|
||||
#define DOT11_MAX_MPDU_BODY_LEN 2304
|
||||
/* A4 header + QoS + CCMP + PDU + ICV + FCS = 2352 */
|
||||
#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \
|
||||
DOT11_QOS_LEN + \
|
||||
DOT11_IV_AES_CCM_LEN + \
|
||||
DOT11_MAX_MPDU_BODY_LEN + \
|
||||
DOT11_ICV_LEN + \
|
||||
DOT11_FCS_LEN)
|
||||
|
||||
#define DOT11_MAX_SSID_LEN 32
|
||||
|
||||
/* dot11RTSThreshold */
|
||||
#define DOT11_DEFAULT_RTS_LEN 2347
|
||||
#define DOT11_MAX_RTS_LEN 2347
|
||||
|
||||
/* dot11FragmentationThreshold */
|
||||
#define DOT11_MIN_FRAG_LEN 256
|
||||
#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength of the attached PHY */
|
||||
#define DOT11_DEFAULT_FRAG_LEN 2346
|
||||
|
||||
/* dot11BeaconPeriod */
|
||||
#define DOT11_MIN_BEACON_PERIOD 1
|
||||
#define DOT11_MAX_BEACON_PERIOD 0xFFFF
|
||||
|
||||
/* dot11DTIMPeriod */
|
||||
#define DOT11_MIN_DTIM_PERIOD 1
|
||||
#define DOT11_MAX_DTIM_PERIOD 0xFF
|
||||
|
||||
/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */
|
||||
#define DOT11_LLC_SNAP_HDR_LEN 8
|
||||
#define DOT11_OUI_LEN 3
|
||||
struct dot11_llc_snap_header {
|
||||
uint8 dsap; /* always 0xAA */
|
||||
uint8 ssap; /* always 0xAA */
|
||||
uint8 ctl; /* always 0x03 */
|
||||
uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00
|
||||
Bridge-Tunnel: 0x00 0x00 0xF8 */
|
||||
uint16 type; /* ethertype */
|
||||
} PACKED;
|
||||
|
||||
/* RFC1042 header used by 802.11 per 802.1H */
|
||||
#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN)
|
||||
|
||||
/* Generic 802.11 MAC header */
|
||||
/*
|
||||
* N.B.: This struct reflects the full 4 address 802.11 MAC header.
|
||||
* The fields are defined such that the shorter 1, 2, and 3
|
||||
* address headers just use the first k fields.
|
||||
*/
|
||||
struct dot11_header {
|
||||
uint16 fc; /* frame control */
|
||||
uint16 durid; /* duration/ID */
|
||||
struct ether_addr a1; /* address 1 */
|
||||
struct ether_addr a2; /* address 2 */
|
||||
struct ether_addr a3; /* address 3 */
|
||||
uint16 seq; /* sequence control */
|
||||
struct ether_addr a4; /* address 4 */
|
||||
} PACKED;
|
||||
|
||||
/* Control frames */
|
||||
|
||||
struct dot11_rts_frame {
|
||||
uint16 fc; /* frame control */
|
||||
uint16 durid; /* duration/ID */
|
||||
struct ether_addr ra; /* receiver address */
|
||||
struct ether_addr ta; /* transmitter address */
|
||||
} PACKED;
|
||||
#define DOT11_RTS_LEN 16
|
||||
|
||||
struct dot11_cts_frame {
|
||||
uint16 fc; /* frame control */
|
||||
uint16 durid; /* duration/ID */
|
||||
struct ether_addr ra; /* receiver address */
|
||||
} PACKED;
|
||||
#define DOT11_CTS_LEN 10
|
||||
|
||||
struct dot11_ack_frame {
|
||||
uint16 fc; /* frame control */
|
||||
uint16 durid; /* duration/ID */
|
||||
struct ether_addr ra; /* receiver address */
|
||||
} PACKED;
|
||||
#define DOT11_ACK_LEN 10
|
||||
|
||||
struct dot11_ps_poll_frame {
|
||||
uint16 fc; /* frame control */
|
||||
uint16 durid; /* AID */
|
||||
struct ether_addr bssid; /* receiver address, STA in AP */
|
||||
struct ether_addr ta; /* transmitter address */
|
||||
} PACKED;
|
||||
#define DOT11_PS_POLL_LEN 16
|
||||
|
||||
struct dot11_cf_end_frame {
|
||||
uint16 fc; /* frame control */
|
||||
uint16 durid; /* duration/ID */
|
||||
struct ether_addr ra; /* receiver address */
|
||||
struct ether_addr bssid; /* transmitter address, STA in AP */
|
||||
} PACKED;
|
||||
#define DOT11_CS_END_LEN 16
|
||||
|
||||
/* Management frame header */
|
||||
struct dot11_management_header {
|
||||
uint16 fc; /* frame control */
|
||||
uint16 durid; /* duration/ID */
|
||||
struct ether_addr da; /* receiver address */
|
||||
struct ether_addr sa; /* transmitter address */
|
||||
struct ether_addr bssid; /* BSS ID */
|
||||
uint16 seq; /* sequence control */
|
||||
} PACKED;
|
||||
#define DOT11_MGMT_HDR_LEN 24
|
||||
|
||||
/* Management frame payloads */
|
||||
|
||||
struct dot11_bcn_prb {
|
||||
uint32 timestamp[2];
|
||||
uint16 beacon_interval;
|
||||
uint16 capability;
|
||||
} PACKED;
|
||||
#define DOT11_BCN_PRB_LEN 12
|
||||
|
||||
struct dot11_auth {
|
||||
uint16 alg; /* algorithm */
|
||||
uint16 seq; /* sequence control */
|
||||
uint16 status; /* status code */
|
||||
} PACKED;
|
||||
#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge info elt */
|
||||
|
||||
struct dot11_assoc_req {
|
||||
uint16 capability; /* capability information */
|
||||
uint16 listen; /* listen interval */
|
||||
} PACKED;
|
||||
|
||||
struct dot11_assoc_resp {
|
||||
uint16 capability; /* capability information */
|
||||
uint16 status; /* status code */
|
||||
uint16 aid; /* association ID */
|
||||
} PACKED;
|
||||
|
||||
struct dot11_action_measure {
|
||||
uint8 category;
|
||||
uint8 action;
|
||||
uint8 token;
|
||||
uint8 data[1];
|
||||
} PACKED;
|
||||
#define DOT11_ACTION_MEASURE_LEN 3
|
||||
|
||||
/**************
|
||||
802.11h related definitions.
|
||||
**************/
|
||||
typedef struct {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 power;
|
||||
} dot11_power_cnst_t;
|
||||
|
||||
typedef struct {
|
||||
uint8 min;
|
||||
uint8 max;
|
||||
} dot11_power_cap_t;
|
||||
|
||||
typedef struct {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 tx_pwr;
|
||||
uint8 margin;
|
||||
} dot11_tpc_rep_t;
|
||||
#define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */
|
||||
|
||||
typedef struct {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 first_channel;
|
||||
uint8 num_channels;
|
||||
} dot11_supp_channels_t;
|
||||
|
||||
struct dot11_channel_switch {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 mode;
|
||||
uint8 channel;
|
||||
uint8 count;
|
||||
} PACKED;
|
||||
typedef struct dot11_channel_switch dot11_channel_switch_t;
|
||||
|
||||
/* 802.11h Measurement Request/Report IEs */
|
||||
/* Measurement Type field */
|
||||
#define DOT11_MEASURE_TYPE_BASIC 0
|
||||
#define DOT11_MEASURE_TYPE_CCA 1
|
||||
#define DOT11_MEASURE_TYPE_RPI 2
|
||||
|
||||
/* Measurement Mode field */
|
||||
|
||||
/* Measurement Request Modes */
|
||||
#define DOT11_MEASURE_MODE_ENABLE (1<<1)
|
||||
#define DOT11_MEASURE_MODE_REQUEST (1<<2)
|
||||
#define DOT11_MEASURE_MODE_REPORT (1<<3)
|
||||
/* Measurement Report Modes */
|
||||
#define DOT11_MEASURE_MODE_LATE (1<<0)
|
||||
#define DOT11_MEASURE_MODE_INCAPABLE (1<<1)
|
||||
#define DOT11_MEASURE_MODE_REFUSED (1<<2)
|
||||
/* Basic Measurement Map bits */
|
||||
#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0))
|
||||
#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1))
|
||||
#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2))
|
||||
#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3))
|
||||
#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4))
|
||||
|
||||
typedef struct {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 token;
|
||||
uint8 mode;
|
||||
uint8 type;
|
||||
uint8 channel;
|
||||
uint8 start_time[8];
|
||||
uint16 duration;
|
||||
} dot11_meas_req_t;
|
||||
#define DOT11_MNG_IE_MREQ_LEN 14
|
||||
/* length of Measure Request IE data not including variable len */
|
||||
#define DOT11_MNG_IE_MREQ_FIXED_LEN 3
|
||||
|
||||
struct dot11_meas_rep {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 token;
|
||||
uint8 mode;
|
||||
uint8 type;
|
||||
union
|
||||
{
|
||||
struct {
|
||||
uint8 channel;
|
||||
uint8 start_time[8];
|
||||
uint16 duration;
|
||||
uint8 map;
|
||||
} PACKED basic;
|
||||
uint8 data[1];
|
||||
} PACKED rep;
|
||||
} PACKED;
|
||||
typedef struct dot11_meas_rep dot11_meas_rep_t;
|
||||
|
||||
/* length of Measure Report IE data not including variable len */
|
||||
#define DOT11_MNG_IE_MREP_FIXED_LEN 3
|
||||
|
||||
struct dot11_meas_rep_basic {
|
||||
uint8 channel;
|
||||
uint8 start_time[8];
|
||||
uint16 duration;
|
||||
uint8 map;
|
||||
} PACKED;
|
||||
typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
|
||||
#define DOT11_MEASURE_BASIC_REP_LEN 12
|
||||
|
||||
struct dot11_quiet {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 count; /* TBTTs until beacon interval in quiet starts */
|
||||
uint8 period; /* Beacon intervals between periodic quiet periods ? */
|
||||
uint16 duration;/* Length of quiet period, in TU's */
|
||||
uint16 offset; /* TU's offset from TBTT in Count field */
|
||||
} PACKED;
|
||||
typedef struct dot11_quiet dot11_quiet_t;
|
||||
|
||||
typedef struct {
|
||||
uint8 channel;
|
||||
uint8 map;
|
||||
} chan_map_tuple_t;
|
||||
|
||||
typedef struct {
|
||||
uint8 id;
|
||||
uint8 len;
|
||||
uint8 eaddr[ETHER_ADDR_LEN];
|
||||
uint8 interval;
|
||||
chan_map_tuple_t map[1];
|
||||
} dot11_ibss_dfs_t;
|
||||
|
||||
/* WME Elements */
|
||||
#define WME_OUI "\x00\x50\xf2"
|
||||
#define WME_VER 1
|
||||
#define WME_TYPE 2
|
||||
#define WME_SUBTYPE_IE 0 /* Information Element */
|
||||
#define WME_SUBTYPE_PARAM_IE 1 /* Parameter Element */
|
||||
#define WME_SUBTYPE_TSPEC 2 /* Traffic Specification */
|
||||
|
||||
/* WME Access Category Indices (ACIs) */
|
||||
#define AC_BE 0 /* Best Effort */
|
||||
#define AC_BK 1 /* Background */
|
||||
#define AC_VI 2 /* Video */
|
||||
#define AC_VO 3 /* Voice */
|
||||
#define AC_MAX 4
|
||||
|
||||
/* WME Information Element (IE) */
|
||||
struct wme_ie {
|
||||
uint8 oui[3];
|
||||
uint8 type;
|
||||
uint8 subtype;
|
||||
uint8 version;
|
||||
uint8 acinfo;
|
||||
} PACKED;
|
||||
typedef struct wme_ie wme_ie_t;
|
||||
#define WME_IE_LEN 7
|
||||
|
||||
struct wme_acparam {
|
||||
uint8 ACI;
|
||||
uint8 ECW;
|
||||
uint16 TXOP; /* stored in network order (ls octet first) */
|
||||
} PACKED;
|
||||
typedef struct wme_acparam wme_acparam_t;
|
||||
|
||||
/* WME Parameter Element (PE) */
|
||||
struct wme_params {
|
||||
uint8 oui[3];
|
||||
uint8 type;
|
||||
uint8 subtype;
|
||||
uint8 version;
|
||||
uint8 acinfo;
|
||||
uint8 rsvd;
|
||||
wme_acparam_t acparam[4];
|
||||
} PACKED;
|
||||
typedef struct wme_params wme_params_t;
|
||||
#define WME_PARAMS_IE_LEN 24
|
||||
|
||||
/* acinfo */
|
||||
#define WME_COUNT_MASK 0x0f
|
||||
/* ACI */
|
||||
#define WME_AIFS_MASK 0x0f
|
||||
#define WME_ACM_MASK 0x10
|
||||
#define WME_ACI_MASK 0x60
|
||||
#define WME_ACI_SHIFT 5
|
||||
/* ECW */
|
||||
#define WME_CWMIN_MASK 0x0f
|
||||
#define WME_CWMAX_MASK 0xf0
|
||||
#define WME_CWMAX_SHIFT 4
|
||||
|
||||
#define WME_TXOP_UNITS 32
|
||||
|
||||
/* WME Traffic Specification (TSPEC) element */
|
||||
#define WME_SUBTYPE_TSPEC 2
|
||||
#define WME_TSPEC_HDR_LEN 2
|
||||
#define WME_TSPEC_BODY_OFF 2
|
||||
struct wme_tspec {
|
||||
uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */
|
||||
uint8 type; /* WME_TYPE */
|
||||
uint8 subtype; /* WME_SUBTYPE_TSPEC */
|
||||
uint8 version; /* WME_VERSION */
|
||||
uint16 ts_info; /* TS Info */
|
||||
uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */
|
||||
uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */
|
||||
uint32 min_service_interval; /* Minimum Service Interval (us) */
|
||||
uint32 max_service_interval; /* Maximum Service Interval (us) */
|
||||
uint32 inactivity_interval; /* Inactivity Interval (us) */
|
||||
uint32 service_start; /* Service Start Time (us) */
|
||||
uint32 min_rate; /* Minimum Data Rate (bps) */
|
||||
uint32 mean_rate; /* Mean Data Rate (bps) */
|
||||
uint32 max_burst_size; /* Maximum Burst Size (bytes) */
|
||||
uint32 min_phy_rate; /* Minimum PHY Rate (bps) */
|
||||
uint32 peak_rate; /* Peak Data Rate (bps) */
|
||||
uint32 delay_bound; /* Delay Bound (us) */
|
||||
uint16 surplus_bandwidth; /* Surplus Bandwidth Allowance Factor */
|
||||
uint16 medium_time; /* Medium Time (32 us/s periods) */
|
||||
} PACKED;
|
||||
typedef struct wme_tspec wme_tspec_t;
|
||||
#define WME_TSPEC_LEN 56 /* not including 2-byte header */
|
||||
|
||||
/* ts_info */
|
||||
/* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */
|
||||
#define TS_INFO_PRIO_SHIFT_HI 11
|
||||
#define TS_INFO_PRIO_MASK_HI (0x7 << TS_INFO_PRIO_SHIFT_HI)
|
||||
#define TS_INFO_PRIO_SHIFT_LO 1
|
||||
#define TS_INFO_PRIO_MASK_LO (0x7 << TS_INFO_PRIO_SHIFT_LO)
|
||||
#define TS_INFO_CONTENTION_SHIFT 7
|
||||
#define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT)
|
||||
#define TS_INFO_DIRECTION_SHIFT 5
|
||||
#define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT)
|
||||
#define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT)
|
||||
#define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT)
|
||||
#define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT)
|
||||
|
||||
/* nom_msdu_size */
|
||||
#define FIXED_MSDU_SIZE 0x8000 /* MSDU size is fixed */
|
||||
#define MSDU_SIZE_MASK 0x7fff /* (Nominal or fixed) MSDU size */
|
||||
|
||||
/* surplus_bandwidth */
|
||||
/* Represented as 3 bits of integer, binary point, 13 bits fraction */
|
||||
#define INTEGER_SHIFT 13
|
||||
#define FRACTION_MASK 0x1FFF
|
||||
|
||||
/* Management Notification Frame */
|
||||
struct dot11_management_notification {
|
||||
uint8 category; /* DOT11_ACTION_NOTIFICATION */
|
||||
uint8 action;
|
||||
uint8 token;
|
||||
uint8 status;
|
||||
uint8 data[1]; /* Elements */
|
||||
} PACKED;
|
||||
#define DOT11_MGMT_NOTIFICATION_LEN 4 /* Fixed length */
|
||||
|
||||
/* WME Action Codes */
|
||||
#define WME_SETUP_REQUEST 0
|
||||
#define WME_SETUP_RESPONSE 1
|
||||
#define WME_TEARDOWN 2
|
||||
|
||||
/* WME Setup Response Status Codes */
|
||||
#define WME_ADMISSION_ACCEPTED 0
|
||||
#define WME_INVALID_PARAMETERS 1
|
||||
#define WME_ADMISSION_REFUSED 3
|
||||
|
||||
/* Macro to take a pointer to a beacon or probe response
|
||||
* header and return the char* pointer to the SSID info element
|
||||
*/
|
||||
#define BCN_PRB_SSID(hdr) ((char*)(hdr) + DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_LEN)
|
||||
|
||||
/* Authentication frame payload constants */
|
||||
#define DOT11_OPEN_SYSTEM 0
|
||||
#define DOT11_SHARED_KEY 1
|
||||
#define DOT11_CHALLENGE_LEN 128
|
||||
|
||||
/* Frame control macros */
|
||||
#define FC_PVER_MASK 0x3
|
||||
#define FC_PVER_SHIFT 0
|
||||
#define FC_TYPE_MASK 0xC
|
||||
#define FC_TYPE_SHIFT 2
|
||||
#define FC_SUBTYPE_MASK 0xF0
|
||||
#define FC_SUBTYPE_SHIFT 4
|
||||
#define FC_TODS 0x100
|
||||
#define FC_TODS_SHIFT 8
|
||||
#define FC_FROMDS 0x200
|
||||
#define FC_FROMDS_SHIFT 9
|
||||
#define FC_MOREFRAG 0x400
|
||||
#define FC_MOREFRAG_SHIFT 10
|
||||
#define FC_RETRY 0x800
|
||||
#define FC_RETRY_SHIFT 11
|
||||
#define FC_PM 0x1000
|
||||
#define FC_PM_SHIFT 12
|
||||
#define FC_MOREDATA 0x2000
|
||||
#define FC_MOREDATA_SHIFT 13
|
||||
#define FC_WEP 0x4000
|
||||
#define FC_WEP_SHIFT 14
|
||||
#define FC_ORDER 0x8000
|
||||
#define FC_ORDER_SHIFT 15
|
||||
|
||||
/* sequence control macros */
|
||||
#define SEQNUM_SHIFT 4
|
||||
#define FRAGNUM_MASK 0xF
|
||||
|
||||
/* Frame Control type/subtype defs */
|
||||
|
||||
/* FC Types */
|
||||
#define FC_TYPE_MNG 0
|
||||
#define FC_TYPE_CTL 1
|
||||
#define FC_TYPE_DATA 2
|
||||
|
||||
/* Management Subtypes */
|
||||
#define FC_SUBTYPE_ASSOC_REQ 0
|
||||
#define FC_SUBTYPE_ASSOC_RESP 1
|
||||
#define FC_SUBTYPE_REASSOC_REQ 2
|
||||
#define FC_SUBTYPE_REASSOC_RESP 3
|
||||
#define FC_SUBTYPE_PROBE_REQ 4
|
||||
#define FC_SUBTYPE_PROBE_RESP 5
|
||||
#define FC_SUBTYPE_BEACON 8
|
||||
#define FC_SUBTYPE_ATIM 9
|
||||
#define FC_SUBTYPE_DISASSOC 10
|
||||
#define FC_SUBTYPE_AUTH 11
|
||||
#define FC_SUBTYPE_DEAUTH 12
|
||||
#define FC_SUBTYPE_ACTION 13
|
||||
|
||||
/* Control Subtypes */
|
||||
#define FC_SUBTYPE_PS_POLL 10
|
||||
#define FC_SUBTYPE_RTS 11
|
||||
#define FC_SUBTYPE_CTS 12
|
||||
#define FC_SUBTYPE_ACK 13
|
||||
#define FC_SUBTYPE_CF_END 14
|
||||
#define FC_SUBTYPE_CF_END_ACK 15
|
||||
|
||||
/* Data Subtypes */
|
||||
#define FC_SUBTYPE_DATA 0
|
||||
#define FC_SUBTYPE_DATA_CF_ACK 1
|
||||
#define FC_SUBTYPE_DATA_CF_POLL 2
|
||||
#define FC_SUBTYPE_DATA_CF_ACK_POLL 3
|
||||
#define FC_SUBTYPE_NULL 4
|
||||
#define FC_SUBTYPE_CF_ACK 5
|
||||
#define FC_SUBTYPE_CF_POLL 6
|
||||
#define FC_SUBTYPE_CF_ACK_POLL 7
|
||||
#define FC_SUBTYPE_QOS_DATA 8
|
||||
#define FC_SUBTYPE_QOS_NULL 12
|
||||
|
||||
/* type-subtype combos */
|
||||
#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK)
|
||||
|
||||
#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))
|
||||
|
||||
#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ)
|
||||
#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP)
|
||||
#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ)
|
||||
#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP)
|
||||
#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
|
||||
#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
|
||||
#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)
|
||||
#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC)
|
||||
#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH)
|
||||
#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH)
|
||||
#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION)
|
||||
|
||||
#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)
|
||||
#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)
|
||||
#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)
|
||||
#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK)
|
||||
#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END)
|
||||
#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK)
|
||||
|
||||
#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA)
|
||||
#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL)
|
||||
#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK)
|
||||
#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA)
|
||||
#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL)
|
||||
|
||||
/* QoS Control Field */
|
||||
|
||||
/* 802.1D Tag */
|
||||
#define QOS_PRIO_SHIFT 0
|
||||
#define QOS_PRIO_MASK 0x0007
|
||||
#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT)
|
||||
|
||||
/* Ack Policy (0 means Acknowledge) */
|
||||
#define QOS_ACK_SHIFT 5
|
||||
#define QOS_ACK_MASK 0x0060
|
||||
#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT)
|
||||
|
||||
/* Management Frames */
|
||||
|
||||
/* Management Frame Constants */
|
||||
|
||||
/* Fixed fields */
|
||||
#define DOT11_MNG_AUTH_ALGO_LEN 2
|
||||
#define DOT11_MNG_AUTH_SEQ_LEN 2
|
||||
#define DOT11_MNG_BEACON_INT_LEN 2
|
||||
#define DOT11_MNG_CAP_LEN 2
|
||||
#define DOT11_MNG_AP_ADDR_LEN 6
|
||||
#define DOT11_MNG_LISTEN_INT_LEN 2
|
||||
#define DOT11_MNG_REASON_LEN 2
|
||||
#define DOT11_MNG_AID_LEN 2
|
||||
#define DOT11_MNG_STATUS_LEN 2
|
||||
#define DOT11_MNG_TIMESTAMP_LEN 8
|
||||
|
||||
/* DUR/ID field in assoc resp is 0xc000 | AID */
|
||||
#define DOT11_AID_MASK 0x3fff
|
||||
|
||||
/* Reason Codes */
|
||||
#define DOT11_RC_RESERVED 0
|
||||
#define DOT11_RC_UNSPECIFIED 1 /* Unspecified reason */
|
||||
#define DOT11_RC_AUTH_INVAL 2 /* Previous authentication no longer valid */
|
||||
#define DOT11_RC_DEAUTH_LEAVING 3 /* Deauthenticated because sending station is
|
||||
leaving (or has left) IBSS or ESS */
|
||||
#define DOT11_RC_INACTIVITY 4 /* Disassociated due to inactivity */
|
||||
#define DOT11_RC_BUSY 5 /* Disassociated because AP is unable to handle
|
||||
all currently associated stations */
|
||||
#define DOT11_RC_INVAL_CLASS_2 6 /* Class 2 frame received from
|
||||
nonauthenticated station */
|
||||
#define DOT11_RC_INVAL_CLASS_3 7 /* Class 3 frame received from
|
||||
nonassociated station */
|
||||
#define DOT11_RC_DISASSOC_LEAVING 8 /* Disassociated because sending station is
|
||||
leaving (or has left) BSS */
|
||||
#define DOT11_RC_NOT_AUTH 9 /* Station requesting (re)association is
|
||||
not authenticated with responding station */
|
||||
#define DOT11_RC_MAX 23 /* Reason codes > 23 are reserved */
|
||||
|
||||
/* Status Codes */
|
||||
#define DOT11_STATUS_SUCCESS 0 /* Successful */
|
||||
#define DOT11_STATUS_FAILURE 1 /* Unspecified failure */
|
||||
#define DOT11_STATUS_CAP_MISMATCH 10 /* Cannot support all requested capabilities
|
||||
in the Capability Information field */
|
||||
#define DOT11_STATUS_REASSOC_FAIL 11 /* Reassociation denied due to inability to
|
||||
confirm that association exists */
|
||||
#define DOT11_STATUS_ASSOC_FAIL 12 /* Association denied due to reason outside
|
||||
the scope of this standard */
|
||||
#define DOT11_STATUS_AUTH_MISMATCH 13 /* Responding station does not support the
|
||||
specified authentication algorithm */
|
||||
#define DOT11_STATUS_AUTH_SEQ 14 /* Received an Authentication frame with
|
||||
authentication transaction sequence number
|
||||
out of expected sequence */
|
||||
#define DOT11_STATUS_AUTH_CHALLENGE_FAIL 15 /* Authentication rejected because of challenge failure */
|
||||
#define DOT11_STATUS_AUTH_TIMEOUT 16 /* Authentication rejected due to timeout waiting
|
||||
for next frame in sequence */
|
||||
#define DOT11_STATUS_ASSOC_BUSY_FAIL 17 /* Association denied because AP is unable to
|
||||
handle additional associated stations */
|
||||
#define DOT11_STATUS_ASSOC_RATE_MISMATCH 18 /* Association denied due to requesting station
|
||||
not supporting all of the data rates in the
|
||||
BSSBasicRateSet parameter */
|
||||
#define DOT11_STATUS_ASSOC_SHORT_REQUIRED 19 /* Association denied due to requesting station
|
||||
not supporting the Short Preamble option */
|
||||
#define DOT11_STATUS_ASSOC_PBCC_REQUIRED 20 /* Association denied due to requesting station
|
||||
not supporting the PBCC Modulation option */
|
||||
#define DOT11_STATUS_ASSOC_AGILITY_REQUIRED 21 /* Association denied due to requesting station
|
||||
not supporting the Channel Agility option */
|
||||
#define DOT11_STATUS_ASSOC_SPECTRUM_REQUIRED 22 /* Association denied because Spectrum Management
|
||||
capability is required. */
|
||||
#define DOT11_STATUS_ASSOC_BAD_POWER_CAP 23 /* Association denied because the info in the
|
||||
Power Cap element is unacceptable. */
|
||||
#define DOT11_STATUS_ASSOC_BAD_SUP_CHANNELS 24 /* Association denied because the info in the
|
||||
Supported Channel element is unacceptable */
|
||||
#define DOT11_STATUS_ASSOC_SHORTSLOT_REQUIRED 25 /* Association denied due to requesting station
|
||||
not supporting the Short Slot Time option */
|
||||
#define DOT11_STATUS_ASSOC_ERPBCC_REQUIRED 26 /* Association denied due to requesting station
|
||||
not supporting the ER-PBCC Modulation option */
|
||||
#define DOT11_STATUS_ASSOC_DSSOFDM_REQUIRED 27 /* Association denied due to requesting station
|
||||
not supporting the DSS-OFDM option */
|
||||
|
||||
/* Info Elts, length of INFORMATION portion of Info Elts */
|
||||
#define DOT11_MNG_DS_PARAM_LEN 1
|
||||
#define DOT11_MNG_IBSS_PARAM_LEN 2
|
||||
|
||||
/* TIM Info element has 3 bytes fixed info in INFORMATION field,
|
||||
* followed by 1 to 251 bytes of Partial Virtual Bitmap */
|
||||
#define DOT11_MNG_TIM_FIXED_LEN 3
|
||||
#define DOT11_MNG_TIM_DTIM_COUNT 0
|
||||
#define DOT11_MNG_TIM_DTIM_PERIOD 1
|
||||
#define DOT11_MNG_TIM_BITMAP_CTL 2
|
||||
#define DOT11_MNG_TIM_PVB 3
|
||||
|
||||
/* TLV defines */
|
||||
#define TLV_TAG_OFF 0
|
||||
#define TLV_LEN_OFF 1
|
||||
#define TLV_HDR_LEN 2
|
||||
#define TLV_BODY_OFF 2
|
||||
|
||||
/* Management Frame Information Element IDs */
|
||||
#define DOT11_MNG_SSID_ID 0
|
||||
#define DOT11_MNG_RATES_ID 1
|
||||
#define DOT11_MNG_FH_PARMS_ID 2
|
||||
#define DOT11_MNG_DS_PARMS_ID 3
|
||||
#define DOT11_MNG_CF_PARMS_ID 4
|
||||
#define DOT11_MNG_TIM_ID 5
|
||||
#define DOT11_MNG_IBSS_PARMS_ID 6
|
||||
#define DOT11_MNG_COUNTRY_ID 7
|
||||
#define DOT11_MNG_HOPPING_PARMS_ID 8
|
||||
#define DOT11_MNG_HOPPING_TABLE_ID 9
|
||||
#define DOT11_MNG_REQUEST_ID 10
|
||||
#define DOT11_MNG_CHALLENGE_ID 16
|
||||
#define DOT11_MNG_PWR_CONSTRAINT_ID 32 /* 11H PowerConstraint */
|
||||
#define DOT11_MNG_PWR_CAP_ID 33 /* 11H PowerCapability */
|
||||
#define DOT11_MNG_TPC_REQUEST_ID 34 /* 11H TPC Request */
|
||||
#define DOT11_MNG_TPC_REPORT_ID 35 /* 11H TPC Report */
|
||||
#define DOT11_MNG_SUPP_CHANNELS_ID 36 /* 11H Supported Channels */
|
||||
#define DOT11_MNG_CHANNEL_SWITCH_ID 37 /* 11H ChannelSwitch Announcement*/
|
||||
#define DOT11_MNG_MEASURE_REQUEST_ID 38 /* 11H MeasurementRequest */
|
||||
#define DOT11_MNG_MEASURE_REPORT_ID 39 /* 11H MeasurementReport */
|
||||
#define DOT11_MNG_QUIET_ID 40 /* 11H Quiet */
|
||||
#define DOT11_MNG_IBSS_DFS_ID 41 /* 11H IBSS_DFS */
|
||||
#define DOT11_MNG_ERP_ID 42
|
||||
#define DOT11_MNG_NONERP_ID 47
|
||||
#define DOT11_MNG_EXT_RATES_ID 50
|
||||
#define DOT11_MNG_WPA_ID 221
|
||||
#define DOT11_MNG_PROPR_ID 221
|
||||
|
||||
/* ERP info element bit values */
|
||||
#define DOT11_MNG_ERP_LEN 1 /* ERP is currently 1 byte long */
|
||||
#define DOT11_MNG_NONERP_PRESENT 0x01 /* NonERP (802.11b) STAs are present in the BSS */
|
||||
#define DOT11_MNG_USE_PROTECTION 0x02 /* Use protection mechanisms for ERP-OFDM frames */
|
||||
#define DOT11_MNG_BARKER_PREAMBLE 0x04 /* Short Preambles: 0 == allowed, 1 == not allowed */
|
||||
|
||||
/* Capability Information Field */
|
||||
#define DOT11_CAP_ESS 0x0001
|
||||
#define DOT11_CAP_IBSS 0x0002
|
||||
#define DOT11_CAP_POLLABLE 0x0004
|
||||
#define DOT11_CAP_POLL_RQ 0x0008
|
||||
#define DOT11_CAP_PRIVACY 0x0010
|
||||
#define DOT11_CAP_SHORT 0x0020
|
||||
#define DOT11_CAP_PBCC 0x0040
|
||||
#define DOT11_CAP_AGILITY 0x0080
|
||||
#define DOT11_CAP_SPECTRUM 0x0100
|
||||
#define DOT11_CAP_SHORTSLOT 0x0400
|
||||
#define DOT11_CAP_CCK_OFDM 0x2000
|
||||
|
||||
/* Action Frame Constants */
|
||||
#define DOT11_ACTION_CAT_ERR_MASK 0x80
|
||||
#define DOT11_ACTION_CAT_SPECT_MNG 0x00
|
||||
#define DOT11_ACTION_NOTIFICATION 0x11 /* 17 */
|
||||
|
||||
#define DOT11_ACTION_ID_M_REQ 0
|
||||
#define DOT11_ACTION_ID_M_REP 1
|
||||
#define DOT11_ACTION_ID_TPC_REQ 2
|
||||
#define DOT11_ACTION_ID_TPC_REP 3
|
||||
#define DOT11_ACTION_ID_CHANNEL_SWITCH 4
|
||||
|
||||
/* MLME Enumerations */
|
||||
#define DOT11_BSSTYPE_INFRASTRUCTURE 0
|
||||
#define DOT11_BSSTYPE_INDEPENDENT 1
|
||||
#define DOT11_BSSTYPE_ANY 2
|
||||
#define DOT11_SCANTYPE_ACTIVE 0
|
||||
#define DOT11_SCANTYPE_PASSIVE 1
|
||||
|
||||
/* 802.11 A PHY constants */
|
||||
#define APHY_SLOT_TIME 9
|
||||
#define APHY_SIFS_TIME 16
|
||||
#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME))
|
||||
#define APHY_PREAMBLE_TIME 16
|
||||
#define APHY_SIGNAL_TIME 4
|
||||
#define APHY_SYMBOL_TIME 4
|
||||
#define APHY_SERVICE_NBITS 16
|
||||
#define APHY_TAIL_NBITS 6
|
||||
#define APHY_CWMIN 15
|
||||
|
||||
/* 802.11 B PHY constants */
|
||||
#define BPHY_SLOT_TIME 20
|
||||
#define BPHY_SIFS_TIME 10
|
||||
#define BPHY_DIFS_TIME 50
|
||||
#define BPHY_PLCP_TIME 192
|
||||
#define BPHY_PLCP_SHORT_TIME 96
|
||||
#define BPHY_CWMIN 31
|
||||
|
||||
/* 802.11 G constants */
|
||||
#define DOT11_OFDM_SIGNAL_EXTENSION 6
|
||||
|
||||
#define PHY_CWMAX 1023
|
||||
|
||||
#define DOT11_MAXNUMFRAGS 16 /* max # fragments per MSDU */
|
||||
|
||||
/* dot11Counters Table - 802.11 spec., Annex D */
|
||||
typedef struct d11cnt {
|
||||
uint32 txfrag; /* dot11TransmittedFragmentCount */
|
||||
uint32 txmulti; /* dot11MulticastTransmittedFrameCount */
|
||||
uint32 txfail; /* dot11FailedCount */
|
||||
uint32 txretry; /* dot11RetryCount */
|
||||
uint32 txretrie; /* dot11MultipleRetryCount */
|
||||
uint32 rxdup; /* dot11FrameduplicateCount */
|
||||
uint32 txrts; /* dot11RTSSuccessCount */
|
||||
uint32 txnocts; /* dot11RTSFailureCount */
|
||||
uint32 txnoack; /* dot11ACKFailureCount */
|
||||
uint32 rxfrag; /* dot11ReceivedFragmentCount */
|
||||
uint32 rxmulti; /* dot11MulticastReceivedFrameCount */
|
||||
uint32 rxcrc; /* dot11FCSErrorCount */
|
||||
uint32 txfrmsnt; /* dot11TransmittedFrameCount */
|
||||
uint32 rxundec; /* dot11WEPUndecryptableCount */
|
||||
} d11cnt_t;
|
||||
|
||||
/* BRCM OUI */
|
||||
#define BRCM_OUI "\x00\x10\x18"
|
||||
|
||||
/* BRCM info element */
|
||||
struct brcm_ie {
|
||||
uchar id;
|
||||
uchar len;
|
||||
uchar oui[3];
|
||||
uchar ver;
|
||||
uchar assoc; /* # of assoc STAs */
|
||||
uchar flags; /* misc flags */
|
||||
} PACKED;
|
||||
#define BRCM_IE_LEN 8
|
||||
typedef struct brcm_ie brcm_ie_t;
|
||||
#define BRCM_IE_VER 1
|
||||
|
||||
/* brcm_ie flags */
|
||||
#define BRF_ABCAP 0x1 /* afterburner capable */
|
||||
#define BRF_ABRQRD 0x2 /* afterburner requested */
|
||||
|
||||
/* WPA definitions */
|
||||
#define WPA_VERSION 1
|
||||
#define WPA_OUI "\x00\x50\xF2"
|
||||
|
||||
#define WPA_OUI_LEN 3
|
||||
|
||||
/* WPA authentication modes */
|
||||
#define WPA_AUTH_NONE 0 /* None */
|
||||
#define WPA_AUTH_UNSPECIFIED 1 /* Unspecified authentication over 802.1X: default for WPA */
|
||||
#define WPA_AUTH_PSK 2 /* Pre-shared Key over 802.1X */
|
||||
#define WPA_AUTH_DISABLED 255 /* Legacy (i.e., non-WPA) */
|
||||
|
||||
#define IS_WPA_AUTH(auth) ((auth) == WPA_AUTH_NONE || \
|
||||
(auth) == WPA_AUTH_UNSPECIFIED || \
|
||||
(auth) == WPA_AUTH_PSK)
|
||||
|
||||
|
||||
/* Key related defines */
|
||||
#define DOT11_MAX_DEFAULT_KEYS 4 /* number of default keys */
|
||||
#define DOT11_MAX_KEY_SIZE 32 /* max size of any key */
|
||||
#define DOT11_MAX_IV_SIZE 16 /* max size of any IV */
|
||||
#define DOT11_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */
|
||||
|
||||
#define WEP1_KEY_SIZE 5 /* max size of any WEP key */
|
||||
#define WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */
|
||||
#define WEP128_KEY_SIZE 13 /* max size of any WEP key */
|
||||
#define WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */
|
||||
#define TKIP_MIC_SIZE 8 /* size of TKIP MIC */
|
||||
#define TKIP_EOM_SIZE 7 /* max size of TKIP EOM */
|
||||
#define TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */
|
||||
#define TKIP_KEY_SIZE 32 /* size of any TKIP key */
|
||||
#define TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */
|
||||
#define TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */
|
||||
#define TKIP_MIC_SUP_RX 16 /* offset to Supplicant MIC RX key */
|
||||
#define TKIP_MIC_SUP_TX 24 /* offset to Supplicant MIC TX key */
|
||||
#define AES_KEY_SIZE 16 /* size of AES key */
|
||||
|
||||
#undef PACKED
|
||||
#if !defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#endif /* _802_11_H_ */
|
@ -1,179 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* $Id$
|
||||
* Copyright 2004, Broadcom Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
|
||||
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
|
||||
* From FreeBSD 2.2.7: Fundamental constants relating to ethernet.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */
|
||||
#define _NET_ETHERNET_H_
|
||||
|
||||
#ifndef _TYPEDEFS_H_
|
||||
#include "typedefs.h"
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define PACKED __attribute__((packed))
|
||||
#else
|
||||
#define PACKED
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The number of bytes in an ethernet (MAC) address.
|
||||
*/
|
||||
#ifndef ETHER_ADDR_LEN
|
||||
#define ETHER_ADDR_LEN 6
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The number of bytes in the type field.
|
||||
*/
|
||||
#ifndef ETHER_TYPE_LEN
|
||||
#define ETHER_TYPE_LEN 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The number of bytes in the trailing CRC field.
|
||||
*/
|
||||
#ifndef ETHER_CRC_LEN
|
||||
#define ETHER_CRC_LEN 4
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The length of the combined header.
|
||||
*/
|
||||
#ifndef ETHER_HDR_LEN
|
||||
#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The minimum packet length.
|
||||
*/
|
||||
#ifndef ETHER_MIN_LEN
|
||||
#define ETHER_MIN_LEN 64
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The minimum packet user data length.
|
||||
*/
|
||||
#ifndef ETHER_MIN_DATA
|
||||
#define ETHER_MIN_DATA 46
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The maximum packet length.
|
||||
*/
|
||||
#ifndef ETHER_MAX_LEN
|
||||
#define ETHER_MAX_LEN 1518
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The maximum packet user data length.
|
||||
*/
|
||||
#define ETHER_MAX_DATA 1500
|
||||
|
||||
/*
|
||||
* Used to uniquely identify a 802.1q VLAN-tagged header.
|
||||
*/
|
||||
#define VLAN_TAG 0x8100
|
||||
|
||||
/*
|
||||
* Located after dest & src address in ether header.
|
||||
*/
|
||||
#define VLAN_FIELDS_OFFSET (ETHER_ADDR_LEN * 2)
|
||||
|
||||
/*
|
||||
* 4 bytes of vlan field info.
|
||||
*/
|
||||
#define VLAN_FIELDS_SIZE 4
|
||||
|
||||
/* location of bits in 16-bit vlan fields */
|
||||
#define VLAN_PRI_SHIFT 13 /* user priority */
|
||||
#define VLAN_CFI_SHIFT 12 /* canonical format indicator bit */
|
||||
|
||||
/* 3 bits of priority */
|
||||
#define VLAN_PRI_MASK 7
|
||||
/* 12 bits of vlan identfier (VID) */
|
||||
#define VLAN_VID_MASK 0xFFF /* VLAN identifier (VID) field */
|
||||
|
||||
struct vlan_tags {
|
||||
uint16 tag_type; /* 0x8100 for VLAN */
|
||||
uint16 tag_control; /* prio | cfi | vid */
|
||||
} PACKED ;
|
||||
|
||||
/* 802.1X ethertype */
|
||||
|
||||
#define ETHER_TYPE_IP 0x0800 /* IP */
|
||||
#define ETHER_TYPE_BRCM 0x886c /* Broadcom Corp. */
|
||||
#define ETHER_TYPE_802_1X 0x888e /* 802.1x */
|
||||
|
||||
#define ETHER_BRCM_SUBTYPE_LEN 4 /* Broadcom 4byte subtype follows ethertype */
|
||||
#define ETHER_BRCM_CRAM 0x1 /* Broadcom subtype cram protocol */
|
||||
|
||||
/*
|
||||
* A macro to validate a length with
|
||||
*/
|
||||
#define ETHER_IS_VALID_LEN(foo) \
|
||||
((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
|
||||
|
||||
#ifndef __NET_ETHERNET_H
|
||||
#ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */
|
||||
/*
|
||||
* Structure of a 10Mb/s Ethernet header.
|
||||
*/
|
||||
struct ether_header {
|
||||
uint8 ether_dhost[ETHER_ADDR_LEN];
|
||||
uint8 ether_shost[ETHER_ADDR_LEN];
|
||||
uint16 ether_type;
|
||||
} PACKED ;
|
||||
|
||||
/*
|
||||
* Structure of a 48-bit Ethernet address.
|
||||
*/
|
||||
struct ether_addr {
|
||||
uint8 octet[ETHER_ADDR_LEN];
|
||||
} PACKED ;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Takes a pointer, returns true if a 48-bit multicast address
|
||||
* (including broadcast, since it is all ones)
|
||||
*/
|
||||
#define ETHER_ISMULTI(ea) (((uint8 *)(ea))[0] & 1)
|
||||
|
||||
/*
|
||||
* Takes a pointer, returns true if a 48-bit broadcast (all ones)
|
||||
*/
|
||||
#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \
|
||||
((uint8 *)(ea))[1] & \
|
||||
((uint8 *)(ea))[2] & \
|
||||
((uint8 *)(ea))[3] & \
|
||||
((uint8 *)(ea))[4] & \
|
||||
((uint8 *)(ea))[5]) == 0xff)
|
||||
|
||||
static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}};
|
||||
|
||||
/*
|
||||
* Takes a pointer, returns true if a 48-bit null address (all zeros)
|
||||
*/
|
||||
#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \
|
||||
((uint8 *)(ea))[1] | \
|
||||
((uint8 *)(ea))[2] | \
|
||||
((uint8 *)(ea))[3] | \
|
||||
((uint8 *)(ea))[4] | \
|
||||
((uint8 *)(ea))[5]) == 0)
|
||||
|
||||
/* Differentiated Services Codepoint - lower 6 bits of tos in iphdr */
|
||||
#define DSCP_PRI_MASK 0x3F /* bits 0-6 */
|
||||
#define DSCP_WME_PRI_MASK 0x38 /* bits 3-6 */
|
||||
#define DSCP_WME_PRI_SHIFT 3
|
||||
|
||||
#undef PACKED
|
||||
|
||||
#endif /* _NET_ETHERNET_H_ */
|
@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Shell-like utility functions
|
||||
*
|
||||
* Copyright 2004, Broadcom Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
|
||||
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _shutils_h_
|
||||
#define _shutils_h_
|
||||
#include <string.h>
|
||||
/*
|
||||
* Reads file and returns contents
|
||||
* @param fd file descriptor
|
||||
* @return contents of file or NULL if an error occurred
|
||||
*/
|
||||
extern char * fd2str(int fd);
|
||||
|
||||
/*
|
||||
* Reads file and returns contents
|
||||
* @param path path to file
|
||||
* @return contents of file or NULL if an error occurred
|
||||
*/
|
||||
extern char * file2str(const char *path);
|
||||
|
||||
/*
|
||||
* Waits for a file descriptor to become available for reading or unblocked signal
|
||||
* @param fd file descriptor
|
||||
* @param timeout seconds to wait before timing out or 0 for no timeout
|
||||
* @return 1 if descriptor changed status or 0 if timed out or -1 on error
|
||||
*/
|
||||
extern int waitfor(int fd, int timeout);
|
||||
|
||||
/*
|
||||
* Concatenates NULL-terminated list of arguments into a single
|
||||
* commmand and executes it
|
||||
* @param argv argument list
|
||||
* @param path NULL, ">output", or ">>output"
|
||||
* @param timeout seconds to wait before timing out or 0 for no timeout
|
||||
* @param ppid NULL to wait for child termination or pointer to pid
|
||||
* @return return value of executed command or errno
|
||||
*/
|
||||
extern int _eval(char *const argv[], char *path, int timeout, pid_t *ppid);
|
||||
|
||||
/*
|
||||
* Concatenates NULL-terminated list of arguments into a single
|
||||
* commmand and executes it
|
||||
* @param argv argument list
|
||||
* @return stdout of executed command or NULL if an error occurred
|
||||
*/
|
||||
extern char * _backtick(char *const argv[]);
|
||||
|
||||
/*
|
||||
* Kills process whose PID is stored in plaintext in pidfile
|
||||
* @param pidfile PID file
|
||||
* @return 0 on success and errno on failure
|
||||
*/
|
||||
extern int kill_pidfile(char *pidfile);
|
||||
|
||||
/*
|
||||
* fread() with automatic retry on syscall interrupt
|
||||
* @param ptr location to store to
|
||||
* @param size size of each element of data
|
||||
* @param nmemb number of elements
|
||||
* @param stream file stream
|
||||
* @return number of items successfully read
|
||||
*/
|
||||
extern int safe_fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
|
||||
/*
|
||||
* fwrite() with automatic retry on syscall interrupt
|
||||
* @param ptr location to read from
|
||||
* @param size size of each element of data
|
||||
* @param nmemb number of elements
|
||||
* @param stream file stream
|
||||
* @return number of items successfully written
|
||||
*/
|
||||
extern int safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
|
||||
/*
|
||||
* Convert Ethernet address string representation to binary data
|
||||
* @param a string in xx:xx:xx:xx:xx:xx notation
|
||||
* @param e binary data
|
||||
* @return TRUE if conversion was successful and FALSE otherwise
|
||||
*/
|
||||
extern int ether_atoe(const char *a, unsigned char *e);
|
||||
|
||||
/*
|
||||
* Convert Ethernet address binary data to string representation
|
||||
* @param e binary data
|
||||
* @param a string in xx:xx:xx:xx:xx:xx notation
|
||||
* @return a
|
||||
*/
|
||||
extern char * ether_etoa(const unsigned char *e, char *a);
|
||||
|
||||
/*
|
||||
* Concatenate two strings together into a caller supplied buffer
|
||||
* @param s1 first string
|
||||
* @param s2 second string
|
||||
* @param buf buffer large enough to hold both strings
|
||||
* @return buf
|
||||
*/
|
||||
static inline char * strcat_r(const char *s1, const char *s2, char *buf)
|
||||
{
|
||||
strcpy(buf, s1);
|
||||
strcat(buf, s2);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Check for a blank character; that is, a space or a tab */
|
||||
#define isblank(c) ((c) == ' ' || (c) == '\t')
|
||||
|
||||
/* Strip trailing CR/NL from string <s> */
|
||||
#define chomp(s) ({ \
|
||||
char *c = (s) + strlen((s)) - 1; \
|
||||
while ((c > (s)) && (*c == '\n' || *c == '\r' || *c == ' ')) \
|
||||
*c-- = '\0'; \
|
||||
s; \
|
||||
})
|
||||
|
||||
/* Simple version of _backtick() */
|
||||
#define backtick(cmd, args...) ({ \
|
||||
char *argv[] = { cmd, ## args, NULL }; \
|
||||
_backtick(argv); \
|
||||
})
|
||||
|
||||
/* Simple version of _eval() (no timeout and wait for child termination) */
|
||||
#define eval(cmd, args...) ({ \
|
||||
char *argv[] = { cmd, ## args, NULL }; \
|
||||
_eval(argv, ">/dev/console", 0, NULL); \
|
||||
})
|
||||
|
||||
/* Copy each token in wordlist delimited by space into word */
|
||||
#define foreach(word, wordlist, next) \
|
||||
for (next = &wordlist[strspn(wordlist, " ")], \
|
||||
strncpy(word, next, sizeof(word)), \
|
||||
word[strcspn(word, " ")] = '\0', \
|
||||
word[sizeof(word) - 1] = '\0', \
|
||||
next = strchr(next, ' '); \
|
||||
strlen(word); \
|
||||
next = next ? &next[strspn(next, " ")] : "", \
|
||||
strncpy(word, next, sizeof(word)), \
|
||||
word[strcspn(word, " ")] = '\0', \
|
||||
word[sizeof(word) - 1] = '\0', \
|
||||
next = strchr(next, ' '))
|
||||
|
||||
/* Return NUL instead of NULL if undefined */
|
||||
#define safe_getenv(s) (getenv(s) ? : "")
|
||||
|
||||
/* Print directly to the console */
|
||||
#define cprintf(fmt, args...) do { \
|
||||
FILE *fp = fopen("/dev/console", "w"); \
|
||||
if (fp) { \
|
||||
fprintf(fp, fmt, ## args); \
|
||||
fclose(fp); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Debug print */
|
||||
#ifdef DEBUG
|
||||
#define dprintf(fmt, args...) cprintf("%s: " fmt, __FUNCTION__, ## args)
|
||||
#else
|
||||
#define dprintf(fmt, args...)
|
||||
#endif
|
||||
|
||||
#ifdef vxworks
|
||||
|
||||
#include <inetLib.h>
|
||||
#define inet_aton(a, n) ((inet_aton((a), (n)) == ERROR) ? 0 : 1)
|
||||
#define inet_ntoa(n) ({ char a[INET_ADDR_LEN]; inet_ntoa_b ((n), a); a; })
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <bcmutils.h>
|
||||
#define ether_atoe(a, e) bcm_ether_atoe((a), (e))
|
||||
#define ether_etoa(e, a) bcm_ether_ntoa((e), (a))
|
||||
|
||||
/* These declarations are not available where you would expect them */
|
||||
extern int vsnprintf (char *, size_t, const char *, va_list);
|
||||
extern int snprintf(char *str, size_t count, const char *fmt, ...);
|
||||
extern char *strdup(const char *);
|
||||
extern char *strsep(char **stringp, char *delim);
|
||||
extern int strcasecmp(const char *s1, const char *s2);
|
||||
extern int strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
|
||||
/* Neither are socket() and connect() */
|
||||
#include <sockLib.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef dprintf
|
||||
#define dprintf printf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _shutils_h_ */
|
@ -1,293 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004, Broadcom Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
|
||||
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _TYPEDEFS_H_
|
||||
#define _TYPEDEFS_H_
|
||||
|
||||
|
||||
/* Define 'SITE_TYPEDEFS' in the compile to include a site specific
|
||||
* typedef file "site_typedefs.h".
|
||||
*
|
||||
* If 'SITE_TYPEDEFS' is not defined, then the "Inferred Typedefs"
|
||||
* section of this file makes inferences about the compile environment
|
||||
* based on defined symbols and possibly compiler pragmas.
|
||||
*
|
||||
* Following these two sections is the "Default Typedefs"
|
||||
* section. This section is only prcessed if 'USE_TYPEDEF_DEFAULTS' is
|
||||
* defined. This section has a default set of typedefs and a few
|
||||
* proprocessor symbols (TRUE, FALSE, NULL, ...).
|
||||
*/
|
||||
|
||||
#ifdef SITE_TYPEDEFS
|
||||
|
||||
/*******************************************************************************
|
||||
* Site Specific Typedefs
|
||||
*******************************************************************************/
|
||||
|
||||
#include "site_typedefs.h"
|
||||
|
||||
#else
|
||||
|
||||
/*******************************************************************************
|
||||
* Inferred Typedefs
|
||||
*******************************************************************************/
|
||||
|
||||
/* Infer the compile environment based on preprocessor symbols and pramas.
|
||||
* Override type definitions as needed, and include configuration dependent
|
||||
* header files to define types.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define TYPEDEF_BOOL
|
||||
#ifndef FALSE
|
||||
#define FALSE false
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE true
|
||||
#endif
|
||||
|
||||
#else /* ! __cplusplus */
|
||||
|
||||
/* for Windows build, define bool as a uchar instead of the default int */
|
||||
#if defined(_WIN32)
|
||||
|
||||
#define TYPEDEF_BOOL
|
||||
typedef unsigned char bool;
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#endif /* ! __cplusplus */
|
||||
|
||||
#ifdef _MSC_VER /* Microsoft C */
|
||||
#define TYPEDEF_INT64
|
||||
#define TYPEDEF_UINT64
|
||||
typedef signed __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
#endif
|
||||
|
||||
#if defined(MACOSX) && defined(KERNEL)
|
||||
#define TYPEDEF_BOOL
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(linux)
|
||||
#define TYPEDEF_UINT
|
||||
#define TYPEDEF_USHORT
|
||||
#define TYPEDEF_ULONG
|
||||
#endif
|
||||
|
||||
#if !defined(linux) && !defined(_WIN32) && !defined(PMON) && !defined(_CFE_)
|
||||
#define TYPEDEF_UINT
|
||||
#define TYPEDEF_USHORT
|
||||
#endif
|
||||
|
||||
|
||||
/* Do not support the (u)int64 types with strict ansi for GNU C */
|
||||
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
|
||||
#define TYPEDEF_INT64
|
||||
#define TYPEDEF_UINT64
|
||||
#endif
|
||||
|
||||
/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
|
||||
* for singned or unsigned */
|
||||
#if defined(__ICL)
|
||||
|
||||
#define TYPEDEF_INT64
|
||||
|
||||
#if defined(__STDC__)
|
||||
#define TYPEDEF_UINT64
|
||||
#endif
|
||||
|
||||
#endif /* __ICL */
|
||||
|
||||
|
||||
#if !defined(_WIN32) && !defined(PMON) && !defined(_CFE_)
|
||||
|
||||
/* pick up ushort & uint from standard types.h */
|
||||
#if defined(linux) && defined(__KERNEL__)
|
||||
|
||||
#include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !_WIN32 && !PMON && !_CFE_ */
|
||||
|
||||
#if defined(MACOSX) && defined(KERNEL)
|
||||
#include <IOKit/IOTypes.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* use the default typedefs in the next section of this file */
|
||||
#define USE_TYPEDEF_DEFAULTS
|
||||
|
||||
#endif /* SITE_TYPEDEFS */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Default Typedefs
|
||||
*******************************************************************************/
|
||||
|
||||
#ifdef USE_TYPEDEF_DEFAULTS
|
||||
#undef USE_TYPEDEF_DEFAULTS
|
||||
|
||||
#ifndef TYPEDEF_BOOL
|
||||
typedef int bool;
|
||||
#endif
|
||||
|
||||
/*----------------------- define uchar, ushort, uint, ulong ----------------*/
|
||||
|
||||
#ifndef TYPEDEF_UCHAR
|
||||
typedef unsigned char uchar;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_USHORT
|
||||
typedef unsigned short ushort;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_UINT
|
||||
typedef unsigned int uint;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_ULONG
|
||||
typedef unsigned long ulong;
|
||||
#endif
|
||||
|
||||
/*----------------------- define [u]int8/16/32/64 --------------------------*/
|
||||
|
||||
#ifndef TYPEDEF_UINT8
|
||||
typedef unsigned char uint8;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_UINT16
|
||||
typedef unsigned short uint16;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_UINT32
|
||||
typedef unsigned int uint32;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_UINT64
|
||||
typedef unsigned long long uint64;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_INT8
|
||||
typedef signed char int8;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_INT16
|
||||
typedef signed short int16;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_INT32
|
||||
typedef signed int int32;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_INT64
|
||||
typedef signed long long int64;
|
||||
#endif
|
||||
|
||||
/*----------------------- define float32/64, float_t -----------------------*/
|
||||
|
||||
#ifndef TYPEDEF_FLOAT32
|
||||
typedef float float32;
|
||||
#endif
|
||||
|
||||
#ifndef TYPEDEF_FLOAT64
|
||||
typedef double float64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* abstracted floating point type allows for compile time selection of
|
||||
* single or double precision arithmetic. Compiling with -DFLOAT32
|
||||
* selects single precision; the default is double precision.
|
||||
*/
|
||||
|
||||
#ifndef TYPEDEF_FLOAT_T
|
||||
|
||||
#if defined(FLOAT32)
|
||||
typedef float32 float_t;
|
||||
#else /* default to double precision floating point */
|
||||
typedef float64 float_t;
|
||||
#endif
|
||||
|
||||
#endif /* TYPEDEF_FLOAT_T */
|
||||
|
||||
/*----------------------- define macro values -----------------------------*/
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef OFF
|
||||
#define OFF 0
|
||||
#endif
|
||||
|
||||
#ifndef ON
|
||||
#define ON 1
|
||||
#endif
|
||||
|
||||
/*----------------------- define PTRSZ, INLINE ----------------------------*/
|
||||
|
||||
#ifndef PTRSZ
|
||||
#define PTRSZ sizeof (char*)
|
||||
#endif
|
||||
|
||||
#ifndef INLINE
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#define INLINE __inline
|
||||
|
||||
#elif __GNUC__
|
||||
|
||||
#define INLINE __inline__
|
||||
|
||||
#else
|
||||
|
||||
#define INLINE
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#endif /* INLINE */
|
||||
|
||||
#undef TYPEDEF_BOOL
|
||||
#undef TYPEDEF_UCHAR
|
||||
#undef TYPEDEF_USHORT
|
||||
#undef TYPEDEF_UINT
|
||||
#undef TYPEDEF_ULONG
|
||||
#undef TYPEDEF_UINT8
|
||||
#undef TYPEDEF_UINT16
|
||||
#undef TYPEDEF_UINT32
|
||||
#undef TYPEDEF_UINT64
|
||||
#undef TYPEDEF_INT8
|
||||
#undef TYPEDEF_INT16
|
||||
#undef TYPEDEF_INT32
|
||||
#undef TYPEDEF_INT64
|
||||
#undef TYPEDEF_FLOAT32
|
||||
#undef TYPEDEF_FLOAT64
|
||||
#undef TYPEDEF_FLOAT_T
|
||||
|
||||
#endif /* USE_TYPEDEF_DEFAULTS */
|
||||
|
||||
#endif /* _TYPEDEFS_H_ */
|
@ -1,131 +0,0 @@
|
||||
#include <cy_conf.h>
|
||||
|
||||
extern int diag_led(int type, int act);
|
||||
extern int C_led(int i);
|
||||
extern int get_single_ip(char *ipaddr, int which);
|
||||
extern char *get_mac_from_ip(char *ip);
|
||||
extern struct dns_lists *get_dns_list(int no);
|
||||
extern int dns_to_resolv(void);
|
||||
extern char *get_wan_face(void);
|
||||
extern int check_wan_link(int num);
|
||||
extern char *get_complete_lan_ip(char *ip);
|
||||
extern int get_int_len(int num);
|
||||
extern int file_to_buf(char *path, char *buf, int len);
|
||||
extern int buf_to_file(char *path, char *buf);
|
||||
extern pid_t* find_pid_by_name( char* pidName);
|
||||
extern int find_pid_by_ps(char* pidName);
|
||||
extern int *find_all_pid_by_ps(char* pidName);
|
||||
extern char *find_name_by_proc(int pid);
|
||||
extern int get_ppp_pid(char *file);
|
||||
extern long convert_ver(char *ver);
|
||||
extern int check_flash(void);
|
||||
extern int check_action(void);
|
||||
extern int check_now_boot(void);
|
||||
extern int check_hw_type(void);
|
||||
extern int is_exist(char *filename);
|
||||
extern void set_ip_forward(char c);
|
||||
struct mtu_lists *get_mtu(char *proto);
|
||||
extern void set_host_domain_name(void);
|
||||
|
||||
extern void encode(char *buf, int len);
|
||||
extern void decode(char *buf, int len);
|
||||
|
||||
extern int sys_netdev_ioctl(int family, int socket, char *if_name, int cmd, struct ifreq *ifr);
|
||||
|
||||
int ct_openlog(const char *ident, int option, int facility, char *log_name);
|
||||
void ct_syslog(int level, int enable, const char *fmt,...);
|
||||
void ct_logger(int level, const char *fmt,...);
|
||||
struct wl_assoc_mac * get_wl_assoc_mac(int *c);
|
||||
|
||||
|
||||
|
||||
enum { DMZ, SESSION, DIAG , WL};
|
||||
|
||||
enum { START_LED, STOP_LED };
|
||||
|
||||
typedef enum { ACT_IDLE,
|
||||
ACT_TFTP_UPGRADE,
|
||||
ACT_WEB_UPGRADE,
|
||||
ACT_WEBS_UPGRADE,
|
||||
ACT_SW_RESTORE,
|
||||
ACT_HW_RESTORE } ACTION;
|
||||
|
||||
enum { UNKNOWN_BOOT = -1, PMON_BOOT, CFE_BOOT };
|
||||
|
||||
enum { BCM4702_CHIP, BCM4712_CHIP, BCM5325E_CHIP };
|
||||
|
||||
enum { FIRST, SECOND };
|
||||
|
||||
enum { SYSLOG_LOG=1, SYSLOG_DEBUG, CONSOLE_ONLY, LOG_CONSOLE, DEBUG_CONSOLE };
|
||||
|
||||
#define ACTION(cmd) buf_to_file(ACTION_FILE, cmd)
|
||||
|
||||
struct dns_lists {
|
||||
int num_servers;
|
||||
char dns_server[4][16];
|
||||
};
|
||||
|
||||
#define NOT_USING 0
|
||||
#define USING 1
|
||||
|
||||
struct wl_assoc_mac
|
||||
{
|
||||
char mac[18];
|
||||
};
|
||||
|
||||
struct mtu_lists {
|
||||
char *proto; /* protocol */
|
||||
char *min; /* min mtu */
|
||||
char *max; /* max mtu */
|
||||
};
|
||||
|
||||
|
||||
#define PPP_PSEUDO_IP "10.64.64.64"
|
||||
#define PPP_PSEUDO_NM "255.255.255.255"
|
||||
#define PPP_PSEUDO_GW "10.112.112.112"
|
||||
|
||||
#define PING_TMP "/tmp/ping.log"
|
||||
#define TRACEROUTE_TMP "/tmp/traceroute.log"
|
||||
#define MAX_BUF_LEN 254
|
||||
|
||||
#define RESOLV_FILE "/tmp/resolv.conf"
|
||||
#define HOSTS_FILE "/tmp/hosts"
|
||||
|
||||
#define LOG_FILE "/var/log/mess"
|
||||
|
||||
#define ACTION_FILE "/tmp/action"
|
||||
|
||||
|
||||
#define split(word, wordlist, next, delim) \
|
||||
for (next = wordlist, \
|
||||
strncpy(word, next, sizeof(word)), \
|
||||
word[(next=strstr(next, delim)) ? strstr(word, delim) - word : sizeof(word) - 1] = '\0', \
|
||||
next = next ? next + sizeof(delim) - 1 : NULL ; \
|
||||
strlen(word); \
|
||||
next = next ? : "", \
|
||||
strncpy(word, next, sizeof(word)), \
|
||||
word[(next=strstr(next, delim)) ? strstr(word, delim) - word : sizeof(word) - 1] = '\0', \
|
||||
next = next ? next + sizeof(delim) - 1 : NULL)
|
||||
|
||||
#define STRUCT_LEN(name) sizeof(name)/sizeof(name[0])
|
||||
|
||||
#define printHEX(str,len) { \
|
||||
int i; \
|
||||
for (i=0 ; i<len ; i++) { \
|
||||
printf("%02X ", (unsigned char)*(str+i)); \
|
||||
if(((i+1)%16) == 0) printf("- "); \
|
||||
if(((i+1)%32) == 0) printf("\n"); \
|
||||
} \
|
||||
printf("\n\n"); \
|
||||
}
|
||||
|
||||
|
||||
#define printASC(str,len) { \
|
||||
int i; \
|
||||
for (i=0 ; i<len ; i++) { \
|
||||
printf("%c", (unsigned char)*(str+i)); \
|
||||
if(((i+1)%16) == 0) printf("- "); \
|
||||
if(((i+1)%32) == 0) printf("\n"); \
|
||||
} \
|
||||
printf("\n\n"); \
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* wlcompat.h
|
||||
*
|
||||
* Copyright (C) 2005 Felix Fietkau <nbd@vd-s.ath.cx>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
#include <linux/wireless.h>
|
||||
|
||||
#ifndef WLCOMPAT_H
|
||||
#define WLCOMPAT_H
|
||||
|
||||
#define WLCOMPAT_SET_MONITOR SIOCIWFIRSTPRIV + 0
|
||||
#define WLCOMPAT_GET_MONITOR SIOCIWFIRSTPRIV + 1
|
||||
#define WLCOMPAT_SET_TXPWR_LIMIT SIOCIWFIRSTPRIV + 2
|
||||
#define WLCOMPAT_GET_TXPWR_LIMIT SIOCIWFIRSTPRIV + 3
|
||||
#define WLCOMPAT_SET_ANTDIV SIOCIWFIRSTPRIV + 4
|
||||
#define WLCOMPAT_GET_ANTDIV SIOCIWFIRSTPRIV + 5
|
||||
#define WLCOMPAT_SET_TXANT SIOCIWFIRSTPRIV + 6
|
||||
#define WLCOMPAT_GET_TXANT SIOCIWFIRSTPRIV + 7
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Broadcom wireless network adapter utility functions
|
||||
*
|
||||
* Copyright 2004, Broadcom Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
|
||||
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _wlutils_h_
|
||||
#define _wlutils_h_
|
||||
|
||||
#include <typedefs.h>
|
||||
#include <wlioctl.h>
|
||||
|
||||
/*
|
||||
* Pass a wlioctl request to the specified interface.
|
||||
* @param name interface name
|
||||
* @param cmd WLC_GET_MAGIC <= cmd < WLC_LAST
|
||||
* @param buf buffer for passing in and/or receiving data
|
||||
* @param len length of buf
|
||||
* @return >= 0 if successful or < 0 otherwise
|
||||
*/
|
||||
extern int wl_ioctl(char *name, int cmd, void *buf, int len);
|
||||
|
||||
/*
|
||||
* Get the MAC (hardware) address of the specified interface.
|
||||
* @param name interface name
|
||||
* @param hwaddr 6-byte buffer for receiving address
|
||||
* @return >= 0 if successful or < 0 otherwise
|
||||
*/
|
||||
extern int wl_hwaddr(char *name, unsigned char *hwaddr);
|
||||
|
||||
/*
|
||||
* Probe the specified interface.
|
||||
* @param name interface name
|
||||
* @return >= 0 if a Broadcom wireless device or < 0 otherwise
|
||||
*/
|
||||
extern int wl_probe(char *name);
|
||||
|
||||
/*
|
||||
* Set/Get named variable.
|
||||
* @param name interface name
|
||||
* @param var variable name
|
||||
* @param val variable value/buffer
|
||||
* @param len variable value/buffer length
|
||||
* @return success == 0, failure != 0
|
||||
*/
|
||||
extern int wl_set_val(char *name, char *var, void *val, int len);
|
||||
extern int wl_get_val(char *name, char *var, void *val, int len);
|
||||
extern int wl_set_int(char *name, char *var, int val);
|
||||
extern int wl_get_int(char *name, char *var, int *val);
|
||||
|
||||
#endif /* _wlutils_h_ */
|
@ -1,4 +0,0 @@
|
||||
Package: base-files-arch
|
||||
Priority: optional
|
||||
Section: sys
|
||||
Description: Board/architecture specific files
|
Loading…
Reference in New Issue
Block a user