Commit Graph

54 Commits

Author SHA1 Message Date
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 e278aab032 [lib] Force 9 digits to display nanoseconds
In owl_timestamp_to_string(), the conversion of the nanosecond value is
forced to be on 9 digits.
2012-07-13 16:35:00 +02:00
Matteo Cypriani b594505ea7 [lib] Optimise owl_mac_equals()
MAC addresses are more likely to vary in the right octets than in the
left octets, so we compare them starting from the end rather than from
the beginning.
2012-05-25 12:23:06 +02:00
Matteo Cypriani 9f8c85d9c7 [lib] timestamp_now(): gettimeofday() if needed
Use gettimeofday() when clock_gettime() is not available.
2012-05-02 17:31:59 +02:00
Matteo Cypriani 6b7e5668fa Add/update headers on the top of each source file 2012-02-06 16:44:09 +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 93f316d2c6 [lib] Fix time_elapsed()
The previous implementation was very naive and incorrect.
2012-01-11 16:48:59 +01:00
Matteo Cypriani 31bea165c5 [lib] create*socket(): return standard error code 2011-08-26 11:29:44 +02:00
Matteo Cypriani 98609d146d [lib] Add owl_msleep()
On *BSD, usleep() does not accept an argument greater than 1'000'000 (1
second). owl_msleep() decomposes its arguments to use sleep() and
usleep() calls.
2011-08-24 15:40:34 +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 de74213102 [lib] Rename OWL_TIMESTAMP_STR_LEN OWL_TIMESTAMP_STRLEN 2011-08-18 14:02:17 +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 21a82b83d0 [lib] time_elapsed(): delete debug message 2011-07-23 21:26:49 +02:00
Matteo Cypriani 35e787064b [lib] mac_bytes_to_string_r(): use snprintf()
Use snprintf() instead of sprintf() in mac_bytes_to_string_r(). This is
really useless, but I want to satisfy the snprintf BSD zealots and get
rid of the warning GCC gives me on OpenBSD.
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 fdf683796a [lib] Remove channel setting functions
Remove the unused functions owl_iface_set_channel() and
owl_iface_channel_hop().
This allows to get rid of the dependency on iwlib.
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 8c58ae804f [lib] Add Hz Wi-Fi frequencies
Add Wi-Fi channel frequencies in Hz.
Rename frequencies OWL_80211_<unit>_CHANNEL_<number>.
2011-05-13 10:51:52 +02:00
Matteo Cypriani 2ce238984c [lib] Add float endianess converters 2011-04-07 16:14:55 +02:00
Matteo Cypriani 921afff682 [lib] .c: categorise functions
+ eliminate last French words.
2011-04-07 16:14:45 +02:00
Matteo Cypriani c802ad1224 [lib] Use const arguments wherever possible 2011-04-05 15:42:16 +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 67a271596c [lib] Add timestamp_equals()
owl_timestamp_equals() allows to compare two owl_timestamp more
accurately and efficiently than "owl_time_elapsed_ms() == 0".
2011-03-25 11:48:25 +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 7fa5819544 [lib] Add timestamp_is_null() 2011-03-25 11:48:25 +01:00
Matteo Cypriani 2289e0ef9f [lib] Add close_fd() & close_file()
These functions are aimed to be used with pthread_cleanup_push().
2011-03-25 11:48:24 +01:00
Matteo Cypriani c87c2e2e93 [lib] Write messages to stderr instead of stdout 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 91cba33dcd [lib] Rename types
- Lowercase all defined types.
- Prefix with "owl_".
- Rename couple_message -> owl_captured_request.
- Rename couple_info -> owl_request_info.
2011-03-25 11:48:22 +01:00
Matteo Cypriani 33f863e2e1 [lib] Refactor time_elapsed()
owl_time_elapsed() now returns a TIMESTAMP. The new function
owl_time_elapsed_ms() returns a value in milliseconds (old behaviour).
2011-03-16 16:46:10 +01:00
Matteo Cypriani 788a61a712 [lib] Add timestamp_to_string() 2011-03-16 16:46:09 +01:00
Matteo Cypriani d0b15bf978 [lib] Do not round to ms precision anymore
Delete owl_timestamp_round_to_ms(), we now keep nanosecond precision.
2011-03-16 16:46:09 +01:00
Matteo Cypriani 3815ccae8b [lib] Fix timestamp_to_ms()
owl_timestamp_to_ms() did not convert properly the result to uint64_t.
This is now fixed, but time functions are still buggy, as we do not take
into account the length of tv_sec (owl_timestamp_round_to_ms() assumes
that it is 9-digit long).
2011-03-16 16:46:09 +01:00
Matteo Cypriani f60287bf49 [lib] Change TIMESTAMP type
TIMESTAMP is not a simple alias for struct timespec. It is now a clone
of struct timespec that uses fields of a fixed size (uint32_t).
2011-03-16 16:46:09 +01:00
Matteo Cypriani 94e3701a51 [lib] Add TIMESTAMP endianess converters
Add the functions owl_hton_timestamp() and  owl_ntoh_timestamp().
2011-03-16 16:45:38 +01:00
Matteo Cypriani b88f26e503 [lib] Rename create_udp_sending_socket()
Rename owl_create_udp_sending_socket() -> owl_create_udp_trx_socket().
2011-03-16 16:45:37 +01:00
Matteo Cypriani 940c5f74df [lib] Prefix all functions with owl_ 2011-03-16 16:45:37 +01:00
Matteo Cypriani 2771f8573b [lib] timestamp_now_ns(): return int (not BOOL) 2011-03-16 16:45:37 +01:00
Matteo Cypriani 8123ee3096 Switch to stdint types where possible
The use of integer types from inttypes.h & stdint.h should help with
portability issues. It will also force the data transmission between
different architectures to work as intended (if we handle endianess
conversions correctly!).
2011-03-16 16:45:37 +01:00
Matteo Cypriani abb1d170cf [lib] Use memset() instead of bzero() 2011-03-16 16:45:36 +01:00
Matteo Cypriani f8e7d9adef [lib] Use clock_gettime() instead of gettimeofday()
Abandon the old struct timeval and gettimeofday(). We now use the new
struct timespec and clock_gettime().
struct timespec has a nanosecond resolution, but we lower the resolution
to keep only milliseconds. The code is inspired from the Timestamp class
of the owlps-positioning.
2011-03-16 16:45:36 +01:00
Matteo Cypriani db8f6dff22 [lib] Add timestamp_now()
Use the new function timestamp_now() everywhere instead of
gettimeofday().
2011-03-16 16:44:32 +01:00
Matteo Cypriani ff81d43cb1 [lib] Introduce type TIMESTAMP
The type TIMESTAMP is a wrapper to the currently-used time structure (we
currently use struct timeval).

The function timeval_to_ms() is now timestamp_to_ms().
2011-03-16 16:44:32 +01:00
Matteo Cypriani 10a47246f4 [lib] Rename sub_date() -> time_elapsed() 2011-03-16 16:44:32 +01:00
Matteo Cypriani 829982766d [lib] Rename mac_cmp() -> mac_equals() 2011-03-16 16:44:32 +01:00
Matteo Cypriani af1c04529d [lib] sigint_handler(): use #ifdef DEBUG 2011-03-16 16:44:32 +01:00
Matteo Cypriani 3d0300cc60 [lib] Translate comments, 72 col. 2011-03-16 16:44:32 +01:00
Matteo Cypriani 719514eab6 [lib] Get rid of the last indent tabs 2011-03-16 16:44:22 +01:00