2015-03-29 01:55:06 +01:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Implements cw_readelem_vendor_specific_payload
|
|
|
|
*/
|
|
|
|
|
2014-08-26 00:56:52 +02:00
|
|
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
|
|
|
#include "capwap.h"
|
2015-03-15 20:53:21 +01:00
|
|
|
#include "lwapp.h"
|
|
|
|
|
2014-08-26 00:56:52 +02:00
|
|
|
#include "cw_log.h"
|
|
|
|
|
2015-03-15 20:53:21 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cw_readelem_cisco_payload(void *data,int msgtype,int elem_id,uint8_t *msgelem, int len)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
switch (msgtype) {
|
2015-03-23 07:48:27 +01:00
|
|
|
case CW_MSG_CONFIGURATION_STATUS_REQUEST:
|
2015-03-15 20:53:21 +01:00
|
|
|
{
|
|
|
|
if (lw_readelem_wtp_board_data((struct wtpinfo*)data,elem_id,msgelem,len))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2015-03-29 15:36:23 +02:00
|
|
|
case CW_MSG_DISCOVERY_REQUEST:
|
2015-03-16 02:41:35 +01:00
|
|
|
{
|
2015-03-17 07:38:09 +01:00
|
|
|
struct wtpinfo * wtpinfo = (struct wtpinfo*)data;
|
|
|
|
if (lw_readelem_wtp_name(&wtpinfo->name,elem_id,msgelem,len))
|
|
|
|
return 1;
|
2015-03-16 02:41:35 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-03-29 01:55:06 +01:00
|
|
|
case CW_MSG_CONFIGURATION_STATUS_RESPONSE:
|
|
|
|
{
|
|
|
|
|
|
|
|
struct radioinfo ri;
|
|
|
|
//lw_read_elem_wtp_wlan_radio_
|
|
|
|
//cw_read
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-16 02:41:35 +01:00
|
|
|
|
2015-03-15 20:53:21 +01:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
2014-08-26 00:56:52 +02:00
|
|
|
|
|
|
|
|
2015-03-29 01:55:06 +01:00
|
|
|
/**
|
|
|
|
* Read a CAPWAP Vendor Specific Payload message element.
|
|
|
|
* @param data pointer to data where the results can be stored
|
|
|
|
* @param msgtype type of message in which the element was found
|
|
|
|
* @param elemtype element type, must be CW_ELEM_VENDOR_PECIFIC_PAYLOAD
|
|
|
|
* @param msgelem pointer to message elemenet data
|
|
|
|
* @param len length of message element data
|
|
|
|
* @return 1 = successful read\n 0 = no vendor specific payload element
|
|
|
|
*/
|
2014-08-26 00:56:52 +02:00
|
|
|
|
|
|
|
int cw_readelem_vendor_specific_payload(void * data,int msgtype,int elemtype,uint8_t *msgelem, int len)
|
|
|
|
{
|
2015-03-23 07:48:27 +01:00
|
|
|
if (elemtype != CW_ELEM_VENDOR_SPECIFIC_PAYLOAD)
|
2014-08-26 00:56:52 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (len < 6){
|
|
|
|
cw_dbg(DBG_ERR,"Vendor specific payload msgelem too short, len < 6.");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-03-15 20:53:21 +01:00
|
|
|
|
2015-03-29 01:55:06 +01:00
|
|
|
uint32_t vendor_id = cw_get_dword(msgelem);
|
|
|
|
uint16_t elem_id = cw_get_word(msgelem+4);
|
2015-03-15 20:53:21 +01:00
|
|
|
int elem_len = len - 6;
|
|
|
|
|
|
|
|
switch (vendor_id) {
|
|
|
|
|
|
|
|
case CW_VENDOR_ID_CISCO:
|
|
|
|
return cw_readelem_cisco_payload(data,msgtype,elem_id,msgelem+6,elem_len);
|
2015-03-23 07:48:27 +01:00
|
|
|
default:
|
|
|
|
cw_dbg(DBG_ERR,"Can't read vendor specific payload. Vendor ID %d",vendor_id);
|
2015-03-15 20:53:21 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-08-26 00:56:52 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|