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
c103fa03
Commit
c103fa03
authored
Apr 13, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VLanTaggedFrame
parent
c843d9da
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
19 deletions
+28
-19
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+10
-1
WiresharkDatagramComparerGre.cs
.../src/PcapDotNet.Core.Test/WiresharkDatagramComparerGre.cs
+13
-17
WiresharkDatagramComparerVLanTaggedFrame.cs
...Net.Core.Test/WiresharkDatagramComparerVLanTaggedFrame.cs
+4
-0
EthernetBaseDatagram.cs
...t/src/PcapDotNet.Packets/Ethernet/EthernetBaseDatagram.cs
+1
-1
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
c103fa03
...
@@ -34,7 +34,7 @@ namespace PcapDotNet.Core.Test
...
@@ -34,7 +34,7 @@ namespace PcapDotNet.Core.Test
get
{
return
RetryNumber
!=
-
1
;
}
get
{
return
RetryNumber
!=
-
1
;
}
}
}
private
const
int
RetryNumber
=
-
1
;
private
const
int
RetryNumber
=
1000
;
/// <summary>
/// <summary>
/// Gets or sets the test context which provides
/// Gets or sets the test context which provides
...
@@ -112,6 +112,15 @@ namespace PcapDotNet.Core.Test
...
@@ -112,6 +112,15 @@ namespace PcapDotNet.Core.Test
ComparePacketsToWireshark
(
packet
);
ComparePacketsToWireshark
(
packet
);
}
}
[
TestMethod
]
public
void
CompareVLanTaggedFrameTrailerToWiresharkTest
()
{
const
string
PacketString
=
"0004f2402ffca870a5002e02810001f408060001080006040001a870a5002e02ac141401000000000000ac1414670000000000000000000000000000"
;
Packet
packet
=
Packet
.
FromHexadecimalString
(
PacketString
,
DateTime
.
Now
,
DataLinkKind
.
Ethernet
);
ComparePacketsToWireshark
(
packet
);
}
[
TestMethod
]
[
TestMethod
]
public
void
CompareEthernetFcsToWiresharkTest
()
public
void
CompareEthernetFcsToWiresharkTest
()
{
{
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkDatagramComparerGre.cs
View file @
c103fa03
...
@@ -91,44 +91,40 @@ namespace PcapDotNet.Core.Test
...
@@ -91,44 +91,40 @@ namespace PcapDotNet.Core.Test
break
;
break
;
case
"gre.routing.address_family"
:
case
"gre.routing.address_family"
:
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
if
(
SupportedGre
(
greDatagram
)
)
{
{
if
(
SupportedGre
(
greDatagram
)
)
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
field
.
AssertShowDecimal
(
0
);
field
.
AssertShowDecimal
(
0
);
else
field
.
AssertShowDecimal
((
ushort
)
greDatagram
.
Routing
[
_routingEntryIndex
].
AddressFamily
);
}
}
else
field
.
AssertShowDecimal
((
ushort
)
greDatagram
.
Routing
[
_routingEntryIndex
].
AddressFamily
);
field
.
AssertNoFields
();
field
.
AssertNoFields
();
break
;
break
;
case
"gre.routing.sre_offset"
:
case
"gre.routing.sre_offset"
:
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
if
(
SupportedGre
(
greDatagram
)
)
{
{
if
(
SupportedGre
(
greDatagram
)
)
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
field
.
AssertShowDecimal
(
0
);
field
.
AssertShowDecimal
(
0
);
else
field
.
AssertShowDecimal
(
greDatagram
.
Routing
[
_routingEntryIndex
].
PayloadOffset
);
}
}
else
field
.
AssertShowDecimal
(
greDatagram
.
Routing
[
_routingEntryIndex
].
PayloadOffset
);
field
.
AssertNoFields
();
field
.
AssertNoFields
();
break
;
break
;
case
"gre.routing.src_length"
:
case
"gre.routing.src_length"
:
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
if
(
SupportedGre
(
greDatagram
)
)
{
{
if
(
SupportedGre
(
greDatagram
)
)
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
field
.
AssertShowDecimal
(
0
);
field
.
AssertShowDecimal
(
0
);
else
field
.
AssertShowDecimal
(
greDatagram
.
Routing
[
_routingEntryIndex
].
PayloadLength
);
}
}
else
field
.
AssertShowDecimal
(
greDatagram
.
Routing
[
_routingEntryIndex
].
PayloadLength
);
field
.
AssertNoFields
();
field
.
AssertNoFields
();
break
;
break
;
case
"gre.routing.information"
:
case
"gre.routing.information"
:
if
(
_routingEntryIndex
==
greDatagram
.
Routing
.
Count
)
if
(
SupportedGre
(
greDatagram
)
&&
_routingEntryIndex
!=
greDatagram
.
Routing
.
Count
)
{
Assert
.
IsFalse
(
SupportedGre
(
greDatagram
));
}
else
{
{
switch
(
greDatagram
.
Routing
[
_routingEntryIndex
].
AddressFamily
)
switch
(
greDatagram
.
Routing
[
_routingEntryIndex
].
AddressFamily
)
{
{
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkDatagramComparerVLanTaggedFrame.cs
View file @
c103fa03
...
@@ -37,6 +37,10 @@ namespace PcapDotNet.Core.Test
...
@@ -37,6 +37,10 @@ namespace PcapDotNet.Core.Test
field
.
AssertShowDecimal
((
ushort
)
vLanTaggedFrameDatagram
.
EtherType
);
field
.
AssertShowDecimal
((
ushort
)
vLanTaggedFrameDatagram
.
EtherType
);
break
;
break
;
case
"vlan.trailer"
:
field
.
AssertValue
(
vLanTaggedFrameDatagram
.
Trailer
);
break
;
default
:
default
:
throw
new
InvalidOperationException
(
"Invalid VLanTaggedFrame field "
+
field
.
Name
());
throw
new
InvalidOperationException
(
"Invalid VLanTaggedFrame field "
+
field
.
Name
());
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Ethernet/EthernetBaseDatagram.cs
View file @
c103fa03
...
@@ -44,7 +44,7 @@ namespace PcapDotNet.Packets.Ethernet
...
@@ -44,7 +44,7 @@ namespace PcapDotNet.Packets.Ethernet
int
payloadLength
=
PayloadByEtherType
.
Length
;
int
payloadLength
=
PayloadByEtherType
.
Length
;
Datagram
fcs
=
FrameCheckSequence
;
Datagram
fcs
=
FrameCheckSequence
;
return
new
Datagram
(
Buffer
,
HeaderLength
+
payloadLength
,
Length
-
HeaderLength
-
payloadLength
-
(
fcs
==
null
?
0
:
fcs
.
Length
));
return
new
Datagram
(
Buffer
,
StartOffset
+
HeaderLength
+
payloadLength
,
Length
-
HeaderLength
-
payloadLength
-
(
fcs
==
null
?
0
:
fcs
.
Length
));
}
}
}
}
...
...
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