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
22797897
Commit
22797897
authored
Jun 26, 2009
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
6a6c0fc5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
4 deletions
+32
-4
PcapDeviceHandler.cpp
PcapDotNet/src/PcapDotNet.Core/PcapDeviceHandler.cpp
+5
-0
PcapDeviceHandler.h
PcapDotNet/src/PcapDotNet.Core/PcapDeviceHandler.h
+6
-0
PcapSendQueue.cpp
PcapDotNet/src/PcapDotNet.Core/PcapSendQueue.cpp
+17
-3
PcapSendQueue.h
PcapDotNet/src/PcapDotNet.Core/PcapSendQueue.h
+4
-1
No files found.
PcapDotNet/src/PcapDotNet.Core/PcapDeviceHandler.cpp
View file @
22797897
...
@@ -79,3 +79,8 @@ PcapDumpFile^ PcapDeviceHandler::OpenDump(System::String^ filename)
...
@@ -79,3 +79,8 @@ PcapDumpFile^ PcapDeviceHandler::OpenDump(System::String^ filename)
throw
gcnew
InvalidOperationException
(
"Error opening output file "
+
filename
+
" Error: "
+
gcnew
System
::
String
(
pcap_geterr
(
_handler
)));
throw
gcnew
InvalidOperationException
(
"Error opening output file "
+
filename
+
" Error: "
+
gcnew
System
::
String
(
pcap_geterr
(
_handler
)));
return
gcnew
PcapDumpFile
(
dumpFile
,
filename
);
return
gcnew
PcapDumpFile
(
dumpFile
,
filename
);
}
}
pcap_t
*
PcapDeviceHandler
::
Handler
::
get
()
{
return
_handler
;
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Core/PcapDeviceHandler.h
View file @
22797897
...
@@ -29,6 +29,12 @@ namespace PcapDotNet
...
@@ -29,6 +29,12 @@ namespace PcapDotNet
PcapDumpFile
^
OpenDump
(
System
::
String
^
filename
);
PcapDumpFile
^
OpenDump
(
System
::
String
^
filename
);
internal
:
property
pcap_t
*
Handler
{
pcap_t
*
get
();
}
private
:
private
:
pcap_t
*
_handler
;
pcap_t
*
_handler
;
IpV4SocketAddress
^
_ipV4Netmask
;
IpV4SocketAddress
^
_ipV4Netmask
;
...
...
PcapDotNet/src/PcapDotNet.Core/PcapSendQueue.cpp
View file @
22797897
#include "PcapSendQueue.h"
#include "PcapSendQueue.h"
#include "PacketHeader.h"
#include "Pcap.h"
#include "Pcap.h"
using
namespace
System
;
using
namespace
PcapDotNet
;
using
namespace
PcapDotNet
;
using
namespace
BPacket
;
using
namespace
BPacket
;
PcapSendQueue
::
PcapSendQueue
(
unsigned
int
size
)
PcapSendQueue
::
PcapSendQueue
(
unsigned
int
capacity
)
{
{
_pcapSendQueue
=
pcap_sendqueue_alloc
(
size
);
_pcapSendQueue
=
pcap_sendqueue_alloc
(
capacity
);
}
}
void
PcapSendQueue
::
Enqueue
(
Packet
^
packet
)
void
PcapSendQueue
::
Enqueue
(
Packet
^
packet
)
{
{
pcap_pkthdr
pcapHeader
;
PacketHeader
::
GetPcapHeader
(
pcapHeader
,
packet
);
pin_ptr
<
Byte
>
unamangedPacketBytes
=
&
packet
->
Buffer
[
0
];
if
(
pcap_sendqueue_queue
(
_pcapSendQueue
,
&
pcapHeader
,
unamangedPacketBytes
)
==
-
1
)
throw
gcnew
InvalidOperationException
(
"Failed enqueue packet"
);
}
//pcap_sendqueue_queue(_pcapSendQueue,
void
PcapSendQueue
::
Transmit
(
PcapDeviceHandler
^
deviceHandler
,
bool
isSync
)
{
unsigned
int
numBytesTransmitted
=
pcap_sendqueue_transmit
(
deviceHandler
->
Handler
,
_pcapSendQueue
,
isSync
);
if
(
numBytesTransmitted
<
_pcapSendQueue
->
len
)
{
throw
gcnew
InvalidOperationException
(
String
::
Format
(
"An error occurred sending the packets: %s. Only %d bytes were sent"
,
gcnew
String
(
pcap_geterr
(
deviceHandler
->
Handler
)),
numBytesTransmitted
));
}
}
}
PcapSendQueue
::~
PcapSendQueue
()
PcapSendQueue
::~
PcapSendQueue
()
...
...
PcapDotNet/src/PcapDotNet.Core/PcapSendQueue.h
View file @
22797897
#pragma once
#pragma once
#include "PcapDeviceHandler.h"
#include "PcapDeclarations.h"
#include "PcapDeclarations.h"
namespace
PcapDotNet
namespace
PcapDotNet
...
@@ -7,10 +8,12 @@ namespace PcapDotNet
...
@@ -7,10 +8,12 @@ namespace PcapDotNet
public
ref
class
PcapSendQueue
:
System
::
IDisposable
public
ref
class
PcapSendQueue
:
System
::
IDisposable
{
{
public
:
public
:
PcapSendQueue
(
unsigned
int
size
);
PcapSendQueue
(
unsigned
int
capacity
);
void
Enqueue
(
BPacket
::
Packet
^
packet
);
void
Enqueue
(
BPacket
::
Packet
^
packet
);
void
Transmit
(
PcapDeviceHandler
^
deviceHandler
,
bool
isSync
);
~
PcapSendQueue
();
~
PcapSendQueue
();
private
:
private
:
...
...
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