-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiphdr.h
169 lines (143 loc) · 3.42 KB
/
iphdr.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
#define URG 32
#define ACK 16
#define PSH 8
#define RST 4
#define SYN 2
#define FIN 1
typedef struct ip_hdr
{
unsigned char ip_verlen;
unsigned char ip_tos;
unsigned short ip_totallength;
unsigned short ip_id;
unsigned short ip_offset;
unsigned char ip_ttl;
unsigned char ip_protocol;
unsigned short ip_checksum;
unsigned int ip_srcaddr;
unsigned int ip_destaddr;
}
IP_HDR, * PIP_HDR;
//udp header
typedef struct udp_hdr
{
unsigned short src_portno;
unsigned short dst_portno;
unsigned short udp_length;
unsigned short udp_checksum;
} UDP_HDR, *PUDP_HDR;
//tcp header
typedef struct tcp_hdr
{
unsigned short source;
unsigned short dest;
unsigned int seq;
unsigned int ack_seq;
unsigned char offset;
unsigned char control;
unsigned short window;
unsigned short check;
unsigned short urg_ptr;
unsigned int tcpoptions1;
unsigned int tcpoptions2;
} TCP_HDR, *PTCP_HDR;
typedef struct tcp_ip_hdr
{
IP_HDR ipHdr;
TCP_HDR tcpHdr;
} TCP_IP_HDR, *PTCP_IP_HDR;
typedef struct udp_ip_hdr
{
IP_HDR ipHdr;
UDP_HDR udpHdr;
} UDP_IP_HDR, *PUDP_IP_HDR;
typedef struct icmp_type_hdr
{
IP_HDR ipHdr;
unsigned char type;
} ICMP_TYPE_HDR, *PICMP_TYPE_HDR;
typedef struct icmp_destination_unreachable_hdr
{
IP_HDR ipHdr;
unsigned char type;
unsigned char code;
unsigned short checksum;
unsigned int unused;
IP_HDR original_datagram;
double data_bits_original_datagram;
} ICMP_DESTINATION_UNREACHABLE_HDR, *pICMP_DESTINATION_UNREACHABLE_HDR;
typedef struct icmp_time_exeeded_hdr
{
IP_HDR ipHdr;
unsigned char type;
unsigned char code;
unsigned short checksum;
unsigned int unused;
IP_HDR original_datagram;
double data_bits_original_datagram;
} ICMP_TIME_EXEEDED_HDR, *pICMP_TIME_EXEEDED_HDR;
typedef struct icmp_parameter_problem_hdr
{
IP_HDR ipHdr;
unsigned char type;
unsigned char code;
unsigned short checksum;
unsigned char pointer;
unsigned char unused1;
unsigned short unused2;
IP_HDR original_datagram;
double data_bits_original_datagram;
} ICMP_PARAMETER_PROBLEM_HDR, *pICMP_PARAMETER_PROBLEM_HDR;
typedef struct icmp_source_quench_hdr
{
IP_HDR ipHdr;
unsigned char type;
unsigned char code;
unsigned short checksum;
unsigned int unused;
IP_HDR original_datagram;
double data_bits_original_datagram;
} ICMP_SOURCE_QUENCH_HDR, *pICMP_SOURCE_QUENCH_HDR;
typedef struct icmp_redirect_hdr
{
IP_HDR ipHdr;
unsigned char type;
unsigned char code;
unsigned short checksum;
unsigned int gateway_address;
IP_HDR original_datagram;
double data_bits_original_datagram;
} ICMP_REDIRECT_HDR, *pICMP_REDIRECT_HDR;
typedef struct icmp_echo_echoreply_hdr
{
IP_HDR ipHdr;
unsigned char type;
unsigned char code;
unsigned short checksum;
unsigned short identifier;
unsigned short seq_number;
} ICMP_ECHO_ECHOREPLY_HDR, *pICMP_ECHO_ECHOREPLY_HDR;
typedef struct icmp_information_requestreply_hdr
{
IP_HDR ipHdr;
unsigned char type;
unsigned char code;
unsigned short checksum;
unsigned short identifier;
unsigned short seq_number;
} ICMP_INFORMATION_REQUESTREPLY_HDR, *pICMP_INFORMATION_REQUESTREPLY_HDR;
typedef struct icmp_timestamp_timestampreply_hdr
{
IP_HDR ipHdr;
unsigned char type;
unsigned char code;
unsigned short checksum;
unsigned short identifier;
unsigned short seq_number;
unsigned int origin_timestamp;
unsigned int rec_timestamp;
unsigned int transmit_timestamp;
} ICMP_TIMESTAMP_TIMESTAMPREPLY_HDR, *pICMP_TIMESTAMP_TIMESTAMPREPLY_HDR;