2015-04-10 17:52:01 +02:00
|
|
|
#include "log.h"
|
2015-04-05 02:10:37 +02:00
|
|
|
#include "conn.h"
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
#include "mbag.h"
|
2015-04-05 02:10:37 +02:00
|
|
|
#include "capwap_items.h"
|
|
|
|
#include "capwap.h"
|
|
|
|
|
|
|
|
|
2015-04-05 20:27:17 +02:00
|
|
|
/*
|
2015-04-05 02:10:37 +02:00
|
|
|
int cw_put_subelem_version(uint8_t *dst,uint16_t subelem_id, uint32_t vendor_id,bstr16_t data)
|
|
|
|
{
|
|
|
|
|
|
|
|
uint8_t *d=dst;
|
|
|
|
d += cw_put_dword(d,vendor_id);
|
|
|
|
d += cw_put_dword(d, (subelem_id<<16) | bstr16_len(data));
|
|
|
|
d += cw_put_data(d,bstr16_data(data),bstr16_len(data));
|
|
|
|
return d-dst;
|
|
|
|
}
|
2015-04-05 20:27:17 +02:00
|
|
|
*/
|
2015-04-05 02:10:37 +02:00
|
|
|
|
|
|
|
|
2015-04-05 20:27:17 +02:00
|
|
|
int cw_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst)
|
2015-04-05 02:10:37 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
uint8_t *d = dst+4;
|
2015-04-19 23:27:44 +02:00
|
|
|
struct mbag_item * i;
|
|
|
|
i = mbag_get(conn->local,CW_ITEM_AC_STATUS);
|
2015-04-05 02:10:37 +02:00
|
|
|
|
|
|
|
if (!i) {
|
|
|
|
cw_log(LOG_ERR,"Can't send AC Descriptor, no AC Status Item found");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-04-05 20:27:17 +02:00
|
|
|
d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->data));
|
2015-04-05 02:10:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
i = mbag_get(conn->local,CW_ITEM_AC_HARDWARE_VERSION);
|
2015-04-05 02:10:37 +02:00
|
|
|
if ( i ) {
|
2015-04-07 07:42:36 +02:00
|
|
|
d += cw_put_version(d,CW_SUBELEM_AC_HARDWARE_VERSION,i->data);
|
2015-04-05 02:10:37 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-04-11 19:00:51 +02:00
|
|
|
cw_log(LOG_ERR, "Can't send hard version in AC descriptor, not set.");
|
2015-04-05 02:10:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
i = mbag_get(conn->local,CW_ITEM_AC_SOFTWARE_VERSION);
|
2015-04-05 02:10:37 +02:00
|
|
|
|
|
|
|
if ( i ) {
|
2015-04-07 07:42:36 +02:00
|
|
|
d += cw_put_version(d,CW_SUBELEM_AC_SOFTWARE_VERSION,i->data);
|
2015-04-05 02:10:37 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-04-11 19:00:51 +02:00
|
|
|
cw_log(LOG_ERR, "Can't send software version in AC descriptor, not set.");
|
2015-04-05 02:10:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int len = d-dst-4;
|
|
|
|
|
2015-04-05 20:27:17 +02:00
|
|
|
return len + cw_put_elem_hdr(dst,a->elem_id,len);
|
2015-04-05 02:10:37 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|