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
6f5691e2
Commit
6f5691e2
authored
Nov 21, 2015
by
Boaz Brickner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IGMP Version 0.
Handle super negative epoch time in Wireshark tests.
parent
b5cc684e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
12 deletions
+37
-12
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+7
-2
WiresharkDatagramComparerIgmp.cs
...src/PcapDotNet.Core.Test/WiresharkDatagramComparerIgmp.cs
+1
-1
IgmpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IgmpTests.cs
+2
-2
RandomIgmpExtensions.cs
.../src/PcapDotNet.Packets.TestUtils/RandomIgmpExtensions.cs
+1
-1
IgmpCreateGroupRequestVersion0Layer.cs
...otNet.Packets/Igmp/IgmpCreateGroupRequestVersion0Layer.cs
+2
-2
IgmpDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Igmp/IgmpDatagram.cs
+3
-3
IgmpVersion0CreateGroupRequestCode.cs
...DotNet.Packets/Igmp/IgmpVersion0CreateGroupRequestCode.cs
+19
-0
IgmpVersion0ReplyCode.cs
...tNet/src/PcapDotNet.Packets/Igmp/IgmpVersion0ReplyCode.cs
+1
-1
PcapDotNet.Packets.csproj
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
+1
-0
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
6f5691e2
...
...
@@ -592,8 +592,13 @@ namespace PcapDotNet.Core.Test
case
"frame.time_epoch"
:
double
timeEpoch
=
double
.
Parse
(
field
.
Show
(),
CultureInfo
.
InvariantCulture
);
DateTime
fieldTimestamp
=
new
DateTime
(
1970
,
1
,
1
).
AddSeconds
(
timeEpoch
);
MoreAssert
.
IsInRange
(
fieldTimestamp
.
AddMilliseconds
(-
1
),
fieldTimestamp
.
AddMilliseconds
(
1
),
packet
.
Timestamp
.
ToUniversalTime
(),
"Timestamp"
);
// TODO: Remove this condition when https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=11744 is fixed.
if
(
timeEpoch
>=
int
.
MinValue
)
{
DateTime
fieldTimestamp
=
new
DateTime
(
1970
,
1
,
1
).
AddSeconds
(
timeEpoch
);
MoreAssert
.
IsInRange
(
fieldTimestamp
.
AddMilliseconds
(-
1
),
fieldTimestamp
.
AddMilliseconds
(
1
),
packet
.
Timestamp
.
ToUniversalTime
(),
"Timestamp"
);
}
break
;
case
"frame.cap_len"
:
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkDatagramComparerIgmp.cs
View file @
6f5691e2
...
...
@@ -124,7 +124,7 @@ namespace PcapDotNet.Core.Test
break
;
case
"igmp.group_type"
:
field
.
AssertShowDecimal
(
igmpDatagram
.
IsPrivat
e
);
field
.
AssertShowDecimal
(
(
byte
)
igmpDatagram
.
CreateGroupRequestCod
e
);
break
;
case
"igmp.mtrace.max_hops"
:
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IgmpTests.cs
View file @
6f5691e2
...
...
@@ -121,7 +121,7 @@ namespace PcapDotNet.Packets.Test
switch
(
igmpLayer
.
MessageTypeValue
)
{
case
IgmpMessageType
.
CreateGroupRequestVersion0
:
Assert
.
AreEqual
(((
IgmpCreateGroupRequestVersion0Layer
)
igmpLayer
).
IsPrivate
,
packet
.
Ethernet
.
Ip
.
Igmp
.
IsPrivat
e
);
Assert
.
AreEqual
(((
IgmpCreateGroupRequestVersion0Layer
)
igmpLayer
).
CreateGroupRequestCode
,
packet
.
Ethernet
.
Ip
.
Igmp
.
CreateGroupRequestCod
e
);
break
;
case
IgmpMessageType
.
CreateGroupReplyVersion0
:
...
...
@@ -519,7 +519,7 @@ namespace PcapDotNet.Packets.Test
{
Packet
packet
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
(),
new
IpV4Layer
(),
new
IgmpQueryVersion1Layer
());
Assert
.
IsTrue
(
packet
.
IsValid
);
Assert
.
IsFalse
(
packet
.
Ethernet
.
IpV4
.
Igmp
.
IsPrivat
e
);
Assert
.
AreEqual
(
IgmpVersion0CreateGroupRequestCode
.
Private
,
packet
.
Ethernet
.
IpV4
.
Igmp
.
CreateGroupRequestCod
e
);
}
[
TestMethod
]
...
...
PcapDotNet/src/PcapDotNet.Packets.TestUtils/RandomIgmpExtensions.cs
View file @
6f5691e2
...
...
@@ -36,7 +36,7 @@ namespace PcapDotNet.Packets.TestUtils
case
IgmpMessageType
.
CreateGroupRequestVersion0
:
return
new
IgmpCreateGroupRequestVersion0Layer
{
IsPrivate
=
random
.
NextBool
(),
CreateGroupRequestCode
=
random
.
NextEnum
<
IgmpVersion0CreateGroupRequestCode
>
(),
Identifier
=
identifier
,
};
...
...
PcapDotNet/src/PcapDotNet.Packets/Igmp/IgmpCreateGroupRequestVersion0Layer.cs
View file @
6f5691e2
...
...
@@ -19,7 +19,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// Indicates if the new host group is to be private or public.
/// </summary>
public
bool
IsPrivat
e
{
get
;
set
;
}
public
IgmpVersion0CreateGroupRequestCode
CreateGroupRequestCod
e
{
get
;
set
;
}
/// <summary>
/// Contains a value to distinguish the request from other requests by the same host.
...
...
@@ -44,7 +44,7 @@ namespace PcapDotNet.Packets.Igmp
internal
override
byte
CodeValue
{
get
{
return
IsPrivate
.
ToByte
()
;
}
get
{
return
(
byte
)
CreateGroupRequestCode
;
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Igmp/IgmpDatagram.cs
View file @
6f5691e2
...
...
@@ -281,13 +281,13 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// In IGMP version 0 Create Group Request message, indicates if the new host group is to be private or public.
/// </summary>
public
bool
IsPrivat
e
public
IgmpVersion0CreateGroupRequestCode
CreateGroupRequestCod
e
{
get
{
if
(
MessageType
!=
IgmpMessageType
.
CreateGroupRequestVersion0
)
throw
new
InvalidOperationException
(
System
.
Reflection
.
MethodBase
.
GetCurrentMethod
().
Name
+
" can only be accessed for CreateGroupRequestVersion0."
);
return
ReadBool
(
Offset
.
Code
,
Mask
.
Code
)
;
return
(
IgmpVersion0CreateGroupRequestCode
)
this
[
Offset
.
Code
]
;
}
}
...
...
@@ -628,7 +628,7 @@ namespace PcapDotNet.Packets.Igmp
case
IgmpMessageType
.
CreateGroupRequestVersion0
:
return
new
IgmpCreateGroupRequestVersion0Layer
{
IsPrivate
=
IsPrivat
e
,
CreateGroupRequestCode
=
CreateGroupRequestCod
e
,
Identifier
=
Identifier
,
};
...
...
PcapDotNet/src/PcapDotNet.Packets/Igmp/IgmpVersion0CreateGroupRequestCode.cs
0 → 100644
View file @
6f5691e2
namespace
PcapDotNet.Packets.Igmp
{
/// <summary>
/// RFC 988.
/// In an IGMP version 0 Create Group Request message, the code field indicates if the new host group is to be public or private.
/// </summary>
public
enum
IgmpVersion0CreateGroupRequestCode
:
byte
{
/// <summary>
/// The new host group is to be public.
/// </summary>
Public
=
0
,
/// <summary>
/// The new host group is to be private.
/// </summary>
Private
=
1
,
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Igmp/IgmpVersion0ReplyCode.cs
View file @
6f5691e2
...
...
@@ -2,7 +2,7 @@ namespace PcapDotNet.Packets.Igmp
{
/// <summary>
/// RFC 988.
/// In an IGMP version 0 Reply message, specifies the outcome of the request
:
/// In an IGMP version 0 Reply message, specifies the outcome of the request
.
/// </summary>
public
enum
IgmpVersion0ReplyCode
:
byte
{
...
...
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
View file @
6f5691e2
...
...
@@ -313,6 +313,7 @@
<Compile
Include=
"Igmp\IgmpReportVersion2Layer.cs"
/>
<Compile
Include=
"Igmp\IgmpReportVersion3Layer.cs"
/>
<Compile
Include=
"Igmp\IgmpRequestVersion0Layer.cs"
/>
<Compile
Include=
"Igmp\IgmpVersion0CreateGroupRequestCode.cs"
/>
<Compile
Include=
"Igmp\IgmpVersion0Layer.cs"
/>
<Compile
Include=
"Igmp\IgmpVersion1PlusLayer.cs"
/>
<Compile
Include=
"Igmp\IgmpVersion1PlusSimpleLayer.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