2015-04-07 07:46:55 +02:00
|
|
|
|
|
|
|
#include "capwap.h"
|
2015-04-12 19:19:29 +02:00
|
|
|
#include "dbg.h"
|
2015-04-07 07:46:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct args {
|
|
|
|
cw_action_in_t *a;
|
|
|
|
cw_action_in_t **out;
|
|
|
|
struct avltree *mand;
|
|
|
|
int n;
|
|
|
|
};
|
2015-04-11 19:00:51 +02:00
|
|
|
/*
|
2015-04-07 07:46:55 +02:00
|
|
|
static int check_mand_cb(void *priv, void *val)
|
|
|
|
{
|
2015-04-10 17:14:55 +02:00
|
|
|
|
2015-04-07 07:46:55 +02:00
|
|
|
|
|
|
|
cw_action_in_t *a = (cw_action_in_t*)val;
|
|
|
|
struct args *args = (struct args*) priv;
|
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
printf("Na?\n");
|
|
|
|
return 1;
|
|
|
|
|
2015-04-07 07:46:55 +02:00
|
|
|
if ( (args->a->msg_id != a->msg_id) || (args->a->capwap_state != a->capwap_state))
|
2015-04-10 17:14:55 +02:00
|
|
|
{
|
|
|
|
printf ("Was soll das denn?\n");
|
|
|
|
printf("End of fun\n");
|
|
|
|
|
2015-04-07 07:46:55 +02:00
|
|
|
return 0;
|
2015-04-10 17:14:55 +02:00
|
|
|
}
|
2015-04-07 07:46:55 +02:00
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
printf("Nu?\n");
|
|
|
|
return 1;
|
2015-04-07 07:46:55 +02:00
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
printf("Found wat %d %d %c\n",a->msg_id,a->elem_id, a->mand ? '*':'-');
|
2015-04-07 07:46:55 +02:00
|
|
|
if (a->mand) {
|
|
|
|
int i = a->item_id;
|
|
|
|
void * rc = avltree_del(args->mand,&i);
|
|
|
|
if (!rc) {
|
|
|
|
if (args->out)
|
|
|
|
args->out[args->n]=a;
|
|
|
|
args->n++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-04-11 19:00:51 +02:00
|
|
|
*/
|
2015-04-07 07:46:55 +02:00
|
|
|
|
|
|
|
int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_in_t *a)
|
|
|
|
{
|
2015-04-10 17:14:55 +02:00
|
|
|
|
|
|
|
|
2015-04-07 07:46:55 +02:00
|
|
|
cw_action_in_t as;
|
|
|
|
|
|
|
|
as.capwap_state = a->capwap_state;
|
|
|
|
as.msg_id = a->msg_id;
|
|
|
|
as.vendor_id = 0;
|
|
|
|
as.elem_id = 0;
|
|
|
|
as.proto=0;
|
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
|
|
|
|
DEFINE_AVLITER(it,conn->actions->in);
|
|
|
|
int n=0;
|
|
|
|
avliter_foreach_from(&it,&as) {
|
2015-04-12 19:19:29 +02:00
|
|
|
// avliter_foreach(&it) {
|
|
|
|
cw_action_in_t * ai = avliter_get(&it);
|
|
|
|
|
|
|
|
if (ai->msg_id != as.msg_id && ai->capwap_state != as.capwap_state)
|
2015-04-10 17:14:55 +02:00
|
|
|
break;
|
2015-04-12 19:19:29 +02:00
|
|
|
if (!ai->mand)
|
2015-04-10 17:14:55 +02:00
|
|
|
continue;
|
|
|
|
|
2015-04-12 19:19:29 +02:00
|
|
|
int i = ai->item_id;
|
2015-04-10 17:14:55 +02:00
|
|
|
void * rc = avltree_del(conn->mand,&i);
|
|
|
|
if (!rc) {
|
2015-04-12 19:19:29 +02:00
|
|
|
out[n++]=ai;
|
2015-04-10 17:14:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2015-04-07 07:46:55 +02:00
|
|
|
struct args args;
|
|
|
|
args.a = &as;
|
|
|
|
args.mand=conn->mand;
|
|
|
|
args.out=out;
|
|
|
|
args.n=0;
|
|
|
|
|
|
|
|
avltree_foreach_from_asc(conn->actions->in,&as,check_mand_cb,&args);
|
2015-04-10 17:14:55 +02:00
|
|
|
*/
|
|
|
|
return n;
|
2015-04-07 07:46:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|