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
fb4532d0
Commit
fb4532d0
authored
Jul 04, 2009
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
6d0cb5d9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
12 deletions
+76
-12
BerkeleyPacketFilterTests.cs
...Net/src/PcapDotNet.Core.Test/BerkeleyPacketFilterTests.cs
+70
-0
OfflinePacketDeviceTests.cs
...tNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs
+2
-0
PcapDotNet.Core.Test.csproj
...tNet/src/PcapDotNet.Core.Test/PcapDotNet.Core.Test.csproj
+1
-0
BerkeleyPacketFilter.h
PcapDotNet/src/PcapDotNet.Core/BerkeleyPacketFilter.h
+3
-2
PacketCommunicator.cpp
PcapDotNet/src/PcapDotNet.Core/PacketCommunicator.cpp
+0
-5
PacketCommunicator.h
PcapDotNet/src/PcapDotNet.Core/PacketCommunicator.h
+0
-5
No files found.
PcapDotNet/src/PcapDotNet.Core.Test/BerkeleyPacketFilterTests.cs
0 → 100644
View file @
fb4532d0
using
System
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
namespace
PcapDotNet.Core.Test
{
/// <summary>
/// Summary description for BerkeleyPacketFilterTests
/// </summary>
[
TestClass
]
public
class
BerkeleyPacketFilterTests
{
public
BerkeleyPacketFilterTests
()
{
//
// TODO: Add constructor logic here
//
}
private
TestContext
testContextInstance
;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public
TestContext
TestContext
{
get
{
return
testContextInstance
;
}
set
{
testContextInstance
=
value
;
}
}
#
region
Additional
test
attributes
//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext) { }
//
// Use ClassCleanup to run code after all tests in a class have run
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// Use TestInitialize to run code before running each test
// [TestInitialize()]
// public void MyTestInitialize() { }
//
// Use TestCleanup to run code after each test has run
// [TestCleanup()]
// public void MyTestCleanup() { }
//
#
endregion
[
TestMethod
]
[
ExpectedException
(
typeof
(
InvalidOperationException
))]
public
void
BadFilterErrorTest
()
{
using
(
PacketCommunicator
communicator
=
LivePacketDeviceTests
.
OpenLiveDevice
())
{
communicator
.
SetFilter
(
"illegal filter string"
);
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs
View file @
fb4532d0
...
...
@@ -159,6 +159,8 @@ namespace PcapDotNet.Core.Test
Assert
.
AreEqual
(
PacketCommunicatorMode
.
Capture
,
communicator
.
Mode
);
Assert
.
IsFalse
(
communicator
.
NonBlocking
);
Assert
.
AreEqual
(
PacketDevice
.
DefaultSnapshotLength
,
communicator
.
SnapshotLength
);
Assert
.
AreEqual
(
2
,
communicator
.
FileMajorVersion
);
Assert
.
AreEqual
(
4
,
communicator
.
FileMinorVersion
);
return
communicator
;
}
catch
(
Exception
)
...
...
PcapDotNet/src/PcapDotNet.Core.Test/PcapDotNet.Core.Test.csproj
View file @
fb4532d0
...
...
@@ -42,6 +42,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BerkeleyPacketFilterTests.cs" />
<Compile Include="MoreAssert.cs" />
<Compile Include="LivePacketDeviceTests.cs" />
<Compile Include="MoreRandom.cs" />
...
...
PcapDotNet/src/PcapDotNet.Core/BerkeleyPacketFilter.h
View file @
fb4532d0
...
...
@@ -8,12 +8,13 @@ namespace PcapDotNet { namespace Core
public
ref
class
BerkeleyPacketFilter
:
System
::
IDisposable
{
public
:
BerkeleyPacketFilter
(
pcap_t
*
pcapDescriptor
,
System
::
String
^
filterString
,
IpV4SocketAddress
^
netmask
);
void
SetFilter
(
pcap_t
*
pcapDescriptor
);
~
BerkeleyPacketFilter
();
// IDisposable
internal
:
BerkeleyPacketFilter
(
pcap_t
*
pcapDescriptor
,
System
::
String
^
filterString
,
IpV4SocketAddress
^
netmask
);
private
:
bpf_program
*
_bpf
;
};
...
...
PcapDotNet/src/PcapDotNet.Core/PacketCommunicator.cpp
View file @
fb4532d0
...
...
@@ -308,11 +308,6 @@ void PacketCommunicator::AssertMode(PacketCommunicatorMode mode)
throw
gcnew
InvalidOperationException
(
"Wrong Mode. Must be in mode "
+
mode
.
ToString
()
+
" and not in mode "
+
Mode
.
ToString
());
}
String
^
PacketCommunicator
::
ErrorMessage
::
get
()
{
return
PcapError
::
GetErrorMessage
(
_pcapDescriptor
);
}
InvalidOperationException
^
PacketCommunicator
::
BuildInvalidOperation
(
System
::
String
^
errorMessage
)
{
return
PcapError
::
BuildInvalidOperation
(
errorMessage
,
_pcapDescriptor
);
...
...
PcapDotNet/src/PcapDotNet.Core/PacketCommunicator.h
View file @
fb4532d0
...
...
@@ -119,11 +119,6 @@ namespace PcapDotNet { namespace Core
void
AssertMode
(
PacketCommunicatorMode
mode
);
property
System
::
String
^
ErrorMessage
{
System
::
String
^
get
();
}
ref
class
PacketHandler
{
public
:
...
...
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