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
8dbf5714
Commit
8dbf5714
authored
Mar 24, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code coverage 94.68%
parent
b47f8f31
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
2 deletions
+46
-2
DnsTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs
+45
-1
DnsGateway.cs
...Net/src/PcapDotNet.Packets/Dns/ResourceData/DnsGateway.cs
+1
-1
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs
View file @
8dbf5714
...
@@ -536,6 +536,13 @@ namespace PcapDotNet.Packets.Test
...
@@ -536,6 +536,13 @@ namespace PcapDotNet.Packets.Test
Assert
.
Fail
();
Assert
.
Fail
();
}
}
[
TestMethod
]
public
void
DnsResourceDataLocationInformationParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataLocationInformation
(
0
,
1000
,
2000
,
3000
,
100
,
200
,
300
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
Loc
,
resourceData
,
1
);
}
[
TestMethod
]
[
TestMethod
]
public
void
DnsResourceDataNextDomainSecureTest
()
public
void
DnsResourceDataNextDomainSecureTest
()
{
{
...
@@ -614,6 +621,18 @@ namespace PcapDotNet.Packets.Test
...
@@ -614,6 +621,18 @@ namespace PcapDotNet.Packets.Test
Assert
.
Fail
();
Assert
.
Fail
();
}
}
[
TestMethod
]
public
void
DnsResourceDataNextDomainSecure3ParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataNextDomainSecure3
(
DnsSecNSec3HashAlgorithm
.
Sha1
,
DnsSecNSec3Flags
.
None
,
0
,
new
DataSegment
(
new
byte
[
5
]),
new
DataSegment
(
new
byte
[
5
]),
new
[]
{
DnsType
.
A
,
DnsType
.
A6
,});
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
NSec3
,
resourceData
,
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
NSec3
,
resourceData
,
-
8
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
NSec3
,
resourceData
,
-
13
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
NSec3
,
resourceData
,
-
14
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
NSec3
,
resourceData
,
-
19
);
}
[
TestMethod
]
[
TestMethod
]
public
void
DnsGatewayTest
()
public
void
DnsGatewayTest
()
{
{
...
@@ -730,7 +749,7 @@ namespace PcapDotNet.Packets.Test
...
@@ -730,7 +749,7 @@ namespace PcapDotNet.Packets.Test
}
}
[
TestMethod
]
[
TestMethod
]
public
void
DnsResourceDataGeographicalPositionWrongLengthTest
()
public
void
DnsResourceDataGeographicalPosition
Parse
WrongLengthTest
()
{
{
var
resourceData
=
new
DnsResourceDataGeographicalPosition
(
"5.03"
,
"-44.4"
,
"22.1"
);
var
resourceData
=
new
DnsResourceDataGeographicalPosition
(
"5.03"
,
"-44.4"
,
"22.1"
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
GPos
,
resourceData
,
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
GPos
,
resourceData
,
1
);
...
@@ -739,6 +758,31 @@ namespace PcapDotNet.Packets.Test
...
@@ -739,6 +758,31 @@ namespace PcapDotNet.Packets.Test
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
GPos
,
resourceData
,
-
14
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
GPos
,
resourceData
,
-
14
);
}
}
[
TestMethod
]
public
void
DnsResourceDataX400PointerParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataX400Pointer
(
0
,
new
DnsDomainName
(
"pcapdot.net"
),
new
DnsDomainName
(
"pcapdotnet.codeplex.com"
));
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
PointerX400
,
resourceData
,
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
PointerX400
,
resourceData
,
-
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
PointerX400
,
resourceData
,
-
26
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
PointerX400
,
resourceData
,
-
39
);
}
[
TestMethod
]
public
void
DnsResourceDataIpSecKeyParseWrongLengthTest
()
{
var
resourceDataIpV4
=
new
DnsResourceDataIpSecKey
(
1
,
new
DnsGatewayIpV4
(
IpV4Address
.
Zero
),
DnsPublicKeyAlgorithm
.
Rsa
,
new
DataSegment
(
new
byte
[
5
]));
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
IpSecKey
,
resourceDataIpV4
,
-
6
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
IpSecKey
,
resourceDataIpV4
,
-
10
);
var
resourceDataIpV6
=
new
DnsResourceDataIpSecKey
(
1
,
new
DnsGatewayIpV6
(
IpV6Address
.
Zero
),
DnsPublicKeyAlgorithm
.
Rsa
,
new
DataSegment
(
new
byte
[
5
]));
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
IpSecKey
,
resourceDataIpV6
,
-
6
);
var
resourceDataDomainName
=
new
DnsResourceDataIpSecKey
(
1
,
new
DnsGatewayDomainName
(
new
DnsDomainName
(
"pcapdot.net"
)),
DnsPublicKeyAlgorithm
.
Rsa
,
new
DataSegment
(
new
byte
[
5
]));
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
IpSecKey
,
resourceDataDomainName
,
-
6
);
}
private
static
void
TestDomainNameCompression
(
int
expectedCompressionBenefit
,
DnsLayer
dnsLayer
)
private
static
void
TestDomainNameCompression
(
int
expectedCompressionBenefit
,
DnsLayer
dnsLayer
)
{
{
dnsLayer
.
DomainNameCompressionMode
=
DnsDomainNameCompressionMode
.
Nothing
;
dnsLayer
.
DomainNameCompressionMode
=
DnsDomainNameCompressionMode
.
Nothing
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsGateway.cs
View file @
8dbf5714
...
@@ -79,6 +79,6 @@ namespace PcapDotNet.Packets.Dns
...
@@ -79,6 +79,6 @@ namespace PcapDotNet.Packets.Dns
}
}
}
}
private
static
DnsGatewayNone
_none
=
new
DnsGatewayNone
();
private
static
readonly
DnsGatewayNone
_none
=
new
DnsGatewayNone
();
}
}
}
}
\ 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