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
33f0320c
Commit
33f0320c
authored
Feb 06, 2010
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Icmp refactoring
parent
faa30217
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
706 additions
and
580 deletions
+706
-580
IcmpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IcmpTests.cs
+37
-0
IcmpAddressMaskDatagram.cs
...et/src/PcapDotNet.Packets/Icmp/IcmpAddressMaskDatagram.cs
+0
-46
IcmpAddressMaskRequestDatagram.cs
...PcapDotNet.Packets/Icmp/IcmpAddressMaskRequestDatagram.cs
+78
-0
IcmpAddressMaskRequestLayer.cs
...rc/PcapDotNet.Packets/Icmp/IcmpAddressMaskRequestLayer.cs
+3
-3
IcmpConversionFailedDatagram.cs
...c/PcapDotNet.Packets/Icmp/IcmpConversionFailedDatagram.cs
+16
-13
IcmpDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagram.cs
+77
-348
IcmpDestinationUnreachableDatagram.cs
...DotNet.Packets/Icmp/IcmpDestinationUnreachableDatagram.cs
+19
-0
IcmpDomainNameRequestDatagram.cs
.../PcapDotNet.Packets/Icmp/IcmpDomainNameRequestDatagram.cs
+20
-0
IcmpEchoDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpEchoDatagram.cs
+17
-18
IcmpEchoReplyDatagram.cs
...tNet/src/PcapDotNet.Packets/Icmp/IcmpEchoReplyDatagram.cs
+35
-0
IcmpIdentifiedDatagram.cs
...Net/src/PcapDotNet.Packets/Icmp/IcmpIdentifiedDatagram.cs
+10
-8
IcmpInformationReplyDatagram.cs
...c/PcapDotNet.Packets/Icmp/IcmpInformationReplyDatagram.cs
+20
-0
IcmpInformationRequestDatagram.cs
...PcapDotNet.Packets/Icmp/IcmpInformationRequestDatagram.cs
+20
-0
IcmpIpV4HeaderPlus64BitsPayloadDatagram.cs
...t.Packets/Icmp/IcmpIpV4HeaderPlus64BitsPayloadDatagram.cs
+8
-18
IcmpIpV4PayloadDatagram.cs
...et/src/PcapDotNet.Packets/Icmp/IcmpIpV4PayloadDatagram.cs
+11
-9
IcmpLayer.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpLayer.cs
+9
-3
IcmpParameterProblemDatagram.cs
...c/PcapDotNet.Packets/Icmp/IcmpParameterProblemDatagram.cs
+23
-10
IcmpRedirectDatagram.cs
...otNet/src/PcapDotNet.Packets/Icmp/IcmpRedirectDatagram.cs
+17
-4
IcmpRouterAdvertisementDatagram.cs
...capDotNet.Packets/Icmp/IcmpRouterAdvertisementDatagram.cs
+22
-44
IcmpRouterAdvertisementEntry.cs
...c/PcapDotNet.Packets/Icmp/IcmpRouterAdvertisementEntry.cs
+38
-0
IcmpRouterAdvertisementLayer.cs
...c/PcapDotNet.Packets/Icmp/IcmpRouterAdvertisementLayer.cs
+1
-1
IcmpSecurityFailuresDatagram.cs
...c/PcapDotNet.Packets/Icmp/IcmpSecurityFailuresDatagram.cs
+24
-10
IcmpSourceQuenchDatagram.cs
...t/src/PcapDotNet.Packets/Icmp/IcmpSourceQuenchDatagram.cs
+19
-0
IcmpTimeExceededDatagram.cs
...t/src/PcapDotNet.Packets/Icmp/IcmpTimeExceededDatagram.cs
+19
-0
IcmpTimestampDatagram.cs
...tNet/src/PcapDotNet.Packets/Icmp/IcmpTimestampDatagram.cs
+31
-16
IcmpTimestampLayer.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTimestampLayer.cs
+2
-2
IcmpTimestampReplyDatagram.cs
...src/PcapDotNet.Packets/Icmp/IcmpTimestampReplyDatagram.cs
+23
-0
IcmpTracerouteDatagram.cs
...Net/src/PcapDotNet.Packets/Icmp/IcmpTracerouteDatagram.cs
+30
-14
IcmpTracerouteLayer.cs
...DotNet/src/PcapDotNet.Packets/Icmp/IcmpTracerouteLayer.cs
+2
-2
IcmpTypedDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTypedDatagram.cs
+9
-9
IcmpUnknownDatagram.cs
...DotNet/src/PcapDotNet.Packets/Icmp/IcmpUnknownDatagram.cs
+22
-0
IcmpUnknownLayer.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpUnknownLayer.cs
+31
-0
IpV4Datagram.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Datagram.cs
+1
-1
PcapDotNet.Packets.csproj
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
+12
-1
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/IcmpTests.cs
View file @
33f0320c
...
...
@@ -154,6 +154,43 @@ namespace PcapDotNet.Packets.Test
icmpLayer
.
Checksum
=
actualIcmpLayer
.
Checksum
;
Assert
.
AreEqual
(
icmpLayer
,
actualIcmpLayer
);
Assert
.
IsTrue
(
packet
.
Ethernet
.
IpV4
.
Icmp
.
IsChecksumCorrect
);
switch
(
packet
.
Ethernet
.
IpV4
.
Icmp
.
MessageType
)
{
case
IcmpMessageType
.
DestinationUnreachable
:
// Assert.AreEqual(icmpIpV4Layer, packet.Ethernet.IpV4.Icmp.DestinationUncreachable.IpV4.ExtractLayer());
case
IcmpMessageType
.
TimeExceeded
:
case
IcmpMessageType
.
ParameterProblem
:
case
IcmpMessageType
.
SourceQuench
:
case
IcmpMessageType
.
Redirect
:
case
IcmpMessageType
.
ConversionFailed
:
isIpV4Payload
=
true
;
break
;
case
IcmpMessageType
.
Echo
:
case
IcmpMessageType
.
EchoReply
:
case
IcmpMessageType
.
Timestamp
:
case
IcmpMessageType
.
TimestampReply
:
case
IcmpMessageType
.
InformationRequest
:
case
IcmpMessageType
.
InformationReply
:
case
IcmpMessageType
.
RouterAdvertisement
:
case
IcmpMessageType
.
RouterSolicitation
:
// packet.Ethernet.IpV4.Icmp.RouterSolicitation
case
IcmpMessageType
.
AddressMaskRequest
:
case
IcmpMessageType
.
AddressMaskReply
:
case
IcmpMessageType
.
Traceroute
:
case
IcmpMessageType
.
DomainNameRequest
:
case
IcmpMessageType
.
SecurityFailures
:
isIpV4Payload
=
false
;
break
;
case
IcmpMessageType
.
DomainNameReply
:
default
:
throw
new
InvalidOperationException
(
"Invalid icmpMessageType "
+
packet
.
Ethernet
.
IpV4
.
Icmp
.
MessageType
);
}
}
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpAddressMaskDatagram.cs
deleted
100644 → 0
View file @
faa30217
using
System
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
{
/// <summary>
/// RFC 950.
/// <pre>
/// +-----+------------+-----------------+
/// | Bit | 0-15 | 16-31 |
/// +-----+------------+-----------------+
/// | 0 | Identifier | Sequence Number |
/// +-----+------------+-----------------+
/// | 32 | Address Mask |
/// +-----+------------------------------+
/// </pre>
/// </summary>
public
class
IcmpAddressMaskDatagram
:
IcmpIdentifiedDatagram
{
public
const
int
HeaderLength
=
HeaderMinimumLength
+
HeaderAdditionalLength
;
public
const
int
HeaderAdditionalLength
=
4
;
private
class
Offset
{
public
const
int
AddressMask
=
4
;
}
/// <summary>
/// A 32-bit mask.
/// </summary>
public
IpV4Address
AddressMask
{
get
{
return
ReadIpV4Address
(
Offset
.
AddressMask
,
Endianity
.
Big
);
}
}
internal
IcmpAddressMaskDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
internal
static
void
WriteHeaderAdditional
(
byte
[]
buffer
,
int
offset
,
IpV4Address
addressMask
)
{
buffer
.
Write
(
offset
,
addressMask
,
Endianity
.
Big
);
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpAddressMaskRequestDatagram.cs
0 → 100644
View file @
33f0320c
using
System
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
{
/// <summary>
/// RFC 950.
/// <pre>
/// +-----+------+------+-----------------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+-----------------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+-----------------+
/// | 32 | Identifier | Sequence Number |
/// +-----+-------------+-----------------+
/// | 64 | Address Mask |
/// +-----+-------------------------------+
/// </pre>
/// </summary>
public
class
IcmpAddressMaskRequestDatagram
:
IcmpIdentifiedDatagram
{
public
const
int
DatagramLength
=
HeaderLength
+
PayloadLength
;
public
const
int
PayloadLength
=
4
;
private
class
Offset
{
public
const
int
AddressMask
=
8
;
}
/// <summary>
/// A 32-bit mask.
/// </summary>
public
IpV4Address
AddressMask
{
get
{
return
ReadIpV4Address
(
Offset
.
AddressMask
,
Endianity
.
Big
);
}
}
internal
IcmpAddressMaskRequestDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
internal
static
void
WriteHeaderAdditional
(
byte
[]
buffer
,
int
offset
,
IpV4Address
addressMask
)
{
buffer
.
Write
(
offset
,
addressMask
,
Endianity
.
Big
);
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpAddressMaskRequestLayer
{
Checksum
=
Checksum
,
Identifier
=
Identifier
,
SequenceNumber
=
SequenceNumber
,
AddressMask
=
AddressMask
,
};
}
}
public
class
IcmpAddressMaskReplyDatagram
:
IcmpAddressMaskRequestDatagram
{
internal
IcmpAddressMaskReplyDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpAddressMaskReplyLayer
{
Checksum
=
Checksum
,
Identifier
=
Identifier
,
SequenceNumber
=
SequenceNumber
,
AddressMask
=
AddressMask
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpAddressMaskRequestLayer.cs
View file @
33f0320c
...
...
@@ -15,13 +15,13 @@ namespace PcapDotNet.Packets.Icmp
{
get
{
return
base
.
Length
+
IcmpAddressMask
Datagram
.
HeaderAdditional
Length
;
return
base
.
Length
+
IcmpAddressMask
RequestDatagram
.
Payload
Length
;
}
}
protected
override
void
Write
HeaderAdditional
(
byte
[]
buffer
,
int
offset
)
protected
override
void
Write
Payload
(
byte
[]
buffer
,
int
offset
)
{
IcmpAddressMaskDatagram
.
WriteHeaderAdditional
(
buffer
,
offset
,
AddressMask
);
IcmpAddressMask
Request
Datagram
.
WriteHeaderAdditional
(
buffer
,
offset
,
AddressMask
);
}
public
bool
Equals
(
IcmpAddressMaskRequestLayer
other
)
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpConversionFailedDatagram.cs
View file @
33f0320c
using
System
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
...
...
@@ -5,12 +6,14 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 1475.
/// <pre>
/// +-----+------+------+-----------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+-----------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+-----------+
/// | 32 | pointer to problem area |
/// +-----+-------------------------+
/// | Bit | 0-31 |
/// +-----+-------------------------+
/// | 0 | pointer to problem area |
/// +-----+-------------------------+
/// | 32 | copy of datagram that |
/// | 64 | copy of datagram that |
/// | | could not be converted |
/// | | ... |
/// +-----+-------------------------+
...
...
@@ -20,7 +23,7 @@ namespace PcapDotNet.Packets.Icmp
{
private
class
Offset
{
public
const
int
Pointer
=
0
;
public
const
int
Pointer
=
4
;
}
/// <summary>
...
...
@@ -31,14 +34,14 @@ namespace PcapDotNet.Packets.Icmp
get
{
return
ReadUInt
(
Offset
.
Pointer
,
Endianity
.
Big
);
}
}
/// <summary>
/// The data is part of the datagram that could not be converted.
/// It must be at least the IP and transport headers, and must include the field pointed to by the previous parameter.
/// For code 4, the transport header is probably not identifiable; the data should include 256 bytes of the original datagram.
/// </summary>
public
IpV4Datagram
IpV4
public
override
ILayer
ExtractLayer
()
{
get
{
return
IpV4Payload
;
}
return
new
IcmpConversionFailedLayer
{
Checksum
=
Checksum
,
Code
=
(
IcmpCodeConversionFailed
)
Code
,
Pointer
=
Pointer
};
}
internal
IcmpConversionFailedDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagram.cs
View file @
33f0320c
This diff is collapsed.
Click to expand it.
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDestinationUnreachableDatagram.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpDestinationUnreachableDatagram
:
IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
public
IcmpDestinationUnreachableDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpDestinationUnreachableLayer
{
Code
=
(
IcmpCodeDestinationUnrechable
)
Code
,
Checksum
=
Checksum
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDomainNameRequestDatagram.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpDomainNameRequestDatagram
:
IcmpIdentifiedDatagram
{
internal
IcmpDomainNameRequestDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpDomainNameRequestLayer
{
Checksum
=
Checksum
,
Identifier
=
Identifier
,
SequenceNumber
=
SequenceNumber
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpEchoDatagram.cs
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
/// <summary>
/// Echo
or Echo Reply
/// Echo
/// RFC 792.
/// <pre>
/// +-----+------------+-----------------+
/// | Bit | 0-15 | 16-31 |
/// +-----+------------+-----------------+
/// | 0 | Identifier | Sequence Number |
/// +-----+------------+-----------------+
/// | 32 | Data... |
/// +-----+------------------------------+
/// +-----+------+------+-----------------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+-----------------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+-----------------+
/// | 0 | Identifier | Sequence Number |
/// +-----+-------------+-----------------+
/// | 32 | Data... |
/// +-----+-------------------------------+
/// </pre>
/// </summary>
public
class
IcmpEchoDatagram
:
IcmpIdentifiedDatagram
{
p
rivate
class
Offset
p
ublic
override
ILayer
ExtractLayer
()
{
public
const
int
Data
=
4
;
}
/// <summary>
/// The data received in the echo message must be returned in the echo reply message.
/// </summary>
public
Datagram
Data
{
get
{
return
new
Datagram
(
Buffer
,
StartOffset
+
Offset
.
Data
,
Length
-
Offset
.
Data
);
}
return
new
IcmpEchoLayer
{
Checksum
=
Checksum
,
Identifier
=
Identifier
,
SequenceNumber
=
SequenceNumber
};
}
internal
IcmpEchoDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpEchoReplyDatagram.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
/// <summary>
/// Echo Reply
/// RFC 792.
/// <pre>
/// +-----+------+------+-----------------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+-----------------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+-----------------+
/// | 0 | Identifier | Sequence Number |
/// +-----+-------------+-----------------+
/// | 32 | Data... |
/// +-----+-------------------------------+
/// </pre>
/// </summary>
public
class
IcmpEchoReplyDatagram
:
IcmpIdentifiedDatagram
{
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpEchoReplyLayer
{
Checksum
=
Checksum
,
Identifier
=
Identifier
,
SequenceNumber
=
SequenceNumber
};
}
internal
IcmpEchoReplyDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpIdentifiedDatagram.cs
View file @
33f0320c
...
...
@@ -3,19 +3,21 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// <pre>
/// +-----+------------+-----------------+
/// | Bit | 0-15 | 16-31 |
/// +-----+------------+-----------------+
/// | 0 | Identifier | Sequence Number |
/// +-----+------------+-----------------+
/// +-----+------+------+-----------------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+-----------------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+-----------------+
/// | 32 | Identifier | Sequence Number |
/// +-----+-------------+-----------------+
/// </pre>
/// </summary>
public
class
IcmpIdentifiedDatagram
:
IcmpTyped
Datagram
public
abstract
class
IcmpIdentifiedDatagram
:
Icmp
Datagram
{
private
class
Offset
{
public
const
int
Identifier
=
0
;
public
const
int
SequenceNumber
=
2
;
public
const
int
Identifier
=
4
;
public
const
int
SequenceNumber
=
6
;
}
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpInformationReplyDatagram.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpInformationReplyDatagram
:
IcmpIdentifiedDatagram
{
internal
IcmpInformationReplyDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpInformationReplyLayer
{
Checksum
=
Checksum
,
Identifier
=
Identifier
,
SequenceNumber
=
SequenceNumber
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpInformationRequestDatagram.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpInformationRequestDatagram
:
IcmpIdentifiedDatagram
{
internal
IcmpInformationRequestDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpInformationRequestLayer
{
Checksum
=
Checksum
,
Identifier
=
Identifier
,
SequenceNumber
=
SequenceNumber
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpIpV4HeaderPlus64BitsPayloadDatagram.cs
View file @
33f0320c
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
{
/// <summary>
/// RFC 792.
/// <pre>
/// +-----+------+------+-----------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+-----------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+-----------+
/// | 32 | unused |
/// +-----+-------------------------+
/// | Bit | 0-31 |
/// +-----+-------------------------+
/// | 0 | unused |
/// +-----+-------------------------+
/// | 32 | Internet Header |
/// | 64 | Internet Header |
/// | | + 64 bits of |
/// | | Original Data Datagram |
/// +-----+-------------------------+
/// </pre>
/// </summary>
public
class
IcmpIpV4HeaderPlus64BitsPayloadDatagram
:
IcmpIpV4PayloadDatagram
public
abstract
class
IcmpIpV4HeaderPlus64BitsPayloadDatagram
:
IcmpIpV4PayloadDatagram
{
internal
IcmpIpV4HeaderPlus64BitsPayloadDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
/// <summary>
/// The internet header plus the first 64 bits of the original datagram's data.
/// This data is used by the host to match the message to the appropriate process.
/// If a higher level protocol uses port numbers, they are assumed to be in the first 64 data bits of the original datagram's data.
/// </summary>
public
IpV4Datagram
IpV4
{
get
{
return
IpV4Payload
;
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpIpV4PayloadDatagram.cs
View file @
33f0320c
...
...
@@ -4,28 +4,30 @@ namespace PcapDotNet.Packets.Icmp
{
/// <summary>
/// <pre>
/// +-----+------+------+-----------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+-----------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+-----------+
/// | 32 | unused |
/// +-----+-------------------------+
/// | Bit | 0-31 |
/// +-----+-------------------------+
/// | 0 | unused |
/// +-----+-------------------------+
/// | 32 | IpV4 datagram |
/// | 64 | IpV4 datagram |
/// +-----+-------------------------+
/// </pre>
/// </summary>
public
abstract
class
IcmpIpV4PayloadDatagram
:
Icmp
Typed
Datagram
public
abstract
class
IcmpIpV4PayloadDatagram
:
IcmpDatagram
{
internal
IcmpIpV4PayloadDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
protected
IpV4Datagram
IpV4
Payload
protected
IpV4Datagram
IpV4
{
get
{
if
(
_ipV4
==
null
&&
Length
>=
Header
Minimum
Length
)
_ipV4
=
new
IpV4Datagram
(
Buffer
,
StartOffset
+
Header
MinimumLength
,
Length
-
HeaderMinimum
Length
);
if
(
_ipV4
==
null
&&
Length
>=
HeaderLength
)
_ipV4
=
new
IpV4Datagram
(
Buffer
,
StartOffset
+
Header
Length
,
Length
-
Header
Length
);
return
_ipV4
;
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpLayer.cs
View file @
33f0320c
using
System
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
...
...
@@ -23,14 +24,14 @@ namespace PcapDotNet.Packets.Icmp
protected
override
sealed
void
Write
(
byte
[]
buffer
,
int
offset
)
{
IcmpDatagram
.
WriteHeader
(
buffer
,
offset
,
MessageType
,
CodeValue
,
Value
);
Write
HeaderAdditional
(
buffer
,
offset
+
IcmpDatagram
.
HeaderLength
);
Write
Payload
(
buffer
,
offset
+
IcmpDatagram
.
HeaderLength
);
}
protected
virtual
void
Write
HeaderAdditional
(
byte
[]
buffer
,
int
offset
)
protected
virtual
void
Write
Payload
(
byte
[]
buffer
,
int
offset
)
{
}
public
override
void
Finalize
(
byte
[]
buffer
,
int
offset
,
int
payloadLength
,
ILayer
nextLayer
)
public
override
sealed
void
Finalize
(
byte
[]
buffer
,
int
offset
,
int
payloadLength
,
ILayer
nextLayer
)
{
IcmpDatagram
.
WriteChecksum
(
buffer
,
offset
,
Length
+
payloadLength
,
Checksum
);
}
...
...
@@ -52,5 +53,10 @@ namespace PcapDotNet.Packets.Icmp
{
return
base
.
Equals
(
other
)
&&
Equals
(
other
as
IcmpLayer
);
}
public
override
string
ToString
()
{
return
MessageType
+
"."
+
CodeValue
+
"("
+
Value
+
")"
;
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpParameterProblemDatagram.cs
View file @
33f0320c
using
System
;
namespace
PcapDotNet.Packets.Icmp
{
/// <summary>
/// RFC 792.
/// <pre>
/// +-----+---------+---------------+
/// | Bit | 0-7 | 8-31 |
/// +-----+---------+---------------+
/// | 0 | Pointer | unused |
/// +-----+---------+---------------+
/// | 32 | Internet Header |
/// | | + 64 bits of |
/// | | Original Data Datagram |
/// +-----+-------------------------+
/// +-----+---------+------+-----------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+---------+------+-----------+
/// | 0 | Type | Code | Checksum |
/// +-----+---------+------+-----------+
/// | 32 | Pointer | unused |
/// +-----+---------+------------------+
/// | 64 | Internet Header |
/// | | + 64 bits of |
/// | | Original Data Datagram |
/// +-----+----------------------------+
/// </pre>
/// </summary>
public
class
IcmpParameterProblemDatagram
:
IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
private
class
Offset
{
public
const
int
Pointer
=
0
;
public
const
int
Pointer
=
4
;
}
/// <summary>
...
...
@@ -34,5 +38,14 @@ namespace PcapDotNet.Packets.Icmp
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpParameterProblemLayer
{
Checksum
=
Checksum
,
Pointer
=
Pointer
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpRedirectDatagram.cs
View file @
33f0320c
using
System
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
...
...
@@ -5,9 +6,11 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// <pre>
/// +-----+--------------------------+
/// | Bit | 0-31 |
/// +-----+--------------------------+
/// +-----+------+------+------------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+------------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+------------+
/// | 0 | Gateway Internet Address |
/// +-----+--------------------------+
/// | 32 | Internet Header |
...
...
@@ -20,7 +23,7 @@ namespace PcapDotNet.Packets.Icmp
{
private
class
Offset
{
public
const
int
GatewayInternetAddress
=
0
;
public
const
int
GatewayInternetAddress
=
4
;
}
/// <summary>
...
...
@@ -35,5 +38,15 @@ namespace PcapDotNet.Packets.Icmp
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpRedirectLayer
{
Code
=
(
IcmpCodeRedirect
)
Code
,
Checksum
=
Checksum
,
GatewayInternetAddress
=
GatewayInternetAddress
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpRouterAdvertisementDatagram.cs
View file @
33f0320c
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpRouterAdvertisementEntry
{
public
IcmpRouterAdvertisementEntry
(
IpV4Address
routerAddress
,
int
routerAddressPreference
)
{
_routerAddress
=
routerAddress
;
_routerAddressPreference
=
routerAddressPreference
;
}
public
IpV4Address
RouterAddress
{
get
{
return
_routerAddress
;}
}
public
int
RouterAddressPreference
{
get
{
return
_routerAddressPreference
;
}
}
public
bool
Equals
(
IcmpRouterAdvertisementEntry
other
)
{
return
other
!=
null
&&
RouterAddress
==
other
.
RouterAddress
&&
RouterAddressPreference
==
other
.
RouterAddressPreference
;
}
public
override
bool
Equals
(
object
obj
)
{
return
Equals
(
obj
as
IcmpRouterAdvertisementEntry
);
}
private
readonly
IpV4Address
_routerAddress
;
private
readonly
int
_routerAddressPreference
;
}
/// <summary>
/// RFC 1256.
/// <pre>
/// +-----+-----------+-----------------+----------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+-----------+-----------------+----------+
/// | 0 | Num Addrs | Addr Entry Size | Lifetime |
/// | 0 | Type | Code | Checksum |
/// +-----+-----------+-----------------+----------+
/// | 32 | Num Addrs | Addr Entry Size | Lifetime |
/// +-----+-----------+-----------------+----------+
/// |
32
| Router Address[1] |
/// |
64
| Router Address[1] |
/// +-----+----------------------------------------+
/// |
64
| Preference Level[1] |
/// |
96
| Preference Level[1] |
/// +-----+----------------------------------------+
/// |
96
| Router Address[2] |
/// |
128
| Router Address[2] |
/// +-----+----------------------------------------+
/// | 1
28
| Preference Level[2] |
/// | 1
60
| Preference Level[2] |
/// +-----+----------------------------------------+
/// | . | . |
/// | . | . |
/// | . | . |
/// </pre>
/// </summary>
public
class
IcmpRouterAdvertisementDatagram
:
Icmp
Typed
Datagram
public
class
IcmpRouterAdvertisementDatagram
:
IcmpDatagram
{
public
const
int
DefaultAddressEntrySize
=
2
;
private
class
Offset
{
public
const
int
NumAddresses
=
0
;
public
const
int
AddressEntrySize
=
1
;
public
const
int
Lifetime
=
2
;
public
const
int
Addresses
=
4
;
public
const
int
NumAddresses
=
4
;
public
const
int
AddressEntrySize
=
5
;
public
const
int
Lifetime
=
6
;
public
const
int
Addresses
=
8
;
}
/// <summary>
...
...
@@ -151,5 +120,14 @@ namespace PcapDotNet.Packets.Icmp
}
private
ReadOnlyCollection
<
IcmpRouterAdvertisementEntry
>
_entries
;
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpRouterAdvertisementLayer
{
Checksum
=
Checksum
,
Lifetime
=
Lifetime
,
Entries
=
Entries
.
ToList
()
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpRouterAdvertisementEntry.cs
0 → 100644
View file @
33f0320c
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpRouterAdvertisementEntry
{
public
IcmpRouterAdvertisementEntry
(
IpV4Address
routerAddress
,
int
routerAddressPreference
)
{
_routerAddress
=
routerAddress
;
_routerAddressPreference
=
routerAddressPreference
;
}
public
IpV4Address
RouterAddress
{
get
{
return
_routerAddress
;}
}
public
int
RouterAddressPreference
{
get
{
return
_routerAddressPreference
;
}
}
public
bool
Equals
(
IcmpRouterAdvertisementEntry
other
)
{
return
other
!=
null
&&
RouterAddress
==
other
.
RouterAddress
&&
RouterAddressPreference
==
other
.
RouterAddressPreference
;
}
public
override
bool
Equals
(
object
obj
)
{
return
Equals
(
obj
as
IcmpRouterAdvertisementEntry
);
}
private
readonly
IpV4Address
_routerAddress
;
private
readonly
int
_routerAddressPreference
;
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpRouterAdvertisementLayer.cs
View file @
33f0320c
...
...
@@ -32,7 +32,7 @@ namespace PcapDotNet.Packets.Icmp
}
}
protected
override
void
Write
HeaderAdditional
(
byte
[]
buffer
,
int
offset
)
protected
override
void
Write
Payload
(
byte
[]
buffer
,
int
offset
)
{
IcmpRouterAdvertisementDatagram
.
WriteHeaderAdditional
(
buffer
,
offset
,
Entries
);
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpSecurityFailuresDatagram.cs
View file @
33f0320c
using
System
;
namespace
PcapDotNet.Packets.Icmp
{
/// <summary>
/// RFC 2521.
/// <pre>
/// +-----+----------+--------------+
/// | Bit | 0-15 | 16-31 |
/// +-----+----------+--------------+
/// | 0 | Reserved | Pointer |
/// +-----+----------+--------------+
/// | 32 | Internet Header |
/// | | + 64 bits of |
/// | | Original Data Datagram |
/// +-----+-------------------------+
/// +-----+------+------+----------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+----------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+----------+
/// | 32 | Reserved | Pointer |
/// +-----+-------------+----------+
/// | 64 | Internet Header |
/// | | + 64 bits of |
/// | | Original Data Datagram |
/// +-----+------------------------+
/// </pre>
/// </summary>
public
class
IcmpSecurityFailuresDatagram
:
IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
private
class
Offset
{
public
const
int
Pointer
=
2
;
public
const
int
Pointer
=
6
;
}
/// <summary>
...
...
@@ -34,5 +38,15 @@ namespace PcapDotNet.Packets.Icmp
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpSecurityFailuresLayer
{
Code
=
(
IcmpCodeSecurityFailures
)
Code
,
Checksum
=
Checksum
,
Pointer
=
Pointer
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpSourceQuenchDatagram.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpSourceQuenchDatagram
:
IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
public
IcmpSourceQuenchDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpSourceQuenchLayer
{
Checksum
=
Checksum
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTimeExceededDatagram.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpTimeExceededDatagram
:
IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
public
IcmpTimeExceededDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpTimeExceededLayer
{
Code
=
(
IcmpCodeTimeExceeded
)
Code
,
Checksum
=
Checksum
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTimestampDatagram.cs
View file @
33f0320c
...
...
@@ -6,29 +6,31 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// <pre>
/// +-----+------------+-----------------+
/// | Bit | 0-15 | 16-31 |
/// +-----+------------+-----------------+
/// | 0 | Identifier | Sequence Number |
/// +-----+------------+-----------------+
/// | 32 | Originate Timestamp |
/// +-----+------------------------------+
/// | 64 | Receive Timestamp |
/// +-----+------------------------------+
/// | 96 | Transmit Timestamp |
/// +-----+------------------------------+
/// +-----+------+------+-----------------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+------+-----------------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+------+-----------------+
/// | 32 | Identifier | Sequence Number |
/// +-----+-------------+-----------------+
/// | 64 | Originate Timestamp |
/// +-----+-------------------------------+
/// | 96 | Receive Timestamp |
/// +-----+-------------------------------+
/// | 128 | Transmit Timestamp |
/// +-----+-------------------------------+
/// </pre>
/// </summary>
public
class
IcmpTimestampDatagram
:
IcmpIdentifiedDatagram
{
public
const
int
HeaderLength
=
HeaderMinimumLength
+
HeaderAdditional
Length
;
public
const
int
HeaderAdditional
Length
=
12
;
public
const
int
DatagramLength
=
HeaderLength
+
Payload
Length
;
public
const
int
Payload
Length
=
12
;
private
class
Offset
{
public
const
int
OriginateTimestamp
=
4
;
public
const
int
ReceiveTimestamp
=
8
;
public
const
int
TransmitTimestamp
=
1
2
;
public
const
int
OriginateTimestamp
=
8
;
public
const
int
ReceiveTimestamp
=
12
;
public
const
int
TransmitTimestamp
=
1
6
;
}
/// <summary>
...
...
@@ -55,6 +57,19 @@ namespace PcapDotNet.Packets.Icmp
get
{
return
ReadIpV4TimeOfDay
(
Offset
.
TransmitTimestamp
,
Endianity
.
Big
);
}
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpTimestampLayer
{
Checksum
=
Checksum
,
Identifier
=
Identifier
,
SequenceNumber
=
SequenceNumber
,
OriginateTimestamp
=
OriginateTimestamp
,
ReceiveTimestamp
=
ReceiveTimestamp
,
TransmitTimestamp
=
TransmitTimestamp
};
}
internal
IcmpTimestampDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTimestampLayer.cs
View file @
33f0320c
...
...
@@ -16,11 +16,11 @@ namespace PcapDotNet.Packets.Icmp
{
get
{
return
base
.
Length
+
IcmpTimestampDatagram
.
HeaderAdditional
Length
;
return
base
.
Length
+
IcmpTimestampDatagram
.
Payload
Length
;
}
}
protected
override
void
Write
HeaderAdditional
(
byte
[]
buffer
,
int
offset
)
protected
override
void
Write
Payload
(
byte
[]
buffer
,
int
offset
)
{
IcmpTimestampDatagram
.
WriteHeaderAdditional
(
buffer
,
offset
,
OriginateTimestamp
,
ReceiveTimestamp
,
TransmitTimestamp
);
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTimestampReplyDatagram.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpTimestampReplyDatagram
:
IcmpTimestampDatagram
{
internal
IcmpTimestampReplyDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpTimestampReplyLayer
{
Checksum
=
Checksum
,
Identifier
=
Identifier
,
SequenceNumber
=
SequenceNumber
,
OriginateTimestamp
=
OriginateTimestamp
,
ReceiveTimestamp
=
ReceiveTimestamp
,
TransmitTimestamp
=
TransmitTimestamp
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTracerouteDatagram.cs
View file @
33f0320c
...
...
@@ -5,30 +5,32 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 1393.
/// <pre>
/// +-----+------+-------------+------------------+
/// | Bit | 0-7 | 8-15 | 16-31 |
/// +-----+------+-------------+------------------+
/// | 0 | Type | Code | Checksum |
/// +-----+------+-------------+------------------+
/// | 32 | ID Number | unused |
/// +-----+--------------------+------------------+
/// |
Bit | 0-15 | 16-31
|
/// |
64 | Outbound Hop Count | Return Hop Count
|
/// +-----+--------------------+------------------+
/// | 0 | ID Number | unused |
/// +-----+--------------------+------------------+
/// | 32 | Outbound Hop Count | Return Hop Count |
/// +-----+--------------------+------------------+
/// | 64 | Output Link Speed |
/// | 96 | Output Link Speed |
/// +-----+---------------------------------------+
/// |
96
| Output Link MTU |
/// |
128
| Output Link MTU |
/// +-----+---------------------------------------+
/// </pre>
/// </summary>
public
class
IcmpTracerouteDatagram
:
Icmp
Typed
Datagram
public
class
IcmpTracerouteDatagram
:
IcmpDatagram
{
public
const
int
HeaderAdditional
Length
=
12
;
public
const
int
Payload
Length
=
12
;
private
class
Offset
{
public
const
int
Identifier
=
0
;
public
const
int
OutboundHopCount
=
4
;
public
const
int
ReturnHopCount
=
6
;
public
const
int
OutputLinkSpeed
=
8
;
public
const
int
OutputLinkMtu
=
1
2
;
public
const
int
Identifier
=
4
;
public
const
int
OutboundHopCount
=
8
;
public
const
int
ReturnHopCount
=
10
;
public
const
int
OutputLinkSpeed
=
12
;
public
const
int
OutputLinkMtu
=
1
6
;
}
/// <summary>
...
...
@@ -88,5 +90,19 @@ namespace PcapDotNet.Packets.Icmp
buffer
.
Write
(
ref
offset
,
outputLinkSpeed
,
Endianity
.
Big
);
buffer
.
Write
(
offset
,
outputLinkMtu
,
Endianity
.
Big
);
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpTracerouteLayer
{
Code
=
(
IcmpCodeTraceroute
)
Code
,
Checksum
=
Checksum
,
Identification
=
Identification
,
OutboundHopCount
=
OutboundHopCount
,
ReturnHopCount
=
ReturnHopCount
,
OutputLinkSpeed
=
OutputLinkSpeed
,
OutputLinkMtu
=
OutputLinkMtu
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTracerouteLayer.cs
View file @
33f0320c
...
...
@@ -25,7 +25,7 @@ namespace PcapDotNet.Packets.Icmp
{
get
{
return
base
.
Length
+
IcmpTracerouteDatagram
.
HeaderAdditional
Length
;
return
base
.
Length
+
IcmpTracerouteDatagram
.
Payload
Length
;
}
}
...
...
@@ -45,7 +45,7 @@ namespace PcapDotNet.Packets.Icmp
}
}
protected
override
void
Write
HeaderAdditional
(
byte
[]
buffer
,
int
offset
)
protected
override
void
Write
Payload
(
byte
[]
buffer
,
int
offset
)
{
IcmpTracerouteDatagram
.
WriteHeaderAdditional
(
buffer
,
offset
,
OutboundHopCount
,
ReturnHopCount
,
OutputLinkSpeed
,
OutputLinkMtu
);
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTypedDatagram.cs
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpTypedDatagram
:
Datagram
{
public
const
int
HeaderMinimumLength
=
4
;
internal
IcmpTypedDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
}
//
public class IcmpTypedDatagram : Datagram
//
{
//
public const int HeaderMinimumLength = 4;
//
//
internal IcmpTypedDatagram(byte[] buffer, int offset, int length)
//
: base(buffer, offset, length)
//
{
//
}
//
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpUnknownDatagram.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpUnknownDatagram
:
IcmpDatagram
{
public
IcmpUnknownDatagram
(
byte
[]
buffer
,
int
offset
,
int
length
)
:
base
(
buffer
,
offset
,
length
)
{
}
public
override
ILayer
ExtractLayer
()
{
return
new
IcmpUnknownLayer
{
LayerMessageType
=
(
byte
)
MessageType
,
LayerCode
=
Code
,
Checksum
=
Checksum
,
LayerValue
=
Variable
,
Payload
=
Payload
};
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpUnknownLayer.cs
0 → 100644
View file @
33f0320c
namespace
PcapDotNet.Packets.Icmp
{
public
class
IcmpUnknownLayer
:
IcmpLayer
{
public
byte
LayerMessageType
{
get
;
set
;
}
public
byte
LayerCode
{
get
;
set
;
}
public
uint
LayerValue
{
get
;
set
;
}
public
Datagram
Payload
{
get
;
set
;
}
public
override
IcmpMessageType
MessageType
{
get
{
return
(
IcmpMessageType
)
LayerMessageType
;
}
}
protected
override
uint
Value
{
get
{
return
LayerValue
;
}
}
protected
override
void
WritePayload
(
byte
[]
buffer
,
int
offset
)
{
Payload
.
Write
(
buffer
,
offset
);
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Datagram.cs
View file @
33f0320c
...
...
@@ -235,7 +235,7 @@ namespace PcapDotNet.Packets.IpV4
get
{
if
(
_icmp
==
null
&&
Length
>=
HeaderLength
)
_icmp
=
new
Icmp
Datagram
(
Buffer
,
StartOffset
+
HeaderLength
,
Length
-
HeaderLength
);
_icmp
=
IcmpDatagram
.
Create
Datagram
(
Buffer
,
StartOffset
+
HeaderLength
,
Length
-
HeaderLength
);
return
_icmp
;
}
...
...
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
View file @
33f0320c
...
...
@@ -76,25 +76,34 @@
<Compile
Include=
"Icmp\IcmpAddressMaskReplyLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpAddressMaskRequestLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpConversionFailedLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpDestinationUnreachableDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpDestinationUnreachableLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpDomainNameRequestDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpDomainNameRequestLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpEchoLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpEchoReplyDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpEchoReplyLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpIdentifiedLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpInformationReplyDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpInformationReplyLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpInformationRequestDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpInformationRequestLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpParameterProblemLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpRedirectLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpRouterAdvertisementEntry.cs"
/>
<Compile
Include=
"Icmp\IcmpRouterAdvertisementLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpRouterSolicitationLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpSecurityFailuresLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpSourceQuenchDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpSourceQuenchLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpTimeExceededDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpTimeExceededLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpTimestampLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpTimestampReplyDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpTimestampReplyLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpTracerouteLayer.cs"
/>
<Compile
Include=
"Icmp\IcmpAddressMaskDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpAddressMask
Request
Datagram.cs"
/>
<Compile
Include=
"Icmp\IcmpCodeDestinationUnrechable.cs"
/>
<Compile
Include=
"Icmp\IcmpConversionFailedDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpDatagram.cs"
/>
...
...
@@ -111,6 +120,8 @@
<Compile
Include=
"Icmp\IcmpMessageType.cs"
/>
<Compile
Include=
"Icmp\IcmpMessageTypeAndCode.cs"
/>
<Compile
Include=
"Icmp\IcmpTypedDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpUnknownDatagram.cs"
/>
<Compile
Include=
"Icmp\IcmpUnknownLayer.cs"
/>
<Compile
Include=
"IDataLink.cs"
/>
<Compile
Include=
"Ethernet\IEthernetNextLayer.cs"
/>
<Compile
Include=
"Igmp\IgmpLayer.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