Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
88bbdf85
Commit
88bbdf85
authored
Nov 26, 2009
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ICMP
parent
18b85375
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
186 additions
and
57 deletions
+186
-57
IcmpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IcmpTests.cs
+35
-4
IcmpCodeDestinationUnrechable.cs
.../PcapDotNet.Packets/Icmp/IcmpCodeDestinationUnrechable.cs
+49
-0
IcmpMessageType.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpMessageType.cs
+0
-1
IcmpMessageTypeAndCode.cs
...Net/src/PcapDotNet.Packets/Icmp/IcmpMessageTypeAndCode.cs
+0
-47
PacketBuilder.cs
PcapDotNet/src/PcapDotNet.Packets/PacketBuilder.cs
+100
-4
PcapDotNet.Packets.csproj
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
+2
-1
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/IcmpTests.cs
View file @
88bbdf85
...
...
@@ -86,10 +86,6 @@ namespace PcapDotNet.Packets.Test
IcmpMessageType
icmpMessageType
=
random
.
NextEnum
<
IcmpMessageType
>();
Packet
packet
;
switch
(
icmpMessageType
)
{
case
IcmpMessageType
.
DestinationUnreachable
:
IcmpCodeDestinationUnrechable
code
=
random
.
NextEnum
<
IcmpCodeDestinationUnrechable
>();
byte
icmpIpV4TypeOfService
=
random
.
NextByte
();
ushort
icmpIpV4Identification
=
random
.
NextUShort
();
byte
icmpIpV4Ttl
=
random
.
NextByte
();
...
...
@@ -99,6 +95,10 @@ namespace PcapDotNet.Packets.Test
IpV4Address
icmpIpV4Destination
=
new
IpV4Address
(
random
.
NextUInt
());
IpV4Options
icmpIpV4Options
=
random
.
NextIpV4Options
();
Datagram
icmpIpV4Payload
=
random
.
NextDatagram
(
random
.
Next
(
200
));
switch
(
icmpMessageType
)
{
case
IcmpMessageType
.
DestinationUnreachable
:
IcmpCodeDestinationUnrechable
code
=
random
.
NextEnum
<
IcmpCodeDestinationUnrechable
>();
packet
=
PacketBuilder
.
EthernetIpV4IcmpDestinationUnreachable
(
DateTime
.
Now
,
ethernetSource
,
ethernetDestination
,
...
...
@@ -113,6 +113,37 @@ namespace PcapDotNet.Packets.Test
icmpIpV4Options
,
icmpIpV4Payload
);
break
;
// case IcmpMessageType.TimeExceeded:
// PacketBuilder.EthernetIpV4IcmpTimeExceeded(DateTime.Now,
// ethernetSource, ethernetDestination,
// ipV4TypeOfService, ipV4Identification, ipV4Fragmentation,
// ipV4Ttl,
// ipV4Source, ipV4Destination, ipV4Options,
// code,
// icmpIpV4TypeOfService, icmpIpV4Identification,
// icmpIpV4Fragmentation,
// icmpIpV4Ttl, icmpIpV4Protocol, icmpIpV4Source,
// icmpIpV4Destination,
// icmpIpV4Options, icmpIpV4Payload);
// case IcmpMessageType.ParameterProblem:
// case IcmpMessageType.SourceQuench:
// case IcmpMessageType.Redirect:
// case IcmpMessageType.Echo:
// case IcmpMessageType.EchoReply:
// case IcmpMessageType.Timestamp:
// case IcmpMessageType.TimestampReply:
// case IcmpMessageType.InformationRequest:
// case IcmpMessageType.InformationReply:
// case IcmpMessageType.RouterAdvertisement:
// case IcmpMessageType.RouterSolicitation:
// case IcmpMessageType.AddressMaskRequest:
// case IcmpMessageType.AddressMaskReply:
// case IcmpMessageType.Traceroute:
// case IcmpMessageType.ConversionFailed:
// case IcmpMessageType.DomainNameRequest:
// case IcmpMessageType.DomainNameReply:
// case IcmpMessageType.SecurityFailures:
default
:
throw
new
InvalidOperationException
(
"Invalid icmpMessageType "
+
icmpMessageType
);
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpCodeDestinationUnrechable.cs
0 → 100644
View file @
88bbdf85
namespace
PcapDotNet.Packets.Icmp
{
/// <summary>
/// RFC 792.
/// </summary>
public
enum
IcmpCodeDestinationUnrechable
:
byte
{
/// <summary>
/// If, according to the information in the gateway's routing tables,
/// the network specified in the internet destination field of a datagram is unreachable,
/// e.g., the distance to the network is infinity,
/// the gateway may send a destination unreachable message to the internet source host of the datagram.
/// </summary>
DestinationUnreachableNetUnreachable
=
0x00
,
/// <summary>
/// RFC 792.
/// In some networks, the gateway may be able to determine if the internet destination host is unreachable.
/// Gateways in these networks may send destination unreachable messages to the source host when the destination host is unreachable.
/// </summary>
DestinationUnreachableHostUnreachable
=
0x01
,
/// <summary>
/// RFC 792.
/// If, in the destination host, the IP module cannot deliver the datagram because the indicated protocol module is not active,
/// the destination host may send a destination unreachable message to the source host.
/// </summary>
DestinationUnreachableProtocolUnreachable
=
0x02
,
/// <summary>
/// RFC 792.
/// If, in the destination host, the IP module cannot deliver the datagram because the indicated process port is not active,
/// the destination host may send a destination unreachable message to the source host.
/// </summary>
DestinationUnreachablePortUnreachable
=
0x03
,
/// <summary>
/// RFC 792.
/// A datagram must be fragmented to be forwarded by a gateway yet the Don't Fragment flag is on.
/// In this case the gateway must discard the datagram and may return a destination unreachable message.
/// </summary>
DestinationUnreachableFragmentationNeededAndDontFragmentSet
=
0x04
,
/// <summary>
/// RFC 792.
/// </summary>
DestinationUnreachableSourceRouteFailed
=
0x05
,
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpMessageType.cs
View file @
88bbdf85
...
...
@@ -312,6 +312,5 @@ namespace PcapDotNet.Packets.Icmp
/// RFC 2521.
/// </summary>
SecurityFailures
=
0x28
,
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpMessageTypeAndCode.cs
View file @
88bbdf85
namespace
PcapDotNet.Packets.Icmp
{
/// <summary>
/// RFC 792.
/// </summary>
public
enum
IcmpCodeDestinationUnrechable
:
byte
{
/// <summary>
/// If, according to the information in the gateway's routing tables,
/// the network specified in the internet destination field of a datagram is unreachable,
/// e.g., the distance to the network is infinity,
/// the gateway may send a destination unreachable message to the internet source host of the datagram.
/// </summary>
DestinationUnreachableNetUnreachable
=
0x00
,
/// <summary>
/// RFC 792.
/// In some networks, the gateway may be able to determine if the internet destination host is unreachable.
/// Gateways in these networks may send destination unreachable messages to the source host when the destination host is unreachable.
/// </summary>
DestinationUnreachableHostUnreachable
=
0x01
,
/// <summary>
/// RFC 792.
/// If, in the destination host, the IP module cannot deliver the datagram because the indicated protocol module is not active,
/// the destination host may send a destination unreachable message to the source host.
/// </summary>
DestinationUnreachableProtocolUnreachable
=
0x02
,
/// <summary>
/// RFC 792.
/// If, in the destination host, the IP module cannot deliver the datagram because the indicated process port is not active,
/// the destination host may send a destination unreachable message to the source host.
/// </summary>
DestinationUnreachablePortUnreachable
=
0x03
,
/// <summary>
/// RFC 792.
/// A datagram must be fragmented to be forwarded by a gateway yet the Don't Fragment flag is on.
/// In this case the gateway must discard the datagram and may return a destination unreachable message.
/// </summary>
DestinationUnreachableFragmentationNeededAndDontFragmentSet
=
0x04
,
/// <summary>
/// RFC 792.
/// </summary>
DestinationUnreachableSourceRouteFailed
=
0x05
,
}
public
enum
IcmpMessageTypeAndCode
:
ushort
{
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/PacketBuilder.cs
View file @
88bbdf85
This diff is collapsed.
Click to expand it.
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
View file @
88bbdf85
...
...
@@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
9.0.
30729
</ProductVersion>
<ProductVersion>
9.0.
21022
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{8A184AF5-E46C-482C-81A3-76D8CE290104}
</ProjectGuid>
<OutputType>
Library
</OutputType>
...
...
@@ -71,6 +71,7 @@
<Compile
Include=
"Ethernet\EthernetType.cs"
/>
<Compile
Include=
"Ethernet\MacAddress.cs"
/>
<Compile
Include=
"Icmp\IcmpAddressMaskDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpCodeDestinationUnrechable.cs"
/>
<Compile
Include=
"Icmp\IcmpConversionFailedDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpEchoDatagram.cs"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment