From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

WinPCAP

I'm developing a LabVIEW wrapper for the WinPCAP DLL.

I'd like to share my work with others, if it hasn't already been done. How can I do this?

Regards,

-JamesM

Message 1 of 13
(4,666 Views)
Hey James!

Are you asking how you could share your work with others or how to develop a wrapper in LabVIEW?  If it is the develop in LabVIEW option, then check out the Call Library Function node which is used for calling DLLs.  There is a great example called Call DLL.vi that is very useful when trying to match different data types to those available in LabVIEW, which can be found by opening the Example Finder (Help » Find Examples, then searching for DLL).

If your question is about sharing your work, one great place would be right here!  Another good place would be the Developer Zone on ni.com.  You could submit example code that others could search.  Another thing you might consider is to send WinPCAP the code if they are interested in that. 

Let me know if you have other questions!
Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 2 of 13
(4,655 Views)
Thanks Andy!

I'm asking how to share it once I'm done (and also making sure it hasn't been done already). Hope to be done this week. Thanks for the information!

-James
0 Kudos
Message 3 of 13
(4,649 Views)
hi,

i also tried to use the winpcap.dll in labview, but labview doesn´t identificate the parameter-type and returnvalue-type of all functions, and it is a lot of work to make for every function a VI, because it is not always clearly for me, what type i should use for struct-pointer etc. ...
What have you made already ?
0 Kudos
Message 4 of 13
(4,630 Views)

Hi James,

You could search existing, and if not found, post your VIs here as well:

http://vindex.lavag.org/

-Khalid

0 Kudos
Message 5 of 13
(4,619 Views)
> What have you made already ?

I've made a wrapper DLL that encapsulates pcap_findalldevs_ex, pcap_open, pcap_freealldevs, and pcap_next_ex.

I've also got a labview app with hooks to call the wrapper functions. I'm using only strings and integers into and out of the functions.

I've got a problem with the strings, because I can't determine the size that's allocated by default to me. This can (and does) cause an occasional memory error.
I think the solution is to use a fixed-length array or fixed-length string, but I haven't yet made the change.


Are there particular elements of the pcap library you'd like to see implemented?

Thanks for the interest!
Message 6 of 13
(4,607 Views)
hi,

can you send me your VIs for the functions above, please ?
you can find my e-mail in the ni-profil. thx

lg
0 Kudos
Message 7 of 13
(4,592 Views)
I couldn't see your e-mail address on your profile. It's possible I'm just overlooking it, or that it's not publicly visible?

I followed Khalid's advice (thanks Khalid!) and posted the current version on the forum. Link is:

http://forums.ni.com/ni/board/message?board.id=170&message.id=175885

I had hoped to work on fixing the problem with Read in the VI this weekend. You may find the work to-date of very limited usefulness until I correct that; which I hope will happen very soon.

Thanks for the interest!
0 Kudos
Message 8 of 13
(4,588 Views)
James, this is a very commendable project you are taking on.  I have actually been looking for a way to use LabView code to sniff traffic on a subnet.  I would offer my help but I am relatively new to LabView programming and am not sure how much help I would be.  I appreciate the effort!

-Rob
0 Kudos
Message 9 of 13
(4,530 Views)
Rob,

Thanks for the encouragement. I've made a correction to the *.vi file, providing 255 character long buffers to pass into the DLL. I've only tested in for a few hours this morning; however, it seems that you can safely read packets through the API without causing a LabView memory error.

I've uploaded the new version here: http://forums.ni.com/ni/board/message?board.id=170&message.id=175885&jump=true#M175885

Message 10 of 13
(4,489 Views)