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
07592ef7
Commit
07592ef7
authored
Sep 21, 2013
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6
parent
b7799fc9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
45 deletions
+66
-45
IpV6Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
+1
-1
IpV6ExtensionHeader.cs
...DotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeader.cs
+1
-1
IpV6ExtensionHeaderFragmentData.cs
...capDotNet.Packets/IpV6/IpV6ExtensionHeaderFragmentData.cs
+26
-18
IpV6ExtensionHeaderOptions.cs
...src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeaderOptions.cs
+1
-1
IpV6OptionJumboPayload.cs
...PcapDotNet.Packets/IpV6/Options/IpV6OptionJumboPayload.cs
+1
-1
IpV6OptionTunnelEncapsulationLimit.cs
...ackets/IpV6/Options/IpV6OptionTunnelEncapsulationLimit.cs
+1
-1
IpV6Options.cs
...DotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Options.cs
+35
-22
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
View file @
07592ef7
...
@@ -59,7 +59,7 @@ namespace PcapDotNet.Packets.Test
...
@@ -59,7 +59,7 @@ namespace PcapDotNet.Packets.Test
EtherType
=
EthernetType
EtherType
=
EthernetType
};
};
Random
random
=
new
Random
();
Random
random
=
new
Random
(
1
);
for
(
int
i
=
0
;
i
!=
1000
;
++
i
)
for
(
int
i
=
0
;
i
!=
1000
;
++
i
)
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeader.cs
View file @
07592ef7
...
@@ -85,7 +85,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -85,7 +85,7 @@ namespace PcapDotNet.Packets.IpV6
return
null
;
return
null
;
DataSegment
data
=
extensionHeaderData
.
Subsegment
(
Offset
.
Data
,
length
-
Offset
.
Data
);
DataSegment
data
=
extensionHeaderData
.
Subsegment
(
Offset
.
Data
,
length
-
Offset
.
Data
);
numBytesRead
=
data
.
L
ength
;
numBytesRead
=
l
ength
;
switch
(
nextHeader
)
switch
(
nextHeader
)
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeaderFragmentData.cs
View file @
07592ef7
This diff is collapsed.
Click to expand it.
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6ExtensionHeaderOptions.cs
View file @
07592ef7
...
@@ -44,7 +44,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -44,7 +44,7 @@ namespace PcapDotNet.Packets.IpV6
:
base
(
nextHeader
)
:
base
(
nextHeader
)
{
{
if
(
options
.
BytesLength
%
8
!=
6
)
if
(
options
.
BytesLength
%
8
!=
6
)
throw
new
ArgumentException
(
"Options length in bytes must be an integral product of 8 + 6."
,
"options"
);
options
=
options
.
Pad
((
14
-
options
.
BytesLength
%
8
)
%
8
);
Options
=
options
;
Options
=
options
;
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionJumboPayload.cs
View file @
07592ef7
...
@@ -14,7 +14,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -14,7 +14,7 @@ namespace PcapDotNet.Packets.IpV6
/// </pre>
/// </pre>
/// </summary>
/// </summary>
[
IpV6OptionTypeRegistration
(
IpV6OptionType
.
JumboPayload
)]
[
IpV6OptionTypeRegistration
(
IpV6OptionType
.
JumboPayload
)]
public
class
IpV6OptionJumboPayload
:
IpV6OptionComplex
,
IIpV6OptionComplexFactory
public
sealed
class
IpV6OptionJumboPayload
:
IpV6OptionComplex
,
IIpV6OptionComplexFactory
{
{
public
const
int
OptionDataLength
=
sizeof
(
uint
);
public
const
int
OptionDataLength
=
sizeof
(
uint
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6OptionTunnelEncapsulationLimit.cs
View file @
07592ef7
...
@@ -18,7 +18,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -18,7 +18,7 @@ namespace PcapDotNet.Packets.IpV6
public
const
int
OptionDataLength
=
sizeof
(
byte
);
public
const
int
OptionDataLength
=
sizeof
(
byte
);
public
IpV6OptionTunnelEncapsulationLimit
(
byte
tunnelEncapsulationLimit
)
public
IpV6OptionTunnelEncapsulationLimit
(
byte
tunnelEncapsulationLimit
)
:
base
(
IpV6OptionType
.
JumboPayload
)
:
base
(
IpV6OptionType
.
TunnelEncapsulationLimit
)
{
{
TunnelEncapsulationLimit
=
tunnelEncapsulationLimit
;
TunnelEncapsulationLimit
=
tunnelEncapsulationLimit
;
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Options.cs
View file @
07592ef7
...
@@ -15,7 +15,7 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -15,7 +15,7 @@ namespace PcapDotNet.Packets.IpV6
public
sealed
class
IpV6Options
:
Options
<
IpV6Option
>
public
sealed
class
IpV6Options
:
Options
<
IpV6Option
>
{
{
public
IpV6Options
(
IList
<
IpV6Option
>
options
)
public
IpV6Options
(
IList
<
IpV6Option
>
options
)
:
base
(
AddPadding
(
options
)
,
true
,
null
)
:
base
(
options
,
true
,
null
)
{
{
}
}
...
@@ -29,22 +29,14 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -29,22 +29,14 @@ namespace PcapDotNet.Packets.IpV6
{
{
}
}
private
IpV6Options
(
Tuple
<
IList
<
IpV6Option
>,
bool
>
optionsAndIsValid
)
internal
IpV6Options
Pad
(
int
paddingSize
)
:
base
(
AddPadding
(
optionsAndIsValid
.
Item1
),
optionsAndIsValid
.
Item2
,
null
)
{
{
if
(
paddingSize
==
0
)
return
this
;
return
new
IpV6Options
(
OptionsCollection
.
Concat
(
paddingSize
==
1
?
(
IpV6Option
)
new
IpV6OptionPad1
()
:
new
IpV6OptionPadN
(
paddingSize
-
2
)));
}
}
private
static
IList
<
IpV6Option
>
AddPadding
(
IList
<
IpV6Option
>
options
)
internal
static
Tuple
<
IList
<
IpV6Option
>,
bool
>
Read
(
DataSegment
data
)
{
int
optionsLength
=
options
.
Sum
(
option
=>
option
.
Length
);
if
(
optionsLength
%
8
==
6
)
return
options
;
int
paddingLength
=
(
14
-
optionsLength
%
8
)
%
8
;
return
options
.
Concat
(
paddingLength
==
1
?
(
IpV6Option
)
new
IpV6OptionPad1
()
:
new
IpV6OptionPadN
(
paddingLength
-
2
)).
ToArray
();
}
public
static
Tuple
<
IList
<
IpV6Option
>,
bool
>
Read
(
DataSegment
data
)
{
{
int
offset
=
0
;
int
offset
=
0
;
List
<
IpV6Option
>
options
=
new
List
<
IpV6Option
>();
List
<
IpV6Option
>
options
=
new
List
<
IpV6Option
>();
...
@@ -89,6 +81,11 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -89,6 +81,11 @@ namespace PcapDotNet.Packets.IpV6
return
optionsLength
;
return
optionsLength
;
}
}
private
IpV6Options
(
Tuple
<
IList
<
IpV6Option
>,
bool
>
optionsAndIsValid
)
:
base
(
optionsAndIsValid
.
Item1
,
optionsAndIsValid
.
Item2
,
null
)
{
}
private
static
IpV6Option
CreateOption
(
IpV6OptionType
optionType
,
DataSegment
data
)
private
static
IpV6Option
CreateOption
(
IpV6OptionType
optionType
,
DataSegment
data
)
{
{
IIpV6OptionComplexFactory
factory
;
IIpV6OptionComplexFactory
factory
;
...
@@ -147,6 +144,15 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -147,6 +144,15 @@ namespace PcapDotNet.Packets.IpV6
{
{
}
}
/// <summary>
/// Creates options from a list of options.
/// </summary>
/// <param name="options">The list of options.</param>
public
IpV6MobilityOptions
(
IEnumerable
<
IpV6MobilityOption
>
options
)
:
this
(
options
.
ToArray
())
{
}
/// <summary>
/// <summary>
/// Creates options from a list of options.
/// Creates options from a list of options.
/// </summary>
/// </summary>
...
@@ -156,25 +162,32 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -156,25 +162,32 @@ namespace PcapDotNet.Packets.IpV6
{
{
}
}
/// <summary>
/// No options instance.
/// </summary>
public
static
IpV6MobilityOptions
None
{
get
{
return
_none
;
}
}
internal
IpV6MobilityOptions
(
DataSegment
data
)
internal
IpV6MobilityOptions
(
DataSegment
data
)
:
this
(
Read
(
data
))
:
this
(
Read
(
data
))
{
{
}
}
private
IpV6MobilityOptions
(
Tuple
<
IList
<
IpV6MobilityOption
>,
bool
>
optionsAndIsValid
)
internal
IpV6MobilityOptions
Pad
(
int
paddingSize
)
:
base
(
optionsAndIsValid
.
Item1
,
optionsAndIsValid
.
Item2
)
{
{
if
(
paddingSize
==
0
)
return
this
;
return
new
IpV6MobilityOptions
(
OptionsCollection
.
Concat
(
paddingSize
==
1
?
(
IpV6MobilityOption
)
new
IpV6MobilityOptionPad1
()
:
new
IpV6MobilityOptionPadN
(
paddingSize
-
2
)));
}
}
/// <summary>
private
IpV6MobilityOptions
(
Tuple
<
IList
<
IpV6MobilityOption
>,
bool
>
optionsAndIsValid
)
/// No options instance.
:
base
(
optionsAndIsValid
.
Item1
,
optionsAndIsValid
.
Item2
)
/// </summary>
public
static
IpV6MobilityOptions
None
{
{
get
{
return
_none
;
}
}
}
public
static
Tuple
<
IList
<
IpV6MobilityOption
>,
bool
>
Read
(
DataSegment
data
)
internal
static
Tuple
<
IList
<
IpV6MobilityOption
>,
bool
>
Read
(
DataSegment
data
)
{
{
int
offset
=
0
;
int
offset
=
0
;
List
<
IpV6MobilityOption
>
options
=
new
List
<
IpV6MobilityOption
>();
List
<
IpV6MobilityOption
>
options
=
new
List
<
IpV6MobilityOption
>();
...
...
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