File: sn_packetstructs.h

package info (click to toggle)
sniffit 0.3.7.beta-17
  • links: PTS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 1,512 kB
  • sloc: ansic: 11,609; sh: 1,568; yacc: 234; lex: 203; makefile: 141
file content (59 lines) | stat: -rw-r--r-- 1,625 bytes parent folder | download | duplicates (8)
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
/* Sniffit Packet Discription File                             */

#ifndef _SN_PACKETSTRUCTS_H_
#define _SN_PACKETSTRUCTS_H_

#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;
	_32_bit source, destination;
};

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

struct TCP_header                       /* The TCP header (without options) */
{
	unsigned short source, destination;
	_32_bit 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;                                     /* keep signed! */
	char FRAG_f;                                    /* first fragment */
	char FRAG_nf;                           /* not the first fragment */
};


#endif