You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
#include "capwap.h"
|
|
#include "msgset.h"
|
|
#include "val.h"
|
|
#include "log.h"
|
|
#include "cw.h"
|
|
|
|
#include "dbg.h"
|
|
|
|
|
|
int cw_out_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
|
|
, uint8_t * dst)
|
|
{
|
|
cw_dbg(DBG_X,"Key: %s",handler->key);
|
|
stop();
|
|
|
|
|
|
int start;
|
|
int len;
|
|
cw_Val_t search, *result;
|
|
|
|
if (!handler->type){
|
|
cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);
|
|
return 0;
|
|
}
|
|
|
|
search.key = (char*)handler->key;
|
|
result = mavl_get_first(params->cfg,&search);
|
|
if (result == NULL ){
|
|
if (params->elemdata->mand)
|
|
cw_log(LOG_ERR,"Can't put mandatory message element %s, no data available",handler->name);
|
|
return 0;
|
|
}
|
|
|
|
if (strncmp(result->key,handler->key, strlen(handler->key))!=0){
|
|
if (params->elemdata->mand)
|
|
cw_log(LOG_ERR,"Can't put mandatory message element %s, no data available",handler->name);
|
|
return 0;
|
|
}
|
|
|
|
start = params->msgset->header_len(handler);
|
|
|
|
len = cw_ktv_write_struct(params->cfg,
|
|
params->cfg,
|
|
handler->type,handler->key,dst+start);
|
|
|
|
return params->msgset->write_header(handler,dst,len);
|
|
|
|
}
|
|
|