mirror of
https://github.com/markqvist/OpenModem.git
synced 2024-12-24 23:19:36 -05:00
Added outgoing packet capture
This commit is contained in:
parent
f5a2aafeb8
commit
34a5346566
@ -151,7 +151,6 @@ void kiss_messageCallback(AX25Ctx *ctx) {
|
||||
}
|
||||
fputc(FEND, &serial->uart0);
|
||||
|
||||
ticks_t start_t = timer_clock();
|
||||
if (config_log_packets && sd_mounted()) {
|
||||
if (log_ready || log_init()) {
|
||||
log_fr = f_open(&log_fp, log_filename, FA_OPEN_APPEND | FA_WRITE);
|
||||
@ -160,14 +159,14 @@ void kiss_messageCallback(AX25Ctx *ctx) {
|
||||
UINT written = 0;
|
||||
uint32_t pcap_ts_sec = rtc_seconds();
|
||||
uint32_t pcap_ts_usec = (rtc_milliseconds()*(uint32_t)1000);
|
||||
uint32_t pcap_incl_len = ctx->frame_len;
|
||||
uint32_t pcap_orig_len = ctx->frame_len;
|
||||
uint32_t pcap_incl_len = ctx->frame_len-2;
|
||||
uint32_t pcap_orig_len = ctx->frame_len-2;
|
||||
|
||||
f_write(&log_fp, &pcap_ts_sec, sizeof(pcap_ts_sec), &written);
|
||||
f_write(&log_fp, &pcap_ts_usec, sizeof(pcap_ts_usec), &written);
|
||||
f_write(&log_fp, &pcap_incl_len, sizeof(pcap_incl_len), &written);
|
||||
f_write(&log_fp, &pcap_orig_len, sizeof(pcap_orig_len), &written);
|
||||
f_write(&log_fp, ctx->buf, ctx->frame_len, &written);
|
||||
f_write(&log_fp, ctx->buf, ctx->frame_len-2, &written);
|
||||
|
||||
// Close handle and flush to disk
|
||||
f_close(&log_fp);
|
||||
@ -411,6 +410,29 @@ void kiss_flushQueue(void) {
|
||||
tx_buffer[i] = packet_queue[pos];
|
||||
}
|
||||
|
||||
if (config_log_packets && sd_mounted()) {
|
||||
if (log_ready || log_init()) {
|
||||
log_fr = f_open(&log_fp, log_filename, FA_OPEN_APPEND | FA_WRITE);
|
||||
if (log_fr == FR_OK) {
|
||||
// Write PCAP segment to file
|
||||
UINT written = 0;
|
||||
uint32_t pcap_ts_sec = rtc_seconds();
|
||||
uint32_t pcap_ts_usec = (rtc_milliseconds()*(uint32_t)1000);
|
||||
uint32_t pcap_incl_len = length;
|
||||
uint32_t pcap_orig_len = length;
|
||||
|
||||
f_write(&log_fp, &pcap_ts_sec, sizeof(pcap_ts_sec), &written);
|
||||
f_write(&log_fp, &pcap_ts_usec, sizeof(pcap_ts_usec), &written);
|
||||
f_write(&log_fp, &pcap_incl_len, sizeof(pcap_incl_len), &written);
|
||||
f_write(&log_fp, &pcap_orig_len, sizeof(pcap_orig_len), &written);
|
||||
f_write(&log_fp, tx_buffer, length, &written);
|
||||
|
||||
// Close handle and flush to disk
|
||||
f_close(&log_fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ax25_sendRaw(ax25ctx, tx_buffer, length);
|
||||
processed++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user