File: sn_packetstructs.h

package info (click to toggle)
sniffit 0.3.5-3
  • links: PTS
  • area: non-free
  • in suites: hamm, slink
  • size: 984 kB
  • ctags: 1,367
  • sloc: ansic: 10,604; sh: 1,568; yacc: 234; lex: 202; makefile: 154
file content (51 lines) | stat: -rw-r--r-- 1,394 bytes parent folder | download
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
/* Sniffit Packet Discription File                             */

#include <sys/time.h>

struct packetheader
{
        struct timeval ts;      /* time stamp */
        unsigned long caplen;          /* length of portion present */
        unsigned long len;             /* length this packet (off wire) */
};           

struct IP_header                        /* The IPheader (without options) */
{
	unsigned char verlen, type;
	unsigned short length, ID, flag_offset;
	unsigned char TTL, protocol;
	unsigned short checksum;
	unsigned long int source, destination;
};

struct pseudo_IP_header 
{
        unsigned long int source, destination;
        char zero_byte, protocol;
        unsigned short TCP_UDP_len;
};            

struct TCP_header                       /* The TCP header (without options) */
{
	unsigned short source, destination;
	unsigned long int seq_nr, ACK_nr;
	unsigned short offset_flag, window, checksum, urgent; 
};

struct ICMP_header                                /* The ICMP header */ 
{
	unsigned char type, code;
	unsigned short checksum; 
};

struct UDP_header                                /* The UDP header */ 
{
	unsigned short source, destination;
	unsigned short length, checksum;
};

struct unwrap                                           /* some extra info */
{
	int IP_len, TCP_len, ICMP_len, UDP_len;         /* header lengths */ 
	int DATA_len;
};