-
Notifications
You must be signed in to change notification settings - Fork 2
/
define.h
73 lines (60 loc) · 2.64 KB
/
define.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
Definition of macro and header size
Decoder - decode TLS/SSL traffic - save handshake and extract certificate
Copyright (C) 2016-2024 Michele Campus <[email protected]>
This file is part of decoder.
decoder 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 3 of the License, or (at your option) any later
version.
decoder 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
decoder. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef DEFINE_H_
#define DEFINE_H_
/* Header offsets */
#define ETHHDR_SIZE 14
#define TOKENRING_SIZE 22
#define PPPHDR_SIZE 4
#define SLIPHDR_SIZE 16
#define RAWHDR_SIZE 0
#define LOOPHDR_SIZE 4
#define FDDIHDR_SIZE 21
#define ISDNHDR_SIZE 16
#define IEEE80211HDR_SIZE 32
#define IPv4 4
#define IPv6 6
/* IPV6 header length */
#define IPV6_HDR_LEN 40
/* UDP header length */
#define UDP_HDR_LEN 8
/* SCTP header len */
#define SCTP_HDR_LEN 12
/* Ethernet protocol ID's from Ether Type field */
#define ETHERTYPE_ARP 0x0806 /* Address resolution */
#define ETHERTYPE_RARP 0x8035 /* Reverse ARP */
#define ETHERTYPE_APPLETLK 0x809B /* AppleTalk protocol */
#define ETHERTYPE_APPLEARP 0x80F3 /* AppleTalk ARP */
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */
#define ETHERTYPE_IPv4 0x0800 /* IP */
#define ETHERTYPE_IPv6 0x86dd /* IP protocol version 6 */
#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */
#define ETHERTYPE_MPLS_UNI 0x8847
#define ETHERTYPE_MPLS_MULTI 0x8848
#define ETHERTYPE_PPPoE_1 0x8863
#define ETHERTYPE_PPPoE 0x8864
#define ETHERTYPE_LLDP 0x88CC
/* SNAP extension */
#define SNAP 0xaa
/* mask for FCF */
#define WIFI_DATA 0x2 /* 0000 0010 */
#define FCF_TYPE(fc) (((fc) >> 2) & 0x3) /* 0000 0011 = 0x3 */
#define FCF_SUBTYPE(fc) (((fc) >> 4) & 0xF) /* 0000 1111 = 0xF */
#define FCF_TO_DS(fc) ((fc) & 0x0100)
#define FCF_FROM_DS(fc) ((fc) & 0x0200)
/* mask for Bad FCF presence */
#define BAD_FCS 0x50 /* 0101 0000 */
#endif