2015-04-05 02:10:37 +02:00
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
#include "cw.h"
|
2015-04-05 02:10:37 +02:00
|
|
|
#include "capwap_items.h"
|
|
|
|
|
2015-04-11 19:00:51 +02:00
|
|
|
#include "dbg.h"
|
2015-04-10 17:52:01 +02:00
|
|
|
#include "log.h"
|
2018-03-12 18:01:40 +01:00
|
|
|
#include "msgset.h"
|
|
|
|
#include "ktv.h"
|
2015-04-07 07:42:36 +02:00
|
|
|
|
2015-04-05 02:10:37 +02:00
|
|
|
|
2018-03-12 18:01:40 +01:00
|
|
|
int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
|
|
|
|
, uint8_t * dst)
|
2015-04-05 02:10:37 +02:00
|
|
|
{
|
2018-03-15 20:07:17 +01:00
|
|
|
struct cw_KTV * elem, search;
|
2018-03-12 18:01:40 +01:00
|
|
|
int start, len;
|
|
|
|
/* Get the element to put */
|
2018-03-15 20:07:17 +01:00
|
|
|
|
|
|
|
search.key=handler->key;
|
|
|
|
elem = mavl_get(params->conn->local_cfg, &search);
|
2015-04-05 20:27:17 +02:00
|
|
|
|
|
|
|
/* Size for msg elem header depends on
|
|
|
|
vendor specific payload */
|
2018-03-12 18:01:40 +01:00
|
|
|
start = handler->vendor ? 10 : 4;
|
2015-04-05 20:27:17 +02:00
|
|
|
|
2018-03-12 18:01:40 +01:00
|
|
|
if (elem == NULL) {
|
2015-04-19 16:44:20 +02:00
|
|
|
const char *vendor="";
|
2018-03-12 18:01:40 +01:00
|
|
|
if ( handler->vendor ) {
|
|
|
|
vendor=cw_strvendor(handler->vendor);
|
2015-04-19 16:44:20 +02:00
|
|
|
}
|
2018-03-15 20:07:17 +01:00
|
|
|
if ( params->elemdata->mand) {
|
|
|
|
cw_log(LOG_ERR,
|
2016-04-11 03:25:40 +02:00
|
|
|
"Can't put mandatory element %s %d - (%s) into %s. No value for '%s' found.",
|
2018-03-15 20:07:17 +01:00
|
|
|
vendor, handler->id, handler->name, "nona"
|
|
|
|
, handler->key
|
2015-04-11 19:00:51 +02:00
|
|
|
);
|
2018-03-15 20:07:17 +01:00
|
|
|
}
|
2015-04-11 19:00:51 +02:00
|
|
|
else{
|
2018-02-26 18:28:12 +01:00
|
|
|
/* cw_dbg(DBG_WARN,"No output for element %s%d -(%s) in %s. Item %s not found.",
|
2015-04-19 16:44:20 +02:00
|
|
|
vendor,
|
2015-04-11 19:00:51 +02:00
|
|
|
a->elem_id, cw_strelemp(conn->actions, a->elem_id)
|
|
|
|
, cw_strmsg(a->msg_id),a->item_id);
|
2018-02-26 18:28:12 +01:00
|
|
|
*/
|
2015-04-07 07:42:36 +02:00
|
|
|
}
|
|
|
|
return 0;
|
2018-03-12 18:01:40 +01:00
|
|
|
}
|
|
|
|
len = handler->type->put(elem,dst+start);
|
2015-04-05 20:27:17 +02:00
|
|
|
|
2018-03-12 18:01:40 +01:00
|
|
|
/*(cw_put_mbag_item(dst + start, item);*/
|
2015-04-05 20:27:17 +02:00
|
|
|
|
2018-03-12 18:01:40 +01:00
|
|
|
if (handler->vendor)
|
|
|
|
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
2015-04-05 20:27:17 +02:00
|
|
|
|
2018-03-12 18:01:40 +01:00
|
|
|
return len + cw_put_elem_hdr(dst, handler->id, len);
|
2015-04-05 02:10:37 +02:00
|
|
|
}
|
2015-04-28 10:23:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|