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
d6af7b3a
Commit
d6af7b3a
authored
Sep 08, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6
parent
3736d46f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
2 deletions
+125
-2
IpV6Datagram.cs
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Datagram.cs
+125
-2
No files found.
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Datagram.cs
View file @
d6af7b3a
...
...
@@ -2028,7 +2028,7 @@ namespace PcapDotNet.Packets.IpV6
}
/// <summary>
/// Charles Lynn.
.
/// Charles Lynn.
/// http://ana-3.lcs.mit.edu/~jnc/nimrod/eidoption.txt
/// Endpoint Identifier Option.
/// <pre>
...
...
@@ -2104,7 +2104,130 @@ namespace PcapDotNet.Packets.IpV6
buffer
.
Write
(
ref
offset
,
DestinationEndpointIdentifier
);
}
}
// RplOption = 0x63,
/// <summary>
/// RFC 6553.
/// Routing Protocol for Low-Power and Lossy Networks option.
/// <pre>
/// +-----+---+---+---+-----+---------------+
/// | Bit | 0 | 1 | 2 | 3-7 | 8-15 |
/// +-----+---+---+---+-----+---------------+
/// | 0 | Option Type | Opt Data Len |
/// +-----+---+---+---+-----+---------------+
/// | 16 | O | R | F | 0 | RPLInstanceID |
/// +-----+---+---+---+-----+---------------+
/// | 32 | SenderRank |
/// +-----+---------------------------------+
/// | 48 | (sub-TLVs) |
/// | ... | |
/// +-----+---------------------------------+
/// </pre>
/// </summary>
[
IpV6OptionTypeRegistration
(
IpV6OptionType
.
RplOption
)]
public
class
IpV6OptionRoutingProtocolLowPowerAndLossyNetworks
:
IpV6OptionComplex
{
private
static
class
Offset
{
public
const
int
Down
=
0
;
public
const
int
RankError
=
Down
;
public
const
int
ForwardingError
=
RankError
;
public
const
int
RplInstanceId
=
ForwardingError
+
sizeof
(
byte
);
public
const
int
SenderRank
=
RplInstanceId
+
sizeof
(
byte
);
public
const
int
SubTlvs
=
SenderRank
+
sizeof
(
ushort
);
}
private
static
class
Mask
{
public
const
byte
Down
=
0x80
;
public
const
byte
RankError
=
0x40
;
public
const
byte
ForwardingError
=
0x20
;
}
public
const
int
OptionDataMinimumLength
=
Offset
.
SubTlvs
;
public
IpV6OptionRoutingProtocolLowPowerAndLossyNetworks
(
bool
down
,
bool
rankError
,
bool
forwardingError
,
byte
rplInstanceId
,
ushort
senderRank
,
DataSegment
subTlvs
)
:
base
(
IpV6OptionType
.
EndpointIdentification
)
{
Down
=
down
;
RankError
=
rankError
;
ForwardingError
=
forwardingError
;
RplInstanceId
=
rplInstanceId
;
SenderRank
=
senderRank
;
SubTlvs
=
subTlvs
;
}
/// <summary>
/// Indicating whether the packet is expected to progress Up or Down.
/// A router sets the Down flag when the packet is expected to progress Down (using DAO routes),
/// and clears it when forwarding toward the DODAG root (to a node with a lower Rank).
/// A host or RPL leaf node must set the Down flag to 0.
/// </summary>
public
bool
Down
{
get
;
private
set
;
}
/// <summary>
/// Indicating whether a Rank error was detected.
/// A Rank error is detected when there is a mismatch in the relative Ranks and the direction as indicated in the Down flag.
/// A host or RPL leaf node must set the Rank Error flag to 0.
/// </summary>
public
bool
RankError
{
get
;
private
set
;
}
/// <summary>
/// Indicating that this node cannot forward the packet further towards the destination.
/// The Forward Error flag might be set by a child node that does not have a route to destination for a packet with the Down flag set.
/// A host or RPL leaf node must set the Forwarding error flag to 0.
/// </summary>
public
bool
ForwardingError
{
get
;
private
set
;
}
/// <summary>
/// Indicating the DODAG instance along which the packet is sent.
/// </summary>
public
byte
RplInstanceId
{
get
;
private
set
;
}
/// <summary>
/// Set to zero by the source and to DAGRank(rank) by a router that forwards inside the RPL network.
/// </summary>
public
ushort
SenderRank
{
get
;
private
set
;
}
/// <summary>
/// A RPL device must skip over any unrecognized sub-TLVs and attempt to process any additional sub-TLVs that may appear after.
/// </summary>
public
DataSegment
SubTlvs
{
get
;
private
set
;
}
internal
IpV6OptionRoutingProtocolLowPowerAndLossyNetworks
()
:
this
(
false
,
false
,
false
,
0
,
0
,
DataSegment
.
Empty
)
{
}
internal
override
IpV6Option
CreateInstance
(
DataSegment
data
)
{
if
(
data
.
Length
<
OptionDataMinimumLength
)
return
null
;
bool
down
=
data
.
ReadBool
(
Offset
.
Down
,
Mask
.
Down
);
bool
rankError
=
data
.
ReadBool
(
Offset
.
RankError
,
Mask
.
RankError
);
bool
forwardingError
=
data
.
ReadBool
(
Offset
.
ForwardingError
,
Mask
.
ForwardingError
);
byte
rplInstanceId
=
data
[
Offset
.
RplInstanceId
];
ushort
senderRank
=
data
.
ReadUShort
(
Offset
.
SenderRank
,
Endianity
.
Big
);
DataSegment
subTlvs
=
data
.
Subsegment
(
Offset
.
SubTlvs
,
data
.
Length
-
Offset
.
SubTlvs
);
return
new
IpV6OptionRoutingProtocolLowPowerAndLossyNetworks
(
down
,
rankError
,
forwardingError
,
rplInstanceId
,
senderRank
,
subTlvs
);
}
internal
override
int
DataLength
{
get
{
return
OptionDataMinimumLength
+
SubTlvs
.
Length
;
}
}
internal
override
void
WriteData
(
byte
[]
buffer
,
ref
int
offset
)
{
byte
flags
=
(
byte
)((
Down
?
Mask
.
Down
:
0
)
|
(
RankError
?
Mask
.
RankError
:
0
)
|
(
ForwardingError
?
Mask
.
ForwardingError
:
0
));
buffer
.
Write
(
ref
offset
,
flags
);
buffer
.
Write
(
ref
offset
,
RplInstanceId
);
buffer
.
Write
(
ref
offset
,
SenderRank
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
SubTlvs
);
}
}
// IlnpNonce = 0x8B,
public
class
IpV6Options
:
Options
<
IpV6Option
>
...
...
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