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
3e290c34
Commit
3e290c34
authored
Sep 17, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6
parent
b5779710
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
14 deletions
+97
-14
IpV6ExtensionHeader.cs
...DotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeader.cs
+14
-14
IpV6ExtensionHeaderFragmentData.cs
...capDotNet.Packets/IpV6/IpV6ExtensionHeaderFragmentData.cs
+82
-0
PcapDotNet.Packets.csproj
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
+1
-0
No files found.
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeader.cs
View file @
3e290c34
...
@@ -46,27 +46,27 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -46,27 +46,27 @@ namespace PcapDotNet.Packets.IpV6
switch
(
nextHeader
)
switch
(
nextHeader
)
{
{
case
IpV4Protocol
.
IpV6HopByHopOption
:
// 0
case
IpV4Protocol
.
IpV6HopByHopOption
:
// 0
return
IpV6ExtensionHeaderHopByHopOptions
.
ParseData
(
nextNextHeader
,
data
);
return
IpV6ExtensionHeaderHopByHopOptions
.
ParseData
(
nextNextHeader
,
data
);
case
IpV4Protocol
.
IpV6Route
:
// 43
case
IpV4Protocol
.
IpV6Route
:
// 43
return
IpV6ExtensionHeaderRouting
.
ParseData
(
nextNextHeader
,
data
);
return
IpV6ExtensionHeaderRouting
.
ParseData
(
nextNextHeader
,
data
);
/*
case IpV4Protocol.FragmentHeaderForIpV6: // 44
return IpV6ExtensionHeaderFragment.Parse(data);
case IpV4Protocol.EncapsulatingSecurityPayload: // 50
case
IpV4Protocol
.
FragmentHeaderForIpV6
:
// 44
return IpV6ExtensionHeaderEncapsulatingSecurityPayload.Parse(data);
return
IpV6ExtensionHeaderFragmentData
.
ParseData
(
nextNextHeader
,
data
);
/*
case IpV4Protocol.EncapsulatingSecurityPayload: // 50
return IpV6ExtensionHeaderEncapsulatingSecurityPayload.Parse(data);
case IpV4Protocol.AuthenticationHeader: // 51
case IpV4Protocol.AuthenticationHeader: // 51
return IpV6ExtensionHeaderAuthentication.Parse(data);
return IpV6ExtensionHeaderAuthentication.Parse(data);
case IpV4Protocol.IpV6Opts: // 60
case IpV4Protocol.IpV6Opts: // 60
return IpV6ExtensionHeaderDestinationOptions.Parse(data);
return IpV6ExtensionHeaderDestinationOptions.Parse(data);
case IpV4Protocol.MobilityHeader: // 135
case IpV4Protocol.MobilityHeader: // 135
return IpV6MobilityExtensionHeader.Parse(data);
return IpV6MobilityExtensionHeader.Parse(data);
*/
*/
default
:
default
:
return
null
;
return
null
;
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeaderFragmentData.cs
0 → 100644
View file @
3e290c34
using
System
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.IpV6
{
/// <summary>
/// RFC 2460.
/// <pre>
/// +-----+-------------+-------------------------+-----------------+-------+----+
/// | Bit | 0-7 | 8-15 | 16-28 | 29-30 | 31 |
/// +-----+-------------+-------------------------+-----------------+-------+----+
/// | 0 | Next Header | Header Extension Length | Fragment Offset | Res | M |
/// +-----+-------------+-------------------------+-----------------+-------+----+
/// | 32 | Identification |
/// +-----+----------------------------------------------------------------------+
/// </pre>
/// </summary>
public
class
IpV6ExtensionHeaderFragmentData
:
IpV6ExtensionHeader
{
private
static
class
DataOffset
{
public
const
int
FragmentOffset
=
0
;
public
const
int
MoreFragments
=
FragmentOffset
+
sizeof
(
byte
);
public
const
int
Identification
=
MoreFragments
+
sizeof
(
byte
);
}
private
static
class
DataMask
{
public
const
ushort
FragmentOffset
=
0xFFF8
;
public
const
byte
MoreFragments
=
0x01
;
}
private
static
class
DataShift
{
public
const
int
FragmentOffset
=
3
;
}
public
const
int
DataLength
=
DataOffset
.
Identification
+
sizeof
(
uint
);
public
const
ushort
MaxFragmentOffset
=
0x1FFF
;
public
IpV6ExtensionHeaderFragmentData
(
IpV4Protocol
nextHeader
,
ushort
fragmentOffset
,
bool
moreFragments
,
uint
identification
)
:
base
(
nextHeader
)
{
if
(
fragmentOffset
>
MaxFragmentOffset
)
throw
new
ArgumentOutOfRangeException
(
"fragmentOffset"
,
fragmentOffset
,
"Max value is "
+
MaxFragmentOffset
);
FragmentOffset
=
fragmentOffset
;
MoreFragments
=
moreFragments
;
Identification
=
identification
;
}
/// <summary>
/// The offset, in 8-octet units, of the data following this header, relative to the start of the Fragmentable Part of the original packet.
/// </summary>
public
ushort
FragmentOffset
{
get
;
private
set
;
}
/// <summary>
/// True - more fragments.
/// False - last fragment.
/// </summary>
public
bool
MoreFragments
{
get
;
private
set
;
}
/// <summary>
/// For every packet that is to be fragmented, the source node generates an Identification value.
/// The Identification must be different than that of any other fragmented packet sent recently with the same Source Address and Destination Address.
/// If a Routing header is present, the Destination Address of concern is that of the final destination.
/// </summary>
public
uint
Identification
{
get
;
private
set
;
}
internal
static
IpV6ExtensionHeaderFragmentData
ParseData
(
IpV4Protocol
nextHeader
,
DataSegment
data
)
{
if
(
data
.
Length
!=
DataLength
)
return
null
;
ushort
fragmentOffset
=
(
ushort
)((
data
.
ReadUShort
(
DataOffset
.
FragmentOffset
,
Endianity
.
Big
)
&
DataMask
.
FragmentOffset
)
>>
DataShift
.
FragmentOffset
);
bool
moreFragments
=
data
.
ReadBool
(
DataOffset
.
MoreFragments
,
DataMask
.
MoreFragments
);
uint
identification
=
data
.
ReadUInt
(
DataOffset
.
Identification
,
Endianity
.
Big
);
return
new
IpV6ExtensionHeaderFragmentData
(
nextHeader
,
fragmentOffset
,
moreFragments
,
identification
);
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
View file @
3e290c34
...
@@ -318,6 +318,7 @@
...
@@ -318,6 +318,7 @@
<Compile
Include=
"Igmp\IIgmpLayerWithGroupAddress.cs"
/>
<Compile
Include=
"Igmp\IIgmpLayerWithGroupAddress.cs"
/>
<Compile
Include=
"IpV6\IpV6CalipsoDomainOfInterpretation.cs"
/>
<Compile
Include=
"IpV6\IpV6CalipsoDomainOfInterpretation.cs"
/>
<Compile
Include=
"IpV6\IpV6ExtensionHeader.cs"
/>
<Compile
Include=
"IpV6\IpV6ExtensionHeader.cs"
/>
<Compile
Include=
"IpV6\IpV6ExtensionHeaderFragmentData.cs"
/>
<Compile
Include=
"IpV6\IpV6ExtensionHeaderHopByHopOptions.cs"
/>
<Compile
Include=
"IpV6\IpV6ExtensionHeaderHopByHopOptions.cs"
/>
<Compile
Include=
"IpV6\IpV6ExtensionHeaderRouting.cs"
/>
<Compile
Include=
"IpV6\IpV6ExtensionHeaderRouting.cs"
/>
<Compile
Include=
"IpV6\IpV6ExtensionHeaderRoutingHomeAddress.cs"
/>
<Compile
Include=
"IpV6\IpV6ExtensionHeaderRoutingHomeAddress.cs"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment