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
c04ed979
Commit
c04ed979
authored
Aug 01, 2009
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IpV4
Code Analysis
parent
f96304cf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
826 additions
and
250 deletions
+826
-250
PcapDotNet.4.5.resharper
PcapDotNet/src/PcapDotNet.4.5.resharper
+21
-1
CodeAnalysisDictionary.xml
PcapDotNet/src/PcapDotNet.Base/CodeAnalysisDictionary.xml
+25
-0
PcapDotNet.Base.csproj
PcapDotNet/src/PcapDotNet.Base/PcapDotNet.Base.csproj
+7
-0
AssemblyInfo.cs
PcapDotNet/src/PcapDotNet.Base/Properties/AssemblyInfo.cs
+4
-1
UInt24.cs
PcapDotNet/src/PcapDotNet.Base/UInt24.cs
+27
-1
PcapDotNet.Console.csproj
PcapDotNet/src/PcapDotNet.Console/PcapDotNet.Console.csproj
+0
-106
PcapDotNet.Console.csproj.vspscc
...t/src/PcapDotNet.Console/PcapDotNet.Console.csproj.vspscc
+0
-10
Program.cs
PcapDotNet/src/PcapDotNet.Console/Program.cs
+0
-21
AssemblyInfo.cs
PcapDotNet/src/PcapDotNet.Console/Properties/AssemblyInfo.cs
+0
-36
DumpPacketsTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/DumpPacketsTests.cs
+2
-2
WinPCapDotNet.Core.vcproj
PcapDotNet/src/PcapDotNet.Core/WinPCapDotNet.Core.vcproj
+4
-4
IpV4Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4Tests.cs
+5
-5
CodeAnalysisDictionary.xml
PcapDotNet/src/PcapDotNet.Packets/CodeAnalysisDictionary.xml
+32
-1
Datagram.cs
PcapDotNet/src/PcapDotNet.Packets/Datagram.cs
+23
-1
IpV4Address.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Address.cs
+9
-8
IpV4Fragmentation.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Fragmentation.cs
+20
-5
IpV4FragmentationOptions.cs
...t/src/PcapDotNet.Packets/IpV4/IpV4FragmentationOptions.cs
+3
-3
IpV4Option.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Option.cs
+5
-0
IpV4OptionRoute.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRoute.cs
+7
-0
IpV4OptionSecurity.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSecurity.cs
+8
-0
IpV4OptionSecurityLevel.cs
...et/src/PcapDotNet.Packets/IpV4/IpV4OptionSecurityLevel.cs
+3
-3
IpV4OptionStreamIdentifier.cs
...src/PcapDotNet.Packets/IpV4/IpV4OptionStreamIdentifier.cs
+6
-0
IpV4OptionTimestamp.cs
...DotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestamp.cs
+8
-0
IpV4OptionTimestampAndAddress.cs
.../PcapDotNet.Packets/IpV4/IpV4OptionTimestampAndAddress.cs
+8
-0
IpV4OptionTimestampOnly.cs
...et/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampOnly.cs
+6
-0
IpV4OptionTimestampType.cs
...et/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampType.cs
+0
-1
IpV4Options.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Options.cs
+6
-0
IpV4Protocol.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Protocol.cs
+560
-1
MoreByteArray.cs
PcapDotNet/src/PcapDotNet.Packets/MoreByteArray.cs
+2
-0
PacketBuilder.cs
PcapDotNet/src/PcapDotNet.Packets/PacketBuilder.cs
+1
-1
PcapDotNet.Packets.csproj
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
+5
-3
PcapDotNet.sln
PcapDotNet/src/PcapDotNet.sln
+19
-36
No files found.
PcapDotNet/src/PcapDotNet.4.5.resharper
View file @
c04ed979
...
@@ -30,7 +30,27 @@
...
@@ -30,7 +30,27 @@
<WRAP_LIMIT>150</WRAP_LIMIT>
<WRAP_LIMIT>150</WRAP_LIMIT>
</FormatSettings>
</FormatSettings>
<UsingsSettings />
<UsingsSettings />
<Naming2 />
<Naming2>
<ExceptionName IsNull="False">
</ExceptionName>
<OverrideDefaultSettings>True</OverrideDefaultSettings>
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />
<PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />
<PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
</Naming2>
</CSharp>
</CSharp>
<VB>
<VB>
<FormatSettings>
<FormatSettings>
...
...
PcapDotNet/src/PcapDotNet.Base/CodeAnalysisDictionary.xml
0 → 100644
View file @
c04ed979
<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
<Words>
<Unrecognized>
<!--Word>cb</Word-->
</Unrecognized>
<Recognized>
<Word>
pcap
</Word>
</Recognized>
<Deprecated>
<!--Term PreferredAlternate="EnterpriseServices">complus</Term-->
</Deprecated>
<Compound>
<!--Term CompoundAlternate="DataStore">datastore</Term-->
</Compound>
<DiscreteExceptions>
<!--Term>netmask</Term-->
</DiscreteExceptions>
</Words>
<Acronyms>
<CasingExceptions>
<!-->Acronym>Ip</Acronym-->
</CasingExceptions>
</Acronyms>
</Dictionary>
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Base/PcapDotNet.Base.csproj
View file @
c04ed979
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
<RunCodeAnalysis>
true
</RunCodeAnalysis>
<DocumentationFile>
..\..\bin\Debug\PcapDotNet.Base.XML
</DocumentationFile>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<DebugType>
pdbonly
</DebugType>
...
@@ -35,6 +37,8 @@
...
@@ -35,6 +37,8 @@
<DefineConstants>
TRACE
</DefineConstants>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
<RunCodeAnalysis>
true
</RunCodeAnalysis>
<DocumentationFile>
..\..\bin\Release\PcapDotNet.Base.XML
</DocumentationFile>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System"
/>
...
@@ -57,6 +61,9 @@
...
@@ -57,6 +61,9 @@
<ItemGroup>
<ItemGroup>
<None
Include=
"..\PcapDotNet.snk"
/>
<None
Include=
"..\PcapDotNet.snk"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary
Include=
"CodeAnalysisDictionary.xml"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Other similar extension points exist, see Microsoft.Common.targets.
...
...
PcapDotNet/src/PcapDotNet.Base/Properties/AssemblyInfo.cs
View file @
c04ed979
using
System.Reflection
;
using
System
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
...
@@ -34,3 +35,5 @@ using System.Runtime.InteropServices;
...
@@ -34,3 +35,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CLSCompliant(true)]
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Base/UInt24.cs
View file @
c04ed979
...
@@ -30,8 +30,34 @@ namespace PcapDotNet.Base
...
@@ -30,8 +30,34 @@ namespace PcapDotNet.Base
return
_mostSignificant
<<
16
+
_leastSignificant
;
return
_mostSignificant
<<
16
+
_leastSignificant
;
}
}
public
bool
Equals
(
UInt24
other
)
{
return
other
.
_mostSignificant
==
_mostSignificant
&&
other
.
_leastSignificant
==
_leastSignificant
;
}
public
override
bool
Equals
(
object
obj
)
{
return
(
obj
is
UInt24
)
&&
Equals
((
UInt24
)
obj
);
}
public
static
bool
operator
==(
UInt24
value1
,
UInt24
value2
)
{
return
value1
.
Equals
(
value2
);
}
public
static
bool
operator
!=(
UInt24
value1
,
UInt24
value2
)
{
return
!(
value1
==
value2
);
}
public
override
int
GetHashCode
()
{
return
this
;
}
private
readonly
byte
_mostSignificant
;
private
readonly
byte
_mostSignificant
;
private
readonly
ushort
_leastSignificant
;
private
readonly
ushort
_leastSignificant
;
}
}
}
}
PcapDotNet/src/PcapDotNet.Console/PcapDotNet.Console.csproj
deleted
100644 → 0
View file @
f96304cf
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"3.5"
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
9.0.21022
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}
</ProjectGuid>
<OutputType>
Exe
</OutputType>
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
WinPcapDotNet.Console
</RootNamespace>
<AssemblyName>
WinPcapDotNet.Console
</AssemblyName>
<TargetFrameworkVersion>
v3.5
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<PublishUrl>
publish\
</PublishUrl>
<Install>
true
</Install>
<InstallFrom>
Disk
</InstallFrom>
<UpdateEnabled>
false
</UpdateEnabled>
<UpdateMode>
Foreground
</UpdateMode>
<UpdateInterval>
7
</UpdateInterval>
<UpdateIntervalUnits>
Days
</UpdateIntervalUnits>
<UpdatePeriodically>
false
</UpdatePeriodically>
<UpdateRequired>
false
</UpdateRequired>
<MapFileExtensions>
true
</MapFileExtensions>
<ApplicationRevision>
0
</ApplicationRevision>
<ApplicationVersion>
1.0.0.%2a
</ApplicationVersion>
<IsWebBootstrapper>
false
</IsWebBootstrapper>
<UseApplicationTrust>
false
</UseApplicationTrust>
<BootstrapperEnabled>
true
</BootstrapperEnabled>
<SccProjectName>
SAK
</SccProjectName>
<SccLocalPath>
SAK
</SccLocalPath>
<SccAuxPath>
SAK
</SccAuxPath>
<SccProvider>
SAK
</SccProvider>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
..\..\bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
..\..\bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Xml.Linq"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data.DataSetExtensions"
>
<RequiredTargetFramework>
3.5
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\PcapDotNet.Core\WinPCapDotNet.Core.vcproj"
>
<Project>
{89C63BE1-AF9A-472E-B256-A4F56B1655A7}
</Project>
<Name>
PcapDotNet.Core
</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage
Include=
"Microsoft.Net.Framework.2.0"
>
<Visible>
False
</Visible>
<ProductName>
.NET Framework 2.0 %28x86%29
</ProductName>
<Install>
false
</Install>
</BootstrapperPackage>
<BootstrapperPackage
Include=
"Microsoft.Net.Framework.3.0"
>
<Visible>
False
</Visible>
<ProductName>
.NET Framework 3.0 %28x86%29
</ProductName>
<Install>
false
</Install>
</BootstrapperPackage>
<BootstrapperPackage
Include=
"Microsoft.Net.Framework.3.5"
>
<Visible>
False
</Visible>
<ProductName>
.NET Framework 3.5
</ProductName>
<Install>
true
</Install>
</BootstrapperPackage>
<BootstrapperPackage
Include=
"Microsoft.Windows.Installer.3.1"
>
<Visible>
False
</Visible>
<ProductName>
Windows Installer 3.1
</ProductName>
<Install>
true
</Install>
</BootstrapperPackage>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Console/PcapDotNet.Console.csproj.vspscc
deleted
100644 → 0
View file @
f96304cf
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
PcapDotNet/src/PcapDotNet.Console/Program.cs
deleted
100644 → 0
View file @
f96304cf
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Text
;
using
PcapDotNet
;
using
PcapDotNet.Core
;
namespace
WinPcapDotNet.Console
{
class
Program
{
/// <summary>
///
/// </summary>
/// <param name="args"></param>
static
void
Main
(
string
[]
args
)
{
}
}
}
PcapDotNet/src/PcapDotNet.Console/Properties/AssemblyInfo.cs
deleted
100644 → 0
View file @
f96304cf
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PcapDotNet.Console")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PcapDotNet.Console")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("97b50e85-bf8b-4d86-8e5c-3f84732e9a3d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
PcapDotNet/src/PcapDotNet.Core.Test/DumpPacketsTests.cs
View file @
c04ed979
...
@@ -78,7 +78,7 @@ namespace PcapDotNet.Core.Test
...
@@ -78,7 +78,7 @@ namespace PcapDotNet.Core.Test
byte ipV4TypeOfService = random.NextByte();
byte ipV4TypeOfService = random.NextByte();
ushort ipV4Identification = random.NextUShort();
ushort ipV4Identification = random.NextUShort();
byte ipV4Ttl = random.NextByte();
byte ipV4Ttl = random.NextByte();
IpV4Fragmentation
Flags ipV4FragmentationFlags = random.NextEnum<IpV4FragmentationFlag
s>();
IpV4Fragmentation
Options ipV4FragmentationFlags = random.NextEnum<IpV4FragmentationOption
s>();
ushort ipV4FragmentationOffset = random.NextUShort();
ushort ipV4FragmentationOffset = random.NextUShort();
IpV4Fragmentation ipV4Fragmentation = new IpV4Fragmentation(ipV4FragmentationFlags, ipV4FragmentationOffset);
IpV4Fragmentation ipV4Fragmentation = new IpV4Fragmentation(ipV4FragmentationFlags, ipV4FragmentationOffset);
IpV4Protocol ipV4Protocol = random.NextEnum<IpV4Protocol>();
IpV4Protocol ipV4Protocol = random.NextEnum<IpV4Protocol>();
...
@@ -90,7 +90,7 @@ namespace PcapDotNet.Core.Test
...
@@ -90,7 +90,7 @@ namespace PcapDotNet.Core.Test
random.NextBytes(ipV4PayloadBuffer);
random.NextBytes(ipV4PayloadBuffer);
Datagram ipV4Payload = new Datagram(ipV4PayloadBuffer);
Datagram ipV4Payload = new Datagram(ipV4PayloadBuffer);
Packet packet = PacketBuilder.IpV4(DateTime.Now,
Packet packet = PacketBuilder.
Ethernet
IpV4(DateTime.Now,
ethernetSource, ethernetDestination, ethernetType,
ethernetSource, ethernetDestination, ethernetType,
ipV4TypeOfService, ipV4Identification, ipV4Fragmentation, ipV4Ttl, ipV4Protocol,
ipV4TypeOfService, ipV4Identification, ipV4Fragmentation, ipV4Ttl, ipV4Protocol,
ipV4Source, ipV4Destination, ipV4Options,
ipV4Source, ipV4Destination, ipV4Options,
...
...
PcapDotNet/src/PcapDotNet.Core/WinPCapDotNet.Core.vcproj
View file @
c04ed979
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
/>
/>
<Tool
<Tool
Name=
"VCFxCopTool"
Name=
"VCFxCopTool"
Rules=
"-Microsoft.Design#CA1021;-Microsoft.Design#CA1028;-Microsoft.Design#CA1027"
Rules=
"-Microsoft.Design#CA1021;-Microsoft.Design#CA1028;-Microsoft.Design#CA1027
;-Microsoft.Reliability#CA2004
"
EnableFxCop=
"true"
EnableFxCop=
"true"
Dictionaries=
"CodeAnalysisDictionary.xml"
Dictionaries=
"CodeAnalysisDictionary.xml"
/>
/>
...
@@ -103,7 +103,7 @@
...
@@ -103,7 +103,7 @@
<Tool
<Tool
Name=
"VCPostBuildEventTool"
Name=
"VCPostBuildEventTool"
Description=
"Build Release Files"
Description=
"Build Release Files"
CommandLine=
"cd $(OutDir)
zip Pcap.Net.Binary.zip $(TargetFileName) $(ProjectName).pdb $(ProjectName).xml"
CommandLine=
"cd $(OutDir)
zip Pcap.Net.Binary.zip $(TargetFileName) $(ProjectName).pdb $(ProjectName).xml


"
/>
/>
</Configuration>
</Configuration>
<Configuration
<Configuration
...
@@ -186,7 +186,7 @@
...
@@ -186,7 +186,7 @@
<Tool
<Tool
Name=
"VCPostBuildEventTool"
Name=
"VCPostBuildEventTool"
Description=
"Build Release Files"
Description=
"Build Release Files"
CommandLine=
"cd $(OutDir)
zip Pcap.Net.Binary.zip $(TargetFileName) $(ProjectName).pdb $(ProjectName).xml"
CommandLine=
"cd $(OutDir)
zip Pcap.Net.Binary.zip $(TargetFileName) $(ProjectName).pdb $(ProjectName).xml


"
/>
/>
</Configuration>
</Configuration>
</Configurations>
</Configurations>
...
@@ -208,7 +208,7 @@
...
@@ -208,7 +208,7 @@
/>
/>
<ProjectReference
<ProjectReference
ReferencedProjectIdentifier=
"{8A184AF5-E46C-482C-81A3-76D8CE290104}"
ReferencedProjectIdentifier=
"{8A184AF5-E46C-482C-81A3-76D8CE290104}"
RelativePathToProject=
".\P
ackets\
Packets.csproj"
RelativePathToProject=
".\P
capDotNet.Packets\PcapDotNet.
Packets.csproj"
/>
/>
</References>
</References>
<Files>
<Files>
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4Tests.cs
View file @
c04ed979
...
@@ -82,7 +82,7 @@ namespace PcapDotNet.Packets.Test
...
@@ -82,7 +82,7 @@ namespace PcapDotNet.Packets.Test
Assert
.
AreEqual
(
IpV4Datagram
.
HeaderMinimumLength
,
packet
.
Ethernet
.
IpV4
.
HeaderLength
,
"IP HeaderLength"
);
Assert
.
AreEqual
(
IpV4Datagram
.
HeaderMinimumLength
,
packet
.
Ethernet
.
IpV4
.
HeaderLength
,
"IP HeaderLength"
);
Assert
.
AreEqual
(
0
,
packet
.
Ethernet
.
IpV4
.
TypeOfService
,
"IP TypeOfService"
);
Assert
.
AreEqual
(
0
,
packet
.
Ethernet
.
IpV4
.
TypeOfService
,
"IP TypeOfService"
);
Assert
.
AreEqual
(
packet
.
Length
-
EthernetDatagram
.
HeaderLength
,
packet
.
Ethernet
.
IpV4
.
TotalLength
,
"IP TotalLength"
);
Assert
.
AreEqual
(
packet
.
Length
-
EthernetDatagram
.
HeaderLength
,
packet
.
Ethernet
.
IpV4
.
TotalLength
,
"IP TotalLength"
);
Assert
.
AreEqual
(
new
IpV4Fragmentation
(
IpV4Fragmentation
Flags
.
Don
tFragment
,
0
),
packet
.
Ethernet
.
IpV4
.
Fragmentation
,
"IP Fragmentation"
);
Assert
.
AreEqual
(
new
IpV4Fragmentation
(
IpV4Fragmentation
Options
.
DoNo
tFragment
,
0
),
packet
.
Ethernet
.
IpV4
.
Fragmentation
,
"IP Fragmentation"
);
Assert
.
AreEqual
(
128
,
packet
.
Ethernet
.
IpV4
.
Ttl
,
"IP Ttl"
);
Assert
.
AreEqual
(
128
,
packet
.
Ethernet
.
IpV4
.
Ttl
,
"IP Ttl"
);
Assert
.
AreEqual
(
IpV4Protocol
.
Tcp
,
packet
.
Ethernet
.
IpV4
.
Protocol
,
"IP Protocol"
);
Assert
.
AreEqual
(
IpV4Protocol
.
Tcp
,
packet
.
Ethernet
.
IpV4
.
Protocol
,
"IP Protocol"
);
Assert
.
AreEqual
(
0x9010
,
packet
.
Ethernet
.
IpV4
.
HeaderChecksum
,
"IP HeaderChecksum"
);
Assert
.
AreEqual
(
0x9010
,
packet
.
Ethernet
.
IpV4
.
HeaderChecksum
,
"IP HeaderChecksum"
);
...
@@ -106,9 +106,9 @@ namespace PcapDotNet.Packets.Test
...
@@ -106,9 +106,9 @@ namespace PcapDotNet.Packets.Test
byte
ipV4TypeOfService
=
random
.
NextByte
();
byte
ipV4TypeOfService
=
random
.
NextByte
();
ushort
ipV4Identification
=
random
.
NextUShort
();
ushort
ipV4Identification
=
random
.
NextUShort
();
byte
ipV4Ttl
=
random
.
NextByte
();
byte
ipV4Ttl
=
random
.
NextByte
();
IpV4Fragmentation
Flags
ipV4FragmentationFlags
=
random
.
NextEnum
<
IpV4FragmentationFlag
s
>();
IpV4Fragmentation
Options
ipV4FragmentationOptions
=
random
.
NextEnum
<
IpV4FragmentationOption
s
>();
ushort
ipV4FragmentationOffset
=
random
.
NextUShort
();
ushort
ipV4FragmentationOffset
=
random
.
NextUShort
();
IpV4Fragmentation
ipV4Fragmentation
=
new
IpV4Fragmentation
(
ipV4Fragmentation
Flag
s
,
ipV4FragmentationOffset
);
IpV4Fragmentation
ipV4Fragmentation
=
new
IpV4Fragmentation
(
ipV4Fragmentation
Option
s
,
ipV4FragmentationOffset
);
IpV4Protocol
ipV4Protocol
=
random
.
NextEnum
<
IpV4Protocol
>();
IpV4Protocol
ipV4Protocol
=
random
.
NextEnum
<
IpV4Protocol
>();
IpV4Address
ipV4Source
=
new
IpV4Address
(
random
.
NextUInt
());
IpV4Address
ipV4Source
=
new
IpV4Address
(
random
.
NextUInt
());
IpV4Address
ipV4Destination
=
new
IpV4Address
(
random
.
NextUInt
());
IpV4Address
ipV4Destination
=
new
IpV4Address
(
random
.
NextUInt
());
...
@@ -118,7 +118,7 @@ namespace PcapDotNet.Packets.Test
...
@@ -118,7 +118,7 @@ namespace PcapDotNet.Packets.Test
random
.
NextBytes
(
ipV4PayloadBuffer
);
random
.
NextBytes
(
ipV4PayloadBuffer
);
Datagram
ipV4Payload
=
new
Datagram
(
ipV4PayloadBuffer
);
Datagram
ipV4Payload
=
new
Datagram
(
ipV4PayloadBuffer
);
Packet
packet
=
PacketBuilder
.
IpV4
(
DateTime
.
Now
,
Packet
packet
=
PacketBuilder
.
Ethernet
IpV4
(
DateTime
.
Now
,
ethernetSource
,
ethernetDestination
,
ethernetType
,
ethernetSource
,
ethernetDestination
,
ethernetType
,
ipV4TypeOfService
,
ipV4Identification
,
ipV4Fragmentation
,
ipV4Ttl
,
ipV4Protocol
,
ipV4TypeOfService
,
ipV4Identification
,
ipV4Fragmentation
,
ipV4Ttl
,
ipV4Protocol
,
ipV4Source
,
ipV4Destination
,
ipV4Options
,
ipV4Source
,
ipV4Destination
,
ipV4Options
,
...
@@ -139,7 +139,7 @@ namespace PcapDotNet.Packets.Test
...
@@ -139,7 +139,7 @@ namespace PcapDotNet.Packets.Test
Assert
.
AreEqual
(
packet
.
Length
-
EthernetDatagram
.
HeaderLength
,
packet
.
Ethernet
.
IpV4
.
TotalLength
,
"IP TotalLength"
);
Assert
.
AreEqual
(
packet
.
Length
-
EthernetDatagram
.
HeaderLength
,
packet
.
Ethernet
.
IpV4
.
TotalLength
,
"IP TotalLength"
);
Assert
.
AreEqual
(
ipV4Identification
,
packet
.
Ethernet
.
IpV4
.
Identification
,
"IP Identification"
);
Assert
.
AreEqual
(
ipV4Identification
,
packet
.
Ethernet
.
IpV4
.
Identification
,
"IP Identification"
);
Assert
.
AreEqual
(
ipV4Fragmentation
,
packet
.
Ethernet
.
IpV4
.
Fragmentation
,
"IP Fragmentation"
);
Assert
.
AreEqual
(
ipV4Fragmentation
,
packet
.
Ethernet
.
IpV4
.
Fragmentation
,
"IP Fragmentation"
);
Assert
.
AreEqual
(
ipV4Fragmentation
.
Flags
,
packet
.
Ethernet
.
IpV4
.
Fragmentation
.
Flag
s
,
"IP Fragmentation"
);
Assert
.
AreEqual
(
ipV4Fragmentation
.
Options
,
packet
.
Ethernet
.
IpV4
.
Fragmentation
.
Option
s
,
"IP Fragmentation"
);
Assert
.
AreEqual
(
ipV4Fragmentation
.
Offset
,
packet
.
Ethernet
.
IpV4
.
Fragmentation
.
Offset
,
"IP Fragmentation"
);
Assert
.
AreEqual
(
ipV4Fragmentation
.
Offset
,
packet
.
Ethernet
.
IpV4
.
Fragmentation
.
Offset
,
"IP Fragmentation"
);
Assert
.
AreEqual
(
ipV4Ttl
,
packet
.
Ethernet
.
IpV4
.
Ttl
,
"IP Ttl"
);
Assert
.
AreEqual
(
ipV4Ttl
,
packet
.
Ethernet
.
IpV4
.
Ttl
,
"IP Ttl"
);
Assert
.
AreEqual
(
ipV4Protocol
,
packet
.
Ethernet
.
IpV4
.
Protocol
,
"IP Protocol"
);
Assert
.
AreEqual
(
ipV4Protocol
,
packet
.
Ethernet
.
IpV4
.
Protocol
,
"IP Protocol"
);
...
...
PcapDotNet/src/PcapDotNet.Packets/CodeAnalysisDictionary.xml
View file @
c04ed979
...
@@ -5,7 +5,35 @@
...
@@ -5,7 +5,35 @@
<!--Word>cb</Word-->
<!--Word>cb</Word-->
</Unrecognized>
</Unrecognized>
<Recognized>
<Recognized>
<Word>
Endianity
</Word>
<Word>
pcap
</Word>
<Word>
endianity
</Word>
<Word>
prespecified
</Word>
<Word>
ttl
</Word>
<Word>
mmmm
</Word>
<!-- Still couldn't find out what this mean -->
<Word>
satnet
</Word>
<Word>
bbn
</Word>
<!-- Probably BBN Technologies (originally Bolt, Beranek and Newman) -->
<Word>
aris
</Word>
<Word>
ax
</Word>
<Word>
cbt
</Word>
<Word>
cftp
</Word>
<!-- maybe Configurable Fault Tolerant Processor -->
<Word>
dcn
</Word>
<Word>
emcon
</Word>
<Word>
fibre
</Word>
<Word>
gmtp
</Word>
<Word>
iplt
</Word>
<Word>
ipsilon
</Word>
<!-- As in Ipsilon Networks -->
<Word>
kryptolan
</Word>
<Word>
internodal
</Word>
<Word>
qnx
</Word>
<!-- www.qnx.com -->
<Word>
expak
</Word>
<Word>
sitara
</Word>
<Word>
tcf
</Word>
<Word>
ttp
</Word>
<Word>
lite
</Word>
<Word>
uti
</Word>
<Word>
rcc
</Word>
<Word>
internetwork
</Word>
<Word>
multiprotocol
</Word>
</Recognized>
</Recognized>
<Deprecated>
<Deprecated>
<!--Term PreferredAlternate="EnterpriseServices">complus</Term-->
<!--Term PreferredAlternate="EnterpriseServices">complus</Term-->
...
@@ -20,6 +48,9 @@
...
@@ -20,6 +48,9 @@
<Acronyms>
<Acronyms>
<CasingExceptions>
<CasingExceptions>
<Acronym>
Ip
</Acronym>
<Acronym>
Ip
</Acronym>
<Acronym>
Sm
</Acronym>
<Acronym>
Nd
</Acronym>
<Acronym>
Ns
</Acronym>
</CasingExceptions>
</CasingExceptions>
</Acronyms>
</Acronyms>
</Dictionary>
</Dictionary>
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Datagram.cs
View file @
c04ed979
using
System
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Linq
;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
public
class
Datagram
:
IEquatable
<
Datagram
>
public
class
Datagram
:
IEquatable
<
Datagram
>
,
IEnumerable
<
byte
>
{
{
public
Datagram
(
byte
[]
buffer
)
public
Datagram
(
byte
[]
buffer
)
:
this
(
buffer
,
0
,
buffer
.
Length
)
:
this
(
buffer
,
0
,
buffer
.
Length
)
...
@@ -46,6 +49,17 @@ namespace PcapDotNet.Packets
...
@@ -46,6 +49,17 @@ namespace PcapDotNet.Packets
return
true
;
return
true
;
}
}
public
IEnumerator
<
byte
>
GetEnumerator
()
{
for
(
int
i
=
0
;
i
!=
Length
;
++
i
)
yield
return
this
[
i
];
}
IEnumerator
IEnumerable
.
GetEnumerator
()
{
return
GetEnumerator
();
}
public
bool
Equals
(
Datagram
other
)
public
bool
Equals
(
Datagram
other
)
{
{
if
(
Length
!=
other
.
Length
)
if
(
Length
!=
other
.
Length
)
...
@@ -65,6 +79,13 @@ namespace PcapDotNet.Packets
...
@@ -65,6 +79,13 @@ namespace PcapDotNet.Packets
return
Equals
(
obj
as
Datagram
);
return
Equals
(
obj
as
Datagram
);
}
}
public
override
int
GetHashCode
()
{
int
i
=
0
;
return
Length
.
GetHashCode
()
^
this
.
Aggregate
(
0
,
(
value
,
b
)
=>
value
^
(
b
<<
(
8
*
(
i
++
%
4
))));
}
internal
void
Write
(
byte
[]
buffer
,
int
offset
)
internal
void
Write
(
byte
[]
buffer
,
int
offset
)
{
{
System
.
Buffer
.
BlockCopy
(
_buffer
,
StartOffset
,
buffer
,
offset
,
Length
);
System
.
Buffer
.
BlockCopy
(
_buffer
,
StartOffset
,
buffer
,
offset
,
Length
);
...
@@ -87,6 +108,7 @@ namespace PcapDotNet.Packets
...
@@ -87,6 +108,7 @@ namespace PcapDotNet.Packets
return
_buffer
.
ReadUShort
(
StartOffset
+
offset
,
endianity
);
return
_buffer
.
ReadUShort
(
StartOffset
+
offset
,
endianity
);
}
}
[
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessage
(
"Microsoft.Naming"
,
"CA1720:IdentifiersShouldNotContainTypeNames"
,
MessageId
=
"uint"
)]
protected
uint
ReadUInt
(
int
offset
,
Endianity
endianity
)
protected
uint
ReadUInt
(
int
offset
,
Endianity
endianity
)
{
{
return
_buffer
.
ReadUInt
(
StartOffset
+
offset
,
endianity
);
return
_buffer
.
ReadUInt
(
StartOffset
+
offset
,
endianity
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Address.cs
View file @
c04ed979
using
System.Globalization
;
using
System.Text
;
using
System.Text
;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
...
@@ -12,10 +13,10 @@ namespace PcapDotNet.Packets
...
@@ -12,10 +13,10 @@ namespace PcapDotNet.Packets
public
IpV4Address
(
string
value
)
public
IpV4Address
(
string
value
)
{
{
string
[]
values
=
value
.
Split
(
'.'
);
string
[]
values
=
value
.
Split
(
'.'
);
_value
=
(
uint
)((
byte
.
Parse
(
values
[
0
])
<<
24
)
+
_value
=
(
uint
)((
byte
.
Parse
(
values
[
0
]
,
CultureInfo
.
InvariantCulture
)
<<
24
)
+
(
byte
.
Parse
(
values
[
1
])
<<
16
)
+
(
byte
.
Parse
(
values
[
1
]
,
CultureInfo
.
InvariantCulture
)
<<
16
)
+
(
byte
.
Parse
(
values
[
2
])
<<
8
)
+
(
byte
.
Parse
(
values
[
2
]
,
CultureInfo
.
InvariantCulture
)
<<
8
)
+
(
byte
.
Parse
(
values
[
3
])));
(
byte
.
Parse
(
values
[
3
]
,
CultureInfo
.
InvariantCulture
)));
}
}
public
static
IpV4Address
Zero
public
static
IpV4Address
Zero
...
@@ -48,14 +49,14 @@ namespace PcapDotNet.Packets
...
@@ -48,14 +49,14 @@ namespace PcapDotNet.Packets
Equals
((
IpV4Address
)
obj
));
Equals
((
IpV4Address
)
obj
));
}
}
public
static
bool
operator
==(
IpV4Address
ipV4Address1
,
IpV4Address
ipV4Address
2
)
public
static
bool
operator
==(
IpV4Address
value1
,
IpV4Address
value
2
)
{
{
return
ipV4Address1
.
Equals
(
ipV4Address
2
);
return
value1
.
Equals
(
value
2
);
}
}
public
static
bool
operator
!=(
IpV4Address
ipV4Address1
,
IpV4Address
ipV4Address
2
)
public
static
bool
operator
!=(
IpV4Address
value1
,
IpV4Address
value
2
)
{
{
return
!(
ipV4Address1
==
ipV4Address
2
);
return
!(
value1
==
value
2
);
}
}
public
override
int
GetHashCode
()
public
override
int
GetHashCode
()
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Fragmentation.cs
View file @
c04ed979
...
@@ -9,14 +9,14 @@ namespace PcapDotNet.Packets
...
@@ -9,14 +9,14 @@ namespace PcapDotNet.Packets
get
{
return
_none
;
}
get
{
return
_none
;
}
}
}
public
IpV4Fragmentation
(
IpV4Fragmentation
Flags
flag
s
,
ushort
offset
)
public
IpV4Fragmentation
(
IpV4Fragmentation
Options
option
s
,
ushort
offset
)
:
this
((
ushort
)((
ushort
)
flag
s
|
(
offset
/
8
)))
:
this
((
ushort
)((
ushort
)
option
s
|
(
offset
/
8
)))
{
{
}
}
public
IpV4Fragmentation
Flags
Flag
s
public
IpV4Fragmentation
Options
Option
s
{
{
get
{
return
(
IpV4Fragmentation
Flag
s
)(
_value
&
0xE000
);
}
get
{
return
(
IpV4Fragmentation
Option
s
)(
_value
&
0xE000
);
}
}
}
public
ushort
Offset
public
ushort
Offset
...
@@ -35,6 +35,21 @@ namespace PcapDotNet.Packets
...
@@ -35,6 +35,21 @@ namespace PcapDotNet.Packets
Equals
((
IpV4Fragmentation
)
obj
));
Equals
((
IpV4Fragmentation
)
obj
));
}
}
public
static
bool
operator
==(
IpV4Fragmentation
value1
,
IpV4Fragmentation
value2
)
{
return
value1
.
Equals
(
value2
);
}
public
static
bool
operator
!=(
IpV4Fragmentation
value1
,
IpV4Fragmentation
value2
)
{
return
!(
value1
==
value2
);
}
public
override
int
GetHashCode
()
{
return
_value
;
}
internal
IpV4Fragmentation
(
ushort
value
)
internal
IpV4Fragmentation
(
ushort
value
)
{
{
_value
=
value
;
_value
=
value
;
...
@@ -45,7 +60,7 @@ namespace PcapDotNet.Packets
...
@@ -45,7 +60,7 @@ namespace PcapDotNet.Packets
buffer
.
Write
(
offset
,
_value
,
Endianity
.
Big
);
buffer
.
Write
(
offset
,
_value
,
Endianity
.
Big
);
}
}
private
static
readonly
IpV4Fragmentation
_none
=
new
IpV4Fragmentation
(
IpV4Fragmentation
Flag
s
.
None
,
0
);
private
static
readonly
IpV4Fragmentation
_none
=
new
IpV4Fragmentation
(
IpV4Fragmentation
Option
s
.
None
,
0
);
private
readonly
ushort
_value
;
private
readonly
ushort
_value
;
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Fragmentation
Flag
s.cs
→
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Fragmentation
Option
s.cs
View file @
c04ed979
...
@@ -3,11 +3,11 @@ using System;
...
@@ -3,11 +3,11 @@ using System;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
[
Flags
]
[
Flags
]
public
enum
IpV4Fragmentation
Flag
s
:
ushort
public
enum
IpV4Fragmentation
Option
s
:
ushort
{
{
None
=
0x0
<<
13
,
None
=
0x0
<<
13
,
Reserved
=
0x4
<<
13
,
//
Reserved = 0x4 << 13,
Do
ntFragment
=
0x2
<<
13
,
Do
NotFragment
=
0x2
<<
13
,
MoreFragments
=
0x1
<<
13
MoreFragments
=
0x1
<<
13
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Option.cs
View file @
c04ed979
...
@@ -36,6 +36,11 @@ namespace PcapDotNet.Packets
...
@@ -36,6 +36,11 @@ namespace PcapDotNet.Packets
return
Equals
(
obj
as
IpV4Option
);
return
Equals
(
obj
as
IpV4Option
);
}
}
public
override
int
GetHashCode
()
{
return
(
byte
)
OptionType
;
}
protected
IpV4Option
(
IpV4OptionType
type
)
protected
IpV4Option
(
IpV4OptionType
type
)
{
{
_type
=
type
;
_type
=
type
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRoute.cs
View file @
c04ed979
...
@@ -38,6 +38,13 @@ namespace PcapDotNet.Packets
...
@@ -38,6 +38,13 @@ namespace PcapDotNet.Packets
return
Equals
(
other
as
IpV4OptionRoute
);
return
Equals
(
other
as
IpV4OptionRoute
);
}
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
PointedAddressIndex
^
_addresses
.
Aggregate
(
0
,
(
value
,
address
)
=>
value
^
address
.
GetHashCode
());
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSecurity.cs
View file @
c04ed979
...
@@ -63,6 +63,14 @@ namespace PcapDotNet.Packets
...
@@ -63,6 +63,14 @@ namespace PcapDotNet.Packets
return
Equals
(
other
as
IpV4OptionSecurity
);
return
Equals
(
other
as
IpV4OptionSecurity
);
}
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
(((
ushort
)
Level
<<
16
)
|
Compartments
)
^
(
HandlingRestrictions
<<
16
)
^
TransmissionControlCode
.
GetHashCode
();
}
internal
static
IpV4OptionSecurity
ReadOptionSecurity
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
internal
static
IpV4OptionSecurity
ReadOptionSecurity
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
{
{
if
(
length
<
OptionLength
-
1
)
if
(
length
<
OptionLength
-
1
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionSecurityLevel.cs
View file @
c04ed979
...
@@ -4,9 +4,9 @@ namespace PcapDotNet.Packets
...
@@ -4,9 +4,9 @@ namespace PcapDotNet.Packets
{
{
Unclassified
=
0x0000
,
Unclassified
=
0x0000
,
Confidential
=
0xF135
,
Confidential
=
0xF135
,
E
FTO
=
0x789A
,
E
ncryptedForTransmissionOnly
=
0x789A
,
M
MMM
=
0xBC4D
,
M
mmm
=
0xBC4D
,
P
ROG
=
0x5E26
,
P
rog
=
0x5E26
,
Restricted
=
0xAF13
,
Restricted
=
0xAF13
,
Secret
=
0xD788
,
Secret
=
0xD788
,
TopSecret
=
0x6BC5
TopSecret
=
0x6BC5
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionStreamIdentifier.cs
View file @
c04ed979
...
@@ -39,6 +39,12 @@ namespace PcapDotNet.Packets
...
@@ -39,6 +39,12 @@ namespace PcapDotNet.Packets
return
Equals
(
other
as
IpV4OptionStreamIdentifier
);
return
Equals
(
other
as
IpV4OptionStreamIdentifier
);
}
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
Identifier
.
GetHashCode
();
}
internal
static
IpV4OptionStreamIdentifier
ReadOptionStreamIdentifier
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
internal
static
IpV4OptionStreamIdentifier
ReadOptionStreamIdentifier
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
{
{
if
(
length
<
OptionLength
-
1
)
if
(
length
<
OptionLength
-
1
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestamp.cs
View file @
c04ed979
...
@@ -53,6 +53,14 @@ namespace PcapDotNet.Packets
...
@@ -53,6 +53,14 @@ namespace PcapDotNet.Packets
return
Equals
(
other
as
IpV4OptionTimestamp
);
return
Equals
(
other
as
IpV4OptionTimestamp
);
}
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
((
byte
)
TimestampType
<<
16
)
^
(
Overflow
<<
8
)
^
PointedIndex
;
}
internal
static
IpV4OptionTimestamp
ReadOptionTimestamp
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
internal
static
IpV4OptionTimestamp
ReadOptionTimestamp
(
byte
[]
buffer
,
ref
int
offset
,
int
length
)
{
{
if
(
length
<
OptionMinimumLength
-
1
)
if
(
length
<
OptionMinimumLength
-
1
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampAndAddress.cs
View file @
c04ed979
...
@@ -12,6 +12,14 @@ namespace PcapDotNet.Packets
...
@@ -12,6 +12,14 @@ namespace PcapDotNet.Packets
_addressesAndTimestamps
=
addressesAndTimestamps
;
_addressesAndTimestamps
=
addressesAndTimestamps
;
}
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
_addressesAndTimestamps
.
Aggregate
(
0
,
(
value
,
pair
)
=>
value
^
pair
.
Key
.
GetHashCode
()
^
pair
.
Value
.
GetHashCode
());
}
internal
static
IpV4OptionTimestampAndAddress
Read
(
IpV4OptionTimestampType
timestampType
,
byte
overflow
,
byte
pointedIndex
,
byte
[]
buffer
,
ref
int
offset
,
int
numValues
)
internal
static
IpV4OptionTimestampAndAddress
Read
(
IpV4OptionTimestampType
timestampType
,
byte
overflow
,
byte
pointedIndex
,
byte
[]
buffer
,
ref
int
offset
,
int
numValues
)
{
{
if
(
numValues
%
2
!=
0
)
if
(
numValues
%
2
!=
0
)
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampOnly.cs
View file @
c04ed979
...
@@ -11,6 +11,12 @@ namespace PcapDotNet.Packets
...
@@ -11,6 +11,12 @@ namespace PcapDotNet.Packets
_timestamps
=
timestamps
;
_timestamps
=
timestamps
;
}
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
()
^
_timestamps
.
Aggregate
(
0
,
(
value
,
timestamp
)
=>
value
^
timestamp
.
GetHashCode
());
}
internal
static
IpV4OptionTimestampOnly
Read
(
byte
overflow
,
byte
pointedIndex
,
byte
[]
buffer
,
ref
int
offset
,
int
numValues
)
internal
static
IpV4OptionTimestampOnly
Read
(
byte
overflow
,
byte
pointedIndex
,
byte
[]
buffer
,
ref
int
offset
,
int
numValues
)
{
{
TimeSpan
[]
timestamps
=
new
TimeSpan
[
numValues
];
TimeSpan
[]
timestamps
=
new
TimeSpan
[
numValues
];
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampType.cs
View file @
c04ed979
...
@@ -2,7 +2,6 @@ using System;
...
@@ -2,7 +2,6 @@ using System;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
[
Flags
]
public
enum
IpV4OptionTimestampType
:
byte
public
enum
IpV4OptionTimestampType
:
byte
{
{
TimestampOnly
=
0
,
TimestampOnly
=
0
,
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Options.cs
View file @
c04ed979
...
@@ -75,6 +75,12 @@ namespace PcapDotNet.Packets
...
@@ -75,6 +75,12 @@ namespace PcapDotNet.Packets
return
Equals
(
obj
as
IpV4Options
);
return
Equals
(
obj
as
IpV4Options
);
}
}
public
override
int
GetHashCode
()
{
return
Length
.
GetHashCode
()
^
_options
.
Aggregate
(
0
,
(
value
,
option
)
=>
value
^
option
.
GetHashCode
());
}
internal
void
Write
(
byte
[]
buffer
,
int
offset
)
internal
void
Write
(
byte
[]
buffer
,
int
offset
)
{
{
int
offsetEnd
=
offset
+
Length
;
int
offsetEnd
=
offset
+
Length
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Protocol.cs
View file @
c04ed979
This diff is collapsed.
Click to expand it.
PcapDotNet/src/PcapDotNet.Packets/MoreByteArray.cs
View file @
c04ed979
...
@@ -27,6 +27,7 @@ namespace PcapDotNet.Packets
...
@@ -27,6 +27,7 @@ namespace PcapDotNet.Packets
return
(
ushort
)
ReadShort
(
buffer
,
offset
,
endianity
);
return
(
ushort
)
ReadShort
(
buffer
,
offset
,
endianity
);
}
}
[
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessage
(
"Microsoft.Naming"
,
"CA1720:IdentifiersShouldNotContainTypeNames"
,
MessageId
=
"ushort"
)]
public
static
ushort
ReadUShort
(
this
byte
[]
buffer
,
ref
int
offset
,
Endianity
endianity
)
public
static
ushort
ReadUShort
(
this
byte
[]
buffer
,
ref
int
offset
,
Endianity
endianity
)
{
{
ushort
result
=
ReadUShort
(
buffer
,
offset
,
endianity
);
ushort
result
=
ReadUShort
(
buffer
,
offset
,
endianity
);
...
@@ -55,6 +56,7 @@ namespace PcapDotNet.Packets
...
@@ -55,6 +56,7 @@ namespace PcapDotNet.Packets
return
(
uint
)
ReadInt
(
buffer
,
offset
,
endianity
);
return
(
uint
)
ReadInt
(
buffer
,
offset
,
endianity
);
}
}
[
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessage
(
"Microsoft.Naming"
,
"CA1720:IdentifiersShouldNotContainTypeNames"
,
MessageId
=
"uint"
)]
public
static
uint
ReadUInt
(
this
byte
[]
buffer
,
ref
int
offset
,
Endianity
endianity
)
public
static
uint
ReadUInt
(
this
byte
[]
buffer
,
ref
int
offset
,
Endianity
endianity
)
{
{
uint
result
=
ReadUInt
(
buffer
,
offset
,
endianity
);
uint
result
=
ReadUInt
(
buffer
,
offset
,
endianity
);
...
...
PcapDotNet/src/PcapDotNet.Packets/PacketBuilder.cs
View file @
c04ed979
...
@@ -14,7 +14,7 @@ namespace PcapDotNet.Packets
...
@@ -14,7 +14,7 @@ namespace PcapDotNet.Packets
return
new
Packet
(
buffer
,
timestamp
,
new
DataLink
(
DataLinkKind
.
Ethernet
));
return
new
Packet
(
buffer
,
timestamp
,
new
DataLink
(
DataLinkKind
.
Ethernet
));
}
}
public
static
Packet
IpV4
(
DateTime
timestamp
,
public
static
Packet
Ethernet
IpV4
(
DateTime
timestamp
,
MacAddress
ethernetSource
,
MacAddress
ethernetDestination
,
EthernetType
ethernetType
,
MacAddress
ethernetSource
,
MacAddress
ethernetDestination
,
EthernetType
ethernetType
,
byte
ipV4TypeOfService
,
ushort
ipV4Identification
,
IpV4Fragmentation
ipV4Fragmentation
,
byte
ipV4TypeOfService
,
ushort
ipV4Identification
,
IpV4Fragmentation
ipV4Fragmentation
,
byte
ipV4Ttl
,
IpV4Protocol
ipV4Protocol
,
byte
ipV4Ttl
,
IpV4Protocol
ipV4Protocol
,
...
...
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
View file @
c04ed979
...
@@ -30,7 +30,8 @@
...
@@ -30,7 +30,8 @@
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
<AllowUnsafeBlocks>
true
</AllowUnsafeBlocks>
<AllowUnsafeBlocks>
true
</AllowUnsafeBlocks>
<RunCodeAnalysis>
true
</RunCodeAnalysis>
<RunCodeAnalysis>
true
</RunCodeAnalysis>
<CodeAnalysisRules>
-Microsoft.Design#CA1028
</CodeAnalysisRules>
<CodeAnalysisRules>
-Microsoft.Design#CA1021;-Microsoft.Design#CA1045;-Microsoft.Design#CA1028;-Microsoft.Naming#CA1710
</CodeAnalysisRules>
<DocumentationFile>
..\..\bin\Debug\PcapDotNet.Packets.XML
</DocumentationFile>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<DebugType>
pdbonly
</DebugType>
...
@@ -41,7 +42,8 @@
...
@@ -41,7 +42,8 @@
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
<AllowUnsafeBlocks>
true
</AllowUnsafeBlocks>
<AllowUnsafeBlocks>
true
</AllowUnsafeBlocks>
<RunCodeAnalysis>
true
</RunCodeAnalysis>
<RunCodeAnalysis>
true
</RunCodeAnalysis>
<CodeAnalysisRules>
-Microsoft.Design#CA1028
</CodeAnalysisRules>
<CodeAnalysisRules>
-Microsoft.Design#CA1021;-Microsoft.Design#CA1045;-Microsoft.Design#CA1028;-Microsoft.Naming#CA1710
</CodeAnalysisRules>
<DocumentationFile>
..\..\bin\Release\PcapDotNet.Packets.XML
</DocumentationFile>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System"
/>
...
@@ -68,7 +70,7 @@
...
@@ -68,7 +70,7 @@
<Compile
Include=
"IpV4\IpV4Address.cs"
/>
<Compile
Include=
"IpV4\IpV4Address.cs"
/>
<Compile
Include=
"IpV4\IpV4Datagram.cs"
/>
<Compile
Include=
"IpV4\IpV4Datagram.cs"
/>
<Compile
Include=
"IpV4\IpV4Fragmentation.cs"
/>
<Compile
Include=
"IpV4\IpV4Fragmentation.cs"
/>
<Compile
Include=
"IpV4\IpV4Fragmentation
Flag
s.cs"
/>
<Compile
Include=
"IpV4\IpV4Fragmentation
Option
s.cs"
/>
<Compile
Include=
"IpV4\IpV4Option.cs"
/>
<Compile
Include=
"IpV4\IpV4Option.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionEndOfOptionsList.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionEndOfOptionsList.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionLooseSourceRouting.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionLooseSourceRouting.cs"
/>
...
...
PcapDotNet/src/PcapDotNet.sln
View file @
c04ed979
Microsoft Visual Studio Solution File, Format Version 10.00
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PcapDotNet.Console", "PcapDotNet.Console\PcapDotNet.Console.csproj", "{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PcapDotNet.Core", "PcapDotNet.Core\WinPCapDotNet.Core.vcproj", "{89C63BE1-AF9A-472E-B256-A4F56B1655A7}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PcapDotNet.Core", "PcapDotNet.Core\WinPCapDotNet.Core.vcproj", "{89C63BE1-AF9A-472E-B256-A4F56B1655A7}"
EndProject
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PcapDotNet.Core.Test", "PcapDotNet.Core.Test\PcapDotNet.Core.Test.csproj", "{045A6460-C260-4CDA-8030-FD19A0086C95}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PcapDotNet.Core.Test", "PcapDotNet.Core.Test\PcapDotNet.Core.Test.csproj", "{045A6460-C260-4CDA-8030-FD19A0086C95}"
...
@@ -26,34 +24,31 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PcapDotNet.Packets.Test", "
...
@@ -26,34 +24,31 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PcapDotNet.Packets.Test", "
EndProject
EndProject
Global
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects =
9
SccNumberOfProjects =
8
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://tfs06.codeplex.com/
SccTeamFoundationServer = https://tfs06.codeplex.com/
SccLocalPath0 = .
SccLocalPath0 = .
SccProjectUniqueName1 = PcapDotNet.Core\\WinPCapDotNet.Core.vcproj
SccProjectUniqueName1 = PcapDotNet.Core\\WinPCapDotNet.Core.vcproj
SccProjectName1 = PcapDotNet.Core
SccProjectName1 = PcapDotNet.Core
SccLocalPath1 = PcapDotNet.Core
SccLocalPath1 = PcapDotNet.Core
SccProjectUniqueName2 = PcapDotNet.Console\\PcapDotNet.Console.csproj
SccProjectUniqueName2 = PcapDotNet.Core.Test\\PcapDotNet.Core.Test.csproj
SccProjectName2 = PcapDotNet.Console
SccProjectName2 = PcapDotNet.Core.Test
SccLocalPath2 = PcapDotNet.Console
SccLocalPath2 = PcapDotNet.Core.Test
SccProjectUniqueName3 = PcapDotNet.Core.Test\\PcapDotNet.Core.Test.csproj
SccProjectUniqueName3 = PcapDotNet.TestUtils\\PcapDotNet.TestUtils.csproj
SccProjectName3 = PcapDotNet.Core.Test
SccProjectName3 = PcapDotNet.TestUtils
SccLocalPath3 = PcapDotNet.Core.Test
SccLocalPath3 = PcapDotNet.TestUtils
SccProjectUniqueName4 = PcapDotNet.TestUtils\\PcapDotNet.TestUtils.csproj
SccProjectUniqueName4 = PcapDotNet.Packets.TestUtils\\PcapDotNet.Packets.TestUtils.csproj
SccProjectName4 = PcapDotNet.TestUtils
SccProjectName4 = PcapDotNet.Packets.TestUtils
SccLocalPath4 = PcapDotNet.TestUtils
SccLocalPath4 = PcapDotNet.Packets.TestUtils
SccProjectUniqueName5 = PcapDotNet.Packets.TestUtils\\PcapDotNet.Packets.TestUtils.csproj
SccProjectUniqueName5 = PcapDotNet.Base\\PcapDotNet.Base.csproj
SccProjectName5 = PcapDotNet.Packets.TestUtils
SccProjectName5 = PcapDotNet.Base
SccLocalPath5 = PcapDotNet.Packets.TestUtils
SccLocalPath5 = PcapDotNet.Base
SccProjectUniqueName6 = PcapDotNet.Base\\PcapDotNet.Base.csproj
SccProjectUniqueName6 = PcapDotNet.Packets.Test\\PcapDotNet.Packets.Test.csproj
SccProjectName6 = PcapDotNet.Base
SccProjectName6 = PcapDotNet.Packets.Test
SccLocalPath6 = PcapDotNet.Base
SccLocalPath6 = PcapDotNet.Packets.Test
SccProjectUniqueName7 = PcapDotNet.Packets.Test\\PcapDotNet.Packets.Test.csproj
SccProjectUniqueName7 = PcapDotNet.Packets\\PcapDotNet.Packets.csproj
SccProjectName7 = PcapDotNet.Packets.Test
SccProjectName7 = PcapDotNet.Packets
SccLocalPath7 = PcapDotNet.Packets.Test
SccLocalPath7 = PcapDotNet.Packets
SccProjectUniqueName8 = PcapDotNet.Packets\\PcapDotNet.Packets.csproj
SccProjectName8 = PcapDotNet.Packets
SccLocalPath8 = PcapDotNet.Packets
EndGlobalSection
EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = PcapDotNet.vsmdi
CategoryFile = PcapDotNet.vsmdi
...
@@ -67,18 +62,6 @@ Global
...
@@ -67,18 +62,6 @@ Global
Release|Win32 = Release|Win32
Release|Win32 = Release|Win32
EndGlobalSection
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Debug|Win32.ActiveCfg = Debug|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Debug|Win32.Build.0 = Debug|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Release|Any CPU.Build.0 = Release|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Release|Win32.ActiveCfg = Release|Any CPU
{5B4E80EB-DED5-4F20-871A-D9567F3F79DD}.Release|Win32.Build.0 = Release|Any CPU
{89C63BE1-AF9A-472E-B256-A4F56B1655A7}.Debug|Any CPU.ActiveCfg = Debug|Win32
{89C63BE1-AF9A-472E-B256-A4F56B1655A7}.Debug|Any CPU.ActiveCfg = Debug|Win32
{89C63BE1-AF9A-472E-B256-A4F56B1655A7}.Debug|Any CPU.Build.0 = Debug|Win32
{89C63BE1-AF9A-472E-B256-A4F56B1655A7}.Debug|Any CPU.Build.0 = Debug|Win32
{89C63BE1-AF9A-472E-B256-A4F56B1655A7}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{89C63BE1-AF9A-472E-B256-A4F56B1655A7}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
...
...
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