mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
Give sorting order as parameter
This commit is contained in:
parent
589eb3f98b
commit
ffc954f193
5 changed files with 17 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
||||||
config 'settings' 'dawn'
|
config 'settings' 'dawn'
|
||||||
option broadcast_ip '192.186.1.255'
|
option broadcast_ip '192.186.1.255'
|
||||||
option broadcast_port '1025'
|
option broadcast_port '1025'
|
||||||
|
option sort_order 'cfsb'
|
||||||
option background '0'
|
option background '0'
|
|
@ -18,12 +18,15 @@ start_service()
|
||||||
config_load "${NAME}"
|
config_load "${NAME}"
|
||||||
config_get broadcast_ip dawn broadcast_ip
|
config_get broadcast_ip dawn broadcast_ip
|
||||||
config_get broadcast_port dawn broadcast_port
|
config_get broadcast_port dawn broadcast_port
|
||||||
|
config_get sort_order dawn sort_order
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
echo "$PROG -p $broadcast_port -i $broadcast_ip"
|
echo "$PROG -p $broadcast_port -i $broadcast_ip -o $sort_order"
|
||||||
procd_set_param command "$PROG"
|
procd_set_param command "$PROG"
|
||||||
procd_append_param command -p "${broadcast_port}"
|
procd_append_param command -p "${broadcast_port}"
|
||||||
procd_append_param command -i "${broadcast_ip}"
|
procd_append_param command -i "${broadcast_ip}"
|
||||||
|
procd_append_param command -o "${sort_order}"
|
||||||
|
|
||||||
|
|
||||||
procd_set_param stdout 1
|
procd_set_param stdout 1
|
||||||
procd_set_param stderr 1
|
procd_set_param stderr 1
|
||||||
|
|
|
@ -56,7 +56,6 @@ int go_next(char sort_order[], int i, probe_entry entry, probe_entry next_entry)
|
||||||
int conditions = 1;
|
int conditions = 1;
|
||||||
for(int j = 0; j < i; j++)
|
for(int j = 0; j < i; j++)
|
||||||
{
|
{
|
||||||
printf("go_next %i", j);
|
|
||||||
i &= !(go_next(sort_order, j, entry, next_entry));
|
i &= !(go_next(sort_order, j, entry, next_entry));
|
||||||
}
|
}
|
||||||
return conditions && go_next_help(sort_order, i, entry, next_entry);
|
return conditions && go_next_help(sort_order, i, entry, next_entry);
|
||||||
|
@ -70,7 +69,7 @@ node* insert(node* head, probe_entry entry) {
|
||||||
|
|
||||||
|
|
||||||
// length of sorting string
|
// length of sorting string
|
||||||
char sort_string[] = "cfsb";
|
//char sort_string[] = "cfsb";
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if(!head)
|
if(!head)
|
||||||
|
@ -221,6 +220,7 @@ int mac_is_greater(uint8_t addr1[], uint8_t addr2[])
|
||||||
void print_list()
|
void print_list()
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&list_mutex);
|
pthread_mutex_lock(&list_mutex);
|
||||||
|
printf("------------------\n");
|
||||||
node* head = probe_list_head;
|
node* head = probe_list_head;
|
||||||
if(!head)
|
if(!head)
|
||||||
{
|
{
|
||||||
|
@ -233,6 +233,7 @@ void print_list()
|
||||||
print_probe_entry(next->data);
|
print_probe_entry(next->data);
|
||||||
next = next->ptr;
|
next = next->ptr;
|
||||||
}
|
}
|
||||||
|
printf("------------------\n");
|
||||||
pthread_mutex_unlock(&list_mutex);
|
pthread_mutex_unlock(&list_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,4 +249,5 @@ void print_probe_entry(probe_entry entry)
|
||||||
|
|
||||||
printf("bssid_addr: %s, client_addr: %s, target_addr: %s, signal: %d, freq: %d\n",
|
printf("bssid_addr: %s, client_addr: %s, target_addr: %s, signal: %d, freq: %d\n",
|
||||||
mac_buf_ap, mac_buf_client, mac_buf_target, entry.signal, entry.freq);
|
mac_buf_ap, mac_buf_client, mac_buf_target, entry.signal, entry.freq);
|
||||||
|
|
||||||
}
|
}
|
|
@ -12,6 +12,8 @@
|
||||||
#define ETH_ALEN 6
|
#define ETH_ALEN 6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SORT_NUM 5
|
||||||
|
|
||||||
// Probe entrys
|
// Probe entrys
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t bssid_addr[ETH_ALEN];
|
uint8_t bssid_addr[ETH_ALEN];
|
||||||
|
@ -37,5 +39,6 @@ int mac_first_in_probe_list(uint8_t bssid_addr[], uint8_t client_addr[]);
|
||||||
|
|
||||||
pthread_mutex_t list_mutex;
|
pthread_mutex_t list_mutex;
|
||||||
node* probe_list_head;
|
node* probe_list_head;
|
||||||
|
char sort_string[SORT_NUM];
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -15,7 +15,7 @@ int main(int argc, char **argv)
|
||||||
char opt_broadcast_ip[BUFSIZE];
|
char opt_broadcast_ip[BUFSIZE];
|
||||||
char opt_broadcast_port[BUFSIZE];
|
char opt_broadcast_port[BUFSIZE];
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "cs:p:i:b:")) != -1) {
|
while ((ch = getopt(argc, argv, "cs:p:i:b:o:")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 's':
|
case 's':
|
||||||
ubus_socket = optarg;
|
ubus_socket = optarg;
|
||||||
|
@ -28,6 +28,9 @@ int main(int argc, char **argv)
|
||||||
snprintf(opt_broadcast_ip,BUFSIZE,"%s",optarg);
|
snprintf(opt_broadcast_ip,BUFSIZE,"%s",optarg);
|
||||||
printf("broadcast ip: %s\n", opt_broadcast_ip);
|
printf("broadcast ip: %s\n", opt_broadcast_ip);
|
||||||
break;
|
break;
|
||||||
|
case 'o':
|
||||||
|
snprintf(sort_string,SORT_NUM,"%s",optarg);
|
||||||
|
printf("sort string: %s\n", sort_string);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue