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
3ea1b949
Commit
3ea1b949
authored
Jun 26, 2009
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
16159dcc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
PcapDeviceHandler.cpp
PcapDotNet/src/PcapDotNet.Core/PcapDeviceHandler.cpp
+17
-1
PcapDeviceHandler.h
PcapDotNet/src/PcapDotNet.Core/PcapDeviceHandler.h
+6
-0
No files found.
PcapDotNet/src/PcapDotNet.Core/PcapDeviceHandler.cpp
View file @
3ea1b949
...
@@ -42,10 +42,26 @@ DeviceHandlerMode PcapDeviceHandler::Mode::get()
...
@@ -42,10 +42,26 @@ DeviceHandlerMode PcapDeviceHandler::Mode::get()
void
PcapDeviceHandler
::
Mode
::
set
(
DeviceHandlerMode
value
)
void
PcapDeviceHandler
::
Mode
::
set
(
DeviceHandlerMode
value
)
{
{
if
(
pcap_setmode
(
_pcapDescriptor
,
safe_cast
<
int
>
(
value
))
<
0
)
if
(
pcap_setmode
(
_pcapDescriptor
,
safe_cast
<
int
>
(
value
))
<
0
)
throw
gcnew
InvalidOperationException
(
"Error setting the mode."
);
throw
BuildInvalidOperation
(
"Error setting mode "
+
value
.
ToString
()
);
_mode
=
value
;
_mode
=
value
;
}
}
bool
PcapDeviceHandler
::
NonBlocking
::
get
()
{
char
errbuf
[
PCAP_ERRBUF_SIZE
];
int
nonBlockValue
=
pcap_getnonblock
(
_pcapDescriptor
,
errbuf
);
if
(
nonBlockValue
==
-
1
)
throw
gcnew
InvalidOperationException
(
"Error getting NonBlocking value"
);
return
nonBlockValue
!=
0
;
}
void
PcapDeviceHandler
::
NonBlocking
::
set
(
bool
value
)
{
char
errbuf
[
PCAP_ERRBUF_SIZE
];
if
(
pcap_setnonblock
(
_pcapDescriptor
,
value
,
errbuf
)
!=
0
)
throw
gcnew
InvalidOperationException
(
"Error setting NonBlocking to "
+
value
.
ToString
());
}
DeviceHandlerResult
PcapDeviceHandler
::
GetNextPacket
([
Out
]
Packet
^%
packet
)
DeviceHandlerResult
PcapDeviceHandler
::
GetNextPacket
([
Out
]
Packet
^%
packet
)
{
{
AssertMode
(
DeviceHandlerMode
::
Capture
);
AssertMode
(
DeviceHandlerMode
::
Capture
);
...
...
PcapDotNet/src/PcapDotNet.Core/PcapDeviceHandler.h
View file @
3ea1b949
...
@@ -36,6 +36,12 @@ namespace PcapDotNet
...
@@ -36,6 +36,12 @@ namespace PcapDotNet
void
set
(
DeviceHandlerMode
value
);
void
set
(
DeviceHandlerMode
value
);
}
}
property
bool
NonBlocking
{
bool
get
();
void
set
(
bool
value
);
}
delegate
void
HandlePacket
(
BPacket
::
Packet
^
packet
);
delegate
void
HandlePacket
(
BPacket
::
Packet
^
packet
);
DeviceHandlerResult
GetNextPacket
([
System
::
Runtime
::
InteropServices
::
Out
]
BPacket
::
Packet
^%
packet
);
DeviceHandlerResult
GetNextPacket
([
System
::
Runtime
::
InteropServices
::
Out
]
BPacket
::
Packet
^%
packet
);
DeviceHandlerResult
GetNextPackets
(
int
maxPackets
,
HandlePacket
^
callBack
,
[
System
::
Runtime
::
InteropServices
::
Out
]
int
%
numPacketsGot
);
DeviceHandlerResult
GetNextPackets
(
int
maxPackets
,
HandlePacket
^
callBack
,
[
System
::
Runtime
::
InteropServices
::
Out
]
int
%
numPacketsGot
);
...
...
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