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
96b7db96
Commit
96b7db96
authored
Sep 06, 2014
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
677 warnings left.
Code Coverage 94.53%.
parent
fe832502
Show whitespace changes
Inline
Side-by-side
Showing
134 changed files
with
920 additions
and
566 deletions
+920
-566
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+1
-1
WiresharkDatagramComparerSimple.cs
...c/PcapDotNet.Core.Test/WiresharkDatagramComparerSimple.cs
+1
-1
IpV6Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
+6
-1
DnsDataResourceRecord.cs
...otNet/src/PcapDotNet.Packets/Dns/DnsDataResourceRecord.cs
+4
-4
DnsGateway.cs
...Net/src/PcapDotNet.Packets/Dns/ResourceData/DnsGateway.cs
+2
-2
DnsOption.cs
...tNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsOption.cs
+1
-1
DnsResourceDataDomainNames.cs
...et.Packets/Dns/ResourceData/DnsResourceDataDomainNames.cs
+2
-2
DnsResourceDataUShortDomainName.cs
...ckets/Dns/ResourceData/DnsResourceDataUShortDomainName.cs
+2
-2
IIpOptionQuickStart.cs
PcapDotNet/src/PcapDotNet.Packets/Ip/IIpOptionQuickStart.cs
+4
-0
Option.cs
PcapDotNet/src/PcapDotNet.Packets/Ip/Option.cs
+11
-0
Options.cs
PcapDotNet/src/PcapDotNet.Packets/Ip/Options.cs
+1
-2
V4Option.cs
PcapDotNet/src/PcapDotNet.Packets/Ip/V4Option.cs
+3
-0
V4Options.cs
PcapDotNet/src/PcapDotNet.Packets/Ip/V4Options.cs
+5
-1
IpV4Option.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Option.cs
+5
-2
IpV4OptionBasicSecurity.cs
...et/src/PcapDotNet.Packets/IpV4/IpV4OptionBasicSecurity.cs
+2
-6
IpV4OptionQuickStart.cs
...otNet/src/PcapDotNet.Packets/IpV4/IpV4OptionQuickStart.cs
+5
-10
IpV4OptionRoute.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRoute.cs
+2
-7
IpV4OptionRouterAlert.cs
...tNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRouterAlert.cs
+5
-9
IpV4OptionSimple.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSimple.cs
+5
-0
IpV4OptionStreamIdentifier.cs
...src/PcapDotNet.Packets/IpV4/IpV4OptionStreamIdentifier.cs
+5
-9
IpV4OptionTimestamp.cs
...DotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestamp.cs
+2
-6
IpV4OptionTimestampAndAddress.cs
.../PcapDotNet.Packets/IpV4/IpV4OptionTimestampAndAddress.cs
+2
-5
IpV4OptionTimestampOnly.cs
...et/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampOnly.cs
+2
-5
IpV4OptionTraceRoute.cs
...otNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTraceRoute.cs
+5
-11
IpV4OptionUnknown.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionUnknown.cs
+8
-8
IpV4Options.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Options.cs
+1
-1
IpV6ExtensionHeader.cs
...tNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeader.cs
+1
-1
IpV6ExtensionHeaderMobility.cs
...kets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderMobility.cs
+5
-5
IpV6ExtensionHeaderMobilityBindingAcknowledgementBase.cs
.../IpV6ExtensionHeaderMobilityBindingAcknowledgementBase.cs
+1
-1
IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage.cs
...nHeaderMobilityBindingRevocationAcknowledgementMessage.cs
+1
-1
IpV6ExtensionHeaderMobilityBindingRevocationMessage.cs
...rs/IpV6ExtensionHeaderMobilityBindingRevocationMessage.cs
+2
-2
IpV6ExtensionHeaderMobilityLocalizedRouting.cs
...ionHeaders/IpV6ExtensionHeaderMobilityLocalizedRouting.cs
+2
-2
IpV6ExtensionHeaderOptions.cs
...ckets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderOptions.cs
+3
-3
IpV6ExtensionHeaderRouting.cs
...ckets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderRouting.cs
+3
-3
IpV6ExtensionHeaderStandard.cs
...kets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderStandard.cs
+3
-3
IpV6RoutingType.cs
...apDotNet.Packets/IpV6/ExtensionHeaders/IpV6RoutingType.cs
+4
-0
IpV6AccessNetworkIdentifierSubOption.cs
...kets/IpV6/Options/IpV6AccessNetworkIdentifierSubOption.cs
+10
-2
IpV6AccessNetworkIdentifierSubOptionGeoLocation.cs
...ptions/IpV6AccessNetworkIdentifierSubOptionGeoLocation.cs
+5
-0
IpV6AccessNetworkIdentifierSubOptionNetworkIdentifier.cs
.../IpV6AccessNetworkIdentifierSubOptionNetworkIdentifier.cs
+6
-0
IpV6AccessNetworkIdentifierSubOptionOperatorIdentifier.cs
...IpV6AccessNetworkIdentifierSubOptionOperatorIdentifier.cs
+7
-0
IpV6AccessNetworkIdentifierSubOptionUnknown.cs
...V6/Options/IpV6AccessNetworkIdentifierSubOptionUnknown.cs
+5
-0
IpV6FlowIdentificationSubOption.cs
...t.Packets/IpV6/Options/IpV6FlowIdentificationSubOption.cs
+9
-1
IpV6FlowIdentificationSubOptionBindingReference.cs
...ptions/IpV6FlowIdentificationSubOptionBindingReference.cs
+5
-0
IpV6FlowIdentificationSubOptionComplex.cs
...ts/IpV6/Options/IpV6FlowIdentificationSubOptionComplex.cs
+2
-2
IpV6FlowIdentificationSubOptionPad1.cs
...ckets/IpV6/Options/IpV6FlowIdentificationSubOptionPad1.cs
+9
-0
IpV6FlowIdentificationSubOptionPadN.cs
...ckets/IpV6/Options/IpV6FlowIdentificationSubOptionPadN.cs
+12
-1
IpV6FlowIdentificationSubOptionSimple.cs
...ets/IpV6/Options/IpV6FlowIdentificationSubOptionSimple.cs
+9
-4
IpV6FlowIdentificationSubOptionTrafficSelector.cs
...Options/IpV6FlowIdentificationSubOptionTrafficSelector.cs
+7
-0
IpV6FlowIdentificationSubOptionUnknown.cs
...ts/IpV6/Options/IpV6FlowIdentificationSubOptionUnknown.cs
+5
-0
IpV6MobilityOption.cs
...src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOption.cs
+8
-0
IpV6MobilityOptionAccessNetworkIdentifier.cs
...IpV6/Options/IpV6MobilityOptionAccessNetworkIdentifier.cs
+5
-0
IpV6MobilityOptionAlternateIpV4CareOfAddress.cs
...6/Options/IpV6MobilityOptionAlternateIpV4CareOfAddress.cs
+5
-0
IpV6MobilityOptionAuthentication.cs
....Packets/IpV6/Options/IpV6MobilityOptionAuthentication.cs
+7
-0
IpV6MobilityOptionBindingAuthorizationDataForFmIpV6.cs
...ns/IpV6MobilityOptionBindingAuthorizationDataForFmIpV6.cs
+7
-0
IpV6MobilityOptionBindingIdentifier.cs
...ckets/IpV6/Options/IpV6MobilityOptionBindingIdentifier.cs
+7
-0
IpV6MobilityOptionBindingRefreshAdvice.cs
...ts/IpV6/Options/IpV6MobilityOptionBindingRefreshAdvice.cs
+5
-0
IpV6MobilityOptionComplex.cs
...pDotNet.Packets/IpV6/Options/IpV6MobilityOptionComplex.cs
+2
-2
IpV6MobilityOptionContextRequest.cs
....Packets/IpV6/Options/IpV6MobilityOptionContextRequest.cs
+5
-0
IpV6MobilityOptionDnsUpdate.cs
...otNet.Packets/IpV6/Options/IpV6MobilityOptionDnsUpdate.cs
+7
-0
IpV6MobilityOptionEmpty.cs
...capDotNet.Packets/IpV6/Options/IpV6MobilityOptionEmpty.cs
+15
-4
IpV6MobilityOptionFlowIdentification.cs
...kets/IpV6/Options/IpV6MobilityOptionFlowIdentification.cs
+6
-0
IpV6MobilityOptionFlowSummary.cs
...Net.Packets/IpV6/Options/IpV6MobilityOptionFlowSummary.cs
+5
-0
IpV6MobilityOptionGreKey.cs
...apDotNet.Packets/IpV6/Options/IpV6MobilityOptionGreKey.cs
+5
-0
IpV6MobilityOptionIpV4Address.cs
...Net.Packets/IpV6/Options/IpV6MobilityOptionIpV4Address.cs
+7
-2
IpV6MobilityOptionIpV4AddressAcknowledgement.cs
...6/Options/IpV6MobilityOptionIpV4AddressAcknowledgement.cs
+6
-0
IpV6MobilityOptionIpV4DhcpSupportMode.cs
...ets/IpV6/Options/IpV6MobilityOptionIpV4DhcpSupportMode.cs
+5
-0
IpV6MobilityOptionIpV4HomeAddress.cs
...Packets/IpV6/Options/IpV6MobilityOptionIpV4HomeAddress.cs
+6
-0
IpV6MobilityOptionIpV4HomeAddressReply.cs
...ts/IpV6/Options/IpV6MobilityOptionIpV4HomeAddressReply.cs
+6
-0
IpV6MobilityOptionIpV4HomeAddressRequest.cs
.../IpV6/Options/IpV6MobilityOptionIpV4HomeAddressRequest.cs
+6
-0
IpV6MobilityOptionIpV6Address.cs
...Net.Packets/IpV6/Options/IpV6MobilityOptionIpV6Address.cs
+8
-3
IpV6MobilityOptionIpV6AddressPrefix.cs
...ckets/IpV6/Options/IpV6MobilityOptionIpV6AddressPrefix.cs
+6
-0
IpV6MobilityOptionLinkLayerAddress.cs
...ackets/IpV6/Options/IpV6MobilityOptionLinkLayerAddress.cs
+7
-0
IpV6MobilityOptionLoadInformation.cs
...Packets/IpV6/Options/IpV6MobilityOptionLoadInformation.cs
+7
-0
IpV6MobilityOptionLocalMobilityAnchorAddress.cs
...6/Options/IpV6MobilityOptionLocalMobilityAnchorAddress.cs
+6
-0
IpV6MobilityOptionMobileAccessGatewayIpV6Address.cs
...tions/IpV6MobilityOptionMobileAccessGatewayIpV6Address.cs
+5
-0
IpV6MobilityOptionMobileNodeGroupIdentifier.cs
...V6/Options/IpV6MobilityOptionMobileNodeGroupIdentifier.cs
+7
-0
IpV6MobilityOptionMobileNodeIdentifier.cs
...ts/IpV6/Options/IpV6MobilityOptionMobileNodeIdentifier.cs
+6
-0
IpV6MobilityOptionMobileNodeLinkLayerIdentifier.cs
...ptions/IpV6MobilityOptionMobileNodeLinkLayerIdentifier.cs
+5
-0
IpV6MobilityOptionMobileNodeLinkLocalAddressInterfaceIdentifier.cs
...ityOptionMobileNodeLinkLocalAddressInterfaceIdentifier.cs
+5
-0
IpV6MobilityOptionNatDetection.cs
...et.Packets/IpV6/Options/IpV6MobilityOptionNatDetection.cs
+7
-0
IpV6MobilityOptionNetworkPrefix.cs
...t.Packets/IpV6/Options/IpV6MobilityOptionNetworkPrefix.cs
+10
-3
IpV6MobilityOptionNonceIndices.cs
...et.Packets/IpV6/Options/IpV6MobilityOptionNonceIndices.cs
+7
-0
IpV6MobilityOptionPadN.cs
...PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionPadN.cs
+14
-1
IpV6MobilityOptionRedirect.cs
...DotNet.Packets/IpV6/Options/IpV6MobilityOptionRedirect.cs
+6
-0
IpV6MobilityOptionRedirectCapability.cs
...kets/IpV6/Options/IpV6MobilityOptionRedirectCapability.cs
+5
-0
IpV6MobilityOptionReservedByteValueByte.cs
...s/IpV6/Options/IpV6MobilityOptionReservedByteValueByte.cs
+7
-2
IpV6MobilityOptionRestartCounter.cs
....Packets/IpV6/Options/IpV6MobilityOptionRestartCounter.cs
+5
-0
IpV6MobilityOptionSingleDataSegmentField.cs
.../IpV6/Options/IpV6MobilityOptionSingleDataSegmentField.cs
+8
-3
IpV6MobilityOptionTransientBinding.cs
...ackets/IpV6/Options/IpV6MobilityOptionTransientBinding.cs
+7
-0
IpV6MobilityOptionType.cs
...PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionType.cs
+3
-0
IpV6MobilityOptionULong.cs
...capDotNet.Packets/IpV6/Options/IpV6MobilityOptionULong.cs
+8
-3
IpV6MobilityOptionVendorSpecific.cs
....Packets/IpV6/Options/IpV6MobilityOptionVendorSpecific.cs
+8
-1
IpV6MobilityOptions.cs
...rc/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptions.cs
+3
-0
IpV6Option.cs
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Option.cs
+8
-0
IpV6OptionCalipso.cs
.../src/PcapDotNet.Packets/IpV6/Options/IpV6OptionCalipso.cs
+5
-0
IpV6OptionComplex.cs
.../src/PcapDotNet.Packets/IpV6/Options/IpV6OptionComplex.cs
+2
-2
IpV6OptionEndpointIdentification.cs
....Packets/IpV6/Options/IpV6OptionEndpointIdentification.cs
+7
-0
IpV6OptionHomeAddress.cs
.../PcapDotNet.Packets/IpV6/Options/IpV6OptionHomeAddress.cs
+5
-0
IpV6OptionIlnpNonce.cs
...rc/PcapDotNet.Packets/IpV6/Options/IpV6OptionIlnpNonce.cs
+5
-0
IpV6OptionJumboPayload.cs
...PcapDotNet.Packets/IpV6/Options/IpV6OptionJumboPayload.cs
+5
-0
IpV6OptionLineIdentificationDestination.cs
...s/IpV6/Options/IpV6OptionLineIdentificationDestination.cs
+5
-0
IpV6OptionPad1.cs
...Net/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionPad1.cs
+5
-0
IpV6OptionPadN.cs
...Net/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionPadN.cs
+12
-1
IpV6OptionQuickStart.cs
...c/PcapDotNet.Packets/IpV6/Options/IpV6OptionQuickStart.cs
+6
-0
IpV6OptionRouterAlert.cs
.../PcapDotNet.Packets/IpV6/Options/IpV6OptionRouterAlert.cs
+5
-0
IpV6OptionRoutingProtocolLowPowerAndLossyNetworks.cs
...ions/IpV6OptionRoutingProtocolLowPowerAndLossyNetworks.cs
+7
-0
IpV6OptionSimple.cs
...t/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionSimple.cs
+7
-2
IpV6OptionSmfDpdDefault.cs
...capDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdDefault.cs
+5
-0
IpV6OptionSmfDpdIpV4.cs
...c/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdIpV4.cs
+5
-0
IpV6OptionSmfDpdIpV6.cs
...c/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdIpV6.cs
+5
-0
IpV6OptionSmfDpdNull.cs
...c/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdNull.cs
+5
-0
IpV6OptionSmfDpdSequenceBased.cs
...Net.Packets/IpV6/Options/IpV6OptionSmfDpdSequenceBased.cs
+10
-2
IpV6OptionSmfDpdSequenceHashAssistValue.cs
...s/IpV6/Options/IpV6OptionSmfDpdSequenceHashAssistValue.cs
+5
-0
IpV6OptionTunnelEncapsulationLimit.cs
...ackets/IpV6/Options/IpV6OptionTunnelEncapsulationLimit.cs
+5
-0
IpV6OptionUnknown.cs
.../src/PcapDotNet.Packets/IpV6/Options/IpV6OptionUnknown.cs
+5
-0
IpV6Options.cs
...DotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Options.cs
+19
-1
V6Options.cs
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/V6Options.cs
+6
-2
TcpOption.cs
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOption.cs
+11
-7
TcpOptionAlternateChecksumData.cs
...otNet.Packets/Transport/TcpOptionAlternateChecksumData.cs
+17
-28
TcpOptionAlternateChecksumRequest.cs
...et.Packets/Transport/TcpOptionAlternateChecksumRequest.cs
+17
-28
TcpOptionConnectionCountBase.cs
...pDotNet.Packets/Transport/TcpOptionConnectionCountBase.cs
+11
-23
TcpOptionEcho.cs
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionEcho.cs
+17
-28
TcpOptionEchoReply.cs
...et/src/PcapDotNet.Packets/Transport/TcpOptionEchoReply.cs
+17
-28
TcpOptionMaximumSegmentSize.cs
...apDotNet.Packets/Transport/TcpOptionMaximumSegmentSize.cs
+17
-29
TcpOptionMd5Signature.cs
...src/PcapDotNet.Packets/Transport/TcpOptionMd5Signature.cs
+17
-28
TcpOptionMood.cs
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionMood.cs
+17
-28
TcpOptionPartialOrderConnectionPermitted.cs
...ets/Transport/TcpOptionPartialOrderConnectionPermitted.cs
+16
-17
TcpOptionPartialOrderServiceProfile.cs
....Packets/Transport/TcpOptionPartialOrderServiceProfile.cs
+17
-29
TcpOptionSelectiveAcknowledgment.cs
...Net.Packets/Transport/TcpOptionSelectiveAcknowledgment.cs
+17
-28
TcpOptionSelectiveAcknowledgmentPermitted.cs
...ts/Transport/TcpOptionSelectiveAcknowledgmentPermitted.cs
+16
-17
TcpOptionSimple.cs
...otNet/src/PcapDotNet.Packets/Transport/TcpOptionSimple.cs
+15
-0
TcpOptionTimestamp.cs
...et/src/PcapDotNet.Packets/Transport/TcpOptionTimestamp.cs
+17
-29
TcpOptionUnknown.cs
...tNet/src/PcapDotNet.Packets/Transport/TcpOptionUnknown.cs
+17
-29
TcpOptionWindowScale.cs
.../src/PcapDotNet.Packets/Transport/TcpOptionWindowScale.cs
+17
-29
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
96b7db96
...
@@ -35,7 +35,7 @@ namespace PcapDotNet.Core.Test
...
@@ -35,7 +35,7 @@ namespace PcapDotNet.Core.Test
get
{
return
RetryNumber
!=
-
1
;
}
get
{
return
RetryNumber
!=
-
1
;
}
}
}
private
const
int
RetryNumber
=
-
1
;
private
const
int
RetryNumber
=
220
;
/// <summary>
/// <summary>
/// Gets or sets the test context which provides
/// Gets or sets the test context which provides
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkDatagramComparerSimple.cs
View file @
96b7db96
...
@@ -5,7 +5,7 @@ namespace PcapDotNet.Core.Test
...
@@ -5,7 +5,7 @@ namespace PcapDotNet.Core.Test
{
{
internal
abstract
class
WiresharkDatagramComparerSimple
:
WiresharkDatagramComparer
internal
abstract
class
WiresharkDatagramComparerSimple
:
WiresharkDatagramComparer
{
{
protected
override
sealed
bool
CompareField
(
XElement
field
,
Datagram
parentDatagram
,
Datagram
datagram
)
protected
sealed
override
bool
CompareField
(
XElement
field
,
Datagram
parentDatagram
,
Datagram
datagram
)
{
{
return
CompareField
(
field
,
datagram
);
return
CompareField
(
field
,
datagram
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
View file @
96b7db96
...
@@ -86,8 +86,13 @@ namespace PcapDotNet.Packets.Test
...
@@ -86,8 +86,13 @@ namespace PcapDotNet.Packets.Test
Assert
.
AreEqual
(
ipV6Layer
,
packet
.
Ethernet
.
IpV6
.
ExtractLayer
(),
"IP Layer"
);
Assert
.
AreEqual
(
ipV6Layer
,
packet
.
Ethernet
.
IpV6
.
ExtractLayer
(),
"IP Layer"
);
Assert
.
IsNotNull
(
ipV6Layer
.
GetHashCode
());
Assert
.
IsNotNull
(
ipV6Layer
.
GetHashCode
());
Assert
.
AreEqual
(
string
.
Format
(
"{0} -> {1} ({2})"
,
ipV6Layer
.
Source
,
ipV6Layer
.
CurrentDestination
,
ipV6Layer
.
NextHeader
),
ipV6Layer
.
ToString
());
Assert
.
AreEqual
(
string
.
Format
(
"{0} -> {1} ({2})"
,
ipV6Layer
.
Source
,
ipV6Layer
.
CurrentDestination
,
ipV6Layer
.
NextHeader
),
ipV6Layer
.
ToString
());
for
each
(
IpV6ExtensionHeader
extensionHeader
in
(
IEnumerable
)
packet
.
Ethernet
.
IpV6
.
ExtensionHeaders
)
for
(
int
extensionHeaderIndex
=
0
;
extensionHeaderIndex
!=
packet
.
Ethernet
.
IpV6
.
ExtensionHeaders
.
Headers
.
Count
;
++
extensionHeaderIndex
)
{
{
IpV6ExtensionHeader
extensionHeader
=
packet
.
Ethernet
.
IpV6
.
ExtensionHeaders
[
extensionHeaderIndex
];
IpV6ExtensionHeader
layerExtensionheader
=
ipV6Layer
.
ExtensionHeaders
[
extensionHeaderIndex
];
Assert
.
AreEqual
(
extensionHeader
,
layerExtensionheader
);
// TODO: Bring it back.
// Assert.AreEqual(extensionHeader.GetHashCode(), layerExtensionheader.GetHashCode());
IpV6ExtensionHeaderOptions
extensionHeaderOptions
=
extensionHeader
as
IpV6ExtensionHeaderOptions
;
IpV6ExtensionHeaderOptions
extensionHeaderOptions
=
extensionHeader
as
IpV6ExtensionHeaderOptions
;
if
(
extensionHeaderOptions
!=
null
)
if
(
extensionHeaderOptions
!=
null
)
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsDataResourceRecord.cs
View file @
96b7db96
...
@@ -71,14 +71,14 @@ namespace PcapDotNet.Packets.Dns
...
@@ -71,14 +71,14 @@ namespace PcapDotNet.Packets.Dns
/// For example, SOA records are always distributed with a zero TTL to prohibit caching.
/// For example, SOA records are always distributed with a zero TTL to prohibit caching.
/// Zero values can also be used for extremely volatile data.
/// Zero values can also be used for extremely volatile data.
/// </summary>
/// </summary>
public
override
sealed
int
Ttl
{
get
;
protected
set
;
}
public
sealed
override
int
Ttl
{
get
;
protected
set
;
}
/// <summary>
/// <summary>
/// A variable length string of octets that describes the resource.
/// A variable length string of octets that describes the resource.
/// The format of this information varies according to the TYPE and CLASS of the resource record.
/// The format of this information varies according to the TYPE and CLASS of the resource record.
/// For example, the if the TYPE is A and the CLASS is IN, the RDATA field is a 4 octet ARPA Internet address.
/// For example, the if the TYPE is A and the CLASS is IN, the RDATA field is a 4 octet ARPA Internet address.
/// </summary>
/// </summary>
public
override
sealed
DnsResourceData
Data
{
get
;
protected
set
;
}
public
sealed
override
DnsResourceData
Data
{
get
;
protected
set
;
}
/// <summary>
/// <summary>
/// A string representing the resource record by concatenating its different parts.
/// A string representing the resource record by concatenating its different parts.
...
@@ -102,7 +102,7 @@ namespace PcapDotNet.Packets.Dns
...
@@ -102,7 +102,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// <summary>
/// Two DnsDataResourceRecord are equal iff their domain name, dns type, dns class, ttl and data fields are equal.
/// Two DnsDataResourceRecord are equal iff their domain name, dns type, dns class, ttl and data fields are equal.
/// </summary>
/// </summary>
public
override
sealed
bool
Equals
(
object
obj
)
public
sealed
override
bool
Equals
(
object
obj
)
{
{
return
Equals
(
obj
as
DnsDataResourceRecord
);
return
Equals
(
obj
as
DnsDataResourceRecord
);
}
}
...
@@ -110,7 +110,7 @@ namespace PcapDotNet.Packets.Dns
...
@@ -110,7 +110,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// <summary>
/// A hash code of the combination of the domain name, dns type, dns class, ttl and data fields.
/// A hash code of the combination of the domain name, dns type, dns class, ttl and data fields.
/// </summary>
/// </summary>
public
override
sealed
int
GetHashCode
()
public
sealed
override
int
GetHashCode
()
{
{
return
GetHashCodeBase
()
^
Sequence
.
GetHashCode
(
Ttl
,
Data
);
return
GetHashCodeBase
()
^
Sequence
.
GetHashCode
(
Ttl
,
Data
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsGateway.cs
View file @
96b7db96
...
@@ -32,7 +32,7 @@ namespace PcapDotNet.Packets.Dns
...
@@ -32,7 +32,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// <summary>
/// Two gateway representations are equal if they are of the same type and the value is the same.
/// Two gateway representations are equal if they are of the same type and the value is the same.
/// </summary>
/// </summary>
public
override
sealed
bool
Equals
(
object
obj
)
public
sealed
override
bool
Equals
(
object
obj
)
{
{
return
Equals
(
obj
as
DnsGateway
);
return
Equals
(
obj
as
DnsGateway
);
}
}
...
@@ -41,7 +41,7 @@ namespace PcapDotNet.Packets.Dns
...
@@ -41,7 +41,7 @@ namespace PcapDotNet.Packets.Dns
/// Serves as a hash function for a particular type.
/// Serves as a hash function for a particular type.
/// </summary>
/// </summary>
/// <returns>A hash code for the current gateway represnetation.</returns>
/// <returns>A hash code for the current gateway represnetation.</returns>
public
override
sealed
int
GetHashCode
()
public
sealed
override
int
GetHashCode
()
{
{
return
GatewayType
.
GetHashCode
()
^
DataGetHashCode
();
return
GatewayType
.
GetHashCode
()
^
DataGetHashCode
();
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsOption.cs
View file @
96b7db96
...
@@ -42,7 +42,7 @@ namespace PcapDotNet.Packets.Dns
...
@@ -42,7 +42,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// <summary>
/// Two options are equal if they are of the same type, have the same code and have equal data.
/// Two options are equal if they are of the same type, have the same code and have equal data.
/// </summary>
/// </summary>
public
override
sealed
bool
Equals
(
object
obj
)
public
sealed
override
bool
Equals
(
object
obj
)
{
{
return
Equals
(
obj
as
DnsOption
);
return
Equals
(
obj
as
DnsOption
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceDataDomainNames.cs
View file @
96b7db96
...
@@ -24,7 +24,7 @@ namespace PcapDotNet.Packets.Dns
...
@@ -24,7 +24,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// <summary>
/// Two domain names resource data are equal if they are of the same type and contain the same domain names in the same order.
/// Two domain names resource data are equal if they are of the same type and contain the same domain names in the same order.
/// </summary>
/// </summary>
public
override
sealed
bool
Equals
(
object
obj
)
public
sealed
override
bool
Equals
(
object
obj
)
{
{
return
Equals
(
obj
as
DnsResourceDataDomainNames
);
return
Equals
(
obj
as
DnsResourceDataDomainNames
);
}
}
...
@@ -32,7 +32,7 @@ namespace PcapDotNet.Packets.Dns
...
@@ -32,7 +32,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// <summary>
/// The hash code of the resource data is based on the concrete type and domain names.
/// The hash code of the resource data is based on the concrete type and domain names.
/// </summary>
/// </summary>
public
override
sealed
int
GetHashCode
()
public
sealed
override
int
GetHashCode
()
{
{
return
GetType
().
GetHashCode
()
^
DomainNames
.
SequenceGetHashCode
();
return
GetType
().
GetHashCode
()
^
DomainNames
.
SequenceGetHashCode
();
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceDataUShortDomainName.cs
View file @
96b7db96
...
@@ -40,7 +40,7 @@ namespace PcapDotNet.Packets.Dns
...
@@ -40,7 +40,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// <summary>
/// Two DnsResourceDataUShortDomainName are equal iff their of the same type and their ushort values and domain names are equal.
/// Two DnsResourceDataUShortDomainName are equal iff their of the same type and their ushort values and domain names are equal.
/// </summary>
/// </summary>
public
override
sealed
bool
Equals
(
object
obj
)
public
sealed
override
bool
Equals
(
object
obj
)
{
{
return
Equals
(
obj
as
DnsResourceDataUShortDomainName
);
return
Equals
(
obj
as
DnsResourceDataUShortDomainName
);
}
}
...
@@ -48,7 +48,7 @@ namespace PcapDotNet.Packets.Dns
...
@@ -48,7 +48,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// <summary>
/// A hash code based on the type, ushort value and domain name.
/// A hash code based on the type, ushort value and domain name.
/// </summary>
/// </summary>
public
override
sealed
int
GetHashCode
()
public
sealed
override
int
GetHashCode
()
{
{
return
Sequence
.
GetHashCode
(
GetType
(),
Value
,
DomainName
);
return
Sequence
.
GetHashCode
(
GetType
(),
Value
,
DomainName
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Ip/IIpOptionQuickStart.cs
View file @
96b7db96
...
@@ -2,6 +2,10 @@ using PcapDotNet.Packets.IpV4;
...
@@ -2,6 +2,10 @@ using PcapDotNet.Packets.IpV4;
namespace
PcapDotNet.Packets.Ip
namespace
PcapDotNet.Packets.Ip
{
{
/// <summary>
/// RFC 4782.
/// Common interface of a quick start option.
/// </summary>
public
interface
IIpOptionQuickStart
public
interface
IIpOptionQuickStart
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Ip/Option.cs
View file @
96b7db96
...
@@ -14,13 +14,24 @@ namespace PcapDotNet.Packets.Ip
...
@@ -14,13 +14,24 @@ namespace PcapDotNet.Packets.Ip
/// </summary>
/// </summary>
public
abstract
int
Length
{
get
;
}
public
abstract
int
Length
{
get
;
}
/// <summary>
/// Returns true iff the given object is an equivalent option.
/// </summary>
public
sealed
override
bool
Equals
(
object
obj
)
public
sealed
override
bool
Equals
(
object
obj
)
{
{
return
Equals
(
obj
as
Option
);
return
Equals
(
obj
as
Option
);
}
}
/// <summary>
/// Returns true iff the given option is an equivalent option.
/// </summary>
public
abstract
bool
Equals
(
Option
other
);
public
abstract
bool
Equals
(
Option
other
);
/// <summary>
/// Returns a hash code for the option.
/// </summary>
public
override
abstract
int
GetHashCode
();
internal
abstract
void
Write
(
byte
[]
buffer
,
ref
int
offset
);
internal
abstract
void
Write
(
byte
[]
buffer
,
ref
int
offset
);
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Ip/Options.cs
View file @
96b7db96
...
@@ -77,8 +77,7 @@ namespace PcapDotNet.Packets.Ip
...
@@ -77,8 +77,7 @@ namespace PcapDotNet.Packets.Ip
/// </summary>
/// </summary>
public
sealed
override
int
GetHashCode
()
public
sealed
override
int
GetHashCode
()
{
{
return
BytesLength
.
GetHashCode
()
^
return
Sequence
.
GetHashCode
(
BytesLength
,
OptionsCollection
.
SequenceGetHashCode
());
OptionsCollection
.
SequenceGetHashCode
();
}
}
public
IEnumerator
<
T
>
GetEnumerator
()
public
IEnumerator
<
T
>
GetEnumerator
()
...
...
PcapDotNet/src/PcapDotNet.Packets/Ip/V4Option.cs
View file @
96b7db96
namespace
PcapDotNet.Packets.Ip
namespace
PcapDotNet.Packets.Ip
{
{
/// <summary>
/// Either an IPv4 option or a TCP option.
/// </summary>
public
abstract
class
V4Option
:
Option
public
abstract
class
V4Option
:
Option
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Ip/V4Options.cs
View file @
96b7db96
...
@@ -5,6 +5,10 @@ using PcapDotNet.Base;
...
@@ -5,6 +5,10 @@ using PcapDotNet.Base;
namespace
PcapDotNet.Packets.Ip
namespace
PcapDotNet.Packets.Ip
{
{
/// <summary>
/// Base class for different IPv4 options.
/// </summary>
/// <typeparam name="T">The option concerete type.</typeparam>
public
abstract
class
V4Options
<
T
>
:
Options
<
T
>
where
T
:
V4Option
,
IEquatable
<
T
>
public
abstract
class
V4Options
<
T
>
:
Options
<
T
>
where
T
:
V4Option
,
IEquatable
<
T
>
{
{
internal
V4Options
(
byte
[]
buffer
,
int
offset
,
int
length
,
T
end
)
internal
V4Options
(
byte
[]
buffer
,
int
offset
,
int
length
,
T
end
)
...
@@ -19,7 +23,7 @@ namespace PcapDotNet.Packets.Ip
...
@@ -19,7 +23,7 @@ namespace PcapDotNet.Packets.Ip
throw
new
ArgumentException
(
"given options take "
+
BytesLength
+
" bytes and maximum number of bytes for options is "
+
maximumBytesLength
,
"options"
);
throw
new
ArgumentException
(
"given options take "
+
BytesLength
+
" bytes and maximum number of bytes for options is "
+
maximumBytesLength
,
"options"
);
}
}
internal
override
sealed
int
CalculateBytesLength
(
int
optionsLength
)
internal
sealed
override
int
CalculateBytesLength
(
int
optionsLength
)
{
{
if
(
optionsLength
%
4
==
0
)
if
(
optionsLength
%
4
==
0
)
return
optionsLength
;
return
optionsLength
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Option.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ip
;
using
PcapDotNet.Packets.Ip
;
namespace
PcapDotNet.Packets.IpV4
namespace
PcapDotNet.Packets.IpV4
...
@@ -67,9 +68,9 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -67,9 +68,9 @@ namespace PcapDotNet.Packets.IpV4
/// The hash code of the option is the hash code of the option type.
/// The hash code of the option is the hash code of the option type.
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
public
override
int
GetHashCode
()
public
sealed
override
int
GetHashCode
()
{
{
return
OptionType
.
GetHashCode
(
);
return
Sequence
.
GetHashCode
(
OptionType
,
GetDataHashCode
()
);
}
}
/// <summary>
/// <summary>
...
@@ -80,6 +81,8 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -80,6 +81,8 @@ namespace PcapDotNet.Packets.IpV4
return
OptionType
.
ToString
();
return
OptionType
.
ToString
();
}
}
internal
abstract
int
GetDataHashCode
();
internal
sealed
override
V4Option
Read
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
internal
sealed
override
V4Option
Read
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
{
{
int
offsetEnd
=
offset
+
length
;
int
offsetEnd
=
offset
+
length
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionBasicSecurity.cs
View file @
96b7db96
...
@@ -174,10 +174,9 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -174,10 +174,9 @@ namespace PcapDotNet.Packets.IpV4
/// with the hash code of the combination of the classification level, protection authority and length.
/// with the hash code of the combination of the classification level, protection authority and length.
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
public
override
int
Get
HashCode
()
internal
override
int
GetData
HashCode
()
{
{
return
base
.
GetHashCode
()
^
return
BitSequence
.
Merge
((
byte
)
ClassificationLevel
,
(
byte
)
ProtectionAuthorities
,(
byte
)
Length
).
GetHashCode
();
BitSequence
.
Merge
((
byte
)
ClassificationLevel
,
(
byte
)
ProtectionAuthorities
,(
byte
)
Length
).
GetHashCode
();
}
}
/// <summary>
/// <summary>
...
@@ -189,9 +188,6 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -189,9 +188,6 @@ namespace PcapDotNet.Packets.IpV4
/// <returns>On success - the complex option read. On failure - null.</returns>
/// <returns>On success - the complex option read. On failure - null.</returns>
Option
IOptionComplexFactory
.
CreateInstance
(
byte
[]
buffer
,
ref
int
offset
,
byte
valueLength
)
Option
IOptionComplexFactory
.
CreateInstance
(
byte
[]
buffer
,
ref
int
offset
,
byte
valueLength
)
{
{
// if (buffer == null)
// throw new ArgumentNullException("buffer");
if
(
valueLength
<
OptionValueMinimumLength
)
if
(
valueLength
<
OptionValueMinimumLength
)
return
null
;
return
null
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionQuickStart.cs
View file @
96b7db96
...
@@ -192,16 +192,6 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -192,16 +192,6 @@ namespace PcapDotNet.Packets.IpV4
return
Equals
(
other
as
IpV4OptionQuickStart
);
return
Equals
(
other
as
IpV4OptionQuickStart
);
}
}
/// <summary>
/// The hash code is the xor of the base class hash code with the following values hash code:
/// The combination of function, rate and ttl and the nonce.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)((
byte
)
Function
|
Rate
),
Ttl
),
Nonce
);
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -224,6 +214,11 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -224,6 +214,11 @@ namespace PcapDotNet.Packets.IpV4
return
new
IpV4OptionQuickStart
(
function
,
rate
,
ttl
,
nonce
);
return
new
IpV4OptionQuickStart
(
function
,
rate
,
ttl
,
nonce
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)((
byte
)
Function
|
Rate
),
Ttl
),
Nonce
);
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRoute.cs
View file @
96b7db96
...
@@ -79,14 +79,9 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -79,14 +79,9 @@ namespace PcapDotNet.Packets.IpV4
return
Equals
(
other
as
IpV4OptionRoute
);
return
Equals
(
other
as
IpV4OptionRoute
);
}
}
/// <summary>
internal
override
int
GetDataHashCode
()
/// The hash code of the route option is the xor of the following hash codes: base class, pointed address index and all the addresses in the route.
/// </summary>
public
sealed
override
int
GetHashCode
()
{
{
return
base
.
GetHashCode
()
^
return
Sequence
.
GetHashCode
(
PointedAddressIndex
,
Route
.
SequenceGetHashCode
());
PointedAddressIndex
.
GetHashCode
()
^
Route
.
SequenceGetHashCode
();
}
}
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRouterAlert.cs
View file @
96b7db96
...
@@ -104,15 +104,6 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -104,15 +104,6 @@ namespace PcapDotNet.Packets.IpV4
return
Equals
(
other
as
IpV4OptionRouterAlert
);
return
Equals
(
other
as
IpV4OptionRouterAlert
);
}
}
/// <summary>
/// The hash code value is the xor of the base class hash code and the value hash code.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Value
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -129,6 +120,11 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -129,6 +120,11 @@ namespace PcapDotNet.Packets.IpV4
return
new
IpV4OptionRouterAlert
(
value
);
return
new
IpV4OptionRouterAlert
(
value
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Value
.
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSimple.cs
View file @
96b7db96
...
@@ -30,5 +30,10 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -30,5 +30,10 @@ namespace PcapDotNet.Packets.IpV4
:
base
(
optionType
)
:
base
(
optionType
)
{
{
}
}
internal
override
int
GetDataHashCode
()
{
return
0
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionStreamIdentifier.cs
View file @
96b7db96
...
@@ -84,15 +84,6 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -84,15 +84,6 @@ namespace PcapDotNet.Packets.IpV4
return
Equals
(
other
as
IpV4OptionStreamIdentifier
);
return
Equals
(
other
as
IpV4OptionStreamIdentifier
);
}
}
/// <summary>
/// The hash code value is the xor of the base class hash code and the identifier hash code.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Identifier
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -109,6 +100,11 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -109,6 +100,11 @@ namespace PcapDotNet.Packets.IpV4
return
new
IpV4OptionStreamIdentifier
(
identifier
);
return
new
IpV4OptionStreamIdentifier
(
identifier
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Identifier
.
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestamp.cs
View file @
96b7db96
...
@@ -201,13 +201,9 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -201,13 +201,9 @@ namespace PcapDotNet.Packets.IpV4
return
Equals
(
other
as
IpV4OptionTimestamp
);
return
Equals
(
other
as
IpV4OptionTimestamp
);
}
}
/// <summary>
internal
override
int
GetDataHashCode
()
/// The hash code is the xor of the base class hash code, the timestamp and overflow hash code and the pointed index hash code.
/// </summary>
public
override
int
GetHashCode
()
{
{
return
base
.
GetHashCode
()
^
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)
TimestampType
,
Overflow
),
PointedIndex
);
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)
TimestampType
,
Overflow
),
PointedIndex
);
}
}
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampAndAddress.cs
View file @
96b7db96
...
@@ -58,12 +58,9 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -58,12 +58,9 @@ namespace PcapDotNet.Packets.IpV4
get
{
return
_addressesAndTimestamps
;
}
get
{
return
_addressesAndTimestamps
;
}
}
}
/// <summary>
internal
override
int
GetDataHashCode
()
/// The hash of this option is the base class hash xored with the hash of each timestamp.
/// </summary>
public
override
int
GetHashCode
()
{
{
return
base
.
GetHashCode
()
^
TimedRoute
.
SequenceGetHashCode
();
return
TimedRoute
.
SequenceGetHashCode
();
}
}
internal
static
IpV4OptionTimestampAndAddress
Read
(
IpV4OptionTimestampType
timestampType
,
byte
overflow
,
byte
pointedIndex
,
byte
[]
buffer
,
ref
int
offset
,
int
numValues
)
internal
static
IpV4OptionTimestampAndAddress
Read
(
IpV4OptionTimestampType
timestampType
,
byte
overflow
,
byte
pointedIndex
,
byte
[]
buffer
,
ref
int
offset
,
int
numValues
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampOnly.cs
View file @
96b7db96
...
@@ -49,12 +49,9 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -49,12 +49,9 @@ namespace PcapDotNet.Packets.IpV4
get
{
return
_timestamps
;
}
get
{
return
_timestamps
;
}
}
}
/// <summary>
internal
override
int
GetDataHashCode
()
/// The hash code of this options is the hash code of the base class xored with the hash code of the timestamps.
/// </summary>
public
override
int
GetHashCode
()
{
{
return
base
.
GetHashCode
()
^
Timestamps
.
SequenceGetHashCode
();
return
Timestamps
.
SequenceGetHashCode
();
}
}
internal
static
IpV4OptionTimestampOnly
Read
(
byte
overflow
,
byte
pointedIndex
,
byte
[]
buffer
,
ref
int
offset
,
int
numValues
)
internal
static
IpV4OptionTimestampOnly
Read
(
byte
overflow
,
byte
pointedIndex
,
byte
[]
buffer
,
ref
int
offset
,
int
numValues
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTraceRoute.cs
View file @
96b7db96
...
@@ -161,17 +161,6 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -161,17 +161,6 @@ namespace PcapDotNet.Packets.IpV4
return
Equals
(
other
as
IpV4OptionTraceRoute
);
return
Equals
(
other
as
IpV4OptionTraceRoute
);
}
}
/// <summary>
/// The hash code is the xor of the base class hash code with the following values hash code:
/// The identification, the combination of the outbound and return hop count, the originator address.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Sequence
.
GetHashCode
(
Identification
,
BitSequence
.
Merge
(
OutboundHopCount
,
ReturnHopCount
),
OriginatorIpAddress
);
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -192,6 +181,11 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -192,6 +181,11 @@ namespace PcapDotNet.Packets.IpV4
return
new
IpV4OptionTraceRoute
(
identification
,
outboundHopCount
,
returnHopCount
,
originatorIpAddress
);
return
new
IpV4OptionTraceRoute
(
identification
,
outboundHopCount
,
returnHopCount
,
originatorIpAddress
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
Identification
,
BitSequence
.
Merge
(
OutboundHopCount
,
ReturnHopCount
),
OriginatorIpAddress
);
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionUnknown.cs
View file @
96b7db96
...
@@ -80,14 +80,6 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -80,14 +80,6 @@ namespace PcapDotNet.Packets.IpV4
return
Equals
(
other
as
IpV4OptionUnknown
);
return
Equals
(
other
as
IpV4OptionUnknown
);
}
}
/// <summary>
/// The hash code for an unknown option is the hash code for the option type xored with the hash code of the data.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Data
.
BytesSequenceGetHashCode
();
}
/// <summary>
/// <summary>
/// Creates an unknown option from its type and by reading a buffer for its value.
/// Creates an unknown option from its type and by reading a buffer for its value.
/// </summary>
/// </summary>
...
@@ -108,6 +100,14 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -108,6 +100,14 @@ namespace PcapDotNet.Packets.IpV4
return
new
IpV4OptionUnknown
(
optionType
,
data
);
return
new
IpV4OptionUnknown
(
optionType
,
data
);
}
}
/// <summary>
/// The hash code for an unknown option is the hash code for the option type xored with the hash code of the data.
/// </summary>
internal
override
int
GetDataHashCode
()
{
return
Data
.
BytesSequenceGetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Options.cs
View file @
96b7db96
...
@@ -9,7 +9,7 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -9,7 +9,7 @@ namespace PcapDotNet.Packets.IpV4
/// They must be implemented by all IP modules (host and gateways).
/// They must be implemented by all IP modules (host and gateways).
/// What is optional is their transmission in any particular datagram, not their implementation.
/// What is optional is their transmission in any particular datagram, not their implementation.
/// </summary>
/// </summary>
public
class
IpV4Options
:
V4Options
<
IpV4Option
>
public
sealed
class
IpV4Options
:
V4Options
<
IpV4Option
>
{
{
/// <summary>
/// <summary>
/// The maximum number of bytes the options may take.
/// The maximum number of bytes the options may take.
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeader.cs
View file @
96b7db96
...
@@ -25,7 +25,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -25,7 +25,7 @@ namespace PcapDotNet.Packets.IpV6
public
abstract
bool
IsValid
{
get
;
}
public
abstract
bool
IsValid
{
get
;
}
public
override
sealed
bool
Equals
(
object
obj
)
public
sealed
override
bool
Equals
(
object
obj
)
{
{
return
Equals
(
obj
as
IpV6ExtensionHeader
);
return
Equals
(
obj
as
IpV6ExtensionHeader
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderMobility.cs
View file @
96b7db96
...
@@ -21,12 +21,12 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -21,12 +21,12 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
/// </summary>
public
abstract
class
IpV6ExtensionHeaderMobility
:
IpV6ExtensionHeaderStandard
public
abstract
class
IpV6ExtensionHeaderMobility
:
IpV6ExtensionHeaderStandard
{
{
public
override
sealed
IpV4Protocol
Protocol
public
sealed
override
IpV4Protocol
Protocol
{
{
get
{
return
IpV4Protocol
.
MobilityHeader
;
}
get
{
return
IpV4Protocol
.
MobilityHeader
;
}
}
}
public
override
sealed
bool
IsValid
public
sealed
override
bool
IsValid
{
{
get
{
return
MobilityOptions
.
IsValid
;
}
get
{
return
MobilityOptions
.
IsValid
;
}
}
}
...
@@ -164,7 +164,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -164,7 +164,7 @@ namespace PcapDotNet.Packets.IpV6
}
}
}
}
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
int
offset
)
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
int
offset
)
{
{
buffer
.
Write
(
offset
+
DataOffset
.
MobilityHeaderType
,
(
byte
)
MobilityHeaderType
);
buffer
.
Write
(
offset
+
DataOffset
.
MobilityHeaderType
,
(
byte
)
MobilityHeaderType
);
buffer
.
Write
(
offset
+
DataOffset
.
Checksum
,
Checksum
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
DataOffset
.
Checksum
,
Checksum
,
Endianity
.
Big
);
...
@@ -173,14 +173,14 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -173,14 +173,14 @@ namespace PcapDotNet.Packets.IpV6
internal
abstract
void
WriteMessageData
(
byte
[]
buffer
,
int
offset
);
internal
abstract
void
WriteMessageData
(
byte
[]
buffer
,
int
offset
);
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
MinimumDataLength
+
MessageDataLength
;
}
get
{
return
MinimumDataLength
+
MessageDataLength
;
}
}
}
internal
abstract
int
MessageDataLength
{
get
;
}
internal
abstract
int
MessageDataLength
{
get
;
}
internal
override
sealed
bool
EqualsData
(
IpV6ExtensionHeader
other
)
internal
sealed
override
bool
EqualsData
(
IpV6ExtensionHeader
other
)
{
{
return
EqualsData
(
other
as
IpV6ExtensionHeaderMobility
);
return
EqualsData
(
other
as
IpV6ExtensionHeaderMobility
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderMobilityBindingAcknowledgementBase.cs
View file @
96b7db96
...
@@ -125,7 +125,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -125,7 +125,7 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
sealed
void
WriteMessageData
(
byte
[]
buffer
,
int
offset
)
internal
sealed
override
void
WriteMessageData
(
byte
[]
buffer
,
int
offset
)
{
{
buffer
.
Write
(
offset
+
MessageDataOffset
.
Status
,
(
byte
)
Status
);
buffer
.
Write
(
offset
+
MessageDataOffset
.
Status
,
(
byte
)
Status
);
if
(
KeyManagementMobilityCapability
)
if
(
KeyManagementMobilityCapability
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage.cs
View file @
96b7db96
...
@@ -39,7 +39,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -39,7 +39,7 @@ namespace PcapDotNet.Packets.IpV6
/// <summary>
/// <summary>
/// Defines the type of the Binding Revocation Message.
/// Defines the type of the Binding Revocation Message.
/// </summary>
/// </summary>
public
override
sealed
IpV6MobilityBindingRevocationType
BindingRevocationType
public
sealed
override
IpV6MobilityBindingRevocationType
BindingRevocationType
{
{
get
{
return
IpV6MobilityBindingRevocationType
.
BindingRevocationAcknowledgement
;
}
get
{
return
IpV6MobilityBindingRevocationType
.
BindingRevocationAcknowledgement
;
}
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderMobilityBindingRevocationMessage.cs
View file @
96b7db96
...
@@ -61,7 +61,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -61,7 +61,7 @@ namespace PcapDotNet.Packets.IpV6
/// Identifies the particular mobility message in question.
/// Identifies the particular mobility message in question.
/// An unrecognized MH Type field causes an error indication to be sent.
/// An unrecognized MH Type field causes an error indication to be sent.
/// </summary>
/// </summary>
public
override
sealed
IpV6MobilityHeaderType
MobilityHeaderType
public
sealed
override
IpV6MobilityHeaderType
MobilityHeaderType
{
{
get
{
return
IpV6MobilityHeaderType
.
BindingRevocationMessage
;
}
get
{
return
IpV6MobilityHeaderType
.
BindingRevocationMessage
;
}
}
}
...
@@ -144,7 +144,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -144,7 +144,7 @@ namespace PcapDotNet.Packets.IpV6
}
}
}
}
internal
override
sealed
void
WriteMessageData
(
byte
[]
buffer
,
int
offset
)
internal
sealed
override
void
WriteMessageData
(
byte
[]
buffer
,
int
offset
)
{
{
buffer
.
Write
(
offset
+
MessageDataOffset
.
BindingRevocationType
,
(
byte
)
BindingRevocationType
);
buffer
.
Write
(
offset
+
MessageDataOffset
.
BindingRevocationType
,
(
byte
)
BindingRevocationType
);
buffer
.
Write
(
offset
+
MessageDataOffset
.
RevocationTriggerOrStatus
,
RevocationTriggerOrStatus
);
buffer
.
Write
(
offset
+
MessageDataOffset
.
RevocationTriggerOrStatus
,
RevocationTriggerOrStatus
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderMobilityLocalizedRouting.cs
View file @
96b7db96
...
@@ -69,7 +69,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -69,7 +69,7 @@ namespace PcapDotNet.Packets.IpV6
get
{
return
MinimumMessageDataLength
+
MobilityOptions
.
BytesLength
;
}
get
{
return
MinimumMessageDataLength
+
MobilityOptions
.
BytesLength
;
}
}
}
internal
override
sealed
bool
EqualsMessageData
(
IpV6ExtensionHeaderMobility
other
)
internal
sealed
override
bool
EqualsMessageData
(
IpV6ExtensionHeaderMobility
other
)
{
{
return
EqualsMessageData
(
other
as
IpV6ExtensionHeaderMobilityLocalizedRouting
);
return
EqualsMessageData
(
other
as
IpV6ExtensionHeaderMobilityLocalizedRouting
);
}
}
...
@@ -92,7 +92,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -92,7 +92,7 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
sealed
void
WriteMessageData
(
byte
[]
buffer
,
int
offset
)
internal
sealed
override
void
WriteMessageData
(
byte
[]
buffer
,
int
offset
)
{
{
buffer
.
Write
(
offset
+
MessageDataOffset
.
SequenceNumber
,
SequenceNumber
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
MessageDataOffset
.
SequenceNumber
,
SequenceNumber
,
Endianity
.
Big
);
WriteMessageDataBetweenSequenceNumberAndLifetime
(
buffer
,
offset
);
WriteMessageDataBetweenSequenceNumberAndLifetime
(
buffer
,
offset
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderOptions.cs
View file @
96b7db96
...
@@ -20,17 +20,17 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -20,17 +20,17 @@ namespace PcapDotNet.Packets.IpV6
{
{
public
IpV6Options
Options
{
get
;
private
set
;
}
public
IpV6Options
Options
{
get
;
private
set
;
}
public
override
sealed
bool
IsValid
public
sealed
override
bool
IsValid
{
{
get
{
return
Options
.
IsValid
;
}
get
{
return
Options
.
IsValid
;
}
}
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
Options
.
BytesLength
;
}
get
{
return
Options
.
BytesLength
;
}
}
}
internal
override
sealed
bool
EqualsData
(
IpV6ExtensionHeader
other
)
internal
sealed
override
bool
EqualsData
(
IpV6ExtensionHeader
other
)
{
{
return
EqualsData
(
other
as
IpV6ExtensionHeaderOptions
);
return
EqualsData
(
other
as
IpV6ExtensionHeaderOptions
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderRouting.cs
View file @
96b7db96
...
@@ -52,14 +52,14 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -52,14 +52,14 @@ namespace PcapDotNet.Packets.IpV6
SegmentsLeft
=
segmentsLeft
;
SegmentsLeft
=
segmentsLeft
;
}
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
DataMinimumLength
+
RoutingDataLength
;
}
get
{
return
DataMinimumLength
+
RoutingDataLength
;
}
}
}
internal
abstract
int
RoutingDataLength
{
get
;
}
internal
abstract
int
RoutingDataLength
{
get
;
}
internal
override
sealed
bool
EqualsData
(
IpV6ExtensionHeader
other
)
internal
sealed
override
bool
EqualsData
(
IpV6ExtensionHeader
other
)
{
{
return
EqualsData
(
other
as
IpV6ExtensionHeaderRouting
);
return
EqualsData
(
other
as
IpV6ExtensionHeaderRouting
);
}
}
...
@@ -93,7 +93,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -93,7 +93,7 @@ namespace PcapDotNet.Packets.IpV6
}
}
}
}
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
int
offset
)
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
int
offset
)
{
{
buffer
.
Write
(
offset
+
DataOffset
.
RoutingType
,
(
byte
)
RoutingType
);
buffer
.
Write
(
offset
+
DataOffset
.
RoutingType
,
(
byte
)
RoutingType
);
buffer
.
Write
(
offset
+
DataOffset
.
SegmentsLeft
,
SegmentsLeft
);
buffer
.
Write
(
offset
+
DataOffset
.
SegmentsLeft
,
SegmentsLeft
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderStandard.cs
View file @
96b7db96
...
@@ -29,7 +29,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -29,7 +29,7 @@ namespace PcapDotNet.Packets.IpV6
public
const
int
MinimumLength
=
8
;
public
const
int
MinimumLength
=
8
;
public
override
sealed
bool
Equals
(
IpV6ExtensionHeader
other
)
public
sealed
override
bool
Equals
(
IpV6ExtensionHeader
other
)
{
{
return
other
!=
null
&&
return
other
!=
null
&&
Protocol
==
other
.
Protocol
&&
NextHeader
==
other
.
NextHeader
&&
EqualsData
(
other
);
Protocol
==
other
.
Protocol
&&
NextHeader
==
other
.
NextHeader
&&
EqualsData
(
other
);
...
@@ -42,7 +42,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -42,7 +42,7 @@ namespace PcapDotNet.Packets.IpV6
{
{
}
}
internal
override
sealed
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
NextHeader
,
(
byte
)
NextHeader
);
buffer
.
Write
(
offset
+
Offset
.
NextHeader
,
(
byte
)
NextHeader
);
int
length
=
Length
;
int
length
=
Length
;
...
@@ -53,7 +53,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -53,7 +53,7 @@ namespace PcapDotNet.Packets.IpV6
internal
abstract
void
WriteData
(
byte
[]
buffer
,
int
offset
);
internal
abstract
void
WriteData
(
byte
[]
buffer
,
int
offset
);
public
override
sealed
int
Length
{
get
{
return
Offset
.
Data
+
DataLength
;
}
}
public
sealed
override
int
Length
{
get
{
return
Offset
.
Data
+
DataLength
;
}
}
internal
abstract
int
DataLength
{
get
;
}
internal
abstract
int
DataLength
{
get
;
}
internal
static
bool
IsStandard
(
IpV4Protocol
nextHeader
)
internal
static
bool
IsStandard
(
IpV4Protocol
nextHeader
)
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6RoutingType.cs
View file @
96b7db96
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// IPv6 Routing Type.
/// Used in Routing Extension Header.
/// </summary>
public
enum
IpV6RoutingType
:
byte
public
enum
IpV6RoutingType
:
byte
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOption.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ip
;
using
PcapDotNet.Packets.Ip
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -20,7 +21,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -20,7 +21,7 @@ namespace PcapDotNet.Packets.IpV6
OptionType
=
type
;
OptionType
=
type
;
}
}
public
override
sealed
int
Length
public
sealed
override
int
Length
{
{
get
{
return
sizeof
(
byte
)
+
sizeof
(
byte
)
+
DataLength
;
}
get
{
return
sizeof
(
byte
)
+
sizeof
(
byte
)
+
DataLength
;
}
}
}
...
@@ -31,15 +32,22 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -31,15 +32,22 @@ namespace PcapDotNet.Packets.IpV6
OptionType
==
other
.
OptionType
&&
Length
==
other
.
Length
&&
EqualsData
(
other
);
OptionType
==
other
.
OptionType
&&
Length
==
other
.
Length
&&
EqualsData
(
other
);
}
}
public
override
sealed
bool
Equals
(
Option
other
)
public
sealed
override
bool
Equals
(
Option
other
)
{
{
return
Equals
(
other
as
IpV6AccessNetworkIdentifierSubOption
);
return
Equals
(
other
as
IpV6AccessNetworkIdentifierSubOption
);
}
}
public
override
int
GetHashCode
()
{
return
Sequence
.
GetHashCode
(
OptionType
,
GetDataHashCode
());
}
internal
abstract
int
DataLength
{
get
;
}
internal
abstract
int
DataLength
{
get
;
}
internal
abstract
bool
EqualsData
(
IpV6AccessNetworkIdentifierSubOption
other
);
internal
abstract
bool
EqualsData
(
IpV6AccessNetworkIdentifierSubOption
other
);
internal
abstract
int
GetDataHashCode
();
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
[
offset
++]
=
(
byte
)
OptionType
;
buffer
[
offset
++]
=
(
byte
)
OptionType
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOptionGeoLocation.cs
View file @
96b7db96
...
@@ -111,6 +111,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -111,6 +111,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6AccessNetworkIdentifierSubOptionGeoLocation
);
return
EqualsData
(
other
as
IpV6AccessNetworkIdentifierSubOptionGeoLocation
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
LongitudeDegrees
,
LatitudeDegrees
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
LatitudeDegrees
,
LatitudeDegrees
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
LatitudeDegrees
,
LatitudeDegrees
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOptionNetworkIdentifier.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
...
@@ -119,6 +120,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -119,6 +120,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6AccessNetworkIdentifierSubOptionNetworkIdentifier
);
return
EqualsData
(
other
as
IpV6AccessNetworkIdentifierSubOptionNetworkIdentifier
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
IsNetworkNameUtf8
,
NetworkName
,
AccessPointName
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
if
(
IsNetworkNameUtf8
)
if
(
IsNetworkNameUtf8
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOptionOperatorIdentifier.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -67,6 +69,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -67,6 +69,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6AccessNetworkIdentifierSubOptionOperatorIdentifier
);
return
EqualsData
(
other
as
IpV6AccessNetworkIdentifierSubOptionOperatorIdentifier
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
IdentifierType
,
Identifier
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
IdentifierType
,
(
byte
)
IdentifierType
);
buffer
.
Write
(
offset
+
Offset
.
IdentifierType
,
(
byte
)
IdentifierType
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOptionUnknown.cs
View file @
96b7db96
...
@@ -40,6 +40,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -40,6 +40,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6AccessNetworkIdentifierSubOptionUnknown
);
return
EqualsData
(
other
as
IpV6AccessNetworkIdentifierSubOptionUnknown
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Data
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
Data
);
buffer
.
Write
(
ref
offset
,
Data
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOption.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ip
;
using
PcapDotNet.Packets.Ip
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -25,7 +26,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -25,7 +26,7 @@ namespace PcapDotNet.Packets.IpV6
OptionType
=
type
;
OptionType
=
type
;
}
}
public
override
sealed
bool
Equals
(
Option
other
)
public
sealed
override
bool
Equals
(
Option
other
)
{
{
return
Equals
(
other
as
IpV6FlowIdentificationSubOption
);
return
Equals
(
other
as
IpV6FlowIdentificationSubOption
);
}
}
...
@@ -36,8 +37,15 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -36,8 +37,15 @@ namespace PcapDotNet.Packets.IpV6
OptionType
==
other
.
OptionType
&&
Length
==
other
.
Length
&&
EqualsData
(
other
);
OptionType
==
other
.
OptionType
&&
Length
==
other
.
Length
&&
EqualsData
(
other
);
}
}
public
sealed
override
int
GetHashCode
()
{
return
Sequence
.
GetHashCode
(
OptionType
,
GetDataHashCode
());
}
internal
abstract
bool
EqualsData
(
IpV6FlowIdentificationSubOption
other
);
internal
abstract
bool
EqualsData
(
IpV6FlowIdentificationSubOption
other
);
internal
abstract
object
GetDataHashCode
();
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
[
offset
++]
=
(
byte
)
OptionType
;
buffer
[
offset
++]
=
(
byte
)
OptionType
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptionBindingReference.cs
View file @
96b7db96
...
@@ -69,6 +69,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -69,6 +69,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6FlowIdentificationSubOptionBindingReference
);
return
EqualsData
(
other
as
IpV6FlowIdentificationSubOptionBindingReference
);
}
}
internal
override
object
GetDataHashCode
()
{
return
BindingIds
.
UShortsSequenceGetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
foreach
(
ushort
bindingId
in
BindingIds
)
foreach
(
ushort
bindingId
in
BindingIds
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptionComplex.cs
View file @
96b7db96
...
@@ -20,14 +20,14 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -20,14 +20,14 @@ namespace PcapDotNet.Packets.IpV6
{
{
}
}
public
override
sealed
int
Length
public
sealed
override
int
Length
{
{
get
{
return
base
.
Length
+
sizeof
(
byte
)
+
DataLength
;
}
get
{
return
base
.
Length
+
sizeof
(
byte
)
+
DataLength
;
}
}
}
internal
abstract
int
DataLength
{
get
;
}
internal
abstract
int
DataLength
{
get
;
}
internal
override
sealed
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
[
offset
++]
=
(
byte
)
DataLength
;
buffer
[
offset
++]
=
(
byte
)
DataLength
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptionPad1.cs
View file @
96b7db96
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// RFC 6089.
/// </summary>
public
sealed
class
IpV6FlowIdentificationSubOptionPad1
:
IpV6FlowIdentificationSubOptionSimple
public
sealed
class
IpV6FlowIdentificationSubOptionPad1
:
IpV6FlowIdentificationSubOptionSimple
{
{
/// <summary>
/// The number of bytes this option take.
/// </summary>
public
const
int
OptionLength
=
sizeof
(
byte
);
public
const
int
OptionLength
=
sizeof
(
byte
);
/// <summary>
/// Constructs the option.
/// </summary>
public
IpV6FlowIdentificationSubOptionPad1
()
public
IpV6FlowIdentificationSubOptionPad1
()
:
base
(
IpV6FlowIdentificationSubOptionType
.
Pad1
)
:
base
(
IpV6FlowIdentificationSubOptionType
.
Pad1
)
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptionPadN.cs
View file @
96b7db96
...
@@ -38,7 +38,12 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -38,7 +38,12 @@ namespace PcapDotNet.Packets.IpV6
internal
override
bool
EqualsData
(
IpV6FlowIdentificationSubOption
other
)
internal
override
bool
EqualsData
(
IpV6FlowIdentificationSubOption
other
)
{
{
return
true
;
return
EqualsData
(
other
as
IpV6FlowIdentificationSubOptionPadN
);
}
internal
override
object
GetDataHashCode
()
{
return
PaddingDataLength
.
GetHashCode
();
}
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
...
@@ -50,5 +55,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -50,5 +55,11 @@ namespace PcapDotNet.Packets.IpV6
:
this
(
0
)
:
this
(
0
)
{
{
}
}
private
bool
EqualsData
(
IpV6FlowIdentificationSubOptionPadN
other
)
{
return
other
!=
null
&&
PaddingDataLength
==
other
.
PaddingDataLength
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptionSimple.cs
View file @
96b7db96
...
@@ -19,22 +19,27 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -19,22 +19,27 @@ namespace PcapDotNet.Packets.IpV6
{
{
}
}
public
override
sealed
int
Length
public
sealed
override
int
Length
{
{
get
{
return
base
.
Length
;
}
get
{
return
base
.
Length
;
}
}
}
internal
override
sealed
bool
EqualsData
(
IpV6FlowIdentificationSubOption
other
)
internal
sealed
override
bool
EqualsData
(
IpV6FlowIdentificationSubOption
other
)
{
{
return
true
;
return
true
;
}
}
internal
override
sealed
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
object
GetDataHashCode
()
{
return
0
;
}
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
}
}
internal
override
sealed
IpV6FlowIdentificationSubOption
CreateInstance
(
DataSegment
data
)
internal
sealed
override
IpV6FlowIdentificationSubOption
CreateInstance
(
DataSegment
data
)
{
{
throw
new
InvalidOperationException
(
"Simple options shouldn't be registered."
);
throw
new
InvalidOperationException
(
"Simple options shouldn't be registered."
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptionTrafficSelector.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -63,6 +65,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -63,6 +65,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6FlowIdentificationSubOptionTrafficSelector
);
return
EqualsData
(
other
as
IpV6FlowIdentificationSubOptionTrafficSelector
);
}
}
internal
override
object
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
TrafficSelectorFormat
,
TrafficSelector
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
TrafficSelectorFormat
,
(
byte
)
TrafficSelectorFormat
);
buffer
.
Write
(
offset
+
Offset
.
TrafficSelectorFormat
,
(
byte
)
TrafficSelectorFormat
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptionUnknown.cs
View file @
96b7db96
...
@@ -40,6 +40,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -40,6 +40,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6FlowIdentificationSubOptionUnknown
);
return
EqualsData
(
other
as
IpV6FlowIdentificationSubOptionUnknown
);
}
}
internal
override
object
GetDataHashCode
()
{
return
Data
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
Data
);
buffer
.
Write
(
ref
offset
,
Data
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOption.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ip
;
using
PcapDotNet.Packets.Ip
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -39,6 +40,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -39,6 +40,11 @@ namespace PcapDotNet.Packets.IpV6
OptionType
==
other
.
OptionType
&&
Length
==
other
.
Length
&&
EqualsData
(
other
);
OptionType
==
other
.
OptionType
&&
Length
==
other
.
Length
&&
EqualsData
(
other
);
}
}
public
sealed
override
int
GetHashCode
()
{
return
Sequence
.
GetHashCode
(
OptionType
,
GetDataHashCode
());
}
public
virtual
bool
IsValid
{
get
{
return
true
;
}
}
public
virtual
bool
IsValid
{
get
{
return
true
;
}
}
protected
IpV6MobilityOption
(
IpV6MobilityOptionType
type
)
protected
IpV6MobilityOption
(
IpV6MobilityOptionType
type
)
...
@@ -46,6 +52,8 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -46,6 +52,8 @@ namespace PcapDotNet.Packets.IpV6
OptionType
=
type
;
OptionType
=
type
;
}
}
internal
abstract
int
GetDataHashCode
();
internal
abstract
IpV6MobilityOption
CreateInstance
(
DataSegment
data
);
internal
abstract
IpV6MobilityOption
CreateInstance
(
DataSegment
data
);
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionAccessNetworkIdentifier.cs
View file @
96b7db96
...
@@ -51,6 +51,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -51,6 +51,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionAccessNetworkIdentifier
);
return
EqualsData
(
other
as
IpV6MobilityOptionAccessNetworkIdentifier
);
}
}
internal
override
int
GetDataHashCode
()
{
return
SubOptions
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
SubOptions
.
Write
(
buffer
,
offset
);
SubOptions
.
Write
(
buffer
,
offset
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionAlternateIpV4CareOfAddress.cs
View file @
96b7db96
...
@@ -50,6 +50,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -50,6 +50,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionAlternateIpV4CareOfAddress
);
return
EqualsData
(
other
as
IpV6MobilityOptionAlternateIpV4CareOfAddress
);
}
}
internal
override
int
GetDataHashCode
()
{
return
AlternateCareOfAddress
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
AlternateCareOfAddress
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
AlternateCareOfAddress
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionAuthentication.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -80,6 +82,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -80,6 +82,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionAuthentication
);
return
EqualsData
(
other
as
IpV6MobilityOptionAuthentication
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
Subtype
,
MobilitySecurityParameterIndex
,
AuthenticationData
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Subtype
,
(
byte
)
Subtype
);
buffer
.
Write
(
offset
+
Offset
.
Subtype
,
(
byte
)
Subtype
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionBindingAuthorizationDataForFmIpV6.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -100,6 +102,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -100,6 +102,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionBindingAuthorizationDataForFmIpV6
);
return
EqualsData
(
other
as
IpV6MobilityOptionBindingAuthorizationDataForFmIpV6
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
SecurityParameterIndex
,
Authenticator
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
SecurityParameterIndex
,
SecurityParameterIndex
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
SecurityParameterIndex
,
SecurityParameterIndex
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionBindingIdentifier.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -155,6 +156,12 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -155,6 +156,12 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionBindingIdentifier
);
return
EqualsData
(
other
as
IpV6MobilityOptionBindingIdentifier
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)
Status
,
Priority
,
BindingId
),
SimultaneousHomeAndForeignBinding
,
IpV4CareOfAddress
,
IpV6CareOfAddress
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
BindingId
,
BindingId
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
BindingId
,
BindingId
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionBindingRefreshAdvice.cs
View file @
96b7db96
...
@@ -47,6 +47,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -47,6 +47,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionBindingRefreshAdvice
);
return
EqualsData
(
other
as
IpV6MobilityOptionBindingRefreshAdvice
);
}
}
internal
override
int
GetDataHashCode
()
{
return
RefreshInterval
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
RefreshInterval
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
RefreshInterval
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionComplex.cs
View file @
96b7db96
...
@@ -22,7 +22,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -22,7 +22,7 @@ namespace PcapDotNet.Packets.IpV6
{
{
}
}
public
override
sealed
int
Length
public
sealed
override
int
Length
{
{
get
{
return
base
.
Length
+
sizeof
(
byte
)
+
DataLength
;
}
get
{
return
base
.
Length
+
sizeof
(
byte
)
+
DataLength
;
}
}
}
...
@@ -31,7 +31,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -31,7 +31,7 @@ namespace PcapDotNet.Packets.IpV6
internal
abstract
int
DataLength
{
get
;
}
internal
abstract
int
DataLength
{
get
;
}
internal
override
sealed
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
[
offset
++]
=
(
byte
)
DataLength
;
buffer
[
offset
++]
=
(
byte
)
DataLength
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionContextRequest.cs
View file @
96b7db96
...
@@ -82,6 +82,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -82,6 +82,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionContextRequest
);
return
EqualsData
(
other
as
IpV6MobilityOptionContextRequest
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Requests
.
SequenceGetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
foreach
(
var
request
in
Requests
)
foreach
(
var
request
in
Requests
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionDnsUpdate.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -82,6 +84,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -82,6 +84,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionDnsUpdate
);
return
EqualsData
(
other
as
IpV6MobilityOptionDnsUpdate
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)
Status
,
Remove
.
ToByte
()),
MobileNodeIdentity
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Status
,
(
byte
)
Status
);
buffer
.
Write
(
offset
+
Offset
.
Status
,
(
byte
)
Status
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionEmpty.cs
View file @
96b7db96
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// An IPv6 Mobility option with an empty data.
/// </summary>
public
abstract
class
IpV6MobilityOptionEmpty
:
IpV6MobilityOptionComplex
public
abstract
class
IpV6MobilityOptionEmpty
:
IpV6MobilityOptionComplex
{
{
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public
const
int
OptionDataLength
=
0
;
public
const
int
OptionDataLength
=
0
;
public
IpV6MobilityOptionEmpty
(
IpV6MobilityOptionType
type
)
internal
IpV6MobilityOptionEmpty
(
IpV6MobilityOptionType
type
)
:
base
(
type
)
:
base
(
type
)
{
{
}
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
OptionDataLength
;
}
get
{
return
OptionDataLength
;
}
}
}
internal
override
sealed
bool
EqualsData
(
IpV6MobilityOption
other
)
internal
sealed
override
bool
EqualsData
(
IpV6MobilityOption
other
)
{
{
return
true
;
return
true
;
}
}
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
int
GetDataHashCode
()
{
return
0
;
}
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
}
}
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionFlowIdentification.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
...
@@ -110,6 +111,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -110,6 +111,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionFlowIdentification
);
return
EqualsData
(
other
as
IpV6MobilityOptionFlowIdentification
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
(
FlowIdentifier
,
Priority
),
Status
,
SubOptions
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
FlowIdentifier
,
FlowIdentifier
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
FlowIdentifier
,
FlowIdentifier
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionFlowSummary.cs
View file @
96b7db96
...
@@ -74,6 +74,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -74,6 +74,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionFlowSummary
);
return
EqualsData
(
other
as
IpV6MobilityOptionFlowSummary
);
}
}
internal
override
int
GetDataHashCode
()
{
return
FlowIdentifiers
.
SequenceGetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
foreach
(
ushort
flowIdentifier
in
FlowIdentifiers
)
foreach
(
ushort
flowIdentifier
in
FlowIdentifiers
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionGreKey.cs
View file @
96b7db96
...
@@ -57,6 +57,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -57,6 +57,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionGreKey
);
return
EqualsData
(
other
as
IpV6MobilityOptionGreKey
);
}
}
internal
override
int
GetDataHashCode
()
{
return
GreKeyIdentifier
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
GreKeyIdentifier
,
GreKeyIdentifier
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
GreKeyIdentifier
,
GreKeyIdentifier
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionIpV4Address.cs
View file @
96b7db96
...
@@ -46,7 +46,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -46,7 +46,7 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
OptionDataLength
;
}
get
{
return
OptionDataLength
;
}
}
}
...
@@ -56,7 +56,12 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -56,7 +56,12 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4Address
);
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4Address
);
}
}
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
int
GetDataHashCode
()
{
return
Address
.
GetHashCode
();
}
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Address
,
Address
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
Address
,
Address
,
Endianity
.
Big
);
offset
+=
OptionDataLength
;
offset
+=
OptionDataLength
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionIpV4AddressAcknowledgement.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -97,6 +98,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -97,6 +98,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4AddressAcknowledgement
);
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4AddressAcknowledgement
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)
Status
,
PrefixLength
),
HomeAddress
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Status
,
(
byte
)
Status
);
buffer
.
Write
(
offset
+
Offset
.
Status
,
(
byte
)
Status
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionIpV4DhcpSupportMode.cs
View file @
96b7db96
...
@@ -59,6 +59,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -59,6 +59,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4DhcpSupportMode
);
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4DhcpSupportMode
);
}
}
internal
override
int
GetDataHashCode
()
{
return
IsServer
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
if
(
IsServer
)
if
(
IsServer
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionIpV4HomeAddress.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -101,6 +102,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -101,6 +102,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4HomeAddress
);
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4HomeAddress
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
(
PrefixLength
,
RequestPrefix
.
ToByte
()),
HomeAddress
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
byte
prefixLengthAndRequestPrefix
=
(
byte
)(
PrefixLength
<<
Shift
.
PrefixLength
);
byte
prefixLengthAndRequestPrefix
=
(
byte
)(
PrefixLength
<<
Shift
.
PrefixLength
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionIpV4HomeAddressReply.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -91,6 +92,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -91,6 +92,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4HomeAddressReply
);
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4HomeAddressReply
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)
Status
,
PrefixLength
),
HomeAddress
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Status
,
(
byte
)
Status
);
buffer
.
Write
(
offset
+
Offset
.
Status
,
(
byte
)
Status
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionIpV4HomeAddressRequest.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -91,6 +92,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -91,6 +92,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4HomeAddressRequest
);
return
EqualsData
(
other
as
IpV6MobilityOptionIpV4HomeAddressRequest
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
PrefixLength
,
HomeAddress
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
PrefixLength
,
(
byte
)(
PrefixLength
<<
Shift
.
PrefixLength
));
buffer
.
Write
(
offset
+
Offset
.
PrefixLength
,
(
byte
)(
PrefixLength
<<
Shift
.
PrefixLength
));
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionIpV6Address.cs
View file @
96b7db96
...
@@ -42,17 +42,22 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -42,17 +42,22 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
OptionDataLength
;
}
get
{
return
OptionDataLength
;
}
}
}
internal
override
sealed
bool
EqualsData
(
IpV6MobilityOption
other
)
internal
sealed
override
bool
EqualsData
(
IpV6MobilityOption
other
)
{
{
return
EqualsData
(
other
as
IpV6MobilityOptionIpV6Address
);
return
EqualsData
(
other
as
IpV6MobilityOptionIpV6Address
);
}
}
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
int
GetDataHashCode
()
{
return
Address
.
GetHashCode
();
}
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
Address
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
Address
,
Endianity
.
Big
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionIpV6AddressPrefix.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
...
@@ -85,6 +86,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -85,6 +86,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionIpV6AddressPrefix
);
return
EqualsData
(
other
as
IpV6MobilityOptionIpV6AddressPrefix
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)
Code
,
PrefixLength
),
AddressOrPrefix
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Code
,
(
byte
)
Code
);
buffer
.
Write
(
offset
+
Offset
.
Code
,
(
byte
)
Code
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionLinkLayerAddress.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -63,6 +65,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -63,6 +65,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionLinkLayerAddress
);
return
EqualsData
(
other
as
IpV6MobilityOptionLinkLayerAddress
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
Code
,
LinkLayerAddress
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
OptionCode
,
(
byte
)
Code
);
buffer
.
Write
(
offset
+
Offset
.
OptionCode
,
(
byte
)
Code
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionLoadInformation.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -94,6 +96,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -94,6 +96,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionLoadInformation
);
return
EqualsData
(
other
as
IpV6MobilityOptionLoadInformation
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
Priority
,
SessionsInUse
,
MaximumSessions
,
UsedCapacity
,
MaximumCapacity
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Priority
,
Priority
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
Priority
,
Priority
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionLocalMobilityAnchorAddress.cs
View file @
96b7db96
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -108,6 +109,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -108,6 +109,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionLocalMobilityAnchorAddress
);
return
EqualsData
(
other
as
IpV6MobilityOptionLocalMobilityAnchorAddress
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
Code
,
LocalMobilityAnchorAddressIpV4
,
LocalMobilityAnchorAddressIpV6
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Code
,
(
byte
)
Code
);
buffer
.
Write
(
offset
+
Offset
.
Code
,
(
byte
)
Code
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionMobileAccessGatewayIpV6Address.cs
View file @
96b7db96
...
@@ -66,6 +66,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -66,6 +66,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionMobileAccessGatewayIpV6Address
);
return
EqualsData
(
other
as
IpV6MobilityOptionMobileAccessGatewayIpV6Address
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Address
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
AddressLength
,
AddressLength
);
buffer
.
Write
(
offset
+
Offset
.
AddressLength
,
AddressLength
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionMobileNodeGroupIdentifier.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -67,6 +69,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -67,6 +69,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionMobileNodeGroupIdentifier
);
return
EqualsData
(
other
as
IpV6MobilityOptionMobileNodeGroupIdentifier
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
SubType
,
MobileNodeGroupIdentifier
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
SubType
,
(
byte
)
SubType
);
buffer
.
Write
(
offset
+
Offset
.
SubType
,
(
byte
)
SubType
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionMobileNodeIdentifier.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
...
@@ -76,6 +77,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -76,6 +77,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionMobileNodeIdentifier
);
return
EqualsData
(
other
as
IpV6MobilityOptionMobileNodeIdentifier
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
Subtype
,
Identifier
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Subtype
,
(
byte
)
Subtype
);
buffer
.
Write
(
offset
+
Offset
.
Subtype
,
(
byte
)
Subtype
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionMobileNodeLinkLayerIdentifier.cs
View file @
96b7db96
...
@@ -55,6 +55,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -55,6 +55,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionMobileNodeLinkLayerIdentifier
);
return
EqualsData
(
other
as
IpV6MobilityOptionMobileNodeLinkLayerIdentifier
);
}
}
internal
override
int
GetDataHashCode
()
{
return
LinkLayerIdentifier
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
LinkLayerIdentifier
,
LinkLayerIdentifier
);
buffer
.
Write
(
offset
+
Offset
.
LinkLayerIdentifier
,
LinkLayerIdentifier
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionMobileNodeLinkLocalAddressInterfaceIdentifier.cs
View file @
96b7db96
...
@@ -57,6 +57,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -57,6 +57,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionMobileNodeLinkLocalAddressInterfaceIdentifier
);
return
EqualsData
(
other
as
IpV6MobilityOptionMobileNodeLinkLocalAddressInterfaceIdentifier
);
}
}
internal
override
int
GetDataHashCode
()
{
return
InterfaceIdentifier
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
InterfaceIdentifier
,
InterfaceIdentifier
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
InterfaceIdentifier
,
InterfaceIdentifier
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionNatDetection.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -76,6 +78,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -76,6 +78,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionNatDetection
);
return
EqualsData
(
other
as
IpV6MobilityOptionNatDetection
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
UdpEncapsulationRequired
,
RefreshTime
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
byte
udpEncapsulationRequired
=
0
;
byte
udpEncapsulationRequired
=
0
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionNetworkPrefix.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -48,17 +50,22 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -48,17 +50,22 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
/// </summary>
public
IpV6Address
NetworkPrefix
{
get
;
private
set
;
}
public
IpV6Address
NetworkPrefix
{
get
;
private
set
;
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
OptionDataLength
;
}
get
{
return
OptionDataLength
;
}
}
}
internal
override
sealed
bool
EqualsData
(
IpV6MobilityOption
other
)
internal
sealed
override
bool
EqualsData
(
IpV6MobilityOption
other
)
{
{
return
EqualsData
(
other
as
IpV6MobilityOptionNetworkPrefix
);
return
EqualsData
(
other
as
IpV6MobilityOptionNetworkPrefix
);
}
}
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
PrefixLength
,
NetworkPrefix
);
}
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
PrefixLength
,
PrefixLength
);
buffer
.
Write
(
offset
+
Offset
.
PrefixLength
,
PrefixLength
);
buffer
.
Write
(
offset
+
Offset
.
NetworkPrefix
,
NetworkPrefix
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
NetworkPrefix
,
NetworkPrefix
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionNonceIndices.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -64,6 +66,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -64,6 +66,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionNonceIndices
);
return
EqualsData
(
other
as
IpV6MobilityOptionNonceIndices
);
}
}
internal
override
int
GetDataHashCode
()
{
return
BitSequence
.
Merge
(
HomeNonceIndex
,
CareOfNonceIndex
).
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
HomeNonceIndex
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
HomeNonceIndex
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionPadN.cs
View file @
96b7db96
using
System
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -38,7 +40,12 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -38,7 +40,12 @@ namespace PcapDotNet.Packets.IpV6
internal
override
bool
EqualsData
(
IpV6MobilityOption
other
)
internal
override
bool
EqualsData
(
IpV6MobilityOption
other
)
{
{
return
true
;
return
EqualsData
(
other
as
IpV6MobilityOptionPadN
);
}
internal
override
int
GetDataHashCode
()
{
return
PaddingDataLength
.
GetHashCode
();
}
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
...
@@ -50,5 +57,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -50,5 +57,11 @@ namespace PcapDotNet.Packets.IpV6
:
this
(
0
)
:
this
(
0
)
{
{
}
}
private
bool
EqualsData
(
IpV6MobilityOptionPadN
other
)
{
return
other
!=
null
&&
PaddingDataLength
==
other
.
PaddingDataLength
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionRedirect.cs
View file @
96b7db96
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -99,6 +100,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -99,6 +100,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionRedirect
);
return
EqualsData
(
other
as
IpV6MobilityOptionRedirect
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
LocalMobilityAddressIpV4
,
LocalMobilityAddressIpV6
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
if
(
LocalMobilityAddressIpV4
.
HasValue
)
if
(
LocalMobilityAddressIpV4
.
HasValue
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionRedirectCapability.cs
View file @
96b7db96
...
@@ -40,6 +40,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -40,6 +40,11 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
int
GetDataHashCode
()
{
return
0
;
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
offset
+=
DataLength
;
offset
+=
DataLength
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionReservedByteValueByte.cs
View file @
96b7db96
...
@@ -41,7 +41,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -41,7 +41,7 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
OptionDataLength
;
}
get
{
return
OptionDataLength
;
}
}
}
...
@@ -51,7 +51,12 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -51,7 +51,12 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionReservedByteValueByte
);
return
EqualsData
(
other
as
IpV6MobilityOptionReservedByteValueByte
);
}
}
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
int
GetDataHashCode
()
{
return
Value
.
GetHashCode
();
}
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
Value
,
Value
);
buffer
.
Write
(
offset
+
Offset
.
Value
,
Value
);
offset
+=
DataLength
;
offset
+=
DataLength
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionRestartCounter.cs
View file @
96b7db96
...
@@ -48,6 +48,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -48,6 +48,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionRestartCounter
);
return
EqualsData
(
other
as
IpV6MobilityOptionRestartCounter
);
}
}
internal
override
int
GetDataHashCode
()
{
return
RestartCounter
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
RestartCounter
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
RestartCounter
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionSingleDataSegmentField.cs
View file @
96b7db96
...
@@ -22,17 +22,22 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -22,17 +22,22 @@ namespace PcapDotNet.Packets.IpV6
internal
DataSegment
Value
{
get
;
private
set
;
}
internal
DataSegment
Value
{
get
;
private
set
;
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
Value
.
Length
;
}
get
{
return
Value
.
Length
;
}
}
}
internal
override
sealed
bool
EqualsData
(
IpV6MobilityOption
other
)
internal
sealed
override
bool
EqualsData
(
IpV6MobilityOption
other
)
{
{
return
EqualsData
(
other
as
IpV6MobilityOptionSingleDataSegmentField
);
return
EqualsData
(
other
as
IpV6MobilityOptionSingleDataSegmentField
);
}
}
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
int
GetDataHashCode
()
{
return
Value
.
GetHashCode
();
}
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
Value
.
Write
(
buffer
,
ref
offset
);
Value
.
Write
(
buffer
,
ref
offset
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionTransientBinding.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -67,6 +69,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -67,6 +69,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6MobilityOptionTransientBinding
);
return
EqualsData
(
other
as
IpV6MobilityOptionTransientBinding
);
}
}
internal
override
int
GetDataHashCode
()
{
return
BitSequence
.
Merge
(
LatePathSwitch
.
ToByte
(),
Lifetime
).
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
if
(
LatePathSwitch
)
if
(
LatePathSwitch
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionType.cs
View file @
96b7db96
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// Type of an IPv6 Mobility option.
/// </summary>
public
enum
IpV6MobilityOptionType
:
byte
public
enum
IpV6MobilityOptionType
:
byte
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionULong.cs
View file @
96b7db96
...
@@ -38,17 +38,22 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -38,17 +38,22 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
OptionDataLength
;
}
get
{
return
OptionDataLength
;
}
}
}
internal
override
sealed
bool
EqualsData
(
IpV6MobilityOption
other
)
internal
sealed
override
bool
EqualsData
(
IpV6MobilityOption
other
)
{
{
return
EqualsData
(
other
as
IpV6MobilityOptionULong
);
return
EqualsData
(
other
as
IpV6MobilityOptionULong
);
}
}
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
int
GetDataHashCode
()
{
return
Value
.
GetHashCode
();
}
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
Value
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
Value
,
Endianity
.
Big
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionVendorSpecific.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -75,11 +77,16 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -75,11 +77,16 @@ namespace PcapDotNet.Packets.IpV6
get
{
return
OptionDataMinimumLength
+
Data
.
Length
;
}
get
{
return
OptionDataMinimumLength
+
Data
.
Length
;
}
}
}
internal
sealed
override
bool
EqualsData
(
IpV6MobilityOption
other
)
internal
override
bool
EqualsData
(
IpV6MobilityOption
other
)
{
{
return
EqualsData
(
other
as
IpV6MobilityOptionVendorSpecific
);
return
EqualsData
(
other
as
IpV6MobilityOptionVendorSpecific
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
VendorId
,
SubType
,
Data
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
offset
+
Offset
.
VendorId
,
VendorId
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
VendorId
,
VendorId
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptions.cs
View file @
96b7db96
...
@@ -6,6 +6,9 @@ using PcapDotNet.Base;
...
@@ -6,6 +6,9 @@ using PcapDotNet.Base;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// Set of Mobility options for IPv6 Mobility Extension Header.
/// </summary>
public
class
IpV6MobilityOptions
:
V6Options
<
IpV6MobilityOption
>
public
class
IpV6MobilityOptions
:
V6Options
<
IpV6MobilityOption
>
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Option.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ip
;
using
PcapDotNet.Packets.Ip
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -39,8 +40,15 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -39,8 +40,15 @@ namespace PcapDotNet.Packets.IpV6
OptionType
==
other
.
OptionType
&&
Length
==
other
.
Length
&&
EqualsData
(
other
);
OptionType
==
other
.
OptionType
&&
Length
==
other
.
Length
&&
EqualsData
(
other
);
}
}
public
sealed
override
int
GetHashCode
()
{
return
Sequence
.
GetHashCode
(
OptionType
,
GetDataHashCode
());
}
internal
abstract
bool
EqualsData
(
IpV6Option
other
);
internal
abstract
bool
EqualsData
(
IpV6Option
other
);
internal
abstract
int
GetDataHashCode
();
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
[
offset
++]
=
(
byte
)
OptionType
;
buffer
[
offset
++]
=
(
byte
)
OptionType
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionCalipso.cs
View file @
96b7db96
...
@@ -160,6 +160,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -160,6 +160,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionCalipso
);
return
EqualsData
(
other
as
IpV6OptionCalipso
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
DomainOfInterpretation
,
BitSequence
.
Merge
(
CompartmentLength
,
SensitivityLevel
,
Checksum
),
CompartmentBitmap
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
(
uint
)
DomainOfInterpretation
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
(
uint
)
DomainOfInterpretation
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionComplex.cs
View file @
96b7db96
...
@@ -22,14 +22,14 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -22,14 +22,14 @@ namespace PcapDotNet.Packets.IpV6
{
{
}
}
public
override
sealed
int
Length
public
sealed
override
int
Length
{
{
get
{
return
sizeof
(
byte
)
+
sizeof
(
byte
)
+
DataLength
;
}
get
{
return
sizeof
(
byte
)
+
sizeof
(
byte
)
+
DataLength
;
}
}
}
internal
abstract
int
DataLength
{
get
;
}
internal
abstract
int
DataLength
{
get
;
}
internal
override
sealed
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
[
offset
++]
=
(
byte
)
DataLength
;
buffer
[
offset
++]
=
(
byte
)
DataLength
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionEndpointIdentification.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -69,6 +71,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -69,6 +71,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionEndpointIdentification
);
return
EqualsData
(
other
as
IpV6OptionEndpointIdentification
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
SourceEndpointIdentifier
,
DestinationEndpointIdentifier
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
(
byte
)
SourceEndpointIdentifier
.
Length
);
buffer
.
Write
(
ref
offset
,
(
byte
)
SourceEndpointIdentifier
.
Length
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionHomeAddress.cs
View file @
96b7db96
...
@@ -55,6 +55,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -55,6 +55,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionHomeAddress
);
return
EqualsData
(
other
as
IpV6OptionHomeAddress
);
}
}
internal
override
int
GetDataHashCode
()
{
return
HomeAddress
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
HomeAddress
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
HomeAddress
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionIlnpNonce.cs
View file @
96b7db96
...
@@ -44,6 +44,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -44,6 +44,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionIlnpNonce
);
return
EqualsData
(
other
as
IpV6OptionIlnpNonce
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Nonce
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
Nonce
);
buffer
.
Write
(
ref
offset
,
Nonce
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionJumboPayload.cs
View file @
96b7db96
...
@@ -47,6 +47,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -47,6 +47,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionJumboPayload
);
return
EqualsData
(
other
as
IpV6OptionJumboPayload
);
}
}
internal
override
int
GetDataHashCode
()
{
return
JumboPayloadLength
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
JumboPayloadLength
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
JumboPayloadLength
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionLineIdentificationDestination.cs
View file @
96b7db96
...
@@ -73,6 +73,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -73,6 +73,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionLineIdentificationDestination
);
return
EqualsData
(
other
as
IpV6OptionLineIdentificationDestination
);
}
}
internal
override
int
GetDataHashCode
()
{
return
LineIdentification
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
(
byte
)
LineIdentification
.
Length
);
buffer
.
Write
(
ref
offset
,
(
byte
)
LineIdentification
.
Length
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionPad1.cs
View file @
96b7db96
...
@@ -41,6 +41,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -41,6 +41,11 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
int
GetDataHashCode
()
{
return
0
;
}
internal
override
IpV6MobilityOption
CreateInstance
(
DataSegment
data
)
internal
override
IpV6MobilityOption
CreateInstance
(
DataSegment
data
)
{
{
throw
new
InvalidOperationException
(
"Pad1 options shouldn't be registered."
);
throw
new
InvalidOperationException
(
"Pad1 options shouldn't be registered."
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionPadN.cs
View file @
96b7db96
...
@@ -37,7 +37,12 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -37,7 +37,12 @@ namespace PcapDotNet.Packets.IpV6
internal
override
bool
EqualsData
(
IpV6Option
other
)
internal
override
bool
EqualsData
(
IpV6Option
other
)
{
{
return
true
;
return
EqualsData
(
other
as
IpV6OptionPadN
);
}
internal
override
int
GetDataHashCode
()
{
return
PaddingDataLength
.
GetHashCode
();
}
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
...
@@ -49,5 +54,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -49,5 +54,11 @@ namespace PcapDotNet.Packets.IpV6
:
this
(
0
)
:
this
(
0
)
{
{
}
}
private
bool
EqualsData
(
IpV6OptionPadN
other
)
{
return
other
!=
null
&&
PaddingDataLength
==
other
.
PaddingDataLength
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionQuickStart.cs
View file @
96b7db96
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ip
;
using
PcapDotNet.Packets.Ip
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
...
@@ -66,6 +67,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -66,6 +67,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionQuickStart
);
return
EqualsData
(
other
as
IpV6OptionQuickStart
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
((
byte
)
Function
,
Rate
,
Ttl
),
Nonce
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
IpOptionQuickStartCommon
.
WriteData
(
buffer
,
ref
offset
,
Function
,
Rate
,
Ttl
,
Nonce
);
IpOptionQuickStartCommon
.
WriteData
(
buffer
,
ref
offset
,
Function
,
Rate
,
Ttl
,
Nonce
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionRouterAlert.cs
View file @
96b7db96
...
@@ -46,6 +46,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -46,6 +46,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionRouterAlert
);
return
EqualsData
(
other
as
IpV6OptionRouterAlert
);
}
}
internal
override
int
GetDataHashCode
()
{
return
RouterAlertType
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
(
ushort
)
RouterAlertType
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
(
ushort
)
RouterAlertType
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionRoutingProtocolLowPowerAndLossyNetworks.cs
View file @
96b7db96
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -114,6 +116,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -114,6 +116,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionRoutingProtocolLowPowerAndLossyNetworks
);
return
EqualsData
(
other
as
IpV6OptionRoutingProtocolLowPowerAndLossyNetworks
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
BitSequence
.
Merge
(
BitSequence
.
Merge
(
Down
,
RankError
,
ForwardingError
),
RplInstanceId
,
SenderRank
),
SubTlvs
);
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
byte
flags
=
(
byte
)((
Down
?
Mask
.
Down
:
0
)
|
(
RankError
?
Mask
.
RankError
:
0
)
|
(
ForwardingError
?
Mask
.
ForwardingError
:
0
));
byte
flags
=
(
byte
)((
Down
?
Mask
.
Down
:
0
)
|
(
RankError
?
Mask
.
RankError
:
0
)
|
(
ForwardingError
?
Mask
.
ForwardingError
:
0
));
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionSimple.cs
View file @
96b7db96
...
@@ -18,7 +18,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -18,7 +18,7 @@ namespace PcapDotNet.Packets.IpV6
{
{
}
}
public
override
sealed
int
Length
public
sealed
override
int
Length
{
{
get
{
return
sizeof
(
byte
);
}
get
{
return
sizeof
(
byte
);
}
}
}
...
@@ -28,7 +28,12 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -28,7 +28,12 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
sealed
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
int
GetDataHashCode
()
{
return
0
;
}
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdDefault.cs
View file @
96b7db96
...
@@ -67,6 +67,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -67,6 +67,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsTaggerId
(
other
as
IpV6OptionSmfDpdDefault
);
return
EqualsTaggerId
(
other
as
IpV6OptionSmfDpdDefault
);
}
}
internal
override
int
GetTaggerIdHashCode
()
{
return
TaggerId
.
GetHashCode
();
}
internal
override
void
WriteTaggerId
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteTaggerId
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
TaggerId
);
buffer
.
Write
(
ref
offset
,
TaggerId
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdIpV4.cs
View file @
96b7db96
...
@@ -58,6 +58,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -58,6 +58,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsTaggerId
(
other
as
IpV6OptionSmfDpdIpV4
);
return
EqualsTaggerId
(
other
as
IpV6OptionSmfDpdIpV4
);
}
}
internal
override
int
GetTaggerIdHashCode
()
{
return
TaggerId
.
GetHashCode
();
}
internal
override
void
WriteTaggerId
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteTaggerId
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
TaggerId
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
TaggerId
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdIpV6.cs
View file @
96b7db96
...
@@ -68,6 +68,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -68,6 +68,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsTaggerId
(
other
as
IpV6OptionSmfDpdIpV6
);
return
EqualsTaggerId
(
other
as
IpV6OptionSmfDpdIpV6
);
}
}
internal
override
int
GetTaggerIdHashCode
()
{
return
TaggerId
.
GetHashCode
();
}
internal
override
void
WriteTaggerId
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteTaggerId
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
TaggerId
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
TaggerId
,
Endianity
.
Big
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdNull.cs
View file @
96b7db96
...
@@ -48,6 +48,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -48,6 +48,11 @@ namespace PcapDotNet.Packets.IpV6
return
true
;
return
true
;
}
}
internal
override
int
GetTaggerIdHashCode
()
{
return
0
;
}
internal
override
void
WriteTaggerId
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteTaggerId
(
byte
[]
buffer
,
ref
int
offset
)
{
{
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdSequenceBased.cs
View file @
96b7db96
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
...
@@ -80,7 +81,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -80,7 +81,7 @@ namespace PcapDotNet.Packets.IpV6
Identifier
=
identifier
;
Identifier
=
identifier
;
}
}
internal
override
sealed
int
DataLength
internal
sealed
override
int
DataLength
{
{
get
{
return
OptionDataMinimumLength
+
TaggerIdLength
+
Identifier
.
Length
;
}
get
{
return
OptionDataMinimumLength
+
TaggerIdLength
+
Identifier
.
Length
;
}
}
}
...
@@ -90,9 +91,16 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -90,9 +91,16 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionSmfDpdSequenceBased
);
return
EqualsData
(
other
as
IpV6OptionSmfDpdSequenceBased
);
}
}
internal
sealed
override
int
GetDataHashCode
()
{
return
Sequence
.
GetHashCode
(
Identifier
,
TaggerIdType
,
GetTaggerIdHashCode
());
}
internal
abstract
bool
EqualsTaggerId
(
IpV6OptionSmfDpdSequenceBased
other
);
internal
abstract
bool
EqualsTaggerId
(
IpV6OptionSmfDpdSequenceBased
other
);
internal
override
sealed
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
abstract
int
GetTaggerIdHashCode
();
internal
sealed
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
byte
taggerIdInfo
=
(
byte
)(((
byte
)
TaggerIdType
<<
Shift
.
TaggerIdType
)
&
Mask
.
TaggerIdType
);
byte
taggerIdInfo
=
(
byte
)(((
byte
)
TaggerIdType
<<
Shift
.
TaggerIdType
)
&
Mask
.
TaggerIdType
);
if
(
TaggerIdType
!=
IpV6TaggerIdType
.
Null
)
if
(
TaggerIdType
!=
IpV6TaggerIdType
.
Null
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionSmfDpdSequenceHashAssistValue.cs
View file @
96b7db96
...
@@ -53,6 +53,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -53,6 +53,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionSmfDpdSequenceHashAssistValue
);
return
EqualsData
(
other
as
IpV6OptionSmfDpdSequenceHashAssistValue
);
}
}
internal
override
int
GetDataHashCode
()
{
return
HashAssistValue
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
(
byte
)(
HashAssistValue
[
0
]
|
0x80
));
buffer
.
Write
(
ref
offset
,
(
byte
)(
HashAssistValue
[
0
]
|
0x80
));
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionTunnelEncapsulationLimit.cs
View file @
96b7db96
...
@@ -46,6 +46,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -46,6 +46,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionTunnelEncapsulationLimit
);
return
EqualsData
(
other
as
IpV6OptionTunnelEncapsulationLimit
);
}
}
internal
override
int
GetDataHashCode
()
{
return
TunnelEncapsulationLimit
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
TunnelEncapsulationLimit
);
buffer
.
Write
(
ref
offset
,
TunnelEncapsulationLimit
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionUnknown.cs
View file @
96b7db96
...
@@ -33,6 +33,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -33,6 +33,11 @@ namespace PcapDotNet.Packets.IpV6
return
EqualsData
(
other
as
IpV6OptionUnknown
);
return
EqualsData
(
other
as
IpV6OptionUnknown
);
}
}
internal
override
int
GetDataHashCode
()
{
return
Data
.
GetHashCode
();
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
{
buffer
.
Write
(
ref
offset
,
Data
);
buffer
.
Write
(
ref
offset
,
Data
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Options.cs
View file @
96b7db96
...
@@ -7,26 +7,44 @@ using PcapDotNet.Packets.Ip;
...
@@ -7,26 +7,44 @@ using PcapDotNet.Packets.Ip;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// List of IPv6 options for some of the IPv6 extension headers.
/// </summary>
public
sealed
class
IpV6Options
:
Options
<
IpV6Option
>
public
sealed
class
IpV6Options
:
Options
<
IpV6Option
>
{
{
/// <summary>
/// Empty set of options.
/// </summary>
public
static
IpV6Options
Empty
{
get
{
return
_empty
;
}
}
public
static
IpV6Options
Empty
{
get
{
return
_empty
;
}
}
/// <summary>
/// Creates the list of options from a given IList of otpions.
/// </summary>
/// <param name="options">List of options to build the set from.</param>
public
IpV6Options
(
IList
<
IpV6Option
>
options
)
public
IpV6Options
(
IList
<
IpV6Option
>
options
)
:
base
(
options
,
true
,
null
)
:
base
(
options
,
true
,
null
)
{
{
}
}
/// <summary>
/// Creates the list of options from a given IEnumerable of otpions.
/// </summary>
/// <param name="options">List of options to build the set from.</param>
public
IpV6Options
(
IEnumerable
<
IpV6Option
>
options
)
public
IpV6Options
(
IEnumerable
<
IpV6Option
>
options
)
:
this
(
options
.
ToList
())
:
this
(
options
.
ToList
())
{
{
}
}
/// <summary>
/// Creates the list of options from a given array of otpions.
/// </summary>
/// <param name="options">List of options to build the set from.</param>
public
IpV6Options
(
params
IpV6Option
[]
options
)
public
IpV6Options
(
params
IpV6Option
[]
options
)
:
this
((
IList
<
IpV6Option
>)
options
)
:
this
((
IList
<
IpV6Option
>)
options
)
{
{
}
}
public
IpV6Options
(
DataSegment
data
)
internal
IpV6Options
(
DataSegment
data
)
:
this
(
Read
(
data
))
:
this
(
Read
(
data
))
{
{
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/V6Options.cs
View file @
96b7db96
...
@@ -4,14 +4,18 @@ using PcapDotNet.Packets.Ip;
...
@@ -4,14 +4,18 @@ using PcapDotNet.Packets.Ip;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// Base class for different IPv6 options types.
/// </summary>
/// <typeparam name="T">The option concrete type.</typeparam>
public
abstract
class
V6Options
<
T
>
:
Options
<
T
>
where
T
:
Option
,
IEquatable
<
T
>
public
abstract
class
V6Options
<
T
>
:
Options
<
T
>
where
T
:
Option
,
IEquatable
<
T
>
{
{
public
V6Options
(
IList
<
T
>
options
,
bool
isValid
)
internal
V6Options
(
IList
<
T
>
options
,
bool
isValid
)
:
base
(
options
,
isValid
,
null
)
:
base
(
options
,
isValid
,
null
)
{
{
}
}
internal
override
sealed
int
CalculateBytesLength
(
int
optionsLength
)
internal
sealed
override
int
CalculateBytesLength
(
int
optionsLength
)
{
{
return
optionsLength
;
return
optionsLength
;
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOption.cs
View file @
96b7db96
using
System
;
using
System
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ip
;
using
PcapDotNet.Packets.Ip
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
...
@@ -48,11 +49,10 @@ namespace PcapDotNet.Packets.Transport
...
@@ -48,11 +49,10 @@ namespace PcapDotNet.Packets.Transport
/// <summary>
/// <summary>
/// Checks if the two options are exactly the same - including type and value.
/// Checks if the two options are exactly the same - including type and value.
/// </summary>
/// </summary>
public
virtual
bool
Equals
(
TcpOption
other
)
public
bool
Equals
(
TcpOption
other
)
{
{
if
(
other
==
null
)
return
other
!=
null
&&
return
false
;
OptionType
==
other
.
OptionType
&&
EqualsData
(
other
);
return
Equivalent
(
other
);
}
}
/// <summary>
/// <summary>
...
@@ -67,9 +67,9 @@ namespace PcapDotNet.Packets.Transport
...
@@ -67,9 +67,9 @@ namespace PcapDotNet.Packets.Transport
/// The hash code for a tcp option is the hash code for the option type.
/// The hash code for a tcp option is the hash code for the option type.
/// This should be overridden by tcp options with data.
/// This should be overridden by tcp options with data.
/// </summary>
/// </summary>
public
override
int
GetHashCode
()
public
sealed
override
int
GetHashCode
()
{
{
return
OptionType
.
GetHashCode
(
);
return
Sequence
.
GetHashCode
(
OptionType
,
GetDataHashCode
()
);
}
}
/// <summary>
/// <summary>
...
@@ -80,6 +80,10 @@ namespace PcapDotNet.Packets.Transport
...
@@ -80,6 +80,10 @@ namespace PcapDotNet.Packets.Transport
return
OptionType
.
ToString
();
return
OptionType
.
ToString
();
}
}
internal
abstract
bool
EqualsData
(
TcpOption
other
);
internal
abstract
int
GetDataHashCode
();
internal
sealed
override
V4Option
Read
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
internal
sealed
override
V4Option
Read
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
{
{
int
offsetEnd
=
offset
+
length
;
int
offsetEnd
=
offset
+
length
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionAlternateChecksumData.cs
View file @
96b7db96
...
@@ -35,7 +35,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -35,7 +35,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
AlternateChecksumData
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
AlternateChecksumData
)]
public
sealed
class
TcpOptionAlternateChecksumData
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionAlternateChecksumData
>
public
sealed
class
TcpOptionAlternateChecksumData
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The minimum number of bytes this option take.
/// The minimum number of bytes this option take.
...
@@ -85,33 +85,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -85,33 +85,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two alternate checksum data options are equal if they have the same data.
/// </summary>
public
bool
Equals
(
TcpOptionAlternateChecksumData
other
)
{
if
(
other
==
null
)
return
false
;
return
Data
.
SequenceEqual
(
other
.
Data
);
}
/// <summary>
/// Two alternate checksum data options are equal if they have the same data.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionAlternateChecksumData
);
}
/// <summary>
/// The hash code of this option is the hash code of the option type xored with the hash code of the data.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Data
.
BytesSequenceGetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -128,10 +101,26 @@ namespace PcapDotNet.Packets.Transport
...
@@ -128,10 +101,26 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionAlternateChecksumData
(
data
);
return
new
TcpOptionAlternateChecksumData
(
data
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionAlternateChecksumData
);
}
internal
override
int
GetDataHashCode
()
{
return
Data
.
BytesSequenceGetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
.
Write
(
ref
offset
,
Data
);
buffer
.
Write
(
ref
offset
,
Data
);
}
}
private
bool
EqualsData
(
TcpOptionAlternateChecksumData
other
)
{
return
other
!=
null
&&
Data
.
SequenceEqual
(
other
.
Data
);
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionAlternateChecksumRequest.cs
View file @
96b7db96
...
@@ -29,7 +29,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -29,7 +29,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
AlternateChecksumRequest
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
AlternateChecksumRequest
)]
public
sealed
class
TcpOptionAlternateChecksumRequest
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionAlternateChecksumRequest
>
public
sealed
class
TcpOptionAlternateChecksumRequest
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -79,33 +79,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -79,33 +79,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two alternate checksum request options are equal if they have the same checksum type.
/// </summary>
public
bool
Equals
(
TcpOptionAlternateChecksumRequest
other
)
{
if
(
other
==
null
)
return
false
;
return
ChecksumType
==
other
.
ChecksumType
;
}
/// <summary>
/// Two alternate checksum request options are equal if they have the same checksum type.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionAlternateChecksumRequest
);
}
/// <summary>
/// The hash code of this option is the hash code of the option type xored with hash code of the checksum type.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
ChecksumType
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -122,10 +95,26 @@ namespace PcapDotNet.Packets.Transport
...
@@ -122,10 +95,26 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionAlternateChecksumRequest
((
TcpOptionAlternateChecksumType
)
checksumType
);
return
new
TcpOptionAlternateChecksumRequest
((
TcpOptionAlternateChecksumType
)
checksumType
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionAlternateChecksumRequest
);
}
internal
override
int
GetDataHashCode
()
{
return
ChecksumType
.
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
.
Write
(
ref
offset
,
(
byte
)
ChecksumType
);
buffer
.
Write
(
ref
offset
,
(
byte
)
ChecksumType
);
}
}
private
bool
EqualsData
(
TcpOptionAlternateChecksumRequest
other
)
{
return
other
!=
null
&&
ChecksumType
==
other
.
ChecksumType
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionConnectionCountBase.cs
View file @
96b7db96
...
@@ -5,7 +5,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -5,7 +5,7 @@ namespace PcapDotNet.Packets.Transport
/// <summary>
/// <summary>
/// The base class for connection count TCP options.
/// The base class for connection count TCP options.
/// </summary>
/// </summary>
public
abstract
class
TcpOptionConnectionCountBase
:
TcpOptionComplex
,
IEquatable
<
TcpOptionConnectionCountBase
>
public
abstract
class
TcpOptionConnectionCountBase
:
TcpOptionComplex
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -38,32 +38,14 @@ namespace PcapDotNet.Packets.Transport
...
@@ -38,32 +38,14 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
internal
sealed
override
bool
EqualsData
(
TcpOption
other
)
/// Two connection count options are equal of they are of the same option type and have the same connection count.
/// </summary>
public
bool
Equals
(
TcpOptionConnectionCountBase
other
)
{
if
(
other
==
null
)
return
false
;
return
OptionType
==
other
.
OptionType
&&
ConnectionCount
==
other
.
ConnectionCount
;
}
/// <summary>
/// Two connection count options are equal of they are of the same option type and have the same connection count.
/// </summary>
public
sealed
override
bool
Equals
(
TcpOption
other
)
{
{
return
Equals
(
other
as
TcpOptionConnectionCountBase
);
return
Equals
Data
(
other
as
TcpOptionConnectionCountBase
);
}
}
/// <summary>
internal
sealed
override
int
GetDataHashCode
()
/// The hash code of the connection count option is the hash code of the option type xored with the hash code of the connection count.
/// </summary>
public
sealed
override
int
GetHashCode
()
{
{
return
base
.
GetHashCode
()
^
ConnectionCount
.
GetHashCode
();
return
ConnectionCount
.
GetHashCode
();
}
}
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
sealed
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
...
@@ -100,5 +82,11 @@ namespace PcapDotNet.Packets.Transport
...
@@ -100,5 +82,11 @@ namespace PcapDotNet.Packets.Transport
connectionCount
=
buffer
.
ReadUInt
(
ref
offset
,
Endianity
.
Big
);
connectionCount
=
buffer
.
ReadUInt
(
ref
offset
,
Endianity
.
Big
);
return
true
;
return
true
;
}
}
private
bool
EqualsData
(
TcpOptionConnectionCountBase
other
)
{
return
other
!=
null
&&
OptionType
==
other
.
OptionType
&&
ConnectionCount
==
other
.
ConnectionCount
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionEcho.cs
View file @
96b7db96
...
@@ -22,7 +22,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -22,7 +22,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
Echo
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
Echo
)]
public
sealed
class
TcpOptionEcho
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionEcho
>
public
sealed
class
TcpOptionEcho
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -72,33 +72,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -72,33 +72,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two echo options are equal if they have the same info.
/// </summary>
public
bool
Equals
(
TcpOptionEcho
other
)
{
if
(
other
==
null
)
return
false
;
return
Info
==
other
.
Info
;
}
/// <summary>
/// Two echo options are equal if they have the same info.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionEcho
);
}
/// <summary>
/// The hash code of the echo option is the hash code of the option type xored with the hash code info.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Info
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -115,10 +88,26 @@ namespace PcapDotNet.Packets.Transport
...
@@ -115,10 +88,26 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionEcho
(
info
);
return
new
TcpOptionEcho
(
info
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionEcho
);
}
internal
override
int
GetDataHashCode
()
{
return
Info
.
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
.
Write
(
ref
offset
,
Info
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
Info
,
Endianity
.
Big
);
}
}
private
bool
EqualsData
(
TcpOptionEcho
other
)
{
return
other
!=
null
&&
Info
==
other
.
Info
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionEchoReply.cs
View file @
96b7db96
...
@@ -29,7 +29,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -29,7 +29,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
EchoReply
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
EchoReply
)]
public
sealed
class
TcpOptionEchoReply
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionEchoReply
>
public
sealed
class
TcpOptionEchoReply
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -79,33 +79,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -79,33 +79,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two echo reply options are equal if they have the same info.
/// </summary>
public
bool
Equals
(
TcpOptionEchoReply
other
)
{
if
(
other
==
null
)
return
false
;
return
Info
==
other
.
Info
;
}
/// <summary>
/// Two echo reply options are equal if they have the same info.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionEchoReply
);
}
/// <summary>
/// The hash code of the echo reply option is the hash code of the option type xored with the hash code of the info.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Info
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -122,10 +95,26 @@ namespace PcapDotNet.Packets.Transport
...
@@ -122,10 +95,26 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionEchoReply
(
info
);
return
new
TcpOptionEchoReply
(
info
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionEchoReply
);
}
internal
override
int
GetDataHashCode
()
{
return
Info
.
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
.
Write
(
ref
offset
,
Info
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
Info
,
Endianity
.
Big
);
}
}
private
bool
EqualsData
(
TcpOptionEchoReply
other
)
{
return
other
!=
null
&&
Info
==
other
.
Info
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionMaximumSegmentSize.cs
View file @
96b7db96
...
@@ -19,7 +19,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -19,7 +19,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
MaximumSegmentSize
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
MaximumSegmentSize
)]
public
sealed
class
TcpOptionMaximumSegmentSize
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionMaximumSegmentSize
>
public
sealed
class
TcpOptionMaximumSegmentSize
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -69,34 +69,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -69,34 +69,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two maximum segment size options are equal if they have the same maximum segment size.
/// </summary>
public
bool
Equals
(
TcpOptionMaximumSegmentSize
other
)
{
if
(
other
==
null
)
return
false
;
return
MaximumSegmentSize
==
other
.
MaximumSegmentSize
;
}
/// <summary>
/// Two maximum segment size options are equal if they have the same maximum segment size.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionMaximumSegmentSize
);
}
/// <summary>
/// The hash code of the option is the hash code of the option type xored with the hash code of the maximum segment size.
/// </summary>
/// <returns></returns>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
MaximumSegmentSize
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -113,10 +85,26 @@ namespace PcapDotNet.Packets.Transport
...
@@ -113,10 +85,26 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionMaximumSegmentSize
(
maximumSegmentSize
);
return
new
TcpOptionMaximumSegmentSize
(
maximumSegmentSize
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionMaximumSegmentSize
);
}
internal
override
int
GetDataHashCode
()
{
return
MaximumSegmentSize
.
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
.
Write
(
ref
offset
,
MaximumSegmentSize
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
MaximumSegmentSize
,
Endianity
.
Big
);
}
}
private
bool
EqualsData
(
TcpOptionMaximumSegmentSize
other
)
{
return
other
!=
null
&&
MaximumSegmentSize
==
other
.
MaximumSegmentSize
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionMd5Signature.cs
View file @
96b7db96
...
@@ -27,7 +27,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -27,7 +27,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
Md5Signature
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
Md5Signature
)]
public
sealed
class
TcpOptionMd5Signature
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionMd5Signature
>
public
sealed
class
TcpOptionMd5Signature
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -83,33 +83,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -83,33 +83,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two MD5 signature options are equal if they have the same signature value.
/// </summary>
public
bool
Equals
(
TcpOptionMd5Signature
other
)
{
if
(
other
==
null
)
return
false
;
return
Data
.
SequenceEqual
(
other
.
Data
);
}
/// <summary>
/// Two MD5 signature options are equal if they have the same signature value.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionMd5Signature
);
}
/// <summary>
/// The hash code of the MD5 signature option is the hash code of the option type xored with the hash code of the signature.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Data
.
BytesSequenceGetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -126,10 +99,26 @@ namespace PcapDotNet.Packets.Transport
...
@@ -126,10 +99,26 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionMd5Signature
(
data
);
return
new
TcpOptionMd5Signature
(
data
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionMd5Signature
);
}
internal
override
int
GetDataHashCode
()
{
return
Data
.
BytesSequenceGetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
.
Write
(
ref
offset
,
Data
);
buffer
.
Write
(
ref
offset
,
Data
);
}
}
private
bool
EqualsData
(
TcpOptionMd5Signature
other
)
{
return
other
!=
null
&&
Data
.
SequenceEqual
(
other
.
Data
);
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionMood.cs
View file @
96b7db96
...
@@ -64,7 +64,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -64,7 +64,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
Mood
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
Mood
)]
public
sealed
class
TcpOptionMood
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionMood
>
public
sealed
class
TcpOptionMood
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The minimum number of bytes this option take.
/// The minimum number of bytes this option take.
...
@@ -139,33 +139,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -139,33 +139,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
false
;
}
get
{
return
false
;
}
}
}
/// <summary>
/// Two mood options are equal if they have the same emotion.
/// </summary>
public
bool
Equals
(
TcpOptionMood
other
)
{
if
(
other
==
null
)
return
false
;
return
Emotion
==
other
.
Emotion
;
}
/// <summary>
/// Two mood options are equal if they have the same emotion.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionMood
);
}
/// <summary>
/// The hash code of the echo option is the hash code of the option type xored with the hash code info.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Emotion
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -186,6 +159,16 @@ namespace PcapDotNet.Packets.Transport
...
@@ -186,6 +159,16 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionMood
(
emotion
);
return
new
TcpOptionMood
(
emotion
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionMood
);
}
internal
override
int
GetDataHashCode
()
{
return
Emotion
.
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
...
@@ -206,6 +189,12 @@ namespace PcapDotNet.Packets.Transport
...
@@ -206,6 +189,12 @@ namespace PcapDotNet.Packets.Transport
return
TcpOptionMoodEmotion
.
None
;
return
TcpOptionMoodEmotion
.
None
;
}
}
private
bool
EqualsData
(
TcpOptionMood
other
)
{
return
other
!=
null
&&
Emotion
==
other
.
Emotion
;
}
private
static
readonly
Dictionary
<
string
,
TcpOptionMoodEmotion
>
_stringToEmotion
=
new
Dictionary
<
string
,
TcpOptionMoodEmotion
>
private
static
readonly
Dictionary
<
string
,
TcpOptionMoodEmotion
>
_stringToEmotion
=
new
Dictionary
<
string
,
TcpOptionMoodEmotion
>
{
{
{
":)"
,
TcpOptionMoodEmotion
.
Happy
},
{
":)"
,
TcpOptionMoodEmotion
.
Happy
},
...
...
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionPartialOrderConnectionPermitted.cs
View file @
96b7db96
...
@@ -12,7 +12,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -12,7 +12,7 @@ namespace PcapDotNet.Packets.Transport
/// </pre>
/// </pre>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
PartialOrderConnectionPermitted
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
PartialOrderConnectionPermitted
)]
public
sealed
class
TcpOptionPartialOrderConnectionPermitted
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionPartialOrderConnectionPermitted
>
public
sealed
class
TcpOptionPartialOrderConnectionPermitted
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -48,22 +48,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -48,22 +48,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two partial order connection permitted options are always equal.
/// </summary>
public
bool
Equals
(
TcpOptionPartialOrderConnectionPermitted
other
)
{
return
other
!=
null
;
}
/// <summary>
/// Two partial order connection permitted options are always equal.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionPartialOrderConnectionPermitted
);
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -79,6 +63,21 @@ namespace PcapDotNet.Packets.Transport
...
@@ -79,6 +63,21 @@ namespace PcapDotNet.Packets.Transport
return
_instance
;
return
_instance
;
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionPartialOrderConnectionPermitted
);
}
internal
override
int
GetDataHashCode
()
{
return
0
;
}
private
bool
EqualsData
(
TcpOptionPartialOrderConnectionPermitted
other
)
{
return
other
!=
null
;
}
private
static
readonly
TcpOptionPartialOrderConnectionPermitted
_instance
=
new
TcpOptionPartialOrderConnectionPermitted
();
private
static
readonly
TcpOptionPartialOrderConnectionPermitted
_instance
=
new
TcpOptionPartialOrderConnectionPermitted
();
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionPartialOrderServiceProfile.cs
View file @
96b7db96
...
@@ -25,7 +25,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -25,7 +25,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
PartialOrderServiceProfile
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
PartialOrderServiceProfile
)]
public
sealed
class
TcpOptionPartialOrderServiceProfile
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionPartialOrderServiceProfile
>
public
sealed
class
TcpOptionPartialOrderServiceProfile
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
private
const
byte
NoFlags
=
0x00
;
private
const
byte
NoFlags
=
0x00
;
private
const
byte
StartFlag
=
0x80
;
private
const
byte
StartFlag
=
0x80
;
...
@@ -85,34 +85,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -85,34 +85,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two partial order service profile options are equal if they agree on both IsStart and IsEnd.
/// </summary>
public
bool
Equals
(
TcpOptionPartialOrderServiceProfile
other
)
{
if
(
other
==
null
)
return
false
;
return
(
IsStart
==
other
.
IsStart
)
&&
(
IsEnd
==
other
.
IsEnd
);
}
/// <summary>
/// Two partial order service profile options are equal if they agree on both IsStart and IsEnd.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionPartialOrderServiceProfile
);
}
/// <summary>
/// The hash code of the partial order service profile option is the hash code of the option type xored with a combination of the IsStart and IsEnd values.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
BitSequence
.
Merge
(
IsStart
,
IsEnd
).
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -129,11 +101,27 @@ namespace PcapDotNet.Packets.Transport
...
@@ -129,11 +101,27 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionPartialOrderServiceProfile
((
data
&
StartFlag
)
==
StartFlag
,
(
data
&
EndFlag
)
==
EndFlag
);
return
new
TcpOptionPartialOrderServiceProfile
((
data
&
StartFlag
)
==
StartFlag
,
(
data
&
EndFlag
)
==
EndFlag
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionPartialOrderServiceProfile
);
}
internal
override
int
GetDataHashCode
()
{
return
BitSequence
.
Merge
(
IsStart
,
IsEnd
).
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
byte
data
=
(
byte
)((
IsStart
?
StartFlag
:
NoFlags
)
|
(
IsEnd
?
EndFlag
:
NoFlags
));
byte
data
=
(
byte
)((
IsStart
?
StartFlag
:
NoFlags
)
|
(
IsEnd
?
EndFlag
:
NoFlags
));
buffer
.
Write
(
ref
offset
,
data
);
buffer
.
Write
(
ref
offset
,
data
);
}
}
private
bool
EqualsData
(
TcpOptionPartialOrderServiceProfile
other
)
{
return
other
!=
null
&&
IsStart
==
other
.
IsStart
&&
IsEnd
==
other
.
IsEnd
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionSelectiveAcknowledgment.cs
View file @
96b7db96
...
@@ -55,7 +55,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -55,7 +55,7 @@ namespace PcapDotNet.Packets.Transport
/// the data receiver is permitted to later discard data which have been reported in a SACK option.
/// the data receiver is permitted to later discard data which have been reported in a SACK option.
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
SelectiveAcknowledgment
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
SelectiveAcknowledgment
)]
public
sealed
class
TcpOptionSelectiveAcknowledgment
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionSelectiveAcknowledgment
>
public
sealed
class
TcpOptionSelectiveAcknowledgment
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The minimum number of bytes this option take.
/// The minimum number of bytes this option take.
...
@@ -108,33 +108,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -108,33 +108,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two selective ack options are equal if they have the same selective ack blocks.
/// </summary>
public
bool
Equals
(
TcpOptionSelectiveAcknowledgment
other
)
{
if
(
other
==
null
)
return
false
;
return
Blocks
.
SequenceEqual
(
other
.
Blocks
);
}
/// <summary>
/// Two selective ack options are equal if they have the same selective ack blocks.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionSelectiveAcknowledgment
);
}
/// <summary>
/// The hash code of the selective acknowledgement option is the hash code of the option type xored with all the hash codes of the blocks.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Blocks
.
SequenceGetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -158,6 +131,16 @@ namespace PcapDotNet.Packets.Transport
...
@@ -158,6 +131,16 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionSelectiveAcknowledgment
(
blocks
);
return
new
TcpOptionSelectiveAcknowledgment
(
blocks
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionSelectiveAcknowledgment
);
}
internal
override
int
GetDataHashCode
()
{
return
Blocks
.
SequenceGetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
...
@@ -168,6 +151,12 @@ namespace PcapDotNet.Packets.Transport
...
@@ -168,6 +151,12 @@ namespace PcapDotNet.Packets.Transport
}
}
}
}
private
bool
EqualsData
(
TcpOptionSelectiveAcknowledgment
other
)
{
return
other
!=
null
&&
Blocks
.
SequenceEqual
(
other
.
Blocks
);
}
private
readonly
ReadOnlyCollection
<
TcpOptionSelectiveAcknowledgmentBlock
>
_blocks
;
private
readonly
ReadOnlyCollection
<
TcpOptionSelectiveAcknowledgmentBlock
>
_blocks
;
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionSelectiveAcknowledgmentPermitted.cs
View file @
96b7db96
...
@@ -16,7 +16,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -16,7 +16,7 @@ namespace PcapDotNet.Packets.Transport
/// </pre>
/// </pre>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
SelectiveAcknowledgmentPermitted
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
SelectiveAcknowledgmentPermitted
)]
public
sealed
class
TcpOptionSelectiveAcknowledgmentPermitted
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionSelectiveAcknowledgmentPermitted
>
public
sealed
class
TcpOptionSelectiveAcknowledgmentPermitted
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -52,22 +52,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -52,22 +52,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two selective ack permitted options are always equal.
/// </summary>
public
bool
Equals
(
TcpOptionSelectiveAcknowledgmentPermitted
other
)
{
return
other
!=
null
;
}
/// <summary>
/// Two selective ack permitted options are always equal.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionSelectiveAcknowledgmentPermitted
);
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -83,6 +67,21 @@ namespace PcapDotNet.Packets.Transport
...
@@ -83,6 +67,21 @@ namespace PcapDotNet.Packets.Transport
return
_instance
;
return
_instance
;
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionSelectiveAcknowledgmentPermitted
);
}
internal
override
int
GetDataHashCode
()
{
return
0
;
}
private
bool
EqualsData
(
TcpOptionSelectiveAcknowledgmentPermitted
other
)
{
return
other
!=
null
;
}
private
static
readonly
TcpOptionSelectiveAcknowledgmentPermitted
_instance
=
new
TcpOptionSelectiveAcknowledgmentPermitted
();
private
static
readonly
TcpOptionSelectiveAcknowledgmentPermitted
_instance
=
new
TcpOptionSelectiveAcknowledgmentPermitted
();
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionSimple.cs
View file @
96b7db96
...
@@ -30,5 +30,20 @@ namespace PcapDotNet.Packets.Transport
...
@@ -30,5 +30,20 @@ namespace PcapDotNet.Packets.Transport
:
base
(
optionType
)
:
base
(
optionType
)
{
{
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionSimple
);
}
internal
override
int
GetDataHashCode
()
{
return
0
;
}
private
bool
EqualsData
(
TcpOptionSimple
other
)
{
return
other
!=
null
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionTimestamp.cs
View file @
96b7db96
...
@@ -30,7 +30,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -30,7 +30,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
Timestamp
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
Timestamp
)]
public
sealed
class
TcpOptionTimestamp
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionTimestamp
>
public
sealed
class
TcpOptionTimestamp
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -86,34 +86,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -86,34 +86,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two timestamp options are equal if they have the same timestamp value and echo reply.
/// </summary>
public
bool
Equals
(
TcpOptionTimestamp
other
)
{
if
(
other
==
null
)
return
false
;
return
TimestampValue
==
other
.
TimestampValue
&&
TimestampEchoReply
==
other
.
TimestampEchoReply
;
}
/// <summary>
/// Two timestamp options are equal if they have the same timestamp value and echo reply.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionTimestamp
);
}
/// <summary>
/// The hash code of the timestamp option is the hash code of the option type xored with the hash code of the timestamp echo reply.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
TimestampEchoReply
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -131,11 +103,27 @@ namespace PcapDotNet.Packets.Transport
...
@@ -131,11 +103,27 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionTimestamp
(
timeStampValue
,
timeStampEchoReply
);
return
new
TcpOptionTimestamp
(
timeStampValue
,
timeStampEchoReply
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionTimestamp
);
}
internal
override
int
GetDataHashCode
()
{
return
TimestampEchoReply
.
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
.
Write
(
ref
offset
,
TimestampValue
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
TimestampValue
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
TimestampEchoReply
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
TimestampEchoReply
,
Endianity
.
Big
);
}
}
private
bool
EqualsData
(
TcpOptionTimestamp
other
)
{
return
other
!=
null
&&
TimestampValue
==
other
.
TimestampValue
&&
TimestampEchoReply
==
other
.
TimestampEchoReply
;
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionUnknown.cs
View file @
96b7db96
...
@@ -10,7 +10,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -10,7 +10,7 @@ namespace PcapDotNet.Packets.Transport
/// <summary>
/// <summary>
/// An unknown TCP option.
/// An unknown TCP option.
/// </summary>
/// </summary>
public
sealed
class
TcpOptionUnknown
:
TcpOptionComplex
,
IOptionUnknownFactory
<
TcpOptionType
>
,
IEquatable
<
TcpOptionUnknown
>
public
sealed
class
TcpOptionUnknown
:
TcpOptionComplex
,
IOptionUnknownFactory
<
TcpOptionType
>
{
{
/// <summary>
/// <summary>
/// The minimum number of bytes this option take.
/// The minimum number of bytes this option take.
...
@@ -60,34 +60,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -60,34 +60,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
false
;
}
get
{
return
false
;
}
}
}
/// <summary>
/// Two unknown options are equal iff they are of equal type and equal data.
/// </summary>
public
bool
Equals
(
TcpOptionUnknown
other
)
{
if
(
other
==
null
)
return
false
;
return
OptionType
==
other
.
OptionType
&&
Data
.
SequenceEqual
(
other
.
Data
);
}
/// <summary>
/// Two unknown options are equal iff they are of equal type and equal data.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionUnknown
);
}
/// <summary>
/// The hash code for an unknown option is the hash code for the option type xored with the hash code of the data.
/// </summary>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Data
.
BytesSequenceGetHashCode
();
}
/// <summary>
/// <summary>
/// Creates an unknown option from its type and by reading a buffer for its value.
/// Creates an unknown option from its type and by reading a buffer for its value.
/// </summary>
/// </summary>
...
@@ -105,10 +77,26 @@ namespace PcapDotNet.Packets.Transport
...
@@ -105,10 +77,26 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionUnknown
(
optionType
,
data
);
return
new
TcpOptionUnknown
(
optionType
,
data
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionUnknown
);
}
internal
override
int
GetDataHashCode
()
{
return
Data
.
BytesSequenceGetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
.
Write
(
ref
offset
,
Data
);
buffer
.
Write
(
ref
offset
,
Data
);
}
}
private
bool
EqualsData
(
TcpOptionUnknown
other
)
{
return
other
!=
null
&&
Data
.
SequenceEqual
(
other
.
Data
);
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionWindowScale.cs
View file @
96b7db96
...
@@ -35,7 +35,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -35,7 +35,7 @@ namespace PcapDotNet.Packets.Transport
/// </para>
/// </para>
/// </summary>
/// </summary>
[
TcpOptionTypeRegistration
(
TcpOptionType
.
WindowScale
)]
[
TcpOptionTypeRegistration
(
TcpOptionType
.
WindowScale
)]
public
sealed
class
TcpOptionWindowScale
:
TcpOptionComplex
,
IOptionComplexFactory
,
IEquatable
<
TcpOptionWindowScale
>
public
sealed
class
TcpOptionWindowScale
:
TcpOptionComplex
,
IOptionComplexFactory
{
{
/// <summary>
/// <summary>
/// The number of bytes this option take.
/// The number of bytes this option take.
...
@@ -85,34 +85,6 @@ namespace PcapDotNet.Packets.Transport
...
@@ -85,34 +85,6 @@ namespace PcapDotNet.Packets.Transport
get
{
return
true
;
}
get
{
return
true
;
}
}
}
/// <summary>
/// Two window scale options are equal if they have the same scale factor.
/// </summary>
public
bool
Equals
(
TcpOptionWindowScale
other
)
{
if
(
other
==
null
)
return
false
;
return
ScaleFactorLog
==
other
.
ScaleFactorLog
;
}
/// <summary>
/// Two window scale options are equal if they have the same scale factor.
/// </summary>
public
override
bool
Equals
(
TcpOption
other
)
{
return
Equals
(
other
as
TcpOptionWindowScale
);
}
/// <summary>
/// The hash code of the window scale option is the hash code of the option type xored with the hash code of the scale factor log.
/// </summary>
/// <returns></returns>
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
ScaleFactorLog
.
GetHashCode
();
}
/// <summary>
/// <summary>
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// Tries to read the option from a buffer starting from the option value (after the type and length).
/// </summary>
/// </summary>
...
@@ -129,10 +101,26 @@ namespace PcapDotNet.Packets.Transport
...
@@ -129,10 +101,26 @@ namespace PcapDotNet.Packets.Transport
return
new
TcpOptionWindowScale
(
scaleFactorLog
);
return
new
TcpOptionWindowScale
(
scaleFactorLog
);
}
}
internal
override
bool
EqualsData
(
TcpOption
other
)
{
return
EqualsData
(
other
as
TcpOptionWindowScale
);
}
internal
override
int
GetDataHashCode
()
{
return
ScaleFactorLog
.
GetHashCode
();
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
.
Write
(
ref
offset
,
ScaleFactorLog
);
buffer
.
Write
(
ref
offset
,
ScaleFactorLog
);
}
}
private
bool
EqualsData
(
TcpOptionWindowScale
other
)
{
return
other
!=
null
&&
ScaleFactorLog
==
other
.
ScaleFactorLog
;
}
}
}
}
}
\ No newline at end of file
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