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
175099a5
Commit
175099a5
authored
Jan 29, 2010
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GetMacAddress() of a LivePacketDevice
parent
661af464
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
3 deletions
+40
-3
LivePacketDeviceExtensions.cs
.../PcapDotNet.Core.Extensions/LivePacketDeviceExtensions.cs
+32
-0
PacketCommunicatorExtensions.cs
...capDotNet.Core.Extensions/PacketCommunicatorExtensions.cs
+1
-1
PcapDotNet.Core.Extensions.csproj
...pDotNet.Core.Extensions/PcapDotNet.Core.Extensions.csproj
+7
-2
No files found.
PcapDotNet/src/PcapDotNet.Core.Extensions/LivePacketDeviceExtensions.cs
0 → 100644
View file @
175099a5
using
System
;
using
System.Net.NetworkInformation
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets
;
using
PcapDotNet.Packets.Ethernet
;
namespace
PcapDotNet.Core.Extensions
{
public
static
class
LivePacketDeviceExtensions
{
public
static
NetworkInterface
GetNetworkInterface
(
this
LivePacketDevice
livePacketDevice
)
{
foreach
(
NetworkInterface
networkInterface
in
NetworkInterface
.
GetAllNetworkInterfaces
())
{
if
(
@"rpcap://\Device\NPF_"
+
networkInterface
.
Id
==
livePacketDevice
.
Name
)
return
networkInterface
;
}
return
null
;
}
public
static
MacAddress
GetMacAddress
(
this
LivePacketDevice
livePacketDevice
)
{
NetworkInterface
networkInterface
=
livePacketDevice
.
GetNetworkInterface
();
if
(
networkInterface
==
null
)
throw
new
InvalidOperationException
(
"Couldn't find a network interface for give device"
);
byte
[]
addressBytes
=
networkInterface
.
GetPhysicalAddress
().
GetAddressBytes
();
return
new
MacAddress
(
addressBytes
.
ReadUInt48
(
0
,
Endianity
.
Big
));
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Core.Extensions/
MorePacketCommunicator
.cs
→
PcapDotNet/src/PcapDotNet.Core.Extensions/
PacketCommunicatorExtensions
.cs
View file @
175099a5
...
...
@@ -10,7 +10,7 @@ namespace PcapDotNet.Core.Extensions
/// Different extension methods for PacketCommunicator class.
/// <seealso cref="PacketCommunicator"/>
/// </summary>
public
static
class
MorePacketCommunicator
public
static
class
PacketCommunicatorExtensions
{
/// <summary>
/// Collect a group of packets.
...
...
PcapDotNet/src/PcapDotNet.Core.Extensions/PcapDotNet.Core.Extensions.csproj
View file @
175099a5
...
...
@@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
9.0.
21022
</ProductVersion>
<ProductVersion>
9.0.
30729
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{322040C2-3DC1-4D0C-8E0F-F05290AFE023}
</ProjectGuid>
<OutputType>
Library
</OutputType>
...
...
@@ -55,10 +55,15 @@
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"MorePacketCommunicator.cs"
/>
<Compile
Include=
"LivePacketDeviceExtensions.cs"
/>
<Compile
Include=
"PacketCommunicatorExtensions.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\PcapDotNet.Base\PcapDotNet.Base.csproj"
>
<Project>
{83E805C9-4D29-4E34-A27E-5A78690FBD2B}
</Project>
<Name>
PcapDotNet.Base
</Name>
</ProjectReference>
<ProjectReference
Include=
"..\PcapDotNet.Core\PcapDotNet.Core.vcproj"
>
<Project>
{89C63BE1-AF9A-472E-B256-A4F56B1655A7}
</Project>
<Name>
PcapDotNet.Core
</Name>
...
...
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