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
caa898ce
Commit
caa898ce
authored
Aug 22, 2014
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6
Code Coverage 95.68%
parent
19c96296
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
61 deletions
+112
-61
WiresharkDatagramComparerIpV6MobilityHeader.cs
....Core.Test/WiresharkDatagramComparerIpV6MobilityHeader.cs
+1
-0
IpV6Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
+107
-61
IpV6MobilityOptionCgaParameters.cs
...t.Packets/IpV6/Options/IpV6MobilityOptionCgaParameters.cs
+4
-0
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkDatagramComparerIpV6MobilityHeader.cs
View file @
caa898ce
...
@@ -111,6 +111,7 @@ namespace PcapDotNet.Core.Test
...
@@ -111,6 +111,7 @@ namespace PcapDotNet.Core.Test
protocol
==
IpV4Protocol
.
ActiveNetworks
||
protocol
==
IpV4Protocol
.
ActiveNetworks
||
protocol
==
IpV4Protocol
.
SpectraLinkRadioProtocol
||
protocol
==
IpV4Protocol
.
SpectraLinkRadioProtocol
||
protocol
==
IpV4Protocol
.
MobileAdHocNetwork
||
protocol
==
IpV4Protocol
.
MobileAdHocNetwork
||
protocol
==
IpV4Protocol
.
Shim6
||
// TODO: Implement Shim6.
protocol
==
IpV4Protocol
.
RemoteVirtualDiskProtocol
))
protocol
==
IpV4Protocol
.
RemoteVirtualDiskProtocol
))
return
false
;
return
false
;
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6Tests.cs
View file @
caa898ce
...
@@ -171,6 +171,16 @@ namespace PcapDotNet.Packets.Test
...
@@ -171,6 +171,16 @@ namespace PcapDotNet.Packets.Test
}
}
}
}
break
;
break
;
case
IpV6MobilityOptionType
.
CgaParameters
:
IpV6MobilityOptionCgaParameters
optionCgaParameters
=
(
IpV6MobilityOptionCgaParameters
)
option
;
Assert
.
AreEqual
(
optionCgaParameters
.
Length
-
2
,
optionCgaParameters
.
CgaParameters
.
Length
);
break
;
case
IpV6MobilityOptionType
.
CareOfTest
:
IpV6MobilityOptionCareOfTest
optionCareOfTest
=
(
IpV6MobilityOptionCareOfTest
)
option
;
Assert
.
IsInstanceOfType
(
optionCareOfTest
.
CareOfKeygenToken
,
typeof
(
ulong
));
break
;
}
}
}
}
}
}
...
@@ -640,6 +650,13 @@ namespace PcapDotNet.Packets.Test
...
@@ -640,6 +650,13 @@ namespace PcapDotNet.Packets.Test
new
IpV6MobilityOptionContextRequestEntry
(
0
,
new
DataSegment
(
new
byte
[
100
]))));
new
IpV6MobilityOptionContextRequestEntry
(
0
,
new
DataSegment
(
new
byte
[
100
]))));
}
}
[
TestMethod
]
public
void
IpV6MobilityOptionContextRequestEntryEquals
()
{
Assert
.
AreNotEqual
(
new
IpV6MobilityOptionContextRequestEntry
(
0
,
DataSegment
.
Empty
),
1
);
Assert
.
AreEqual
(
new
IpV6MobilityOptionContextRequestEntry
(
0
,
DataSegment
.
Empty
),
new
IpV6MobilityOptionContextRequestEntry
(
0
,
DataSegment
.
Empty
));
}
[
TestMethod
]
[
TestMethod
]
[
ExpectedException
(
typeof
(
ArgumentOutOfRangeException
),
AllowDerivedTypes
=
false
)]
[
ExpectedException
(
typeof
(
ArgumentOutOfRangeException
),
AllowDerivedTypes
=
false
)]
public
void
IpV6MobilityOptionFlowIdentificationSubOptionsTooLong
()
public
void
IpV6MobilityOptionFlowIdentificationSubOptionsTooLong
()
...
@@ -1065,7 +1082,7 @@ namespace PcapDotNet.Packets.Test
...
@@ -1065,7 +1082,7 @@ namespace PcapDotNet.Packets.Test
[
TestMethod
]
[
TestMethod
]
public
void
IpV6OptionsEnumerableConstructor
()
public
void
IpV6OptionsEnumerableConstructor
()
{
{
IpV6Options
options
=
new
IpV6Options
(
new
IpV6Option
[]{
new
IpV6OptionPad1
()}.
Concat
(
new
IpV6OptionPad1
()));
IpV6Options
options
=
new
IpV6Options
(
new
IpV6Option
[]
{
new
IpV6OptionPad1
()}.
Concat
(
new
IpV6OptionPad1
()));
Assert
.
AreEqual
(
2
,
options
.
Count
);
Assert
.
AreEqual
(
2
,
options
.
Count
);
Assert
.
AreEqual
(
new
IpV6OptionPad1
(),
options
[
0
]);
Assert
.
AreEqual
(
new
IpV6OptionPad1
(),
options
[
0
]);
Assert
.
AreEqual
(
new
IpV6OptionPad1
(),
options
[
1
]);
Assert
.
AreEqual
(
new
IpV6OptionPad1
(),
options
[
1
]);
...
@@ -1159,5 +1176,34 @@ namespace PcapDotNet.Packets.Test
...
@@ -1159,5 +1176,34 @@ namespace PcapDotNet.Packets.Test
Assert
.
AreNotEqual
(
new
IpV6OptionSmfDpdDefault
(
new
DataSegment
(
new
byte
[
16
]),
DataSegment
.
Empty
),
Assert
.
AreNotEqual
(
new
IpV6OptionSmfDpdDefault
(
new
DataSegment
(
new
byte
[
16
]),
DataSegment
.
Empty
),
new
IpV6OptionSmfDpdIpV6
(
IpV6Address
.
Zero
,
DataSegment
.
Empty
));
new
IpV6OptionSmfDpdIpV6
(
IpV6Address
.
Zero
,
DataSegment
.
Empty
));
}
}
[
TestMethod
]
[
ExpectedException
(
typeof
(
ArgumentOutOfRangeException
),
AllowDerivedTypes
=
false
)]
public
void
IpV6MobilityOptionCgaParametersTooLong
()
{
Assert
.
IsNull
(
new
IpV6MobilityOptionCgaParameters
(
new
DataSegment
(
new
byte
[
256
])));
Assert
.
Fail
();
}
[
TestMethod
]
public
void
IpV6MobilityOptionCareOfTestCreateInstanceDataTooShort
()
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV6Layer
{
ExtensionHeaders
=
new
IpV6ExtensionHeaders
(
new
IpV6ExtensionHeaderMobilityBindingError
(
IpV4Protocol
.
Skip
,
0
,
IpV6BindingErrorStatus
.
UnrecognizedMhTypeValue
,
IpV6Address
.
Zero
,
new
IpV6MobilityOptions
(
new
IpV6MobilityOptionCareOfTest
(
0
))))
});
Assert
.
IsTrue
(
packet
.
IsValid
);
--
packet
.
Buffer
[
14
+
40
+
24
+
1
];
Packet
invalidPacket
=
new
Packet
(
packet
.
Buffer
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
Assert
.
IsFalse
(
invalidPacket
.
IsValid
);
}
}
}
}
}
PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6MobilityOptionCgaParameters.cs
View file @
caa898ce
using
System
;
namespace
PcapDotNet.Packets.IpV6
namespace
PcapDotNet.Packets.IpV6
{
{
/// <summary>
/// <summary>
...
@@ -21,6 +23,8 @@ namespace PcapDotNet.Packets.IpV6
...
@@ -21,6 +23,8 @@ namespace PcapDotNet.Packets.IpV6
public
IpV6MobilityOptionCgaParameters
(
DataSegment
cgaParameters
)
public
IpV6MobilityOptionCgaParameters
(
DataSegment
cgaParameters
)
:
base
(
IpV6MobilityOptionType
.
CgaParameters
,
cgaParameters
)
:
base
(
IpV6MobilityOptionType
.
CgaParameters
,
cgaParameters
)
{
{
if
(
cgaParameters
.
Length
>
OptionDataMaxLength
)
throw
new
ArgumentOutOfRangeException
(
"cgaParameters"
,
cgaParameters
,
string
.
Format
(
"Must not exceed {0} bytes."
,
OptionDataMaxLength
));
}
}
/// <summary>
/// <summary>
...
...
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