2015-04-07 07:46:55 +02:00
|
|
|
|
|
|
|
#include "capwap.h"
|
2015-04-12 19:19:29 +02:00
|
|
|
#include "dbg.h"
|
2018-03-15 20:07:17 +01:00
|
|
|
#include "log.h"
|
2015-04-07 07:46:55 +02:00
|
|
|
|
2018-03-12 11:22:06 +01:00
|
|
|
int cw_check_missing_mand(struct cw_MsgData *msgdata, mavl_t keys )
|
2015-04-07 07:46:55 +02:00
|
|
|
{
|
2018-03-12 11:22:06 +01:00
|
|
|
mlistelem_t * elem;
|
|
|
|
char *mandkey, *result;
|
2018-03-15 20:07:17 +01:00
|
|
|
mlist_t missing;
|
|
|
|
int count;
|
2018-03-12 11:22:06 +01:00
|
|
|
|
2018-03-15 20:07:17 +01:00
|
|
|
missing = mlist_create_conststr();
|
|
|
|
if (missing==NULL){
|
|
|
|
cw_log(LOG_ERR, "Can't allocate memory for check of missing mand elems: %s", strerror(errno));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-03-12 11:22:06 +01:00
|
|
|
mlist_foreach(elem, msgdata->mand_keys){
|
|
|
|
mandkey = mlistelem_get_str(elem);
|
|
|
|
|
|
|
|
result = mavl_get_str(keys,mandkey);
|
|
|
|
if (result == NULL){
|
2018-03-15 20:07:17 +01:00
|
|
|
mlist_append_ptr(missing,mandkey);
|
2018-03-12 11:22:06 +01:00
|
|
|
}
|
|
|
|
}
|
2015-04-10 17:14:55 +02:00
|
|
|
|
2018-03-15 20:07:17 +01:00
|
|
|
mlist_foreach(elem,missing){
|
|
|
|
cw_dbg(DBG_RFC," Missing mandatory message element: %s", mlistelem_get_str(elem));
|
2015-04-10 17:14:55 +02:00
|
|
|
}
|
2018-03-15 20:07:17 +01:00
|
|
|
|
|
|
|
count = missing->count;
|
|
|
|
mlist_destroy(missing);
|
|
|
|
return count;
|
2015-04-07 07:46:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-12 11:22:06 +01:00
|
|
|
|