This repository has been archived by the owner on Oct 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
icmp.rflx
119 lines (112 loc) · 4.11 KB
/
icmp.rflx
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
package ICMP is
type Tag is
(Echo_Reply => 0,
Echo_Request => 8,
Destination_Unreachable => 3,
Time_Exceeded => 11,
Parameter_Problem => 12,
Source_Quench => 4,
Redirect => 5,
Timestamp_Msg => 13,
Timestamp_Reply => 14,
Information_Request => 15,
Information_Reply => 16)
with Size => 8;
type Code_Destination_Unreachable is
(Net_Unreachable => 0,
Host_Unreachable => 1,
Protocol_Unreachable => 2,
Port_Unreachable => 3,
Fragmentation_Needed_DF_Set => 4,
Source_Route_Failed => 5)
with Size => 8;
type Code_Time_Exceeded is
(TTL_Exceeded => 0,
Fragment_Reassembly_Time_Exceeded => 1)
with Size => 8;
type Code_Redirect is
(Redirect_for_Network => 0,
Redirect_for_Host => 1,
Redirect_for_Service_Network => 2,
Redirect_for_Service_Host => 3)
with Size => 8;
type Code_Zero is range 0 .. 0 with Size => 8;
type Checksum is mod 2 ** 16;
type Identifier is mod 2 ** 16;
type Sequence_Number is mod 2 ** 16;
type Pointer is mod 2 ** 8;
type Timestamp is mod 2 ** 32;
type Gateway_Internet_Address is mod 2 ** 32;
type Unused_32 is range 0 .. 0 with Size => 32;
type Unused_24 is range 0 .. 0 with Size => 24;
type Message is
message
Tag : Tag
then Code_Destination_Unreachable
if Tag = Destination_Unreachable
then Code_Time_Exceeded
if Tag = Time_Exceeded
then Code_Redirect
if Tag = Redirect
then Code_Zero
if Tag = Echo_Reply
or Tag = Echo_Request
or Tag = Source_Quench
or Tag = Parameter_Problem
or Tag = Timestamp_Msg
or Tag = Timestamp_Reply
or Tag = Information_Request
or Tag = Information_Reply;
Code_Destination_Unreachable : Code_Destination_Unreachable
then Checksum;
Code_Time_Exceeded : Code_Time_Exceeded
then Checksum;
Code_Redirect : Code_Redirect
then Checksum;
Code_Zero : Code_Zero;
Checksum : Checksum
then Unused_32
if Tag = Destination_Unreachable
or Tag = Source_Quench
or Tag = Time_Exceeded
then Identifier
if Tag = Echo_Request
or Tag = Echo_Reply
or Tag = Timestamp_Msg
or Tag = Timestamp_Reply
or Tag = Information_Request
or Tag = Information_Reply
then Pointer
if Tag = Parameter_Problem
then Gateway_Internet_Address
if Tag = Redirect;
Gateway_Internet_Address : Gateway_Internet_Address
then Data
with Size => 224;
Pointer : Pointer;
Unused_24 : Unused_24
then Data
with Size => 224;
Unused_32 : Unused_32
then Data
with Size => 224;
Identifier : Identifier;
Sequence_Number : Sequence_Number
then Originate_Timestamp
if Tag = Timestamp_Msg or Tag = Timestamp_Reply
then null
if (Tag = Information_Request or Tag = Information_Reply) and Checksum'Valid_Checksum
then Data
with Size => Message'Last - Sequence_Number'Last
if Tag = Echo_Reply or Tag = Echo_Request;
Originate_Timestamp : Timestamp;
Receive_Timestamp : Timestamp;
Transmit_Timestamp : Timestamp
then null
if Checksum'Valid_Checksum;
Data : Opaque
then null
if Checksum'Valid_Checksum;
end message with
Checksum => (Checksum => (Tag'First .. Checksum'First - 1, Checksum'Last + 1 .. Message'Last));
end ICMP;