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
1d2fe8dd
Commit
1d2fe8dd
authored
Aug 08, 2009
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Security Option upgraded to RFC 1108.
parent
90639a7b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
211 additions
and
133 deletions
+211
-133
MoreIpV4Option.cs
PcapDotNet/src/PcapDotNet.Core.Test/MoreIpV4Option.cs
+5
-21
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+3
-11
IpV4Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4Tests.cs
+0
-12
MoreRandomPackets.cs
...Net/src/PcapDotNet.Packets.TestUtils/MoreRandomPackets.cs
+8
-3
CodeAnalysisDictionary.xml
PcapDotNet/src/PcapDotNet.Packets/CodeAnalysisDictionary.xml
+0
-1
IpV4OptionSecurity.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSecurity.cs
+110
-82
IpV4OptionSecurityClassificationLevel.cs
...Net.Packets/IpV4/IpV4OptionSecurityClassificationLevel.cs
+32
-0
IpV4OptionSecurityProtectionAuthority.cs
...Net.Packets/IpV4/IpV4OptionSecurityProtectionAuthority.cs
+49
-0
IpV4OptionType.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionType.cs
+2
-2
PcapDotNet.Packets.csproj
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
+2
-1
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/MoreIpV4Option.cs
View file @
1d2fe8dd
...
@@ -50,32 +50,16 @@ namespace PcapDotNet.Core.Test
...
@@ -50,32 +50,16 @@ namespace PcapDotNet.Core.Test
case
IpV4OptionType
.
Security
:
case
IpV4OptionType
.
Security
:
IpV4OptionSecurity
securityOption
=
(
IpV4OptionSecurity
)
option
;
IpV4OptionSecurity
securityOption
=
(
IpV4OptionSecurity
)
option
;
switch
(
securityOption
.
Level
)
switch
(
securityOption
.
Classification
Level
)
{
{
case
IpV4OptionSecurityLevel
.
EncryptedForTransmissionOnly
:
yield
return
"Security: EFTO"
;
break
;
case
IpV4OptionSecurityLevel
.
Mmmm
:
yield
return
"Security: "
+
securityOption
.
Level
.
ToString
().
ToUpper
();
break
;
case
IpV4OptionSecurityLevel
.
TopSecret
:
yield
return
"Security: Top secret"
;
break
;
case
IpV4OptionSecurityLevel
.
Prog
:
yield
return
"Security: Unknown (0x"
+
((
ushort
)
securityOption
.
Level
).
ToString
(
"x4"
)
+
")"
;
break
;
default
:
default
:
yield
return
"Security: "
+
securityOption
.
Level
;
yield
return
"Security: "
+
securityOption
.
Classification
Level
;
break
;
break
;
}
}
yield
return
"Compartments: "
+
securityOption
.
Compartments
;
//
yield return "Compartments: " + securityOption.Compartments;
yield
return
"Handling restrictions: "
;
//
yield return "Handling restrictions: ";
yield
return
"Transmission control code: "
;
//
yield return "Transmission control code: ";
break
;
break
;
case
IpV4OptionType
.
LooseSourceRouting
:
case
IpV4OptionType
.
LooseSourceRouting
:
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
1d2fe8dd
...
@@ -308,18 +308,10 @@ namespace PcapDotNet.Core.Test
...
@@ -308,18 +308,10 @@ namespace PcapDotNet.Core.Test
break
;
break
;
}
}
IpV4Option
option
=
options
[
currentOptionIndex
++];
IpV4Option
option
=
options
[
currentOptionIndex
++];
if
(
option
.
OptionType
==
IpV4OptionType
.
Security
)
continue
;
// Wireshark doesn't support
field
.
AssertShow
(
option
.
GetWiresharkString
());
field
.
AssertShow
(
option
.
GetWiresharkString
());
var
optionShows
=
field
.
Fields
().
Select
(
var
optionShows
=
from
f
in
field
.
Fields
()
select
f
.
Show
();
delegate
(
XElement
optionField
)
{
string
optionFieldShow
=
optionField
.
Show
();
if
(
optionFieldShow
.
StartsWith
(
"Handling restrictions: "
))
optionFieldShow
=
"Handling restrictions: "
;
else
if
(
optionFieldShow
.
StartsWith
(
"Transmission control code: "
))
optionFieldShow
=
"Transmission control code: "
;
return
optionFieldShow
;
});
Assert
.
IsTrue
(
optionShows
.
SequenceEqual
(
option
.
GetWiresharkSubfieldStrings
()));
Assert
.
IsTrue
(
optionShows
.
SequenceEqual
(
option
.
GetWiresharkSubfieldStrings
()));
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4Tests.cs
View file @
1d2fe8dd
...
@@ -169,18 +169,6 @@ namespace PcapDotNet.Packets.Test
...
@@ -169,18 +169,6 @@ namespace PcapDotNet.Packets.Test
}
}
}
}
[
TestMethod
]
public
void
IpV4OptionsTest
()
{
IpV4Options
actual
=
new
IpV4Options
(
new
IpV4OptionSecurity
(
IpV4OptionSecurityLevel
.
Unclassified
,
12345
,
54321
,
(
UInt24
)
123456
));
IpV4Options
expected
=
new
IpV4Options
(
new
IpV4OptionSecurity
(
IpV4OptionSecurityLevel
.
Unclassified
,
12345
,
54321
,
(
UInt24
)
123456
),
IpV4Option
.
End
);
Assert
.
AreEqual
(
expected
,
actual
);
Assert
.
IsTrue
(
expected
.
IsValid
);
Assert
.
IsTrue
(
actual
.
IsValid
);
}
[
TestMethod
]
[
TestMethod
]
[
ExpectedException
(
typeof
(
ArgumentOutOfRangeException
))]
[
ExpectedException
(
typeof
(
ArgumentOutOfRangeException
))]
public
void
IpV4OptionTimestampOverflowErrorTest
()
public
void
IpV4OptionTimestampOverflowErrorTest
()
...
...
PcapDotNet/src/PcapDotNet.Packets.TestUtils/MoreRandomPackets.cs
View file @
1d2fe8dd
...
@@ -92,7 +92,7 @@ namespace PcapDotNet.Packets.TestUtils
...
@@ -92,7 +92,7 @@ namespace PcapDotNet.Packets.TestUtils
throw
new
ArgumentOutOfRangeException
(
"maximumOptionLength"
,
maximumOptionLength
,
"option length must be positive"
);
throw
new
ArgumentOutOfRangeException
(
"maximumOptionLength"
,
maximumOptionLength
,
"option length must be positive"
);
List
<
IpV4OptionType
>
impossibleOptionTypes
=
new
List
<
IpV4OptionType
>();
List
<
IpV4OptionType
>
impossibleOptionTypes
=
new
List
<
IpV4OptionType
>();
if
(
maximumOptionLength
<
IpV4OptionSecurity
.
OptionLength
)
if
(
maximumOptionLength
<
IpV4OptionSecurity
.
Option
Minimum
Length
)
impossibleOptionTypes
.
Add
(
IpV4OptionType
.
Security
);
impossibleOptionTypes
.
Add
(
IpV4OptionType
.
Security
);
if
(
maximumOptionLength
<
IpV4OptionRoute
.
OptionMinimumLength
)
if
(
maximumOptionLength
<
IpV4OptionRoute
.
OptionMinimumLength
)
{
{
...
@@ -114,8 +114,13 @@ namespace PcapDotNet.Packets.TestUtils
...
@@ -114,8 +114,13 @@ namespace PcapDotNet.Packets.TestUtils
return
IpV4Option
.
Nop
;
return
IpV4Option
.
Nop
;
case
IpV4OptionType
.
Security
:
case
IpV4OptionType
.
Security
:
return
new
IpV4OptionSecurity
(
random
.
NextEnum
<
IpV4OptionSecurityLevel
>(),
random
.
NextUShort
(),
random
.
NextUShort
(),
IpV4OptionSecurityProtectionAuthority
protectionAuthority
=
IpV4OptionSecurityProtectionAuthority
.
None
;
random
.
NextUInt24
());
int
protectionAuthorityLength
=
random
.
Next
(
maximumOptionLength
-
IpV4OptionSecurity
.
OptionMinimumLength
);
if
(
protectionAuthorityLength
>
0
)
protectionAuthority
=
random
.
NextEnum
<
IpV4OptionSecurityProtectionAuthority
>();
return
new
IpV4OptionSecurity
(
random
.
NextEnum
<
IpV4OptionSecurityClassificationLevel
>(),
protectionAuthority
,
(
byte
)(
IpV4OptionSecurity
.
OptionMinimumLength
+
protectionAuthorityLength
));
case
IpV4OptionType
.
LooseSourceRouting
:
case
IpV4OptionType
.
LooseSourceRouting
:
case
IpV4OptionType
.
StrictSourceRouting
:
case
IpV4OptionType
.
StrictSourceRouting
:
...
...
PcapDotNet/src/PcapDotNet.Packets/CodeAnalysisDictionary.xml
View file @
1d2fe8dd
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
<Word>
endianity
</Word>
<Word>
endianity
</Word>
<Word>
prespecified
</Word>
<Word>
prespecified
</Word>
<Word>
ttl
</Word>
<Word>
ttl
</Word>
<Word>
mmmm
</Word>
<!-- Still couldn't find out what this mean -->
<Word>
satnet
</Word>
<Word>
satnet
</Word>
<Word>
bbn
</Word>
<!-- Probably BBN Technologies (originally Bolt, Beranek and Newman) -->
<Word>
bbn
</Word>
<!-- Probably BBN Technologies (originally Bolt, Beranek and Newman) -->
<Word>
aris
</Word>
<Word>
aris
</Word>
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSecurity.cs
View file @
1d2fe8dd
This diff is collapsed.
Click to expand it.
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSecurityLevel.cs
→
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSecurity
Classification
Level.cs
View file @
1d2fe8dd
namespace
PcapDotNet.Packets.IpV4
namespace
PcapDotNet.Packets.IpV4
{
{
/// <summary>
/// <summary>
/// Security (S field): 16 bits
/// This field specifies the (U.S.) classification level at which the datagram must be protected.
/// </summary>
/// The information in the datagram must be protected at this level.
public
enum
IpV4OptionSecurityLevel
:
ushort
/// The bit string values in this table were chosen to achieve a minimum Hamming distance of four (4) between any two valid values.
/// This specific assignment of classification level names to values has been defined for compatibility
/// with security devices which have already been developed and deployed.
/// </summary>
public
enum
IpV4OptionSecurityClassificationLevel
:
byte
{
{
/// <summary>
/// <summary>
/// Unclassified
/// Top Secret
/// </summary>
Unclassified
=
0x0000
,
/// <summary>
/// Confidential
/// </summary>
Confidential
=
0xF135
,
/// <summary>
/// Encrypted For Transmission Only (EFTO)
/// </summary>
EncryptedForTransmissionOnly
=
0x789A
,
/// <summary>
/// MMMM
/// </summary>
Mmmm
=
0xBC4D
,
/// <summary>
/// PROG
/// </summary>
/// </summary>
Prog
=
0x5E26
,
TopSecret
=
0x3D
,
/// <summary>
/// <summary>
///
Restricted
///
Secret
/// </summary>
/// </summary>
Restricted
=
0xAF13
,
Secret
=
0x5A
,
/// <summary>
/// <summary>
///
Secret
///
Confidential
/// </summary>
/// </summary>
Secret
=
0xD788
,
Confidential
=
0x96
,
/// <summary>
/// <summary>
///
Top Secret
///
Unclassified
/// </summary>
/// </summary>
TopSecret
=
0x6BC5
Unclassified
=
0xAB
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSecurityProtectionAuthority.cs
0 → 100644
View file @
1d2fe8dd
using
System
;
namespace
PcapDotNet.Packets.IpV4
{
/// <summary>
/// This field identifies the National Access Programs or Special Access Programs
/// which specify protection rules for transmission and processing of the information contained in the datagram.
/// Protection authority flags do NOT represent accreditation authorities, though the semantics are superficially similar.
/// </summary>
[
Flags
]
public
enum
IpV4OptionSecurityProtectionAuthority
:
byte
{
/// <summary>
/// No protection authorities.
/// </summary>
None
=
0x00
,
/// <summary>
/// Designated Approving Authority per DOD 5200.28
/// </summary>
Genser
=
0x80
,
/// <summary>
/// Single Integrated Operational Plan - Extremely Sensitive Information (SIOP-ESI).
/// Department of Defense Organization of the Joint Chiefs of Staff
/// Attn: J6 Washington, DC 20318-6000
/// </summary>
SingleIntegrationOptionalPlanExtremelySensitiveInformation
=
0x40
,
/// <summary>
/// Sensitive Compartmented Information (SCI).
/// Director of Central Intelligence
/// Attn: Chairman, Information Handling Committee, Intelligence Community Staff Washington, D.C. 20505
/// </summary>
SensitiveCompartmentedInformation
=
0x20
,
/// <summary>
/// National Security Agency (NSA).
/// 9800 Savage Road Attn: T03 Ft. Meade, MD 20755-6000
/// </summary>
Nsa
=
0x10
,
/// <summary>
/// Department of Energy (DOE).
/// Attn: DP343.2 Washington, DC 20545
/// </summary>
DeparmentOfEnergy
=
0x08
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionType.cs
View file @
1d2fe8dd
...
@@ -31,8 +31,8 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -31,8 +31,8 @@ namespace PcapDotNet.Packets.IpV4
NoOperation
=
1
,
NoOperation
=
1
,
/// <summary>
/// <summary>
///
Security.
///
DoD Basic Security:
/// Used to carry
Security, Compartmentation, User Group (TCC), and Handling Restriction Codes compatible with DOD requirement
s.
/// Used to carry
the classification level and protection authority flag
s.
/// </summary>
/// </summary>
Security
=
130
,
Security
=
130
,
...
...
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
View file @
1d2fe8dd
...
@@ -75,12 +75,13 @@
...
@@ -75,12 +75,13 @@
<Compile
Include=
"IpV4\IpV4Option.cs"
/>
<Compile
Include=
"IpV4\IpV4Option.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionComplex.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionComplex.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionLooseSourceRouting.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionLooseSourceRouting.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionSecurityProtectionAuthority.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionSimple.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionSimple.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionRecordRoute.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionRecordRoute.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionRoute.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionRoute.cs"
/>
<Compile
Include=
"IpV4\IpV4Options.cs"
/>
<Compile
Include=
"IpV4\IpV4Options.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionSecurity.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionSecurity.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionSecurityLevel.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionSecurity
Classification
Level.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionStreamIdentifier.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionStreamIdentifier.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionStrictSourceRouting.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionStrictSourceRouting.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionTimedAddress.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionTimedAddress.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