mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2025-04-21 12:27:27 +03:00
atrf-txrx: added ability to record received frames in pcap format
- pcap.h: basic pcap file structure definitions - atrf-txrx.c (usage, main): added option "-o file" to write received frames to a pcap file instead of displaying them - atrf-txrx.c (receive): moved code to receive and display a single message into new function receive_message - atrf-txrx.c (write_pcap_hdr, write_pcap_rec, receive_pcap): receive messages into a pcap file
This commit is contained in:
49
tools/atrf-txrx/pcap.h
Normal file
49
tools/atrf-txrx/pcap.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* pcap.h - Minimum pcap file definitions
|
||||
*
|
||||
* Written 2011 by Werner Almesberger
|
||||
* Copyright 2011 Werner Almesberger
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header defines the few things we need to write files in the pcap
|
||||
* format. The identifiers are the same as in the system's pcap/pcap.h, but
|
||||
* the types have been standardized. Note that the timestamp parts have to be
|
||||
* put separately, since "struct timeval" may be padded.
|
||||
*
|
||||
* The reason for having our own header instead of just using pcap/pcap.h is
|
||||
* to avoid a build-dependency on libpcap.
|
||||
*/
|
||||
|
||||
#ifndef PCAP_H
|
||||
#define PCAP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
#define DLT_IEEE802_15_4 195
|
||||
|
||||
struct pcap_file_header {
|
||||
uint32_t magic;
|
||||
uint16_t version_major;
|
||||
uint16_t version_minor;
|
||||
int32_t thiszone;
|
||||
uint32_t sigfigs;
|
||||
uint32_t snaplen;
|
||||
uint32_t linktype;
|
||||
};
|
||||
|
||||
struct pcap_pkthdr {
|
||||
uint32_t ts_sec;
|
||||
uint32_t ts_usec;
|
||||
uint32_t caplen;
|
||||
uint32_t len;
|
||||
};
|
||||
|
||||
#endif /* !PCAP_H */
|
||||
Reference in New Issue
Block a user