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
837abfe3
Commit
837abfe3
authored
Nov 25, 2011
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DNS
parent
1ccbfd97
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
1 deletion
+89
-1
RandomDnsExtensions.cs
...t/src/PcapDotNet.Packets.TestUtils/RandomDnsExtensions.cs
+3
-0
DnsDomainName.cs
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsDomainName.cs
+1
-0
DnsResourceData.cs
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsResourceData.cs
+83
-0
DnsType.cs
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsType.cs
+2
-1
No files found.
PcapDotNet/src/PcapDotNet.Packets.TestUtils/RandomDnsExtensions.cs
View file @
837abfe3
...
...
@@ -293,6 +293,9 @@ namespace PcapDotNet.Packets.TestUtils
case
DnsType
.
RKey
:
return
new
DnsResourceDataRKey
(
random
.
NextUShort
(),
random
.
NextByte
(),
random
.
NextEnum
<
DnsAlgorithm
>(),
random
.
NextDataSegment
(
random
.
NextInt
(
0
,
100
)));
case
DnsType
.
TaLink
:
return
new
DnsResourceDataTrustAnchorLink
(
random
.
NextDnsDomainName
(),
random
.
NextDnsDomainName
());
default
:
return
new
DnsResourceDataAnything
(
random
.
NextDataSegment
(
random
.
Next
(
100
)));
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsDomainName.cs
View file @
837abfe3
...
...
@@ -11,6 +11,7 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public
sealed
class
DnsDomainName
:
IEquatable
<
DnsDomainName
>
{
public
const
int
RootLength
=
sizeof
(
byte
);
private
const
byte
MaxLabelLength
=
63
;
private
const
ushort
CompressionMarker
=
0xC000
;
internal
const
ushort
OffsetMask
=
0x3FFF
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsResourceData.cs
View file @
837abfe3
...
...
@@ -6026,4 +6026,87 @@ namespace PcapDotNet.Packets.Dns
return
new
DnsResourceDataRKey
(
flags
,
protocol
,
algorithm
,
publicKey
);
}
}
/// <summary>
/// Wijngaards.
/// <pre>
/// +----------------------+
/// | Previous Domain Name |
/// +----------------------+
/// | Next Domain Name |
/// +----------------------+
/// </pre>
/// </summary>
[
DnsTypeRegistration
(
Type
=
DnsType
.
TaLink
)]
public
sealed
class
DnsResourceDataTrustAnchorLink
:
DnsResourceDataNoCompression
,
IEquatable
<
DnsResourceDataTrustAnchorLink
>
{
private
const
int
MinimumLength
=
2
*
DnsDomainName
.
RootLength
;
public
DnsResourceDataTrustAnchorLink
(
DnsDomainName
previous
,
DnsDomainName
next
)
{
Previous
=
previous
;
Next
=
next
;
}
/// <summary>
/// The start, or previous name.
/// </summary>
public
DnsDomainName
Previous
{
get
;
private
set
;
}
/// <summary>
/// End or next name in the list.
/// </summary>
public
DnsDomainName
Next
{
get
;
private
set
;
}
public
bool
Equals
(
DnsResourceDataTrustAnchorLink
other
)
{
return
other
!=
null
&&
Previous
.
Equals
(
other
.
Previous
)
&&
Next
.
Equals
(
other
.
Next
);
}
public
override
bool
Equals
(
DnsResourceData
other
)
{
return
Equals
(
other
as
DnsResourceDataTrustAnchorLink
);
}
internal
DnsResourceDataTrustAnchorLink
()
:
this
(
DnsDomainName
.
Root
,
DnsDomainName
.
Root
)
{
}
internal
override
int
GetLength
()
{
return
Previous
.
NonCompressedLength
+
Next
.
NonCompressedLength
;
}
internal
override
int
WriteData
(
byte
[]
buffer
,
int
offset
)
{
Previous
.
WriteUncompressed
(
buffer
,
offset
);
int
previousLength
=
Previous
.
NonCompressedLength
;
Next
.
WriteUncompressed
(
buffer
,
offset
+
previousLength
);
return
previousLength
+
Next
.
NonCompressedLength
;
}
internal
override
DnsResourceData
CreateInstance
(
DnsDatagram
dns
,
int
offsetInDns
,
int
length
)
{
if
(
length
<
MinimumLength
)
return
null
;
DnsDomainName
previous
;
int
previousLength
;
if
(!
DnsDomainName
.
TryParse
(
dns
,
offsetInDns
,
length
-
DnsDomainName
.
RootLength
,
out
previous
,
out
previousLength
))
return
null
;
offsetInDns
+=
previousLength
;
length
-=
previousLength
;
DnsDomainName
next
;
int
nextLength
;
if
(!
DnsDomainName
.
TryParse
(
dns
,
offsetInDns
,
length
,
out
next
,
out
nextLength
))
return
null
;
return
new
DnsResourceDataTrustAnchorLink
(
previous
,
next
);
}
}
}
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsType.cs
View file @
837abfe3
...
...
@@ -393,7 +393,8 @@
/// <summary>
/// Wijngaards.
/// Trust Anchor LINK.
/// DNSSEC Trust Anchor LINK.
/// Payload type: DnsResourceDataTrustAnchorLink.
/// </summary>
TaLink
=
58
,
...
...
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