Commit c9862c84 authored by 's avatar

Bug fix for TO_FILE function in 64-bit systems


git-svn-id: file:///home/svn/mapi/trunk@1249 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 9fbf5beb
......@@ -27,6 +27,18 @@ struct to_tcpdump_data
int file;
};
//For 64-bit compatibility
struct pcap_timeval {
int tv_sec; /* seconds */
int tv_usec; /* microseconds */
};
struct pcap_sf_pkthdr {
struct pcap_timeval ts; /* time stamp */
int caplen; /* length of portion present */
int len; /* length this packet (off wire) */
};
static int to_tcpdump_instance(mapidflib_function_instance_t *instance,
MAPI_UNUSED int fd,
......@@ -92,7 +104,7 @@ static int to_tcpdump_init(mapidflib_function_instance_t *instance,
static int to_tcpdump_process(mapidflib_function_instance_t *instance,MAPI_UNUSED unsigned char* dev_pkt,unsigned char* link_pkt,mapid_pkthdr_t* pkthdr)
{
struct pcap_pkthdr phdr;
struct pcap_sf_pkthdr phdr;
struct to_tcpdump_data *i=instance->internal_data;
int *res=instance->result.data;
unsigned long long ts;
......@@ -115,7 +127,7 @@ static int to_tcpdump_process(mapidflib_function_instance_t *instance,MAPI_UNUSE
phdr.ts.tv_sec += 1;
}
write(i->file,&phdr,sizeof(struct pcap_pkthdr));
write(i->file,&phdr,sizeof(struct pcap_sf_pkthdr));
write(i->file,link_pkt,pkthdr->caplen);
i->pkts++;
return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment