Work on mods.

FossilOrigin-Name: 5c56ae361f2c31ef33603f8b657f3d4768c67a8bb2135b82b0933ba65fd3c985
This commit is contained in:
7u83@mail.ru
2016-03-05 09:11:39 +00:00
parent 304ee17e4f
commit 1885f82f42
8 changed files with 42 additions and 30 deletions

View File

@ -6,7 +6,8 @@ OBJS=\
capwap_actions_wtp.o \
capwap_in_wtp_descriptor.o \
capwap_in_wtp_board_data.o \
capwap_out_wtp_descriptor.o
capwap_out_wtp_descriptor.o \
capwap_out_ac_descriptor.o
NAME=libcapwap.a

View File

@ -132,7 +132,8 @@ static cw_action_in_t actions_in[] = {
.item_id = CW_ITEM_LOCATION_DATA,
.start = cw_in_generic2,
.max_len = 1024,
.min_len = 1
.min_len = 1,
.mand = 1
}
,
@ -242,14 +243,16 @@ static cw_action_in_t actions_in[] = {
static cw_action_out_t actions_out[]={
/* Message Discovery Response */
/* ---------------------------------------------------
* Discovery Response Message
*/
/* Discovery Response AC Descriptor */
{
.msg_id = CW_MSG_DISCOVERY_RESPONSE,
.item_id = CW_ITEM_AC_DESCRIPTOR,
.elem_id = CW_ELEM_AC_DESCRIPTOR,
.out = cw_out_ac_descriptor,
.out = capwap_out_ac_descriptor,
.mand = 1
}
,
@ -265,7 +268,11 @@ static cw_action_out_t actions_out[]={
}
,
/* List of CAPWAP Control IPv4 and IPv6 addresses */
/* List of CAPWAP Control IPv4 and IPv6 addresses
* The handler cw_out_capwap_control_ip_addr_list puts
* ipv4 and ipv6 message elements, so the definition
* of .elem_id isn't needed.
*/
{
.msg_id = CW_MSG_DISCOVERY_RESPONSE,
.item_id = CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST,
@ -275,6 +282,19 @@ static cw_action_out_t actions_out[]={
}
,
/* ---------------------------------------------------
* Join Response Message
*/
{
.msg_id = CW_MSG_JOIN_RESPONSE,
.elem_id = CW_ELEM_RESULT_CODE,
.item_id = CW_ITEM_RESULT_CODE,
.out = cw_out_generic,
.get = cw_out_get_outgoing,
.mand = 1
}
,
{0,0}

View File

@ -0,0 +1,54 @@
#include "cw/log.h"
#include "cw/conn.h"
#include "cw/mbag.h"
#include "cw/capwap_items.h"
#include "cw/capwap.h"
#include "cw/cw.h"
int capwap_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst)
{
uint8_t *d = dst+4;
struct mbag_item * i;
i = mbag_get(conn->local,CW_ITEM_AC_STATUS);
if (!i) {
cw_log(LOG_ERR,"Can't send AC Descriptor, no AC Status Item found");
return 0;
}
d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->data));
i = mbag_get(conn->local,CW_ITEM_AC_HARDWARE_VERSION);
if ( i ) {
d += cw_put_version(d,CW_SUBELEM_AC_HARDWARE_VERSION,i->data);
}
else {
cw_log(LOG_ERR, "Can't send hard version in AC descriptor, not set.");
}
i = mbag_get(conn->local,CW_ITEM_AC_SOFTWARE_VERSION);
if ( i ) {
d += cw_put_version(d,CW_SUBELEM_AC_SOFTWARE_VERSION,i->data);
}
else {
cw_log(LOG_ERR, "Can't send software version in AC descriptor, not set.");
}
int len = d-dst-4;
return len + cw_put_elem_hdr(dst,a->elem_id,len);
}

View File

@ -60,7 +60,7 @@ int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_
d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->data);
}
else {
cw_log(LOG_ERR, "Can't send Software Version in WTP descriptor, not set.");
cw_log(LOG_ERR, "Can't send Bootloader Version in WTP descriptor, not set.");
}

View File

@ -14,5 +14,7 @@ extern int capwap_in_wtp_board_data(struct conn *conn, struct cw_action_in *a,
extern int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
uint8_t * dst);
extern int capwap_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst);
#endif

View File

@ -106,8 +106,9 @@ static cw_action_out_t actions_out[]={
/* Message Discovery Response */
/* Cisco AP Timesync - Important to get the WTP a DTLS
* connection established*/
/* Cisco AP Timesync - Discovery Request
* Important to get the WTP a DTLS connection established
*/
{
.msg_id = CW_MSG_DISCOVERY_RESPONSE,
.item_id = CW_ITEM_AC_TIMESTAMP,
@ -117,7 +118,7 @@ static cw_action_out_t actions_out[]={
.mand = 1
}
,
/* Discovery Response AC Descriptor */
/* AC Descriptor - Discovery Response */
{
.msg_id = CW_MSG_DISCOVERY_RESPONSE,
.item_id = CW_ITEM_AC_DESCRIPTOR,