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
e6ce2bec
Commit
e6ce2bec
authored
Apr 21, 2010
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GRE
parent
1f35830f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
204 additions
and
32 deletions
+204
-32
GreTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/GreTests.cs
+1
-1
GreDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Gre/GreDatagram.cs
+164
-25
GreLayer.cs
PcapDotNet/src/PcapDotNet.Packets/Gre/GreLayer.cs
+39
-6
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/GreTests.cs
View file @
e6ce2bec
...
@@ -80,7 +80,7 @@ namespace PcapDotNet.Packets.Test
...
@@ -80,7 +80,7 @@ namespace PcapDotNet.Packets.Test
Assert
.
AreEqual
(
ethernetLayer
,
packet
.
Ethernet
.
ExtractLayer
(),
"Ethernet Layer"
);
Assert
.
AreEqual
(
ethernetLayer
,
packet
.
Ethernet
.
ExtractLayer
(),
"Ethernet Layer"
);
// IPv4
// IPv4
ipV4Layer
.
Protocol
=
IpV4Protocol
.
InternetControlMessageProtocol
;
ipV4Layer
.
Protocol
=
IpV4Protocol
.
Gre
;
ipV4Layer
.
HeaderChecksum
=
((
IpV4Layer
)
packet
.
Ethernet
.
IpV4
.
ExtractLayer
()).
HeaderChecksum
;
ipV4Layer
.
HeaderChecksum
=
((
IpV4Layer
)
packet
.
Ethernet
.
IpV4
.
ExtractLayer
()).
HeaderChecksum
;
Assert
.
AreEqual
(
ipV4Layer
,
packet
.
Ethernet
.
IpV4
.
ExtractLayer
());
Assert
.
AreEqual
(
ipV4Layer
,
packet
.
Ethernet
.
IpV4
.
ExtractLayer
());
ipV4Layer
.
HeaderChecksum
=
null
;
ipV4Layer
.
HeaderChecksum
=
null
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Gre/GreDatagram.cs
View file @
e6ce2bec
This diff is collapsed.
Click to expand it.
PcapDotNet/src/PcapDotNet.Packets/Gre/GreLayer.cs
View file @
e6ce2bec
using
System
;
using
System
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Gre
namespace
PcapDotNet.Packets.Gre
{
{
public
class
GreLayer
:
Layer
public
class
GreLayer
:
Layer
,
IIpV4NextLayer
,
IEquatable
<
GreLayer
>
{
{
public
byte
RecursionControl
{
get
;
set
;
}
public
GreVersion
Version
{
get
;
set
;
}
public
GreVersion
Version
{
get
;
set
;
}
public
EthernetType
ProtocolType
{
get
;
set
;
}
public
EthernetType
ProtocolType
{
get
;
set
;
}
public
byte
RecursionControl
{
get
;
set
;
}
public
bool
ChecksumPresent
{
get
;
set
;
}
public
ushort
?
Checksum
{
get
;
set
;
}
public
ushort
?
Checksum
{
get
;
set
;
}
public
ushort
?
RoutingOffset
{
get
;
set
;
}
public
uint
?
Key
{
get
;
set
;
}
public
uint
?
Key
{
get
;
set
;
}
public
uint
?
SequenceNumber
{
get
;
set
;
}
public
uint
?
SequenceNumber
{
get
;
set
;
}
public
ushort
?
RoutingOffset
{
get
;
set
;
}
public
ReadOnlyCollection
<
GreSourceRouteEntry
>
Routing
{
get
;
set
;
}
public
ReadOnlyCollection
<
GreSourceRouteEntry
>
Routing
{
get
;
set
;
}
public
bool
StrictSourceRoute
{
get
;
set
;
}
public
override
int
Length
public
override
int
Length
{
{
get
{
throw
new
NotImplementedException
();
}
get
{
return
GreDatagram
.
GetHeaderLength
(
ChecksumPresent
,
Key
!=
null
,
SequenceNumber
!=
null
,
Routing
);
}
}
}
public
override
void
Write
(
byte
[]
buffer
,
int
offset
,
int
payloadLength
,
ILayer
previousLayer
,
ILayer
nextLayer
)
public
override
void
Write
(
byte
[]
buffer
,
int
offset
,
int
payloadLength
,
ILayer
previousLayer
,
ILayer
nextLayer
)
{
{
GreDatagram
.
WriteHeader
(
buffer
,
offset
);
GreDatagram
.
WriteHeader
(
buffer
,
offset
,
RecursionControl
,
Version
,
ProtocolType
,
ChecksumPresent
,
Key
,
SequenceNumber
,
Routing
,
RoutingOffset
,
StrictSourceRoute
);
}
public
override
void
Finalize
(
byte
[]
buffer
,
int
offset
,
int
payloadLength
,
ILayer
nextLayer
)
{
if
(
ChecksumPresent
)
GreDatagram
.
WriteChecksum
(
buffer
,
offset
,
Length
+
payloadLength
,
Checksum
);
}
public
bool
Equals
(
GreLayer
other
)
{
return
other
!=
null
&&
Version
.
Equals
(
other
.
Version
)
&&
ProtocolType
.
Equals
(
other
.
ProtocolType
)
&&
RecursionControl
.
Equals
(
other
.
RecursionControl
)
&&
ChecksumPresent
.
Equals
(
other
.
ChecksumPresent
)
&&
(
Checksum
==
null
?
other
.
Checksum
==
null
:
Checksum
.
Equals
(
other
.
Checksum
))
&&
(
Key
==
null
?
other
.
Key
==
null
:
Key
.
Equals
(
other
.
Key
))
&&
(
SequenceNumber
==
null
?
other
.
SequenceNumber
==
null
:
SequenceNumber
.
Equals
(
other
.
SequenceNumber
))
&&
(
RoutingOffset
==
null
?
other
.
RoutingOffset
==
null
:
RoutingOffset
.
Equals
(
other
.
RoutingOffset
))
&&
(
Routing
==
null
?
other
.
Routing
==
null
:
Routing
.
SequenceEqual
(
other
.
Routing
))
&&
StrictSourceRoute
.
Equals
(
other
.
StrictSourceRoute
);
}
}
public
override
bool
Equals
(
Layer
other
)
public
override
bool
Equals
(
Layer
other
)
{
{
throw
new
NotImplementedException
();
return
Equals
(
other
as
GreLayer
);
}
public
IpV4Protocol
PreviousLayerProtocol
{
get
{
return
IpV4Protocol
.
Gre
;
}
}
}
}
}
}
}
\ No newline at end of file
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