[Listener] Improve/fix radiotap fields definitions

This commit is contained in:
Matteo Cypriani 2013-05-16 11:09:45 -04:00
parent 0614b52219
commit 4a3e1e1091
2 changed files with 55 additions and 55 deletions

View File

@ -158,44 +158,41 @@ enum {MODE_ACTIVE = 'a', MODE_PASSIVE = 'p', MODE_MIXED = 'm'} ;
#define RTAP_L_HPAD 1 // Header pad
#define RTAP_L_HLENGTH 2 // Header length
#define RTAP_L_PRESENTFLAGS 4 // Present flags
#define RTAP_L_MACTS 8 // MAC timestamp (Time Synchronization Function Timer)
#define RTAP_L_TSFT 8 // MAC timestamp (Time Synchronization Function Timer)
#define RTAP_L_FLAGS 1 // Flags
#define RTAP_L_RATE 1 // Data rate
#define RTAP_L_CHANNEL 2 // Channel frequency
#define RTAP_L_CHANNELTYPE 2 // Channel type
#define RTAP_L_ANTENNASIGNALDBM 1 // SSI signal (dBm)
#define RTAP_L_ANTENNANOISEDBM 1 // SSI noise (dBm)
#define RTAP_L_CHANNELFLAGS 2 // Channel flags (channel type)
#define RTAP_L_FHSSHOPSET 1 // FHSS hop set
#define RTAP_L_FHSSHOPPATTERN 1 // FHSS hop pattern
#define RTAP_L_ANTENNASIGNAL 1 // Signal power at the antenna (dBm)
#define RTAP_L_ANTENNANOISE 1 // Noise power at the antenna (dBm)
#define RTAP_L_LOCKQUALITY 2 // Signal quality (quality of Barker code lock)
#define RTAP_L_TXATTENUATION 2 // Transmit power (distance from max power)
#define RTAP_L_DBTXATTENUATION 2 // Ditto (dB)
#define RTAP_L_DBMTXPOWER 1 // Absolute transmit power (dBm)
#define RTAP_L_ANTENNA 1 // Antenna number
#define RTAP_L_FHSS 2 // Hop set and pattern for Frequency-Hopping Spread Spectrum
#define RTAP_L_LOCKQUALITY 2 // Signal quality
#define RTAP_L_TXATTENUATION 2 // Transmit power from max power
#define RTAP_L_TXATTENUATIONDB 2 // Idem (dB)
#define RTAP_L_TXATTENUATIONDBM 1 // Idem (dBm)
#define RTAP_L_ANTENNASIGNALDB 1 // SSI signal (dB)
#define RTAP_L_ANTENNANOISEDB 1 // SSI noise (dB)
#define RTAP_L_FCS 4 // Frame Check Sequence
//#define RTAP_L_CHANNELP // Extended channel info (not implemented)
//#define RTAP_L_EXT // Present flags' extension (not emplemented)
#define RTAP_L_DBANTENNASIGNAL 1 // Relative signal power at the antenna (dB)
#define RTAP_L_DBANTENNANOISE 1 // Relative noise power at the antenna (dB)
#define RTAP_L_RXFLAGS 2 // Properties of the received flags
/* Positions in 'Present flags' (and present fields 'check' array) */
#define RTAP_MACTS 0
#define RTAP_TSFT 0
#define RTAP_FLAGS 1
#define RTAP_RATE 2
#define RTAP_CHANNEL 3 // and RTAP_CHANNELTYPE
#define RTAP_FHSS 4
#define RTAP_ANTENNASIGNALDBM 5
#define RTAP_ANTENNANOISEDBM 6
#define RTAP_CHANNEL 3 // Channel frequency and flags
#define RTAP_FHSS 4 // FHSS hop set and hop pattern
#define RTAP_ANTENNASIGNAL 5
#define RTAP_ANTENNANOISE 6
#define RTAP_LOCKQUALITY 7
#define RTAP_TXATTENUATION 8
#define RTAP_TXATTENUATIONDB 9
#define RTAP_TXATTENUATIONDBM 10
#define RTAP_DBTXATTENUATION 9
#define RTAP_DBMTXPOWER 10
#define RTAP_ANTENNA 11
#define RTAP_ANTENNASIGNALDB 12
#define RTAP_ANTENNANOISEDB 13
#define RTAP_FCS 14
//#define RTAP_CHANNELP 18
//#define RTAP_EXT 31
#define RTAP_DBANTENNASIGNAL 12
#define RTAP_DBANTENNANOISE 13
#define RTAP_RXFLAGS 14
/*

View File

@ -1215,7 +1215,7 @@ void read_packet(const struct pcap_pkthdr *pkt_header,
mobile_ip_str,
request_time_str,
capture_time_str,
rtap_fields[RTAP_ANTENNASIGNALDBM] ? request.ss_dbm : 0,
rtap_fields[RTAP_ANTENNASIGNAL] ? request.ss_dbm : 0,
owl_ntohf(request.x_position),
owl_ntohf(request.y_position),
owl_ntohf(request.z_position),
@ -1309,9 +1309,9 @@ void extract_radiotap_data(const u_char *pkt_data,
{
switch(i)
{
case RTAP_MACTS:
rtap_fields[RTAP_MACTS] = true ;
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_MACTS) ;
case RTAP_TSFT:
rtap_fields[RTAP_TSFT] = true ;
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_TSFT) ;
break ;
case RTAP_FLAGS:
rtap_fields[RTAP_FLAGS] = true;
@ -1327,26 +1327,29 @@ void extract_radiotap_data(const u_char *pkt_data,
// aligned independently
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_CHANNEL) ;
rtap_position += SKIP_FIELD(rtap_position,
RTAP_L_CHANNELTYPE) ;
RTAP_L_CHANNELFLAGS) ;
break ;
case RTAP_FHSS:
rtap_fields[RTAP_FHSS] = true;
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FHSS) ;
rtap_position += SKIP_FIELD(rtap_position,
RTAP_L_FHSSHOPSET) ;
rtap_position += SKIP_FIELD(rtap_position,
RTAP_L_FHSSHOPPATTERN) ;
break ;
case RTAP_ANTENNASIGNALDBM:
rtap_fields[RTAP_ANTENNASIGNALDBM] = true ;
case RTAP_ANTENNASIGNAL:
rtap_fields[RTAP_ANTENNASIGNAL] = true ;
rtap_position += nat_align(rtap_position,
RTAP_L_ANTENNASIGNALDBM) ;
RTAP_L_ANTENNASIGNAL) ;
memcpy(&request->ss_dbm,
&pkt_data[rtap_position], RTAP_L_ANTENNASIGNALDBM) ;
&pkt_data[rtap_position], RTAP_L_ANTENNASIGNAL) ;
if (VERBOSE_INFO)
printf("Antenna signal: %"PRId8" dBm\n", request->ss_dbm) ;
rtap_position += RTAP_L_ANTENNASIGNALDBM ;
rtap_position += RTAP_L_ANTENNASIGNAL ;
break ;
case RTAP_ANTENNANOISEDBM:
rtap_fields[RTAP_ANTENNANOISEDBM] = true;
case RTAP_ANTENNANOISE:
rtap_fields[RTAP_ANTENNANOISE] = true;
rtap_position += SKIP_FIELD(rtap_position,
RTAP_L_ANTENNANOISEDBM) ;
RTAP_L_ANTENNANOISE) ;
break ;
case RTAP_LOCKQUALITY:
rtap_fields[RTAP_LOCKQUALITY] = true;
@ -1358,33 +1361,33 @@ void extract_radiotap_data(const u_char *pkt_data,
rtap_position += SKIP_FIELD(rtap_position,
RTAP_L_TXATTENUATION) ;
break ;
case RTAP_TXATTENUATIONDB:
rtap_fields[RTAP_TXATTENUATIONDB] = true;
case RTAP_DBTXATTENUATION:
rtap_fields[RTAP_DBTXATTENUATION] = true;
rtap_position += SKIP_FIELD(rtap_position,
RTAP_L_TXATTENUATIONDB) ;
RTAP_L_DBTXATTENUATION) ;
break ;
case RTAP_TXATTENUATIONDBM:
rtap_fields[RTAP_TXATTENUATIONDBM] = true;
case RTAP_DBMTXPOWER:
rtap_fields[RTAP_DBMTXPOWER] = true;
rtap_position += SKIP_FIELD(rtap_position,
RTAP_L_TXATTENUATIONDBM) ;
RTAP_L_DBMTXPOWER) ;
break ;
case RTAP_ANTENNA:
rtap_fields[RTAP_ANTENNA] = true;
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_ANTENNA) ;
break ;
case RTAP_ANTENNASIGNALDB:
rtap_fields[RTAP_ANTENNASIGNALDB] = true;
case RTAP_DBANTENNASIGNAL:
rtap_fields[RTAP_DBANTENNASIGNAL] = true;
rtap_position += SKIP_FIELD(rtap_position,
RTAP_L_ANTENNASIGNALDB) ;
RTAP_L_DBANTENNASIGNAL) ;
break ;
case RTAP_ANTENNANOISEDB:
rtap_fields[RTAP_ANTENNANOISEDB] = true;
case RTAP_DBANTENNANOISE:
rtap_fields[RTAP_DBANTENNANOISE] = true;
rtap_position += SKIP_FIELD(rtap_position,
RTAP_L_ANTENNANOISEDB) ;
RTAP_L_DBANTENNANOISE) ;
break ;
case RTAP_FCS:
rtap_fields[RTAP_FCS] = true;
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FCS) ;
case RTAP_RXFLAGS:
rtap_fields[RTAP_RXFLAGS] = true;
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_RXFLAGS) ;
break ;
default:
fprintf(stderr, "Warning! Radiotap field not handled: bit"