5 * Copyright (c) 2006 CACE Technologies, Davis (California)
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the project nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
24 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 #ifndef _AIRPDCAP_INT_H
38 #define _AIRPDCAP_INT_H
40 /****************************************************************************/
43 #include "airpdcap_interop.h"
45 /****************************************************************************/
47 /****************************************************************************/
50 /* IEEE 802.11 packet type values */
51 #define AIRPDCAP_TYPE_MANAGEMENT 0
52 #define AIRPDCAP_TYPE_CONTROL 1
53 #define AIRPDCAP_TYPE_DATA 2
55 /* Min length of encrypted data (TKIP=25bytes, CCMP=21bytes) */
56 #define AIRPDCAP_CRYPTED_DATA_MINLEN 21
58 #define AIRPDCAP_TA_OFFSET 10
61 /****************************************************************************/
63 /****************************************************************************/
64 /* Macro definitions */
67 * Macros to get various bits of a 802.11 control frame
69 #define AIRPDCAP_TYPE(FrameControl_0) (UINT8)((FrameControl_0 >> 2) & 0x3)
70 #define AIRPDCAP_SUBTYPE(FrameControl_0) (UINT8)((FrameControl_0 >> 4) & 0xF)
71 #define AIRPDCAP_DS_BITS(FrameControl_1) (UINT8)(FrameControl_1 & 0x3)
72 #define AIRPDCAP_TO_DS(FrameControl_1) (UINT8)(FrameControl_1 & 0x1)
73 #define AIRPDCAP_FROM_DS(FrameControl_1) (UINT8)((FrameControl_1 >> 1) & 0x1)
74 #define AIRPDCAP_WEP(FrameControl_1) (UINT8)((FrameControl_1 >> 6) & 0x1)
77 * Get the Key ID from the Initialization Vector (last byte)
79 #define AIRPDCAP_EXTIV(KeyID) ((KeyID >> 5) & 0x1)
81 #define AIRPDCAP_KEY_INDEX(KeyID) ((KeyID >> 6) & 0x3) /** Used to determine TKIP group key from unicast (group = 1, unicast = 0) */
83 /* Macros to get various bits of an EAPOL frame */
84 #define AIRPDCAP_EAP_KEY_DESCR_VER(KeyInfo_1) ((UCHAR)(KeyInfo_1 & 0x3))
85 #define AIRPDCAP_EAP_KEY(KeyInfo_1) ((KeyInfo_1 >> 3) & 0x1)
86 #define AIRPDCAP_EAP_INST(KeyInfo_1) ((KeyInfo_1 >> 6) & 0x1)
87 #define AIRPDCAP_EAP_ACK(KeyInfo_1) ((KeyInfo_1 >> 7) & 0x1)
88 #define AIRPDCAP_EAP_MIC(KeyInfo_0) (KeyInfo_0 & 0x1)
89 #define AIRPDCAP_EAP_SEC(KeyInfo_0) ((KeyInfo_0 >> 1) & 0x1)
91 /****************************************************************************/
93 /****************************************************************************/
94 /* Structure definitions */
97 * XXX - According to the thread at
98 * http://www.wireshark.org/lists/wireshark-dev/200612/msg00384.html we
99 * shouldn't have to worry about packing our structs, since the largest
100 * elements are 8 bits wide.
102 #ifdef _MSC_VER /* MS Visual C++ */
107 /* Definition of IEEE 802.11 frame (without the address 4) */
108 typedef struct _AIRPDCAP_MAC_FRAME {
111 UCHAR addr1[AIRPDCAP_MAC_LEN];
112 UCHAR addr2[AIRPDCAP_MAC_LEN];
113 UCHAR addr3[AIRPDCAP_MAC_LEN];
115 } AIRPDCAP_MAC_FRAME, *PAIRPDCAP_MAC_FRAME;
117 /* Definition of IEEE 802.11 frame (with the address 4) */
118 typedef struct _AIRPDCAP_MAC_FRAME_ADDR4 {
121 UCHAR addr1[AIRPDCAP_MAC_LEN];
122 UCHAR addr2[AIRPDCAP_MAC_LEN];
123 UCHAR addr3[AIRPDCAP_MAC_LEN];
125 UCHAR addr4[AIRPDCAP_MAC_LEN];
126 } AIRPDCAP_MAC_FRAME_ADDR4, *PAIRPDCAP_MAC_FRAME_ADDR4;
128 /* Definition of IEEE 802.11 frame (without the address 4, with QOS) */
129 typedef struct _AIRPDCAP_MAC_FRAME_QOS {
132 UCHAR addr1[AIRPDCAP_MAC_LEN];
133 UCHAR addr2[AIRPDCAP_MAC_LEN];
134 UCHAR addr3[AIRPDCAP_MAC_LEN];
137 } AIRPDCAP_MAC_FRAME_QOS, *PAIRPDCAP_MAC_FRAME_QOS;
139 /* Definition of IEEE 802.11 frame (with the address 4 and QOS) */
140 typedef struct _AIRPDCAP_MAC_FRAME_ADDR4_QOS {
143 UCHAR addr1[AIRPDCAP_MAC_LEN];
144 UCHAR addr2[AIRPDCAP_MAC_LEN];
145 UCHAR addr3[AIRPDCAP_MAC_LEN];
147 UCHAR addr4[AIRPDCAP_MAC_LEN];
149 } AIRPDCAP_MAC_FRAME_ADDR4_QOS, *PAIRPDCAP_MAC_FRAME_ADDR4_QOS;
151 #ifdef _MSC_VER /* MS Visual C++ */
155 /******************************************************************************/