Commit Graph

152 Commits

Author SHA1 Message Date
Matteo Cypriani a046dcd3fb [Listener] Fix radiotap alignment bug
The fields in the radiotap header are naturally aligned, which was not
taken into account by the parser.
2013-04-23 18:54:38 -04:00
Matteo Cypriani 6f0d5c8da5 [Listener] Warn in case of unknown rtap field 2013-04-23 18:54:38 -04:00
Matteo Cypriani e7b639a020 [Listener] Minor fixes, mostly cosmetic 2013-04-23 18:54:38 -04:00
Matteo Cypriani 6ea849625c [Listener] Add -R option (read from pcap file)
The new -R option allows one to read packets from a pcap file instead of
capturing from a network interface.
2013-04-23 18:32:59 -04:00
Matteo Cypriani c95257f26a [Listener] Use pcap_next_ex instead of pcap_loop
pcap_next_ex() will allow us to detect the end of a capture file. Since
we used pcap_loop() to capture one packet at a time anyway, this won't
change anything for live captures.

The variable names were standardised in functions using pcap data types
('pkt_header' and 'pkt_data' instead of 'header' and 'packet').
2013-04-23 18:32:37 -04:00
Matteo Cypriani 8df82b9c41 Fix typo "endianness" 2012-11-06 01:22:16 +01:00
Matteo Cypriani d1c64212d8 Test malloc/realloc return values 2012-11-03 16:51:13 +01:00
Matteo Cypriani 8455dd0d74 Add copyright & license information
Add the file COPYRIGHT, the CeCILL license's text, and update the source
files' headers with the copyright and license information.
2012-11-03 14:52:33 +01:00
Matteo Cypriani 316db76861 Makefiles: add common-rules.mk, drop openwrt files
This is the sequel of the work on the Makefiles' unification.
2012-05-24 14:19:04 +02:00
Matteo Cypriani e239dffa4f [Listener] Do not print a warning if AC_port == 0
If the autocalibration request port was not specified, a warning was
issued. This is now fixed by issuing a warning only if the port is too
big, but not if it is zero.
2012-05-14 14:06:05 +02:00
Matteo Cypriani c4e03520f3 [Listener] Display the packet size 2012-05-10 11:38:21 +02:00
Matteo Cypriani 07f5b16ca0 [Listener] Receive the new request format
Read the packet number and number of packets after the request type.
A bit of refactoring was done.
2012-05-10 11:29:17 +02:00
Matteo Cypriani 96d1c54e54 Send number of packets at the beginning of request
The packet number and number of packets are now sent right after the
packet type, instead of at the end of the request.
2012-05-09 21:13:52 +02:00
Matteo Cypriani 92485f3f67 Add common.mk
Adapt all the Makefiles to use it.
Rename all the Makefile_atheros_openwrt-10.03 to
Makefile_atheros_openwrt.
2012-05-09 15:55:17 +02:00
Matteo Cypriani 1cc1ce4302 [Listener] Handle the packet numbering 2012-02-08 10:52:39 +01:00
Matteo Cypriani ca249457be Makefiles: BSD-specific -I/-L 2012-02-07 17:50:19 +01:00
Matteo Cypriani 6b7e5668fa Add/update headers on the top of each source file 2012-02-06 16:44:09 +01:00
Matteo Cypriani 7c7aac31e9 Update time-related default values
Aggregation time, check intervals, etc.
By default the aggregator cannot fully aggregate calibration requests
any more, only the positioning and autocalibration requests.
In order to aggregate calibration requests, the aggregation timeout
needs to be increased, or the number of packets of the request and
the delay between each of them lowered.
2012-02-06 13:27:05 +01:00
Matteo Cypriani 3ed19bb012 Version printing: "Owl" instead of "Open Wireless" 2012-02-06 13:27:05 +01:00
Matteo Cypriani 1ebc0c57ed Different port for autocal. orders and hello
Differentiate the port on which the autocalibration hello messages are
sent to the aggregator by the listeners, and the one on which the
autocalibration orders are sent by the aggregator to the listeners.

This will allow to run a listener and an aggregator on the same machine
with autocalibration enabled.

Both in the listener and the aggregator, the option -a (autocalibration
port) has been replaced by the options -O (autocalibration order port)
and -H (autocalibration hello port). In the listener, the option -H was
previously used to set the hello delay; this is now the role of the -T
option.
2012-02-06 13:27:05 +01:00
Matteo Cypriani ee3ab7b383 [Listener] Same port for all requests
The autocalibration requests are now sent on the same port as the
positioning request, by default. There was no real reason to send them
on a different port.
2012-02-06 13:27:05 +01:00
Matteo Cypriani a0005e9dad Don't use inet_ntoa() any more 2012-02-06 13:27:05 +01:00
Matteo Cypriani 2c1697b78a Enable compilation on GNU/kFreeBSD 2012-02-06 13:27:05 +01:00
Matteo Cypriani a20156a45e [Listener] print_configuration(): fix verbose
The verbose level was displayed as a boolean when the program was
compiled without libconfuse.
2012-02-06 13:27:05 +01:00
Matteo Cypriani 16eaecc53f Avoid displaying non-ASCII characters
Avoid displaying UTF-8 characters on the terminal (French quotes &
ellipsis).
2012-02-06 13:26:50 +01:00
Matteo Cypriani dd01705608 Wrap help messages at 80 columns
In Client, Listener and Aggregator, wrap the help message text at 80
columns to make them easier to read on a standard console.
2012-01-24 18:29:50 +01:00
Matteo Cypriani a1bc3db310 Fix daemon modes (Aggregator, Listener, Client)
daemon() must be called prior to set up signal handlers and threads.
2012-01-24 17:27:46 +01:00
Matteo Cypriani ad8f42117b [Listener] Compile without confuse (Atheros)
For the Atheros platforms, do not link to libconfuse by default.
2012-01-24 17:26:06 +01:00
Matteo Cypriani 7fc89a381c [Listener] Check radiotap header length
From time to time, the length of the radiotap header (rtap_bytes in
read_packet()) is 65535. This is a quick & dirty fix to avoid segfaults,
but we should search for the reason why this value sometimes appears.
2012-01-24 16:11:36 +01:00
Matteo Cypriani 08a8626354 Makefiles: improve static compilation
Add a static target for Listener, Aggregator and Positioning.
Strip the static and semistatic targets.
2012-01-11 16:50:39 +01:00
Matteo Cypriani a81b539a05 Remove Makefiles for OpenWrt 8.09 2012-01-11 16:50:39 +01:00
Matteo Cypriani 2ed7ccd4bc [Listener] Daemon mode (-D)
Basic implementation of the daemon mode.
2012-01-11 16:50:39 +01:00
Matteo Cypriani cf73bf6309 [lib] Avoid struct arguments & return values
Modify the *time*() functions to avoid passing structures in arguments
(using const pointers instead) or returning structures (using result
arguments instead).
2012-01-11 16:50:36 +01:00
Matteo Cypriani 4dc45acff7 Get rid of the SS - 0x100 problems
In the listener & aggregator, the signal strength is stored as an
unsigned byte. To display the actual (negative) value, one must
substract 256 (0x100) to the unsigned value.
This commit changes several things:
 - Use the decimal (256) instead of the hexadecimal value (0x100).
 - Don't substract 256 when copying the value to another unsigned byte
   (aggregator).
 - Be careful with the type length. In the positioning server, a SS
   could be copied to a signed byte, while (theoretically) the negative
   value can exceed the capacity of the signed byte. measurement.hh now
   defines a type ss_t to store a signal strength value with the good
   size (it is currently an int_fast16_t).
2012-01-09 11:11:31 +01:00
Matteo Cypriani 58ba4c79ff [lib] Rename start_time -> capture_time
"start_time" was meaningless in the global data structures of owlps.h,
and could lead to errors in the aggregator, since it defines a field
start_time in one of its internal structures.
2012-01-09 11:11:30 +01:00
Matteo Cypriani aa8d11e12b [lib] Rename antenna_signal_dbm -> ss_dbm
Use "ss" instead of "antenna_signal" in the data types declared in
owlps.h. Shorter, and as meaningful.
2012-01-09 11:11:30 +01:00
Matteo Cypriani 61124e4cfc Makefiles: test CC prior to surcharge it
Verifies that CC is at its default value prior to try to surcharge it
with colorgcc.
2012-01-09 11:11:30 +01:00
Matteo Cypriani 5ffeafb857 [Listener] Option ENABLE_KEEP_MONITOR
Add the compile-time option ENABLE_KEEP_MONITOR to enable/disable the
option -K. That allows to make optional the dependency on iwlib.
This option is disabled by default in the Makefiles.
2012-01-09 11:11:30 +01:00
Matteo Cypriani 8c070d482e Standardise CLI options
Make uniform the command-line options of the various programs.
Positioning: delete some useless short options.
2012-01-09 11:11:30 +01:00
Matteo Cypriani ffd1c1d625 [Listener] Verbose level #4 instead of option -c
Add a fourth verbose level to display the captured packets and suppress
the dedicated options -c / -Q.
2012-01-09 11:11:30 +01:00
Matteo Cypriani 39300aaa85 Makefiles: translate help
Translate help messages from French.
2012-01-09 11:11:30 +01:00
Matteo Cypriani a70fc783e2 Makefiles: translate comments
Translate all the comments from French.
2012-01-09 11:11:30 +01:00
Matteo Cypriani b3b1f8eda2 [Listener] Display the mobile's IP address
When displaying the request to send, display the IP address of the
mobile.
Aggregator: clean the code for displaying requests.
2011-11-22 19:59:01 +01:00
Matteo Cypriani 1debe92624 [Listener] Fix extract_calibration_data() 2011-10-24 13:56:51 +02:00
Matteo Cypriani 603293c5f9 [Listener] Fix request display
Use owl_mac_bytes_to_string_r() instead of owl_mac_bytes_to_string()
when there are more than one address to display in a single printf().
2011-10-13 15:40:05 +02:00
Matteo Cypriani 3fec57b1ae Move all error #defines in owlps.h 2011-08-26 11:09:41 +02:00
Matteo Cypriani 40bc6d0b59 [Listener] Fix reception timestamp
struct pcap_pkthdr.ts is host-endian, not net-endian, so we have to
convert it to net-endianess when reading it from the packet.
2011-08-24 14:05:16 +02:00
Matteo Cypriani 8f48a22482 [Listener] Fix config parsing memory leaks
The configuration parsing function could call exit() (e.g. with -h, -V,
or in case of error), implying a memory leak. This is fixed.
Additionally, minor cleaning in the configuration functions.
2011-08-24 13:39:01 +02:00
Matteo Cypriani ff17c92bfa [lib-client] Change the prefix for "owl_"
Use the prefix "owl_" instead of "owlclient_".
2011-08-23 19:58:49 +02:00
Matteo Cypriani 442c5a4601 [lib] .h all is prefixed with OWL_ or owl_
All the types, defines, etc. are now prefixed with "OWL_" or "owl_".
TRUE and FALSE become owl_true and owl_false.
2011-08-22 22:43:35 +02:00
Matteo Cypriani 1d6016a3ce [lib] Move listener code to owlps-listener.h (bis)
Move the last piece of listener-specific code from owlps.h to
owlps-listener.h.
2011-08-22 22:43:35 +02:00
Matteo Cypriani 8327357290 Makefiles: allow to enable -g easily
Add a commented line DEBUG=-g in each Makefile.
2011-08-22 22:43:35 +02:00
Matteo Cypriani 462298d6e8 [Listener] Set the signal flags to 0 2011-08-20 20:00:39 +02:00
Matteo Cypriani de74213102 [lib] Rename OWL_TIMESTAMP_STR_LEN OWL_TIMESTAMP_STRLEN 2011-08-18 14:02:17 +02:00
Matteo Cypriani ac4dd87ef9 Use ++var instead of var++ whenever possible 2011-08-18 11:45:36 +02:00
Matteo Cypriani ab8ad83e52 Add emacs mode command to each Makefile_atheros* 2011-08-18 11:05:45 +02:00
Matteo Cypriani fb9d093d5a [Listener] Add extract_radiotap_data()
Another refactoring step for read_packet().
2011-08-04 00:35:32 +02:00
Matteo Cypriani 4bae0c9b4e [Listener] Add extract_calibration_data()
A first step in the long way of read_packet() refactoring.
2011-08-04 00:25:08 +02:00
Matteo Cypriani ac3c7b4352 [lib] Move listener code to owlps-listener.h
Move listener-specific code (Radiotap fields' definition, etc.) from
owlps.h to owlps-listener.h.
2011-08-03 23:13:16 +02:00
Matteo Cypriani a174a01e0f Rename Atheros Makefiles: specify OpenWrt version
*/Makefile_atheros become */Makefile_atheros_openwrt-8.09.
2011-07-25 13:13:21 +02:00
Matteo Cypriani 1dae048f0c [lib-client] Delay in ms instead of microseconds
In owlclient_send_request(), the delay between two packets is now in
milliseconds.
Client & Listener updated to reflect the change.
2011-07-25 12:46:20 +02:00
Matteo Cypriani e976d80d73 [Listener] Makefiles: split OWLPSFLAGS
Split OWLPSFLAGS into several lines, in order to ease the (un)activation
of options.
2011-07-25 12:46:20 +02:00
Matteo Cypriani 051ce9147c Use -D DEBUG / NDEBUG in Makefiles
Instead of #define DEBUG, we now prefer to use either verbose levels
or, when needed, NDEBUG. Each Makefile was modified to be able to pass
-D NDEBUG to the compiler (but the corresponding lines are commented),
except in the modules where assert is never used, in which case the
Makefile passes -D DEBUG.

Long story short: to totally disable debugging code, comment-out the
"-D DEBUG" lines and uncomment the "-D NDEBUG" lines, in every Makefile.
2011-07-25 12:46:20 +02:00
Matteo Cypriani f008db0e1c [Listener] Use perror() after recvfrom() 2011-07-25 12:46:20 +02:00
Matteo Cypriani f71a56bb9a [Listener] Use verbose levels 2011-07-25 12:46:20 +02:00
Matteo Cypriani a62387e465 [Listener] Switch verbose mode to verbose level 2011-07-25 12:46:19 +02:00
Matteo Cypriani 44bf79f9c4 [Listener] Makefile backfire: use -lconfuse
The Confuse library works on OpenWrt, so why don't link it?
2011-07-19 11:55:52 +02:00
Matteo Cypriani c7e0280596 Fix Makefiles for OpenWrt 10.03 2011-07-18 23:34:06 +02:00
Matteo Cypriani 02da7c7851 [Listener] Define le*toh() for OpenBSD
OpenBSD's endian.h uses the names letoh* instead of le*toh.
2011-06-27 10:09:14 +02:00
Matteo Cypriani 306e855ad1 [Listener] Test the platform for endian.h
The <endian.h> header is Glibc-specific. On BSD platforms, one have to
use <sys/endian.h>.
(This was the occasion to improve the preprocessor code here.)
2011-06-27 10:09:14 +02:00
Matteo Cypriani 5f72702b88 [Listener] Use ETHERTYPE_IP instead of ETH_P_IP
ETH_P_IP is Linux-specific.
2011-06-27 10:09:14 +02:00
Matteo Cypriani 3ac53e7b76 [Listener] Fix compilation without USE_PTHREAD 2011-06-27 10:09:14 +02:00
Matteo Cypriani 95b9ea30bf [lib] Fix #includes for OpenBSD
libowlps now builds on OpenBSD (4.9)!
2011-06-27 10:09:14 +02:00
Matteo Cypriani 65487af736 [lib] Makefile: remove unneeded -lrt & -lm
-lrt is now added as needed in each module Makefile, but not directly in
the library. Furthermore, the Makefiles add -lrt only if the platform is
Linux.
2011-06-27 10:09:14 +02:00
Matteo Cypriani 00d89efd40 [lib] Move owl_iface_mode_monitor() in Listener
Only owlps-listener uses owl_iface_mode_monitor(), so we don't need to
keep it in libowlps.
2011-06-27 10:09:14 +02:00
Matteo Cypriani 7dade1c36b Makefiles: get rid of echo -e
Use one call to echo for each line, because the echo's -e option is not
standard.
2011-06-27 10:09:14 +02:00
Matteo Cypriani f54b0d11e1 Makefiles: remove -v incompatible with BSD commands
The -v 'verbose' switch of the standard commands (rm, cp, mkdir, etc.)
is not implemented in BSD versions of the commands, so we avoid using
it.
2011-06-27 10:09:14 +02:00
Matteo Cypriani 5364944c68 Add missing Makefiles for OpenWrt 10.03 (Backfire)
* libowlps, libowlps-client & owlps-listener:
Add Makefiles to compile for OpenWrt 10.03 (Backfire). (owlps-client had
one already.)

* libowlps & libowlps-client:
Update the Makefiles for OpenWrt 8.09 (Kamikaze).
2011-06-15 10:36:47 +02:00
Matteo Cypriani cc66eb7c59 [Listener] read_packet(): blank the whole request
Blank the whole request with memset() instead of setting to zero each
field.
2011-05-05 13:21:41 +02:00
Matteo Cypriani be784c8ec0 [Listener] Check SS field before to print it 2011-05-03 13:38:50 +02:00
Matteo Cypriani 3196e5a2e0 Makefiles: resolve OWLPS_VERSION earlier 2011-04-26 10:15:04 +02:00
Matteo Cypriani 52c3b34170 [Listener] Fix -f: do not quit anymore 2011-04-13 00:12:18 +02:00
Matteo Cypriani c23bddffae [Listener] print_version(): print version number
Use git describe to generate a version label. One can also specify a
label:
  make OWLPS_VERSION=v3.14alpha
2011-04-12 23:29:47 +02:00
Matteo Cypriani d31ac3864e Position endianess conversion in all modules 2011-04-07 16:15:46 +02:00
Matteo Cypriani 7499ef9ec5 [Listener] Refactor endianess #defines 2011-04-07 16:14:55 +02:00
Matteo Cypriani d1c6abdaf7 [Listener] Send coordinates in autocalib. requests
One can now provide the coordinates of the listener on the command line.
2011-04-07 09:17:46 +02:00
Matteo Cypriani c1f4c4e77e [Listener] Check autocalibration_nb_packets
Display a warning if the number of autocalibration packets to send is
null.
2011-04-07 09:17:46 +02:00
Matteo Cypriani df5ed19834 Include headers as needed
Move #includes from .h to .c wherever possible.
2011-03-31 16:03:22 +02:00
Matteo Cypriani d62a7500b1 [lib] Rename run -> owl_run 2011-03-31 16:03:22 +02:00
Matteo Cypriani 4f74524f05 Handle request type in Listener & Aggregator
The listener now sends the request type to the aggregator. The
aggregator writes it to the CSV file and transmit it to the positioning
server.
2011-03-25 17:20:18 +01:00
Matteo Cypriani 204750b8c5 [lib] Rename PACKET_TYPE_* -> OWL_REQUEST_* 2011-03-25 16:30:40 +01:00
Matteo Cypriani 1e1023e6b5 Makefiles: update lib dependencies 2011-03-25 13:50:20 +01:00
Matteo Cypriani 4720399513 [lib] mac_bytes_to_string(): do not malloc anymore
owl_mac_bytes_to_string() now uses a static buffer, so the caller do not
need to free the returned buffer manually. Because of this static
buffer, it is not thread-safe anymore, therefore we introduce
owl_mac_bytes_to_string_r() that is a thread-safe version.
2011-03-25 11:48:25 +01:00
Matteo Cypriani e8aa0838f4 Use ETHER_ADDR_LEN instead of 6 2011-03-25 11:48:25 +01:00
Matteo Cypriani 5f9de6e1dc [Listener] Fix the "don't want to quit" bug
In capture(), the pcap_loop() call was blocking, so the program did not
quit if no packet came on rtap_iface. This is now fixed by a call to
pcap_breakloop() in the signal handlers.
2011-03-25 11:48:24 +01:00
Matteo Cypriani 0a52205916 [Listener] Use pthread_cleanup* 2011-03-25 11:48:24 +01:00
Matteo Cypriani 6c4af9020f close(fd) instead of (void) close(fd) 2011-03-25 11:48:24 +01:00
Matteo Cypriani 98386514e5 Use INET_ADDRSTRLEN instead of 16 2011-03-25 11:48:23 +01:00
Matteo Cypriani f71a4650e2 [Listener] Better handling of threads
Fix thread headers, check the return value of pthread_create(), and wait
for the threads at the end of the program.
2011-03-25 11:48:23 +01:00
Matteo Cypriani d4e9d9c97b [Listener] Rename variable couple -> request 2011-03-25 11:48:22 +01:00