forked from jpterry/pcapsipdump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpcapsipdump.h
68 lines (56 loc) · 1.71 KB
/
pcapsipdump.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
/*
This file is part of pcapsipdump
This file is based on linux kernel, namely:
- udp.h by Fred N. van Kempen, <[email protected]>
- ip.h by Fred N. van Kempen, <[email protected]>
pcapsipdump 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 2 of the License, or
(at your option) any later version.
pcapsipdump 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 Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
---
Project's home: http://pcapsipdump.sf.net/
*/
#define PCAPSIPDUMP_VERSION "0.2"
struct iphdr {
#if defined(__LITTLE_ENDIAN)
uint8_t ihl:4,
version:4;
#elif defined (__BIG_ENDIAN)
uint8_t version:4,
ihl:4;
#else
#error Endian not defined
#endif
uint8_t tos;
uint16_t tot_len;
uint16_t id;
uint16_t frag_off;
uint8_t ttl;
uint8_t protocol;
uint16_t check;
uint32_t saddr;
uint32_t daddr;
/*The options start here. */
};
struct udphdr {
uint16_t source;
uint16_t dest;
uint16_t len;
uint16_t check;
};
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
struct ether_header
{
uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
uint16_t ether_type; /* packet type ID field */
} __attribute__ ((__packed__));