Attempt to put the time into the pcap packet record

This commit is contained in:
Holger Freyther 2009-01-02 01:17:48 +00:00
parent 9a3ee0ff1b
commit 2139b246a0
1 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <sys/fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
@ -106,6 +107,8 @@ static void write_pcap_packet(int direction, struct sockaddr_mISDN* addr,
return;
int ret;
time_t cur_time;
struct tm *tm;
struct fake_lapd_frame header = {
.ea1 = 0,
.cr = PCAP_OUTPUT ? 1 : 0,
@ -122,6 +125,10 @@ static void write_pcap_packet(int direction, struct sockaddr_mISDN* addr,
.orig_len = msg->len + sizeof(header) - MISDN_HEADER_LEN,
};
cur_time = time(NULL);
tm = localtime(&cur_time);
payload_header.ts_sec = mktime(tm);
ret = write(pcap_fd, &header, sizeof(header));
ret = write(pcap_fd, &payload_header, sizeof(payload_header));
ret = write(pcap_fd, msg->data + MISDN_HEADER_LEN,