forked from robertdavidgraham/masscan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proto-preprocess.h
54 lines (49 loc) · 1.28 KB
/
proto-preprocess.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
/* Copyright: (c) 2009-2010 by Robert David Graham */
#ifndef PREPROCESS_H
#define PREPROCESS_H
enum {
FOUND_NOTHING=0,
FOUND_ETHERNET,
FOUND_IPV4,
FOUND_IPV6,
FOUND_ICMP,
FOUND_TCP,
FOUND_UDP,
FOUND_SCTP,
FOUND_DNS,
FOUND_IPV6_HOP,
FOUND_8021Q,
FOUND_MPLS,
FOUND_WIFI_DATA,
FOUND_WIFI,
FOUND_RADIOTAP,
FOUND_PRISM,
FOUND_LLC,
FOUND_ARP,
};
struct PreprocessedInfo {
const unsigned char *mac_src;
const unsigned char *mac_dst;
const unsigned char *mac_bss;
unsigned ip_offset; /* 14 for normal Ethernet */
unsigned ip_version; /* 4 or 6 */
unsigned ip_protocol; /* 6 for TCP, 11 for UDP */
unsigned ip_length; /* length of total packet */
unsigned ip_ttl;
const unsigned char *ip_src;
const unsigned char *ip_dst;
unsigned transport_offset; /* 34 for normal Ethernet */
unsigned transport_length;
unsigned port_src;
unsigned port_dst;
unsigned app_offset; /* start of TCP payload */
unsigned app_length; /* length of TCP payload */
int found;
int found_offset;
};
/**
* @return 1 if useful stuff found, 0 otherwise
*/
unsigned
preprocess_frame(const unsigned char *px, unsigned length, unsigned link_type, struct PreprocessedInfo *info);
#endif