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
b9a776fc
Commit
b9a776fc
authored
Mar 24, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code coverage 94.77%
parent
8dbf5714
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
DnsTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs
+53
-0
DnsResourceDataTrustAnchorLink.cs
...ackets/Dns/ResourceData/DnsResourceDataTrustAnchorLink.cs
+3
-0
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs
View file @
b9a776fc
...
@@ -576,6 +576,22 @@ namespace PcapDotNet.Packets.Test
...
@@ -576,6 +576,22 @@ namespace PcapDotNet.Packets.Test
Assert
.
AreEqual
(
1
,
resourceData
.
AuthorityAndFormatIdentifier
);
Assert
.
AreEqual
(
1
,
resourceData
.
AuthorityAndFormatIdentifier
);
}
}
[
TestMethod
]
[
ExpectedException
(
typeof
(
ArgumentNullException
))]
public
void
DnsResourceDataNetworkServiceAccessPointConstructorNullAreaAddressTest
()
{
var
resourceData
=
new
DnsResourceDataNetworkServiceAccessPoint
(
null
,
0
,
0
);
Assert
.
IsNull
(
resourceData
);
Assert
.
Fail
();
}
[
TestMethod
]
public
void
DnsResourceDataNetworkServiceAccessPointParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataNetworkServiceAccessPoint
(
new
DataSegment
(
new
byte
[
5
]),
0
,
0
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
NetworkServiceAccessPoint
,
resourceData
,
-
5
);
}
[
TestMethod
]
[
TestMethod
]
[
ExpectedException
(
typeof
(
ArgumentOutOfRangeException
))]
[
ExpectedException
(
typeof
(
ArgumentOutOfRangeException
))]
public
void
DnsAddressPrefixAddressFamilyDependentPartTooBigTest
()
public
void
DnsAddressPrefixAddressFamilyDependentPartTooBigTest
()
...
@@ -783,6 +799,43 @@ namespace PcapDotNet.Packets.Test
...
@@ -783,6 +799,43 @@ namespace PcapDotNet.Packets.Test
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
IpSecKey
,
resourceDataDomainName
,
-
6
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
IpSecKey
,
resourceDataDomainName
,
-
6
);
}
}
[
TestMethod
]
public
void
DnsResourceDataServerSelectionParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataServerSelection
(
0
,
0
,
0
,
new
DnsDomainName
(
"pcapdot.net"
));
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
ServerSelection
,
resourceData
,
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
ServerSelection
,
resourceData
,
-
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
ServerSelection
,
resourceData
,
-
14
);
}
[
TestMethod
]
public
void
DnsResourceDataStartOfAuthorityParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataStartOfAuthority
(
new
DnsDomainName
(
"pcapdot.net"
),
new
DnsDomainName
(
"pcapdotnet.codeplex.com"
),
1
,
2
,
3
,
4
,
5
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
StartOfAuthority
,
resourceData
,
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
StartOfAuthority
,
resourceData
,
-
21
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
StartOfAuthority
,
resourceData
,
-
46
);
}
[
TestMethod
]
public
void
DnsResourceDataTrustAnchorLinkParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataTrustAnchorLink
(
new
DnsDomainName
(
"pcapdot.net"
),
new
DnsDomainName
(
"pcapdotnet.codeplex.com"
));
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
TrustAnchorLink
,
resourceData
,
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
TrustAnchorLink
,
resourceData
,
-
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
TrustAnchorLink
,
resourceData
,
-
25
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
TrustAnchorLink
,
resourceData
,
-
37
);
}
[
TestMethod
]
public
void
DnsResourceDataMailExchangeParseWrongLengthTest
()
{
var
resourceData
=
new
DnsResourceDataMailExchange
(
1
,
new
DnsDomainName
(
"pcapdot.net"
));
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
MailExchange
,
resourceData
,
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
MailExchange
,
resourceData
,
-
1
);
TestResourceRecordIsNotCreatedWithNewLength
(
DnsType
.
MailExchange
,
resourceData
,
-
14
);
}
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/DnsResourceDataTrustAnchorLink.cs
View file @
b9a776fc
...
@@ -101,6 +101,9 @@ namespace PcapDotNet.Packets.Dns
...
@@ -101,6 +101,9 @@ namespace PcapDotNet.Packets.Dns
if
(!
DnsDomainName
.
TryParse
(
dns
,
offsetInDns
,
length
,
out
next
,
out
nextLength
))
if
(!
DnsDomainName
.
TryParse
(
dns
,
offsetInDns
,
length
,
out
next
,
out
nextLength
))
return
null
;
return
null
;
if
(
length
!=
nextLength
)
return
null
;
return
new
DnsResourceDataTrustAnchorLink
(
previous
,
next
);
return
new
DnsResourceDataTrustAnchorLink
(
previous
,
next
);
}
}
}
}
...
...
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