FIXUP: WIP: verification_trailer
[wireshark-wip.git] / epan / crypt / airpdcap_int.h
blob14f1763ffce9a1b7eb1565cb9e70a4b1e10b96a9
1 /* airpcap_int.h
3 * $Id$
5 * Copyright (c) 2006 CACE Technologies, Davis (California)
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
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
34 * SUCH DAMAGE.
37 #ifndef _AIRPDCAP_INT_H
38 #define _AIRPDCAP_INT_H
40 /****************************************************************************/
41 /* File includes */
43 #include "airpdcap_interop.h"
44 #include "airpdcap_system.h"
46 /****************************************************************************/
48 /****************************************************************************/
49 /* Definitions */
51 /* IEEE 802.11 packet type values */
52 #define AIRPDCAP_TYPE_MANAGEMENT 0
53 #define AIRPDCAP_TYPE_CONTROL 1
54 #define AIRPDCAP_TYPE_DATA 2
56 /* Min length of encrypted data (TKIP=25bytes, CCMP=21bytes) */
57 #define AIRPDCAP_CRYPTED_DATA_MINLEN 21
59 #define AIRPDCAP_TA_OFFSET 10
61 /* */
62 /****************************************************************************/
64 /****************************************************************************/
65 /* Macro definitions */
67 /**
68 * Macros to get various bits of a 802.11 control frame
70 #define AIRPDCAP_TYPE(FrameControl_0) (UINT8)((FrameControl_0 >> 2) & 0x3)
71 #define AIRPDCAP_SUBTYPE(FrameControl_0) (UINT8)((FrameControl_0 >> 4) & 0xF)
72 #define AIRPDCAP_DS_BITS(FrameControl_1) (UINT8)(FrameControl_1 & 0x3)
73 #define AIRPDCAP_TO_DS(FrameControl_1) (UINT8)(FrameControl_1 & 0x1)
74 #define AIRPDCAP_FROM_DS(FrameControl_1) (UINT8)((FrameControl_1 >> 1) & 0x1)
75 #define AIRPDCAP_WEP(FrameControl_1) (UINT8)((FrameControl_1 >> 6) & 0x1)
77 /**
78 * Get the Key ID from the Initialization Vector (last byte)
80 #define AIRPDCAP_EXTIV(KeyID) ((KeyID >> 5) & 0x1)
82 #define AIRPDCAP_KEY_INDEX(KeyID) ((KeyID >> 6) & 0x3) /** Used to determine TKIP group key from unicast (group = 1, unicast = 0) */
84 /* Macros to get various bits of an EAPOL frame */
85 #define AIRPDCAP_EAP_KEY_DESCR_VER(KeyInfo_1) ((UCHAR)(KeyInfo_1 & 0x3))
86 #define AIRPDCAP_EAP_KEY(KeyInfo_1) ((KeyInfo_1 >> 3) & 0x1)
87 #define AIRPDCAP_EAP_INST(KeyInfo_1) ((KeyInfo_1 >> 6) & 0x1)
88 #define AIRPDCAP_EAP_ACK(KeyInfo_1) ((KeyInfo_1 >> 7) & 0x1)
89 #define AIRPDCAP_EAP_MIC(KeyInfo_0) (KeyInfo_0 & 0x1)
90 #define AIRPDCAP_EAP_SEC(KeyInfo_0) ((KeyInfo_0 >> 1) & 0x1)
92 /****************************************************************************/
94 /****************************************************************************/
95 /* Structure definitions */
98 * XXX - According to the thread at
99 * http://www.wireshark.org/lists/wireshark-dev/200612/msg00384.html we
100 * shouldn't have to worry about packing our structs, since the largest
101 * elements are 8 bits wide.
103 #ifdef _MSC_VER /* MS Visual C++ */
104 #pragma pack(push)
105 #pragma pack(1)
106 #endif
108 /* Definition of IEEE 802.11 frame (without the address 4) */
109 typedef struct _AIRPDCAP_MAC_FRAME {
110 UCHAR fc[2];
111 UCHAR dur[2];
112 UCHAR addr1[AIRPDCAP_MAC_LEN];
113 UCHAR addr2[AIRPDCAP_MAC_LEN];
114 UCHAR addr3[AIRPDCAP_MAC_LEN];
115 UCHAR seq[2];
116 } AIRPDCAP_MAC_FRAME, *PAIRPDCAP_MAC_FRAME;
118 /* Definition of IEEE 802.11 frame (with the address 4) */
119 typedef struct _AIRPDCAP_MAC_FRAME_ADDR4 {
120 UCHAR fc[2];
121 UCHAR dur[2];
122 UCHAR addr1[AIRPDCAP_MAC_LEN];
123 UCHAR addr2[AIRPDCAP_MAC_LEN];
124 UCHAR addr3[AIRPDCAP_MAC_LEN];
125 UCHAR seq[2];
126 UCHAR addr4[AIRPDCAP_MAC_LEN];
127 } AIRPDCAP_MAC_FRAME_ADDR4, *PAIRPDCAP_MAC_FRAME_ADDR4;
129 /* Definition of IEEE 802.11 frame (without the address 4, with QOS) */
130 typedef struct _AIRPDCAP_MAC_FRAME_QOS {
131 UCHAR fc[2];
132 UCHAR dur[2];
133 UCHAR addr1[AIRPDCAP_MAC_LEN];
134 UCHAR addr2[AIRPDCAP_MAC_LEN];
135 UCHAR addr3[AIRPDCAP_MAC_LEN];
136 UCHAR seq[2];
137 UCHAR qos[2];
138 } AIRPDCAP_MAC_FRAME_QOS, *PAIRPDCAP_MAC_FRAME_QOS;
140 /* Definition of IEEE 802.11 frame (with the address 4 and QOS) */
141 typedef struct _AIRPDCAP_MAC_FRAME_ADDR4_QOS {
142 UCHAR fc[2];
143 UCHAR dur[2];
144 UCHAR addr1[AIRPDCAP_MAC_LEN];
145 UCHAR addr2[AIRPDCAP_MAC_LEN];
146 UCHAR addr3[AIRPDCAP_MAC_LEN];
147 UCHAR seq[2];
148 UCHAR addr4[AIRPDCAP_MAC_LEN];
149 UCHAR qos[2];
150 } AIRPDCAP_MAC_FRAME_ADDR4_QOS, *PAIRPDCAP_MAC_FRAME_ADDR4_QOS;
152 #ifdef _MSC_VER /* MS Visual C++ */
153 #pragma pack(pop)
154 #endif
156 /******************************************************************************/
158 #endif