File: tcp.h

package info (click to toggle)
ipgrab 0.5-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 268 kB
  • ctags: 169
  • sloc: sh: 1,507; ansic: 1,234; makefile: 56
file content (50 lines) | stat: -rw-r--r-- 1,375 bytes parent folder | download | duplicates (2)
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
/**************************************************************************** 
** File: tcp.h
**
** Author: Mike Borella
**
** Comments: Generic TCP header structure - an attempt at OS independence
**
*****************************************************************************/

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#define TH_FIN  0x01
#define TH_SYN  0x02
#define TH_RST  0x04
#define TH_PUSH 0x08
#define TH_ACK  0x10
#define TH_URG  0x20

#define TCPOPT_EOL      0
#define TCPOPT_NOP      1
#define TCPOPT_MAXSEG   2

/*
 * TCP header
 */

typedef struct _TCPHdr
{
        u_int16_t th_sport;               /* source port */
        u_int16_t th_dport;               /* destination port */
        u_int32_t th_seq;                 /* sequence number */
        u_int32_t th_ack;                 /* acknowledgement number */
#ifdef WORDS_BIGENDIAN
        u_int8_t  th_off:4,               /* data offset */
                  th_x2:4;                /* (unused) */
#else
        u_int8_t  th_x2:4,                /* (unused) */
                  th_off:4;               /* data offset */
#endif
        u_int8_t  th_flags;
        u_int16_t th_win;                 /* window */
        u_int16_t th_sum;                 /* checksum */
        u_int16_t th_urp;                 /* urgent pointer */
} TCPHdr;