Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | * File: tether.h |
| 20 | * |
| 21 | * Purpose: |
| 22 | * |
| 23 | * Author: Tevin Chen |
| 24 | * |
| 25 | * Date: Jan. 28, 1997 |
| 26 | * |
| 27 | */ |
| 28 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 29 | #ifndef __TETHER_H__ |
| 30 | #define __TETHER_H__ |
| 31 | |
Andres More | 9a0e756 | 2010-04-13 21:54:48 -0300 | [diff] [blame] | 32 | #include <linux/if_ether.h> |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 33 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 34 | // |
| 35 | // constants |
| 36 | // |
Andres More | 9a0e756 | 2010-04-13 21:54:48 -0300 | [diff] [blame] | 37 | #define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 38 | // Ethernet address string length |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 39 | #define U_MULTI_ADDR_LEN 8 // multicast address length |
| 40 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 41 | #ifdef __BIG_ENDIAN |
| 42 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 43 | #define TYPE_MGMT_PROBE_RSP 0x5000 |
Andres More | 203e461 | 2010-08-04 19:12:34 -0300 | [diff] [blame] | 44 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 45 | #define FC_TODS 0x0001 |
| 46 | #define FC_FROMDS 0x0002 |
| 47 | #define FC_MOREFRAG 0x0004 |
| 48 | #define FC_RETRY 0x0008 |
| 49 | #define FC_POWERMGT 0x0010 |
| 50 | #define FC_MOREDATA 0x0020 |
| 51 | #define FC_WEP 0x0040 |
| 52 | #define TYPE_802_11_ATIM 0x9000 |
| 53 | |
| 54 | #define TYPE_802_11_DATA 0x0800 |
| 55 | #define TYPE_802_11_CTL 0x0400 |
| 56 | #define TYPE_802_11_MGMT 0x0000 |
| 57 | #define TYPE_802_11_MASK 0x0C00 |
| 58 | #define TYPE_SUBTYPE_MASK 0xFC00 |
| 59 | #define TYPE_802_11_NODATA 0x4000 |
| 60 | #define TYPE_DATE_NULL 0x4800 |
| 61 | |
| 62 | #define TYPE_CTL_PSPOLL 0xa400 |
| 63 | #define TYPE_CTL_RTS 0xb400 |
| 64 | #define TYPE_CTL_CTS 0xc400 |
| 65 | #define TYPE_CTL_ACK 0xd400 |
| 66 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 67 | #else //if LITTLE_ENDIAN |
| 68 | // |
| 69 | // wType field in the SEthernetHeader |
| 70 | // |
| 71 | // NOTE.... |
| 72 | // in network byte order, high byte is going first |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 73 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 74 | #define TYPE_MGMT_PROBE_RSP 0x0050 |
Andres More | 203e461 | 2010-08-04 19:12:34 -0300 | [diff] [blame] | 75 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 76 | #define FC_TODS 0x0100 |
| 77 | #define FC_FROMDS 0x0200 |
| 78 | #define FC_MOREFRAG 0x0400 |
| 79 | #define FC_RETRY 0x0800 |
| 80 | #define FC_POWERMGT 0x1000 |
| 81 | #define FC_MOREDATA 0x2000 |
| 82 | #define FC_WEP 0x4000 |
| 83 | #define TYPE_802_11_ATIM 0x0090 |
| 84 | |
| 85 | #define TYPE_802_11_DATA 0x0008 |
| 86 | #define TYPE_802_11_CTL 0x0004 |
| 87 | #define TYPE_802_11_MGMT 0x0000 |
| 88 | #define TYPE_802_11_MASK 0x000C |
| 89 | #define TYPE_SUBTYPE_MASK 0x00FC |
| 90 | #define TYPE_802_11_NODATA 0x0040 |
| 91 | #define TYPE_DATE_NULL 0x0048 |
| 92 | |
| 93 | #define TYPE_CTL_PSPOLL 0x00a4 |
| 94 | #define TYPE_CTL_RTS 0x00b4 |
| 95 | #define TYPE_CTL_CTS 0x00c4 |
| 96 | #define TYPE_CTL_ACK 0x00d4 |
| 97 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 98 | #endif //#ifdef __BIG_ENDIAN |
| 99 | |
| 100 | #define WEP_IV_MASK 0x00FFFFFF |
| 101 | |
Andres More | b902fbf | 2013-02-25 20:32:51 -0500 | [diff] [blame] | 102 | //u8 ETHbyGetHashIndexByCrc(u8 * pbyMultiAddr); |
| 103 | bool ETHbIsBufferCrc32Ok(u8 * pbyBuffer, unsigned int cbFrameLength); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 104 | |
Andres More | e7b07d1 | 2010-05-01 19:12:26 -0300 | [diff] [blame] | 105 | #endif /* __TETHER_H__ */ |