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
9fc934bc
Commit
9fc934bc
authored
Jul 24, 2009
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
34ce48d6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
94 additions
and
2 deletions
+94
-2
DataLink.cs
PcapDotNet/src/Packets/DataLink.cs
+26
-0
Datagram.cs
PcapDotNet/src/Packets/Datagram.cs
+1
-0
EthernetType.cs
PcapDotNet/src/Packets/EthernetType.cs
+1
-0
IpV4Address.cs
PcapDotNet/src/Packets/IpV4Address.cs
+26
-0
MacAddress.cs
PcapDotNet/src/Packets/MacAddress.cs
+34
-1
Packet.cs
PcapDotNet/src/Packets/Packet.cs
+1
-0
Packets.csproj
PcapDotNet/src/Packets/Packets.csproj
+1
-0
AssemblyInfo.cs
PcapDotNet/src/Packets/Properties/AssemblyInfo.cs
+4
-1
No files found.
PcapDotNet/src/Packets/DataLink.cs
View file @
9fc934bc
...
...
@@ -12,6 +12,32 @@ namespace Packets
get
{
return
_kind
;
}
}
public
bool
Equals
(
DataLink
other
)
{
return
Kind
==
other
.
Kind
;
}
public
override
bool
Equals
(
object
obj
)
{
return
(
obj
is
DataLink
&&
Equals
((
DataLink
)
obj
));
}
public
static
bool
operator
==(
DataLink
dataLink1
,
DataLink
dataLink2
)
{
return
dataLink1
.
Equals
(
dataLink2
);
}
public
static
bool
operator
!=(
DataLink
dataLink1
,
DataLink
dataLink2
)
{
return
!(
dataLink1
==
dataLink2
);
}
public
override
int
GetHashCode
()
{
return
_kind
.
GetHashCode
();
}
private
readonly
DataLinkKind
_kind
;
}
}
\ No newline at end of file
PcapDotNet/src/Packets/Datagram.cs
View file @
9fc934bc
...
...
@@ -29,6 +29,7 @@ namespace Packets
System
.
Buffer
.
BlockCopy
(
_buffer
,
StartOffset
,
buffer
,
offset
,
Length
);
}
[
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessage
(
"Microsoft.Performance"
,
"CA1819:PropertiesShouldNotReturnArrays"
)]
protected
byte
[]
Buffer
{
get
{
return
_buffer
;
}
...
...
PcapDotNet/src/Packets/EthernetType.cs
View file @
9fc934bc
...
...
@@ -2,6 +2,7 @@ namespace Packets
{
public
enum
EthernetType
:
ushort
{
None
,
IpV4
=
0x0800
,
Arp
=
0x0806
,
Ieee802_1Q
=
0x8100
,
...
...
PcapDotNet/src/Packets/IpV4Address.cs
View file @
9fc934bc
...
...
@@ -23,6 +23,32 @@ namespace Packets
return
new
IpV4Address
(
result
);
}
public
bool
Equals
(
IpV4Address
other
)
{
return
ToUInt
()
==
other
.
ToUInt
();
}
public
override
bool
Equals
(
object
obj
)
{
return
(
obj
is
IpV4Address
&&
Equals
((
IpV4Address
)
obj
));
}
public
static
bool
operator
==(
IpV4Address
ipV4Address1
,
IpV4Address
ipV4Address2
)
{
return
ipV4Address1
.
Equals
(
ipV4Address2
);
}
public
static
bool
operator
!=(
IpV4Address
ipV4Address1
,
IpV4Address
ipV4Address2
)
{
return
!(
ipV4Address1
==
ipV4Address2
);
}
public
override
int
GetHashCode
()
{
return
_value
.
GetHashCode
();
}
public
override
string
ToString
()
{
StringBuilder
stringBuilder
=
new
StringBuilder
(
15
);
...
...
PcapDotNet/src/Packets/MacAddress.cs
View file @
9fc934bc
using
System
;
using
System.Globalization
;
namespace
Packets
{
...
...
@@ -27,9 +28,41 @@ namespace Packets
_b6
=
Convert
.
ToByte
(
hexes
[
5
],
16
);
}
public
bool
Equals
(
MacAddress
other
)
{
return
_b1
==
other
.
_b1
&&
_b2
==
other
.
_b2
&&
_b3
==
other
.
_b3
&&
_b4
==
other
.
_b4
&&
_b5
==
other
.
_b5
&&
_b6
==
other
.
_b6
;
}
public
override
bool
Equals
(
object
obj
)
{
return
(
obj
is
MacAddress
&&
Equals
((
MacAddress
)
obj
));
}
public
static
bool
operator
==(
MacAddress
macAddress1
,
MacAddress
macAddress2
)
{
return
macAddress1
.
Equals
(
macAddress2
);
}
public
static
bool
operator
!=(
MacAddress
macAddress1
,
MacAddress
macAddress2
)
{
return
!(
macAddress1
==
macAddress2
);
}
public
override
int
GetHashCode
()
{
return
(
_b1
+
(
_b2
<<
8
)
+
(
_b3
<<
16
)
+
(
_b4
<<
24
)).
GetHashCode
()
^
(
_b5
+
(
_b6
<<
8
)).
GetHashCode
();
}
public
override
string
ToString
()
{
return
string
.
Format
(
"{0:X2}:{1:X2}:{2:X2}:{3:X2}:{4:X2}:{5:X2}"
,
_b1
,
_b2
,
_b3
,
_b4
,
_b5
,
_b6
);
return
string
.
Format
(
CultureInfo
.
InvariantCulture
,
"{0:X2}:{1:X2}:{2:X2}:{3:X2}:{4:X2}:{5:X2}"
,
_b1
,
_b2
,
_b3
,
_b4
,
_b5
,
_b6
);
}
internal
void
Write
(
byte
[]
buffer
,
int
offset
)
...
...
PcapDotNet/src/Packets/Packet.cs
View file @
9fc934bc
...
...
@@ -33,6 +33,7 @@ namespace Packets
get
{
return
_dataLink
;
}
}
[
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessage
(
"Microsoft.Performance"
,
"CA1819:PropertiesShouldNotReturnArrays"
)]
public
byte
[]
Buffer
{
get
{
return
_data
;
}
...
...
PcapDotNet/src/Packets/Packets.csproj
View file @
9fc934bc
...
...
@@ -30,6 +30,7 @@
<WarningLevel>
4
</WarningLevel>
<AllowUnsafeBlocks>
true
</AllowUnsafeBlocks>
<RunCodeAnalysis>
true
</RunCodeAnalysis>
<CodeAnalysisRules>
-Microsoft.Design#CA1028
</CodeAnalysisRules>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
...
...
PcapDotNet/src/Packets/Properties/AssemblyInfo.cs
View file @
9fc934bc
using
System.Reflection
;
using
System
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
...
...
@@ -34,3 +35,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.*")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly:CLSCompliant(false)]
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