#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <arpa/inet.h>
#include <sys/time.h>
Go to the source code of this file.
add_element adds an element (a new device node) to the list. Elements shall be ordered.
- Returns
- the added element pointer.
- Parameters
-
list | a pointer to the list head pointer. |
mac_value | the MAC address of the new node to be added. |
void add_value |
( |
Deque * |
list, |
|
|
double |
value |
|
) |
| |
add_value adds a new RSSI value at the end of the deque.
- Parameters
-
the | deque to append the element to. |
value | the RSSI value (dBm, do not forget to convert when inserting!) |
void calculate_avg |
( |
Element ** |
list, |
|
|
u_char * |
mac_value, |
|
|
u_char * |
nb_samples, |
|
|
u_char * |
avg_value |
|
) |
| |
Calculate avg ss values from a given string mac address.
- Parameters
-
mac_value | the string MAC address necessary to identify the device to which calculation is needed. |
list | a pointer to the list head pointer. |
nb_samples | is a pointer that will contain the number of sample we need to know. |
avg_value | is a pointer that will contain the average rssi_value based on the captured samples. |
void clear_outdated_Elements |
( |
Element ** |
list | ) |
|
clear_outdated_Elements removes all outdated Elements in the linked-list.
- Parameters
-
list | the Element (devices) list in which the outdated devices need to be removed |
void clear_outdated_values |
( |
Deque * |
list | ) |
|
clear_outdated_values removes all outdated RSSI in a RSSI deque.
- Parameters
-
list | the deque from which to filter the outdated values. |
void decrement_all_deadlines |
( |
Element * |
list | ) |
|
This function decrement every second the deadline value of all the samples included in an element list.
- Parameters
-
This function find a specific Deque in the Element List.
- Returns
- it return a pointer to the Element in which the deque is located
- Parameters
-
list | the Element list head pointer |
deq | the address of the Deque to find |
find_mac looks up for a MAC address in the list.
- Returns
- a pointer to the corresponding element, NULL if not found.
- Parameters
-
list | the list head pointer. |
mac_value | the MAC address to search. |
unsigned int mac_maching |
( |
u_char * |
mac1, |
|
|
u_char * |
mac2 |
|
) |
| |
This function makes the comparison of two mac addresses to check if they are equals.
- Returns
- it return 0 if they are not equal and 1 if they are equal
- Parameters
-
mac1 | the first string mac address |
mac2 | the second string mac address |