LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

load a .pcap file

Hi,


I m new in a forum and I try to do the same manipulation. In my project I want to work in pcap file (to do that I need open a pcapfile).


So I need to open a pcap with the pcap function "pcap_open_offline(). I keep on and modify the .cpp file with this add :

 

EXTERNC EXPORT int32 lvwpcap_open_capture_file(const char* file, LStrHandle* error_string)
{


char tempbuf[PCAP_ERRBUF_SIZE];
pcap_t* p = pcap_open_offline(file, tempbuf);
int32 retval = 0;

if (p == NULL) {
SetString("lvwpcap_open_capture_file: impossible de lire le fichier", error_string);
retval = -1;
}


return retval;
}

 

 

 

 

So I modify this file and after compile in a new dll.


Then I export my dll in labview (right clic connectivity -> export dll). I add entries and return in my dll parameters.

But I have severals problems :

My file in entrie is a float char (uint8 in labview) I try to link this with path file function but I don't arrive to convert in a good type.

I don't find pcap file in my dll output.


Can you help me to resolve these problems ?


Thank you.


Regards Sébastien

 

 

Download All
0 Kudos
Message 11 of 14
(1,259 Views)

Hi Sebleon83.

 

In this case you can use directly the wpcap.dll. (npcap installed in winpcap compability mode of course).

I put an example this VI here.

Afterwards just do the reading with pcap_next or pcap_next_ex, until you get an error (-2 is EOF).

Hope this helps...

 

BR

Marcus

0 Kudos
Message 12 of 14
(1,210 Views)

The file format is not super complex. I was able to get most of what I need with this code (no DLL calls, pure LabVIEW) to parse the pcapng files.

Message 13 of 14
(953 Views)

Hello,

 

I was able to get most of the data(starting from Ethernet header to payload) I wanted from reading the pcapng file as a binary file. However, while reading it, I was not able to get any timestamp information. Any idea how I can get it? The content of the wireshark log file will have the byte order info and after that starts with MAC addresses.

0 Kudos
Message 14 of 14
(29 Views)