Commit fdc524c2 authored by Brickner_cp's avatar Brickner_cp

Fix: IPacketDevice.Attributes returns DeviceAttributes instead of DeviceAttributes^

Fix: SocketAddress.Family returns SocketAddressFamily instead of SocketAddressFamily^
Added examples to Developer's Pack
parent b0ff6536
<?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>{BF87FF20-7F17-44E2-BE2B-9F96755F1468}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ObtainingAdvancedInformationAboutInstalledDevices</RootNamespace>
<AssemblyName>ObtainingAdvancedInformationAboutInstalledDevices</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<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="Packets, Version=0.1.0.31042, Culture=neutral, PublicKeyToken=58cf32d85728e684, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\3rdParty\PcapDotNet\Packets.dll</HintPath>
</Reference>
<Reference Include="PcapDotNet.Core, Version=0.1.0.31056, Culture=neutral, PublicKeyToken=58cf32d85728e684, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\3rdParty\PcapDotNet\PcapDotNet.Core.dll</HintPath>
</Reference>
<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>
<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
""
{
"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"
}
using System;
using System.Collections.Generic;
using System.Linq;
using PcapDotNet.Core;
namespace ObtainingAdvancedInformationAboutInstalledDevices
{
class Program
{
static void Main(string[] args)
{
// Retrieve the interfaces list
IList<LivePacketDevice> allDevices = LivePacketDevice.AllLocalMachine;
// Scan the list printing every entry
for (int i = 0; i != allDevices.Count(); ++i)
DevicePrint(allDevices[i]);
}
// Print all the available information on the given interface
private static void DevicePrint(IPacketDevice device)
{
// Name
Console.WriteLine(device.Name);
// Description
if (device.Description != null)
Console.WriteLine("\tDescription: " + device.Description);
// Loopback Address
Console.WriteLine("\tLoopback: " +
(((device.Attributes & DeviceAttributes.Loopback) == DeviceAttributes.Loopback)
? "yes"
: "no"));
// IP addresses
foreach (DeviceAddress address in device.Addresses)
{
Console.WriteLine("\tAddress Family: " + address.Address.Family);
if (address.Address != null)
Console.WriteLine(("\tAddress: " + address.Address));
if (address.Netmask != null)
Console.WriteLine(("\tNetmask: " + address.Netmask));
if (address.Broadcast != null)
Console.WriteLine(("\tBroadcast Address: " + address.Broadcast));
if (address.Destination != null)
Console.WriteLine(("\tDestination Address: " + address.Destination));
}
Console.WriteLine();
}
}
}
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("ObtainingAdvancedInformationAboutInstalledDevices")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ObtainingAdvancedInformationAboutInstalledDevices")]
[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("9c85d96d-9f30-4341-bc5c-47e4de8b0a29")]
// 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")]
......@@ -3,15 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObtainingTheDeviceList", "ObtainingTheDeviceList\ObtainingTheDeviceList.csproj", "{58B6F829-2F7C-4ED3-9CEF-DBE55814D31E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObtainingAdvancedInformationAboutInstalledDevices", "ObtainingAdvancedInformationAboutInstalledDevices\ObtainingAdvancedInformationAboutInstalledDevices.csproj", "{BF87FF20-7F17-44E2-BE2B-9F96755F1468}"
EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccNumberOfProjects = 3
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://tfs06.codeplex.com/
SccLocalPath0 = .
SccProjectUniqueName1 = ObtainingTheDeviceList\\ObtainingTheDeviceList.csproj
SccProjectName1 = ObtainingTheDeviceList
SccLocalPath1 = ObtainingTheDeviceList
SccProjectUniqueName2 = ObtainingAdvancedInformationAboutInstalledDevices\\ObtainingAdvancedInformationAboutInstalledDevices.csproj
SccProjectName2 = ObtainingAdvancedInformationAboutInstalledDevices
SccLocalPath2 = ObtainingAdvancedInformationAboutInstalledDevices
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -22,6 +27,10 @@ Global
{58B6F829-2F7C-4ED3-9CEF-DBE55814D31E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58B6F829-2F7C-4ED3-9CEF-DBE55814D31E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58B6F829-2F7C-4ED3-9CEF-DBE55814D31E}.Release|Any CPU.Build.0 = Release|Any CPU
{BF87FF20-7F17-44E2-BE2B-9F96755F1468}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF87FF20-7F17-44E2-BE2B-9F96755F1468}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF87FF20-7F17-44E2-BE2B-9F96755F1468}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF87FF20-7F17-44E2-BE2B-9F96755F1468}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -24,7 +24,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// Interface flags. Currently the only possible flag is Loopback, that is set if the interface is a loopback interface.
/// </summary>
property DeviceAttributes^ Attributes { DeviceAttributes^ get(); };
property DeviceAttributes Attributes { DeviceAttributes get(); };
/// <summary>
/// List of addresses for the interface.
......
......@@ -63,7 +63,7 @@ String^ LivePacketDevice::Description::get()
return _description;
}
DeviceAttributes^ LivePacketDevice::Attributes::get()
DeviceAttributes LivePacketDevice::Attributes::get()
{
return _attributes;
}
......@@ -88,7 +88,7 @@ PacketCommunicator^ LivePacketDevice::Open(int snapshotLength, PacketDeviceOpenA
// Private Methods
LivePacketDevice::LivePacketDevice(String^ name, String^ description, DeviceAttributes^ attributes, ReadOnlyCollection<DeviceAddress^>^ addresses)
LivePacketDevice::LivePacketDevice(String^ name, String^ description, DeviceAttributes attributes, ReadOnlyCollection<DeviceAddress^>^ addresses)
{
_name = name;
_description = description;
......
......@@ -54,9 +54,9 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// Interface flags. Currently the only possible flag is Loopback, that is set if the interface is a loopback interface.
/// </summary>
virtual property DeviceAttributes^ Attributes
virtual property DeviceAttributes Attributes
{
DeviceAttributes^ get() override;
DeviceAttributes get() override;
}
/// <summary>
......@@ -77,12 +77,12 @@ namespace PcapDotNet { namespace Core
virtual PacketCommunicator^ Open(int snapshotLength, PacketDeviceOpenAttributes attributes, int readTimeout) override;
private:
LivePacketDevice(System::String^ name, System::String^ description, DeviceAttributes^ attributes, System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ addresses);
LivePacketDevice(System::String^ name, System::String^ description, DeviceAttributes attributes, System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ addresses);
private:
System::String^ _name;
System::String^ _description;
DeviceAttributes^ _attributes;
DeviceAttributes _attributes;
System::Collections::ObjectModel::ReadOnlyCollection<DeviceAddress^>^ _addresses;
};
}}
\ No newline at end of file
......@@ -26,7 +26,7 @@ String^ OfflinePacketDevice::Description::get()
return String::Empty;
}
DeviceAttributes^ OfflinePacketDevice::Attributes::get()
DeviceAttributes OfflinePacketDevice::Attributes::get()
{
return DeviceAttributes::None;
}
......
......@@ -36,9 +36,9 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// Interface flags. Currently the only possible flag is Loopback, that is set if the interface is a loopback interface.
/// </summary>
virtual property DeviceAttributes^ Attributes
virtual property DeviceAttributes Attributes
{
DeviceAttributes^ get() override;
DeviceAttributes get() override;
}
/// <summary>
......
......@@ -34,9 +34,9 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// Interface flags. Currently the only possible flag is Loopback, that is set if the interface is a loopback interface.
/// </summary>
virtual property DeviceAttributes^ Attributes
virtual property DeviceAttributes Attributes
{
DeviceAttributes^ get() = 0;
DeviceAttributes get() = 0;
}
/// <summary>
......
......@@ -3,14 +3,14 @@
using namespace System;
using namespace PcapDotNet::Core;
SocketAddressFamily^ SocketAddress::Family::get()
SocketAddressFamily SocketAddress::Family::get()
{
return _family;
}
String^ SocketAddress::ToString()
{
return Family->ToString();
return Family.ToString();
}
SocketAddress::SocketAddress(unsigned short family)
......
......@@ -14,9 +14,9 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// Family (type) of the socket address.
/// </summary>
property SocketAddressFamily^ Family
property SocketAddressFamily Family
{
SocketAddressFamily^ get();
SocketAddressFamily get();
}
virtual System::String^ ToString() override;
......@@ -25,6 +25,6 @@ namespace PcapDotNet { namespace Core
SocketAddress(unsigned short family);
private:
SocketAddressFamily^ _family;
SocketAddressFamily _family;
};
}}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment