Heavy changes ... mbag uses const char * as key
WTP is still not 100% working... FossilOrigin-Name: 9e80cb8f1b62f854b54393e3af75b789125870b1397ccccad6d3442e3395181c
This commit is contained in:
@ -231,7 +231,6 @@ CWACTION=action.o \
|
||||
capwap_action_helpers.o \
|
||||
cw_put_image_data.o \
|
||||
cisco.o \
|
||||
item_strings.o \
|
||||
mbag.o\
|
||||
radio.o \
|
||||
cw_out_radio_info.o \
|
||||
@ -239,6 +238,7 @@ CWACTION=action.o \
|
||||
item.o
|
||||
|
||||
# cw_process_msg.o \
|
||||
# item_strings.o \
|
||||
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ struct cw_action_in{
|
||||
int (*start)(struct conn *conn,struct cw_action_in *a,uint8_t*data,int len,struct sockaddr *from);
|
||||
int (*end)(struct conn *conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from);
|
||||
const struct mbag_typedef * itemtype;
|
||||
uint16_t item_id;
|
||||
const char * item_id;
|
||||
uint16_t min_len;
|
||||
uint16_t max_len;
|
||||
uint8_t mand;
|
||||
@ -82,7 +82,7 @@ cw_action_fun_t cw_set_msg_end_callback(struct conn *conn,
|
||||
/* Definitions for outgoing messages */
|
||||
struct cw_action_out{
|
||||
uint32_t msg_id;
|
||||
uint32_t item_id;
|
||||
const char * item_id;
|
||||
uint32_t vendor_id;
|
||||
uint16_t elem_id;
|
||||
int (*init)(struct conn * conn, struct cw_action_out *a, uint8_t * dst);
|
||||
|
@ -35,12 +35,12 @@ cw_action_in_t capwap_80211_actions_ac_in[] = {
|
||||
|
||||
cw_action_out_t capwap_80211_actions_ac_out[]={
|
||||
/* Radio Infos */
|
||||
{CW_MSG_DISCOVERY_RESPONSE, CW_ELEM80211_WTP_RADIO_INFORMATION, 0,
|
||||
{CW_MSG_DISCOVERY_RESPONSE, NULL /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
|
||||
CW_ELEM80211_WTP_RADIO_INFORMATION, NULL,cw_out_radio_infos, NULL,1}
|
||||
,
|
||||
|
||||
/* Radio Infos */
|
||||
{CW_MSG_JOIN_RESPONSE, CW_ELEM80211_WTP_RADIO_INFORMATION, 0,
|
||||
{CW_MSG_JOIN_RESPONSE, NULL /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
|
||||
CW_ELEM80211_WTP_RADIO_INFORMATION, NULL,cw_out_radio_infos, NULL,1}
|
||||
,
|
||||
|
||||
|
@ -34,7 +34,7 @@ cw_action_out_t capwap_80211_actions_wtp_out[]={
|
||||
*/
|
||||
|
||||
/* 802.11 Radio Information */
|
||||
{CW_MSG_DISCOVERY_REQUEST, CW_ELEM80211_WTP_RADIO_INFORMATION, 0,
|
||||
{CW_MSG_DISCOVERY_REQUEST, NULL /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
|
||||
CW_ELEM80211_WTP_RADIO_INFORMATION, NULL,cw_out_radio_infos, NULL,1}
|
||||
,
|
||||
|
||||
@ -43,7 +43,7 @@ cw_action_out_t capwap_80211_actions_wtp_out[]={
|
||||
*/
|
||||
|
||||
/* 802.11 Radio Information */
|
||||
{CW_MSG_JOIN_REQUEST, CW_ELEM80211_WTP_RADIO_INFORMATION, 0,
|
||||
{CW_MSG_JOIN_REQUEST, NULL /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
|
||||
CW_ELEM80211_WTP_RADIO_INFORMATION, NULL,cw_out_radio_infos, NULL,1}
|
||||
|
||||
|
||||
|
@ -2,10 +2,101 @@
|
||||
|
||||
#include "capwap_items.h"
|
||||
|
||||
|
||||
const char CW_ITEM_NONE[]="";
|
||||
const char CW_ITEM_IDLE_TIMEOUT[]="idle_timeout";
|
||||
const char CW_ITEM_DISCOVERY_TYPE[]="discovery_type";
|
||||
const char CW_ITEM_WTP_NAME[]="wtp_name";
|
||||
|
||||
const char CW_ITEM_WTP_BOARD_VENDOR[]="vendor_id";
|
||||
const char CW_ITEM_WTP_BOARD_MODELNO[]="model_no";
|
||||
const char CW_ITEM_WTP_BOARD_MACADDRESS[]="wtp_board_macadddress";
|
||||
const char CW_ITEM_WTP_BOARD_ID[]="wtp_board_id";
|
||||
const char CW_ITEM_WTP_BOARD_REVISION[]="wtp_board_revision";
|
||||
const char CW_ITEM_WTP_BOARD_SERIALNO[]="serial_no";
|
||||
|
||||
|
||||
|
||||
const char CW_ITEM_WTP_MAC_TYPE[]="wtp_mac_type";
|
||||
const char CW_ITEM_WTP_FRAME_TUNNEL_MODE[]="wtp_frame_tunnel_mode";
|
||||
const char CW_ITEM_WTP_RADIOS_IN_USE[]="max_radios";
|
||||
const char CW_ITEM_WTP_MAX_RADIOS[]="radios_in_use";
|
||||
|
||||
/*
|
||||
const char CW_ITEM_WTP_HARDWARE_VENDOR=
|
||||
*/
|
||||
|
||||
const char CW_ITEM_WTP_HARDWARE_VERSION[]="wtp_hardware_version";
|
||||
|
||||
/*
|
||||
const char CW_ITEM_WTP_SOFTWARE_VENDOR,
|
||||
*/
|
||||
const char CW_ITEM_WTP_SOFTWARE_VERSION[]="wtp_software_version";
|
||||
|
||||
/*
|
||||
const char CW_ITEM_WTP_BOOTLOADER_VENDOR,
|
||||
*/
|
||||
const char CW_ITEM_WTP_BOOTLOADER_VERSION[]="wtp_bootloader_version";
|
||||
/*
|
||||
const char CW_ITEM_WTP_OTHERSOFTWARE_VENDOR,
|
||||
const char CW_ITEM_WTP_OTHERSOFTWARE_VERSION,
|
||||
*/
|
||||
const char CW_ITEM_WTP_BOARD_DATA[]="wtp_board_data";
|
||||
const char CW_ITEM_WTP_DESCRIPTOR[]="wtp_descriptor";
|
||||
const char CW_ITEM_CAPWAP_TIMERS[]="capwap_timers";
|
||||
const char CW_ITEM_RADIO_ADMINISTRATIVE_STATE[]="radio_admin_state";
|
||||
|
||||
const char CW_ITEM_AC_NAME[]="ac_name";
|
||||
const char CW_ITEM_AC_DESCRIPTOR[]="ac_descriptor";
|
||||
const char CW_ITEM_RESULT_CODE[]="result_code";
|
||||
const char CW_ITEM_AC_STATUS[]="ac_status";
|
||||
|
||||
const char CW_ITEM_AC_HARDWARE_VERSION[]="ac_hardware_version";
|
||||
const char CW_ITEM_AC_SOFTWARE_VERSION[]="ac_software_version";
|
||||
|
||||
const char CW_ITEM_AC_IP_LIST[]="ac_ip_list";
|
||||
const char CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST[]="capwap_ctrl_ip_addr";
|
||||
const char CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS[]="capwap_local_ip_addr";
|
||||
|
||||
const char CW_ITEM_LOCATION_DATA[]="location_data";
|
||||
const char CW_ITEM_SESSION_ID[]="session_id";
|
||||
|
||||
const char CW_ITEM_AC_TIMESTAMP[]="ac_timestamp";
|
||||
const char CW_ITEM_STATISTICS_TIMER[]="statistics_timer";
|
||||
const char CW_ITEM_WTP_REBOOT_STATISTICS[]="wtp_reboot_statistics";
|
||||
const char CW_ITEM_IMAGE_IDENTIFIER[]="image_identifier";
|
||||
const char CW_ITEM_AC_HASH_VALUE[]="ac_hash_value";
|
||||
|
||||
const char CW_ITEM_AC_NAME_WITH_PRIORITY[]="ac_name_with_priority";
|
||||
const char CW_ITEM_MAXIMUM_MESSAGE_LENGTH[]="maximum_message_length";
|
||||
|
||||
|
||||
/* CIPWAP and Cisco */
|
||||
const char CW_ITEM_WTP_GROUP_NAME[]="wtp_group_name";
|
||||
|
||||
|
||||
/* Other Items */
|
||||
const char CW_ITEM_AC_IMAGE_DIR[]="ac_img_dir"; /* Path where WTP images are stored */
|
||||
const char CW_ITEM_IMAGE_FILENAME[]="img_filename"; /* Full path of image filename */
|
||||
const char CW_ITEM_DISCOVERIES[]="discoveries";
|
||||
|
||||
/** FILE handle for uploading and downloading images */
|
||||
const char CW_ITEM_IMAGE_FILEHANDLE[]="image_file_handle";
|
||||
|
||||
const char CW_ITEM_RADIO_CFG[]="radio_cfg";
|
||||
const char CW_ITEM_AP_MODE_AND_TYPE[]="cisco_ap_mode_and_type";
|
||||
|
||||
const char CW_ITEM_CISCO_BOARD_DATA_OPTIONS[]="cisco_board_data_options";
|
||||
const char CW_ITEM_RADIOS[]="radios";
|
||||
const char CW_ITEM_RADIO_OPER_STATE[]="radio_oper_state";
|
||||
|
||||
|
||||
|
||||
|
||||
struct cw_item capwap_itemdefs[] = {
|
||||
|
||||
{CW_ITEM_WTP_NAME,"wtp_name",MBAG_BSTR16},
|
||||
{CW_ITEM_LOCATION_DATA,"location_data",MBAG_BSTR16},
|
||||
{CW_ITEM_WTP_NAME,MBAG_BSTR16},
|
||||
{CW_ITEM_LOCATION_DATA,MBAG_BSTR16},
|
||||
|
||||
|
||||
{CW_ITEM_NONE}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "item.h"
|
||||
|
||||
enum capwap_items {
|
||||
/*
|
||||
CW_ITEM_NONE=0,
|
||||
CW_ITEM_IDLE_TIMEOUT,
|
||||
CW_ITEM_DISCOVERY_TYPE,
|
||||
@ -56,16 +56,13 @@ enum capwap_items {
|
||||
CW_ITEM_MAXIMUM_MESSAGE_LENGTH,
|
||||
|
||||
|
||||
/* CIPWAP and Cisco */
|
||||
CW_ITEM_WTP_GROUP_NAME,
|
||||
|
||||
|
||||
/* Other Items */
|
||||
CW_ITEM_AC_IMAGE_DIR, /* Path where WTP images are stored */
|
||||
CW_ITEM_IMAGE_FILENAME, /* Full path of image filename */
|
||||
CW_ITEM_AC_IMAGE_DIR,
|
||||
CW_ITEM_IMAGE_FILENAME,
|
||||
CW_ITEM_DISCOVERIES,
|
||||
|
||||
/** FILE handle for uploading and downloading images */
|
||||
CW_ITEM_IMAGE_FILEHANDLE,
|
||||
|
||||
CW_ITEM_RADIO_CFG,
|
||||
@ -76,7 +73,108 @@ enum capwap_items {
|
||||
CW_ITEM_RADIO_OPER_STATE,
|
||||
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
extern const char CW_ITEM_NONE[];
|
||||
extern const char CW_ITEM_IDLE_TIMEOUT[];
|
||||
extern const char CW_ITEM_DISCOVERY_TYPE[];
|
||||
extern const char CW_ITEM_WTP_NAME[];
|
||||
|
||||
/*
|
||||
extern const char CW_ITEM_WTP_BOARD_VENDOR,
|
||||
extern const char CW_ITEM_WTP_BOARD_MODELNO,
|
||||
extern const char CW_ITEM_WTP_BOARD_MACADDRESS,
|
||||
extern const char CW_ITEM_WTP_BOARD_ID,
|
||||
extern const char CW_ITEM_WTP_BOARD_REVISION,
|
||||
extern const char CW_ITEM_WTP_BOARD_SERIALNO,
|
||||
*/
|
||||
extern const char CW_ITEM_WTP_MAC_TYPE[];
|
||||
extern const char CW_ITEM_WTP_FRAME_TUNNEL_MODE[];
|
||||
/*
|
||||
extern const char CW_ITEM_WTP_RADIOS_IN_USE=
|
||||
extern const char CW_ITEM_WTP_MAX_RADIOS,
|
||||
*/
|
||||
/*
|
||||
extern const char CW_ITEM_WTP_HARDWARE_VENDOR=
|
||||
extern const char CW_ITEM_WTP_HARDWARE_VERSION="
|
||||
*/
|
||||
/*
|
||||
extern const char CW_ITEM_WTP_SOFTWARE_VENDOR,
|
||||
extern const char CW_ITEM_WTP_SOFTWARE_VERSION,
|
||||
extern const char CW_ITEM_WTP_BOOTLOADER_VENDOR,
|
||||
extern const char CW_ITEM_WTP_BOOTLOADER_VERSION,
|
||||
extern const char CW_ITEM_WTP_OTHERSOFTWARE_VENDOR,
|
||||
extern const char CW_ITEM_WTP_OTHERSOFTWARE_VERSION,
|
||||
*/
|
||||
extern const char CW_ITEM_WTP_BOARD_DATA[];
|
||||
extern const char CW_ITEM_WTP_DESCRIPTOR[];
|
||||
extern const char CW_ITEM_CAPWAP_TIMERS[];
|
||||
extern const char CW_ITEM_RADIO_ADMINISTRATIVE_STATE[];
|
||||
|
||||
extern const char CW_ITEM_AC_NAME[];
|
||||
extern const char CW_ITEM_AC_DESCRIPTOR[];
|
||||
extern const char CW_ITEM_RESULT_CODE[];
|
||||
extern const char CW_ITEM_AC_STATUS[];
|
||||
|
||||
extern const char CW_ITEM_AC_HARDWARE_VERSION[];
|
||||
extern const char CW_ITEM_AC_SOFTWARE_VERSION[];
|
||||
|
||||
extern const char CW_ITEM_AC_IP_LIST[];
|
||||
extern const char CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST[];
|
||||
extern const char CW_ITEM_CAPWAP_LOCAL_IP_ADDRESS[];
|
||||
|
||||
extern const char CW_ITEM_LOCATION_DATA[];
|
||||
extern const char CW_ITEM_SESSION_ID[];
|
||||
|
||||
extern const char CW_ITEM_AC_TIMESTAMP[];
|
||||
extern const char CW_ITEM_STATISTICS_TIMER[];
|
||||
extern const char CW_ITEM_WTP_REBOOT_STATISTICS[];
|
||||
extern const char CW_ITEM_IMAGE_IDENTIFIER[];
|
||||
extern const char CW_ITEM_AC_HASH_VALUE[];
|
||||
|
||||
extern const char CW_ITEM_AC_NAME_WITH_PRIORITY[];
|
||||
extern const char CW_ITEM_MAXIMUM_MESSAGE_LENGTH[];
|
||||
|
||||
|
||||
/* CIPWAP and Cisco */
|
||||
extern const char CW_ITEM_WTP_GROUP_NAME[];
|
||||
|
||||
|
||||
/* Other Items */
|
||||
extern const char CW_ITEM_AC_IMAGE_DIR[]; /* Path where WTP images are stored */
|
||||
extern const char CW_ITEM_IMAGE_FILENAME[]; /* Full path of image filename */
|
||||
extern const char CW_ITEM_DISCOVERIES[];
|
||||
|
||||
/** FILE handle for uploading and downloading images */
|
||||
extern const char CW_ITEM_IMAGE_FILEHANDLE[];
|
||||
|
||||
extern const char CW_ITEM_RADIO_CFG[];
|
||||
extern const char CW_ITEM_AP_MODE_AND_TYPE[];
|
||||
|
||||
extern const char CW_ITEM_CISCO_BOARD_DATA_OPTIONS[];
|
||||
extern const char CW_ITEM_RADIOS[];
|
||||
extern const char CW_ITEM_RADIO_OPER_STATE[];
|
||||
|
||||
|
||||
extern const char CW_ITEM_WTP_BOARD_VENDOR[];
|
||||
extern const char CW_ITEM_WTP_BOARD_MODELNO[];
|
||||
extern const char CW_ITEM_WTP_BOARD_MACADDRESS[];
|
||||
extern const char CW_ITEM_WTP_BOARD_ID[];
|
||||
extern const char CW_ITEM_WTP_BOARD_REVISION[];
|
||||
extern const char CW_ITEM_WTP_BOARD_SERIALNO[];
|
||||
|
||||
extern const char CW_ITEM_WTP_SOFTWARE_VERSION[];
|
||||
extern const char CW_ITEM_WTP_HARDWARE_VERSION[];
|
||||
|
||||
extern const char CW_ITEM_WTP_BOOTLOADER_VERSION[];
|
||||
|
||||
extern const char CW_ITEM_WTP_RADIOS_IN_USE[];
|
||||
extern const char CW_ITEM_WTP_MAX_RADIOS[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern struct cw_item capwap_itemdefs[];
|
||||
|
||||
|
@ -95,8 +95,8 @@ int cw_out_cisco_wtp_radio_cfg(struct conn *conn, struct cw_action_out *a, uint8
|
||||
continue;
|
||||
}
|
||||
// l+=cw_put_elem_radio_info(dst+l,i->id,i->data);
|
||||
l+=cw_put_elem_cisco_radio_cfg(dst+l,i->id,i->data);
|
||||
l+=cw_put_elem_cisco_ap_regulatory_domain(dst+l,i->id,i->data);
|
||||
l+=cw_put_elem_cisco_radio_cfg(dst+l,i->iid,i->data);
|
||||
l+=cw_put_elem_cisco_ap_regulatory_domain(dst+l,i->iid,i->data);
|
||||
|
||||
}
|
||||
return l;
|
||||
@ -123,7 +123,7 @@ int cw_in_cisco_radio_cfg(struct conn *conn, struct cw_action_in *a, uint8_t * d
|
||||
{
|
||||
|
||||
int rid = cw_get_byte(data);
|
||||
mbag_t radio = mbag_get_mbag(conn->radios,rid,NULL);
|
||||
mbag_t radio = mbag_i_get_mbag(conn->radios,rid,NULL);
|
||||
if ( !radio){
|
||||
cw_dbg(DBG_ELEM_ERR,"Radio ID %d not defined",rid);
|
||||
return 0;
|
||||
@ -147,7 +147,7 @@ int cw_radio_cisco_set_state(struct conn * conn, uint8_t *data, int len, int cau
|
||||
MAVLITER_DEFINE(it,conn->radios);
|
||||
mavliter_foreach(&it){
|
||||
mbag_item_t *i = mavliter_get(&it);
|
||||
cw_radio_set_admin_state(conn->radios,i->id,state,cause);
|
||||
cw_radio_set_admin_state(conn->radios,i->iid,state,cause);
|
||||
|
||||
}
|
||||
return 1;
|
||||
|
@ -262,7 +262,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,struct
|
||||
if (af->mand && afrc) {
|
||||
/* add found mandatory message element
|
||||
to mand list */
|
||||
intavltree_add(conn->mand, af->item_id);
|
||||
intavltree_add(conn->mand, (int)af->item_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_i
|
||||
if (!ai->mand)
|
||||
continue;
|
||||
|
||||
int i = ai->item_id;
|
||||
int i = (int)ai->item_id;
|
||||
void * rc = mavl_get(conn->mand,&i);
|
||||
if (!rc) {
|
||||
out[n++]=ai;
|
||||
@ -84,7 +84,6 @@ int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_i
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
struct args args;
|
||||
|
@ -13,7 +13,7 @@
|
||||
int cw_in_ac_name_with_priority(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
||||
struct sockaddr *from)
|
||||
{
|
||||
cw_acpriolist_t prios = mbag_get_mavl(conn->config,CW_ITEM_AC_NAME_WITH_PRIORITY,NULL);
|
||||
cw_acpriolist_t prios = mbag_get_mavl(conn->config,CW_ITEM_AC_NAME_WITH_PRIORITY);
|
||||
if (!prios)
|
||||
return 0;
|
||||
|
||||
|
@ -22,7 +22,7 @@ int cw_in_capwap_control_ipv4_address(struct conn *conn, struct cw_action_in *a,
|
||||
uint8_t * data, int len,struct sockaddr *from)
|
||||
{
|
||||
cw_aciplist_t list =
|
||||
mbag_get_avltree_c(conn->incomming,a->item_id,cw_aciplist_create);
|
||||
mbag_get_mavl_c(conn->incomming,a->item_id,cw_aciplist_create);
|
||||
|
||||
if (!list) {
|
||||
cw_log(LOG_ERR, "Error: Can't allocate CAWAP IP Adress List");
|
||||
|
@ -32,8 +32,8 @@ int cw_in_check_disc_resp(struct conn *conn, struct cw_action_in *a, uint8_t * d
|
||||
/* we have all AC information in the incomming buffer */
|
||||
mbag_t discs;
|
||||
|
||||
discs = mbag_get_avltree_c(conn->remote, CW_ITEM_DISCOVERIES,
|
||||
mbag_create);
|
||||
discs = mbag_get_mavl_c(conn->remote, CW_ITEM_DISCOVERIES,
|
||||
mbag_i_create);
|
||||
|
||||
//mavl_del_all(discs);
|
||||
//exit(0);
|
||||
@ -44,7 +44,8 @@ int cw_in_check_disc_resp(struct conn *conn, struct cw_action_in *a, uint8_t * d
|
||||
return -1;
|
||||
}
|
||||
|
||||
mbag_set_avltree(discs,discs->count,conn->incomming);
|
||||
mbag_i_set_mavl(discs,discs->count,conn->incomming);
|
||||
|
||||
conn->incomming = mbag_create();
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@ int cw_in_radio_generic(struct conn *conn, struct cw_action_in *a, uint8_t * dat
|
||||
return 0;
|
||||
|
||||
int rid = cw_get_byte(data);
|
||||
mbag_t radio = mbag_get_mbag(conn->radios, rid, NULL);
|
||||
mbag_t radio = mbag_i_get_mbag(conn->radios, rid, NULL);
|
||||
if (!radio) {
|
||||
if (a->vendor_id != 0
|
||||
|| ( (a->vendor_id == 0) && (a->msg_id != CW_MSG_DISCOVERY_REQUEST
|
||||
@ -112,7 +112,7 @@ int cw_in_radio_generic(struct conn *conn, struct cw_action_in *a, uint8_t * dat
|
||||
cw_dbg(DBG_ELEM_ERR, "Radio not found %d", rid);
|
||||
return 0;
|
||||
}
|
||||
mbag_set_mbag(conn->radios,rid,mbag_create());
|
||||
mbag_i_set_mbag(conn->radios,rid,mbag_create());
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "sock.h"
|
||||
|
||||
|
||||
static int cw_read_wtp_descriptor_versions(mbag_t itemstore, uint8_t * data,
|
||||
static int cw_read_wtp_descriptor_versions(mbag_t mbag, uint8_t * data,
|
||||
int len, int silent)
|
||||
{
|
||||
int i = 0;
|
||||
@ -74,35 +74,49 @@ static int cw_read_wtp_descriptor_versions(mbag_t itemstore, uint8_t * data,
|
||||
|
||||
switch (subtype) {
|
||||
case CW_SUBELEM_WTP_HARDWARE_VERSION:
|
||||
mbag_set_dword(itemstore,
|
||||
/*
|
||||
mbag_set_dword(mbag,
|
||||
CW_ITEM_WTP_HARDWARE_VENDOR,
|
||||
vendor_id);
|
||||
mbag_set_bstrn(itemstore,
|
||||
mbag_set_bstrn(mbag,
|
||||
CW_ITEM_WTP_HARDWARE_VERSION,
|
||||
data + i, sublen);
|
||||
*/
|
||||
|
||||
mbag_set_vendorstr(mbag,
|
||||
CW_ITEM_WTP_HARDWARE_VERSION,
|
||||
vendor_id, data + i, sublen);
|
||||
|
||||
break;
|
||||
case CW_SUBELEM_WTP_SOFTWARE_VERSION:
|
||||
|
||||
mbag_set_vendorstr(itemstore,
|
||||
mbag_set_vendorstr(mbag,
|
||||
CW_ITEM_WTP_SOFTWARE_VERSION,
|
||||
vendor_id, data + i, sublen);
|
||||
/*
|
||||
mbag_set_dword(itemstore,
|
||||
mbag_set_dword(mbag,
|
||||
CW_ITEM_WTP_SOFTWARE_VENDOR,
|
||||
vendor_id);
|
||||
mbag_set_bstrn(itemstore,
|
||||
mbag_set_bstrn(mbag,
|
||||
CW_ITEM_WTP_SOFTWARE_VERSION,
|
||||
data + i, sublen);
|
||||
|
||||
*/
|
||||
break;
|
||||
case CW_SUBELEM_WTP_BOOTLOADER_VERSION:
|
||||
mbag_set_dword(itemstore,
|
||||
|
||||
mbag_set_vendorstr(mbag,
|
||||
CW_ITEM_WTP_BOOTLOADER_VERSION,
|
||||
vendor_id, data + i, sublen);
|
||||
|
||||
/*
|
||||
mbag_set_dword(mbag,
|
||||
CW_ITEM_WTP_BOOTLOADER_VENDOR,
|
||||
vendor_id);
|
||||
mbag_set_bstrn(itemstore,
|
||||
mbag_set_bstrn(mbag,
|
||||
CW_ITEM_WTP_BOOTLOADER_VERSION,
|
||||
data + i, sublen);
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
if (!silent)
|
||||
@ -119,14 +133,14 @@ static int cw_read_wtp_descriptor_versions(mbag_t itemstore, uint8_t * data,
|
||||
|
||||
}
|
||||
|
||||
static int cw_read_wtp_descriptor(mbag_t itemstore, struct conn *conn,
|
||||
static int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
||||
struct cw_action_in *a, uint8_t * data, int len,
|
||||
int silent)
|
||||
{
|
||||
|
||||
|
||||
mbag_set_byte(itemstore, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
||||
mbag_set_byte(itemstore, CW_ITEM_WTP_RADIOS_IN_USE,
|
||||
mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
||||
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE,
|
||||
cw_get_byte(data + 1));
|
||||
|
||||
|
||||
@ -151,7 +165,7 @@ static int cw_read_wtp_descriptor(mbag_t itemstore, struct conn *conn,
|
||||
pos += 3;
|
||||
}
|
||||
|
||||
return cw_read_wtp_descriptor_versions(itemstore, data + pos, len - pos, silent);
|
||||
return cw_read_wtp_descriptor_versions(mbag, data + pos, len - pos, silent);
|
||||
|
||||
}
|
||||
|
||||
@ -161,13 +175,13 @@ static int cw_read_wtp_descriptor(mbag_t itemstore, struct conn *conn,
|
||||
* Read WTP Descriptor in Cisco-Style (Draft 7)
|
||||
*/
|
||||
|
||||
static int cw_read_cisco_wtp_descriptor(mbag_t itemstore, struct conn *conn,
|
||||
static int cw_read_cisco_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
||||
struct cw_action_in *a, uint8_t * data, int len,
|
||||
int silent)
|
||||
{
|
||||
|
||||
mbag_set_byte(itemstore, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
||||
mbag_set_byte(itemstore, CW_ITEM_WTP_RADIOS_IN_USE,
|
||||
mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
||||
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE,
|
||||
cw_get_byte(data + 1));
|
||||
|
||||
|
||||
@ -177,7 +191,7 @@ static int cw_read_cisco_wtp_descriptor(mbag_t itemstore, struct conn *conn,
|
||||
cw_get_word(data + pos + 2);
|
||||
pos += 2;
|
||||
|
||||
return cw_read_wtp_descriptor_versions(itemstore, data + pos, len - pos, silent);
|
||||
return cw_read_wtp_descriptor_versions(mbag, data + pos, len - pos, silent);
|
||||
|
||||
}
|
||||
|
||||
@ -191,9 +205,9 @@ static int cw_read_cisco_wtp_descriptor(mbag_t itemstore, struct conn *conn,
|
||||
int cw_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len, struct sockaddr *from)
|
||||
{
|
||||
mbag_t itemstore = conn->incomming;
|
||||
mbag_t mbag = conn->incomming;
|
||||
|
||||
return cw_read_wtp_descriptor(itemstore, conn, a, data, len, 0);
|
||||
return cw_read_wtp_descriptor(mbag, conn, a, data, len, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -201,38 +215,38 @@ int cw_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * da
|
||||
int cw_in_cipwap_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len, struct sockaddr *from)
|
||||
{
|
||||
mbag_t itemstore = conn->incomming;
|
||||
mbag_t mbag = conn->incomming;
|
||||
|
||||
switch (conn->capwap_mode) {
|
||||
case CW_MODE_CISCO:
|
||||
return cw_read_cisco_wtp_descriptor(itemstore, conn, a, data, len,
|
||||
return cw_read_cisco_wtp_descriptor(mbag, conn, a, data, len,
|
||||
0);
|
||||
case CW_MODE_CIPWAP:
|
||||
{
|
||||
/* try to get the right WTP Descriptor */
|
||||
int rc;
|
||||
rc = cw_read_wtp_descriptor(itemstore, conn, a, data, len,
|
||||
rc = cw_read_wtp_descriptor(mbag, conn, a, data, len,
|
||||
1);
|
||||
|
||||
if (rc) {
|
||||
return cw_read_wtp_descriptor(itemstore, conn, a,
|
||||
return cw_read_wtp_descriptor(mbag, conn, a,
|
||||
data, len, 0);
|
||||
}
|
||||
|
||||
rc = cw_read_cisco_wtp_descriptor(itemstore, conn, a,
|
||||
rc = cw_read_cisco_wtp_descriptor(mbag, conn, a,
|
||||
data, len, 0);
|
||||
if (rc) {
|
||||
return cw_read_cisco_wtp_descriptor(itemstore,
|
||||
return cw_read_cisco_wtp_descriptor(mbag,
|
||||
conn, a, data,
|
||||
len, 0);
|
||||
}
|
||||
|
||||
return cw_read_wtp_descriptor(itemstore, conn, a, data,
|
||||
return cw_read_wtp_descriptor(mbag, conn, a, data,
|
||||
len, 0);
|
||||
|
||||
}
|
||||
default:
|
||||
return cw_read_wtp_descriptor(itemstore, conn, a, data, len, 0);
|
||||
return cw_read_wtp_descriptor(mbag, conn, a, data, len, 0);
|
||||
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ int cw_put_ac_name_with_priority(uint8_t *dst,cw_acprio_t * acprio)
|
||||
|
||||
int cw_out_ac_name_with_priority(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
||||
{
|
||||
cw_acpriolist_t prios = mbag_get_mavl(conn->config,CW_ITEM_AC_NAME_WITH_PRIORITY,NULL);
|
||||
cw_acpriolist_t prios = mbag_get_mavl(conn->config,CW_ITEM_AC_NAME_WITH_PRIORITY);
|
||||
if (!prios)
|
||||
return 0;
|
||||
|
||||
|
@ -36,7 +36,7 @@ int cw_out_radio_infos(struct conn *conn, struct cw_action_out *a, uint8_t * dst
|
||||
if ( i->type != MBAG_MBAG ) {
|
||||
continue;
|
||||
}
|
||||
l+=cw_put_elem_radio_info(dst+l,i->id,i->data);
|
||||
l+=cw_put_elem_radio_info(dst+l,i->iid,i->data);
|
||||
|
||||
}
|
||||
return l;
|
||||
@ -52,7 +52,7 @@ int cw_out_radio_administrative_states(struct conn *conn, struct cw_action_out *
|
||||
if ( i->type != MBAG_MBAG ) {
|
||||
continue;
|
||||
}
|
||||
l+=cw_put_elem_radio_administrative_state(dst+l,i->id,i->data);
|
||||
l+=cw_put_elem_radio_administrative_state(dst+l,i->iid,i->data);
|
||||
|
||||
}
|
||||
return l;
|
||||
|
@ -27,7 +27,7 @@ int cw_out_radio_operational_states(struct conn *conn, struct cw_action_out *a,
|
||||
}
|
||||
|
||||
/* Put the radio ID */
|
||||
cw_put_byte(d+4,radioitem->id);
|
||||
cw_put_byte(d+4,radioitem->iid);
|
||||
|
||||
/* Get the operational state and cause */
|
||||
uint16_t os = ositem->word;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
static int cmp(const void *v1,const void*v2)
|
||||
{
|
||||
return *((int*)v1) - *((char*)v2);
|
||||
return *((int*)v1) - *((int*)v2);
|
||||
}
|
||||
|
||||
static void del(void* d)
|
||||
@ -16,14 +16,14 @@ static void del(void* d)
|
||||
return;
|
||||
}
|
||||
|
||||
struct avltree * intavltree_create()
|
||||
struct mavl * intavltree_create()
|
||||
{
|
||||
return avltree_create(cmp,del);
|
||||
return mavl_create(cmp,del);
|
||||
}
|
||||
|
||||
int * intavltree_add(struct avltree * t, int val)
|
||||
int * intavltree_add(struct mavl * t, int val)
|
||||
{
|
||||
int *v = avltree_get(t,&val);
|
||||
int *v = mavl_get(t,&val);
|
||||
if (v)
|
||||
return v;
|
||||
|
||||
@ -31,5 +31,5 @@ int * intavltree_add(struct avltree * t, int val)
|
||||
if (!v)
|
||||
return NULL;
|
||||
*v=val;
|
||||
return avltree_add(t,v);
|
||||
return mavl_add(t,v);
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
#ifndef __INTAVLTREE_H
|
||||
#define __INTAVLTREE_H
|
||||
|
||||
#include "avltree.h"
|
||||
#include "mavl.h"
|
||||
|
||||
extern struct avltree * intavltree_create();
|
||||
typedef struct avltree * intavltree_t;
|
||||
int * intavltree_add(struct avltree * t, int val);
|
||||
extern struct mavl * intavltree_create();
|
||||
typedef struct mavl * intavltree_t;
|
||||
int * intavltree_add(struct mavl * t, int val);
|
||||
|
||||
#define intavltree_destroy(t) avltree_destroy(t)
|
||||
#define intavltree_foreach_asc(t,f,p) avltree_foreach_asc(t,f,p)
|
||||
#define intavltree_foreach_desc(t,f,p) avltree_foreach_desc(t,f,p)
|
||||
#define intavltree_destroy(t) mavl_destroy(t)
|
||||
#define intavltree_foreach_asc(t,f,p) mavl_foreach_asc(t,f,p)
|
||||
#define intavltree_foreach_desc(t,f,p) mavl_foreach_desc(t,f,p)
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "item.h"
|
||||
#include "capwap_items.h"
|
||||
|
||||
/*
|
||||
struct cw_item * cw_item_get_by_id(int id,struct cw_item *table)
|
||||
{
|
||||
int i;
|
||||
@ -13,13 +14,13 @@ struct cw_item * cw_item_get_by_id(int id,struct cw_item *table)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
struct cw_item * cw_item_get_by_name(const char *name,struct cw_item *table)
|
||||
struct cw_item * cw_item_get_by_name(const char *id,struct cw_item *table)
|
||||
{
|
||||
int i;
|
||||
while (table->id != CW_ITEM_NONE) {
|
||||
if (!strcmp(table->cfgname,name))
|
||||
if (!strcmp(table->id,id))
|
||||
return table;
|
||||
table++;
|
||||
|
||||
|
@ -7,9 +7,7 @@
|
||||
|
||||
struct cw_item {
|
||||
/** ID */
|
||||
uint32_t id;
|
||||
/** Name of the item in cfg files */
|
||||
const char * cfgname;
|
||||
const char *id;
|
||||
/** Type */
|
||||
mbagtype_t type;
|
||||
|
||||
|
@ -106,7 +106,7 @@ static void mbag_del_fun(void *e)
|
||||
}
|
||||
|
||||
|
||||
static void strmbag_del_fun(void *e)
|
||||
static void mbag_i_del_fun(void *e)
|
||||
{
|
||||
|
||||
mbag_del_data(e);
|
||||
@ -114,31 +114,31 @@ static void strmbag_del_fun(void *e)
|
||||
}
|
||||
|
||||
|
||||
static int strmbag_cmp_fun(const void *x1, const void *x2)
|
||||
{
|
||||
return strcmp(( (struct mbag_item *) x1)->name , ((struct mbag_item *) x2)->name );
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int mbag_cmp_fun(const void *x1, const void *x2)
|
||||
{
|
||||
return ((struct mbag_item *) x1)->id - ((struct mbag_item *) x2)->id;
|
||||
return strcmp(( (struct mbag_item *) x1)->id , ((struct mbag_item *) x2)->id );
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int mbag_i_cmp_fun(const void *x1, const void *x2)
|
||||
{
|
||||
return ((struct mbag_item *) x1)->iid - ((struct mbag_item *) x2)->iid;
|
||||
}
|
||||
|
||||
mbag_t mbag_i_create()
|
||||
{
|
||||
return mavl_create(mbag_i_cmp_fun, mbag_i_del_fun);
|
||||
}
|
||||
|
||||
|
||||
mbag_t mbag_create()
|
||||
{
|
||||
return mavl_create(mbag_cmp_fun, mbag_del_fun);
|
||||
}
|
||||
|
||||
|
||||
mbag_t strmbag_create()
|
||||
{
|
||||
return mavl_create(strmbag_cmp_fun, strmbag_del_fun);
|
||||
|
||||
}
|
||||
|
||||
struct mbag_item *mbag_item_create(mbag_t s, uint32_t id)
|
||||
struct mbag_item *mbag_item_create(mbag_t s, const char *id)
|
||||
{
|
||||
struct mbag_item is;
|
||||
is.id = id;
|
||||
@ -158,6 +158,30 @@ struct mbag_item *mbag_item_create(mbag_t s, uint32_t id)
|
||||
}
|
||||
|
||||
|
||||
struct mbag_item *mbag_i_item_create(mbag_t s, uint32_t id)
|
||||
{
|
||||
struct mbag_item is;
|
||||
is.iid = id;
|
||||
|
||||
|
||||
struct mbag_item *i = mavl_get(s, &is);
|
||||
if (i) {
|
||||
mbag_del_data(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
i = malloc(sizeof(struct mbag_item));
|
||||
if (!i)
|
||||
return NULL;
|
||||
i->iid = id;
|
||||
return mavl_add(s, i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
struct mbag_item *strmbag_item_create(mbag_t s, char *name)
|
||||
{
|
||||
struct mbag_item is;
|
||||
@ -177,4 +201,5 @@ struct mbag_item *strmbag_item_create(mbag_t s, char *name)
|
||||
return mavl_add(s, i);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
@ -43,10 +43,11 @@ typedef const struct mbag_typedef * mbagtype_t;
|
||||
|
||||
|
||||
|
||||
|
||||
struct mbag_item{
|
||||
union {
|
||||
uint32_t id;
|
||||
const char *name;
|
||||
uint32_t iid;
|
||||
const char *id;
|
||||
};
|
||||
const struct mbag_typedef * type;
|
||||
union {
|
||||
@ -58,6 +59,7 @@ struct mbag_item{
|
||||
};
|
||||
|
||||
typedef mavl_t mbag_t;
|
||||
|
||||
typedef struct mbag_item mbag_item_t;
|
||||
|
||||
|
||||
@ -91,13 +93,14 @@ extern const struct mbag_typedef mbag_type_const_data;
|
||||
|
||||
|
||||
extern mbag_t mbag_create();
|
||||
extern mbag_t mbag_i_create();
|
||||
|
||||
extern struct mbag_item *mbag_item_create(mbag_t s, uint32_t id);
|
||||
extern struct mbag_item *strmbag_item_create(mbag_t s, char *name);
|
||||
struct mbag_item *mbag_item_create(mbag_t s, const char *id);
|
||||
struct mbag_item *mbag_i_item_create(mbag_t s, uint32_t id);
|
||||
|
||||
|
||||
|
||||
static inline int mbag_set_byte(mbag_t s, uint32_t id, uint8_t byte)
|
||||
static inline int mbag_set_byte(mbag_t s, const char *id, uint8_t byte)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -107,7 +110,7 @@ static inline int mbag_set_byte(mbag_t s, uint32_t id, uint8_t byte)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int mbag_set_word(mbag_t s, uint32_t id, uint16_t word)
|
||||
static inline int mbag_set_word(mbag_t s, const char *id, uint16_t word)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -119,7 +122,7 @@ static inline int mbag_set_word(mbag_t s, uint32_t id, uint16_t word)
|
||||
|
||||
|
||||
|
||||
static inline int mbag_set_dword(mbag_t s, uint32_t id, uint32_t dword)
|
||||
static inline int mbag_set_dword(mbag_t s, const char *id, uint32_t dword)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -130,8 +133,17 @@ static inline int mbag_set_dword(mbag_t s, uint32_t id, uint32_t dword)
|
||||
}
|
||||
|
||||
|
||||
static inline int mbag_i_set_mbag(mbag_t s, uint32_t id, mbag_t mbag)
|
||||
{
|
||||
struct mbag_item *i = mbag_i_item_create(s, id);
|
||||
if (!i)
|
||||
return 0;
|
||||
i->data = mbag;
|
||||
i->type = &mbag_type_mbag;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int mbag_set_mbag(mbag_t s, uint32_t id, mbag_t mbag)
|
||||
static inline int mbag_set_mbag(mbag_t s, const char *id, mbag_t mbag)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -141,7 +153,7 @@ static inline int mbag_set_mbag(mbag_t s, uint32_t id, mbag_t mbag)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int mbag_set_data(mbag_t s, uint32_t id, const struct mbag_typedef *type, void *data)
|
||||
static inline int mbag_set_data(mbag_t s, const char *id, const struct mbag_typedef *type, void *data)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -154,7 +166,7 @@ static inline int mbag_set_data(mbag_t s, uint32_t id, const struct mbag_typedef
|
||||
}
|
||||
|
||||
|
||||
static inline vendorstr_t mbag_set_vendorstr(mbag_t s, uint32_t id, uint32_t vendor_id,
|
||||
static inline vendorstr_t mbag_set_vendorstr(mbag_t s, const char *id, uint32_t vendor_id,
|
||||
uint8_t * vendorstr, int len)
|
||||
{
|
||||
mbag_item_t *i = mbag_item_create(s, id);
|
||||
@ -174,7 +186,7 @@ static inline vendorstr_t mbag_set_vendorstr(mbag_t s, uint32_t id, uint32_t ven
|
||||
#define mbag_set_bstr16(m,i,d) mbag_set_data(m,i,MBAG_BSTR16,d)
|
||||
|
||||
|
||||
static inline mbag_item_t *mbag_get(mbag_t s, uint32_t id)
|
||||
static inline mbag_item_t *mbag_get(mbag_t s, const char *id)
|
||||
{
|
||||
mbag_item_t i;
|
||||
i.id = id;
|
||||
@ -182,7 +194,18 @@ static inline mbag_item_t *mbag_get(mbag_t s, uint32_t id)
|
||||
return mavl_get(s, &i);
|
||||
}
|
||||
|
||||
static inline void mbag_del(mbag_t s,uint32_t id)
|
||||
|
||||
static inline mbag_item_t *mbag_i_get(mbag_t s, uint32_t id)
|
||||
{
|
||||
mbag_item_t i;
|
||||
i.iid = id;
|
||||
i.type=0;
|
||||
return mavl_get(s, &i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline void mbag_del(mbag_t s,const char *id)
|
||||
{
|
||||
mbag_item_t i;
|
||||
i.id = id;
|
||||
@ -190,7 +213,7 @@ static inline void mbag_del(mbag_t s,uint32_t id)
|
||||
mavl_del(s, &i);
|
||||
}
|
||||
|
||||
static inline void * mbag_get_data(mbag_t s, uint32_t id, const struct mbag_typedef * type, void * def)
|
||||
static inline void * mbag_get_data(mbag_t s, const char *id, const struct mbag_typedef * type, void * def)
|
||||
{
|
||||
struct mbag_item *i = mbag_get(s, id);
|
||||
if (!i)
|
||||
@ -203,7 +226,7 @@ static inline void * mbag_get_data(mbag_t s, uint32_t id, const struct mbag_type
|
||||
#define mbag_get_bstr(m,i,d) mbag_get_data(m,i,MBAG_BSTR,d)
|
||||
#define mbag_get_bstr16(m,i,d) mbag_get_data(m,i,MBAG_BSTR16,d)
|
||||
|
||||
static inline void * mbag_get_raw(mbag_t s, uint32_t id, void * def)
|
||||
static inline void * mbag_get_raw(mbag_t s, const char *id, void * def)
|
||||
{
|
||||
struct mbag_item *i = mbag_get(s, id);
|
||||
if (!i)
|
||||
@ -213,7 +236,7 @@ static inline void * mbag_get_raw(mbag_t s, uint32_t id, void * def)
|
||||
|
||||
|
||||
|
||||
static inline uint8_t mbag_get_byte(mbag_t s, uint32_t id, uint8_t def)
|
||||
static inline uint8_t mbag_get_byte(mbag_t s, const char *id, uint8_t def)
|
||||
{
|
||||
struct mbag_item *i = mbag_get(s, id);
|
||||
if (!i)
|
||||
@ -223,7 +246,7 @@ static inline uint8_t mbag_get_byte(mbag_t s, uint32_t id, uint8_t def)
|
||||
return i->byte;
|
||||
}
|
||||
|
||||
static inline uint16_t mbag_get_word(mbag_t s, uint32_t id, uint16_t def)
|
||||
static inline uint16_t mbag_get_word(mbag_t s, const char *id, uint16_t def)
|
||||
{
|
||||
struct mbag_item *i = mbag_get(s, id);
|
||||
if (!i)
|
||||
@ -235,7 +258,7 @@ static inline uint16_t mbag_get_word(mbag_t s, uint32_t id, uint16_t def)
|
||||
|
||||
|
||||
|
||||
static inline uint32_t mbag_get_dword(mbag_t s, uint32_t id, uint32_t def)
|
||||
static inline uint32_t mbag_get_dword(mbag_t s, const char *id, uint32_t def)
|
||||
{
|
||||
struct mbag_item *i = mbag_get(s, id);
|
||||
if (!i)
|
||||
@ -246,8 +269,18 @@ static inline uint32_t mbag_get_dword(mbag_t s, uint32_t id, uint32_t def)
|
||||
}
|
||||
|
||||
|
||||
static inline mbag_t mbag_i_get_mbag(mbag_t s, uint32_t id, mbag_t def)
|
||||
{
|
||||
struct mbag_item *i = mbag_i_get(s, id);
|
||||
if (!i)
|
||||
return def;
|
||||
if (i->type != MBAG_MBAG)
|
||||
return def;
|
||||
return i->data;
|
||||
}
|
||||
|
||||
static inline mbag_t mbag_get_mbag(mbag_t s, uint32_t id, mbag_t def)
|
||||
|
||||
static inline mbag_t mbag_get_mbag(mbag_t s, const char *id, mbag_t def)
|
||||
{
|
||||
struct mbag_item *i = mbag_get(s, id);
|
||||
if (!i)
|
||||
@ -257,7 +290,7 @@ static inline mbag_t mbag_get_mbag(mbag_t s, uint32_t id, mbag_t def)
|
||||
return i->data;
|
||||
}
|
||||
|
||||
static inline mbag_item_t * mbag_set_bstrn(mbag_t s, uint32_t id, uint8_t * data, int len)
|
||||
static inline mbag_item_t * mbag_set_bstrn(mbag_t s, const char *id, uint8_t * data, int len)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -267,7 +300,7 @@ static inline mbag_item_t * mbag_set_bstrn(mbag_t s, uint32_t id, uint8_t * data
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline struct avltree *mbag_get_avltree(mbag_t s, uint32_t id)
|
||||
static inline struct mavl *mbag_get_mavl(mbag_t s, const char *id)
|
||||
{
|
||||
struct mbag_item *i = mbag_get(s, id);
|
||||
if (!i)
|
||||
@ -277,7 +310,17 @@ static inline struct avltree *mbag_get_avltree(mbag_t s, uint32_t id)
|
||||
return i->data;
|
||||
}
|
||||
|
||||
static inline int mbag_set_avltree(mbag_t s, uint32_t id, struct avltree *t)
|
||||
static inline int mbag_i_set_mavl(mbag_t s, uint32_t id, mavl_t t)
|
||||
{
|
||||
struct mbag_item *i = mbag_i_item_create(s, id);
|
||||
if (!i)
|
||||
return 0;
|
||||
i->type = MBAG_AVLTREE;
|
||||
i->data = t;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int mbag_set_mavl(mbag_t s, const char *id, mavl_t t)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -287,21 +330,11 @@ static inline int mbag_set_avltree(mbag_t s, uint32_t id, struct avltree *t)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int mbag_set_mavl(mbag_t s, uint32_t id, mavl_t t)
|
||||
/*
|
||||
static inline struct mavl *mbag_get_avltree_c(mbag_t s, const char *id,
|
||||
struct mavl *(creator) ())
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
return 0;
|
||||
i->type = MBAG_AVLTREE;
|
||||
i->data = t;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static inline struct avltree *mbag_get_avltree_c(mbag_t s, uint32_t id,
|
||||
struct avltree *(creator) ())
|
||||
{
|
||||
struct avltree *avltree = mbag_get_avltree(s, id);
|
||||
struct mavl * avltree = mbag_get_mavl(s, id);
|
||||
if (avltree){
|
||||
return avltree;
|
||||
}
|
||||
@ -309,12 +342,12 @@ static inline struct avltree *mbag_get_avltree_c(mbag_t s, uint32_t id,
|
||||
avltree = creator();
|
||||
if (!avltree)
|
||||
return NULL;
|
||||
mbag_set_avltree(s, id, avltree);
|
||||
mbag_set_mavl(s, id, avltree);
|
||||
return avltree;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
static inline mavl_t mbag_get_mavl(mbag_t s, uint32_t id,
|
||||
static inline mavl_t mbag_get_mavl_c(mbag_t s, const char *id,
|
||||
mavl_t (creator) ())
|
||||
{
|
||||
struct mbag_item *i = mbag_get(s, id);
|
||||
@ -330,12 +363,28 @@ static inline mavl_t mbag_get_mavl(mbag_t s, uint32_t id,
|
||||
return avltree;
|
||||
}
|
||||
|
||||
static inline mavl_t mbag_i_get_mavl(mbag_t s, uint32_t id,
|
||||
mavl_t (creator) ())
|
||||
{
|
||||
struct mbag_item *i = mbag_i_get(s, id);
|
||||
if (i)
|
||||
return i->data;
|
||||
|
||||
if (!creator)
|
||||
return NULL;
|
||||
mavl_t avltree = creator();
|
||||
if (!avltree)
|
||||
return NULL;
|
||||
mbag_i_set_mavl(s, id, avltree);
|
||||
return avltree;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
static inline char *mbag_get_str(mbag_t s, uint32_t id, char *def)
|
||||
static inline char *mbag_get_str(mbag_t s, const char *id, char *def)
|
||||
{
|
||||
struct mbag_item *i = mbag_get(s, id);
|
||||
if (!i)
|
||||
@ -344,7 +393,7 @@ static inline char *mbag_get_str(mbag_t s, uint32_t id, char *def)
|
||||
|
||||
};
|
||||
|
||||
static inline int mbag_set_str(mbag_t s, uint32_t id, const char *str)
|
||||
static inline int mbag_set_str(mbag_t s, const char *id, const char *str)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -393,7 +442,7 @@ static inline void mbag_item_release_data_ptr(struct mbag_item *item, void *data
|
||||
|
||||
}
|
||||
|
||||
static inline int mbag_set_strn(mbag_t s, uint32_t id, const char *str, int n)
|
||||
static inline int mbag_set_strn(mbag_t s, const char *id, const char *str, int n)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -403,7 +452,7 @@ static inline int mbag_set_strn(mbag_t s, uint32_t id, const char *str, int n)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int mbag_set_bstr16n(mbag_t s, uint32_t id, uint8_t * data, int len)
|
||||
static inline int mbag_set_bstr16n(mbag_t s, const char *id, uint8_t * data, int len)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -415,7 +464,7 @@ static inline int mbag_set_bstr16n(mbag_t s, uint32_t id, uint8_t * data, int le
|
||||
|
||||
|
||||
|
||||
static inline mbag_item_t * mbag_set_const_ptr(mbag_t s, uint32_t id, void *ptr)
|
||||
static inline mbag_item_t * mbag_set_const_ptr(mbag_t s, const char *id, void *ptr)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -426,7 +475,7 @@ static inline mbag_item_t * mbag_set_const_ptr(mbag_t s, uint32_t id, void *ptr)
|
||||
}
|
||||
|
||||
|
||||
static inline int mbag_set_ptr(mbag_t s, uint32_t id, void *ptr)
|
||||
static inline int mbag_set_ptr(mbag_t s, const char *id, void *ptr)
|
||||
{
|
||||
struct mbag_item *i = mbag_item_create(s, id);
|
||||
if (!i)
|
||||
@ -439,7 +488,7 @@ static inline int mbag_set_ptr(mbag_t s, uint32_t id, void *ptr)
|
||||
|
||||
|
||||
|
||||
static inline int mbag_set_fun(mbag_t s, uint32_t id,
|
||||
static inline int mbag_set_fun(mbag_t s, const char *id,
|
||||
void *(*funget) (void *arg),
|
||||
void (*funfree) (void *arg, void *data), void *arg)
|
||||
{
|
||||
|
@ -5,6 +5,26 @@
|
||||
#include "dbg.h"
|
||||
|
||||
|
||||
|
||||
const char CW_RADIO_ADMIN_STATE[]="admin_state";
|
||||
const char CW_RADIO_OPER_STATE[]="oper_state";
|
||||
const char CW_RADIO_TYPE[]="type";
|
||||
const char CW_RADIO_REG_DOMAIN[]="reg_domain";
|
||||
const char CW_RADIO_BSSID[]="bssid";
|
||||
const char CW_RADIO_SHORT_PREAMBLE[]="short_preamble";
|
||||
const char CW_RADIO_COUNTRY_STRING[]="country_string";
|
||||
|
||||
/* Cisco */
|
||||
|
||||
const char CW_RADIO_OCCUPANCY_LIMIT[]="occupancy_limit";
|
||||
const char CW_RADIO_CFP_PERIOD[]="cfp_period";
|
||||
const char CW_RADIO_CFP_MAX_DURATION[]="cfp_max_duration";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update all radio operational states.
|
||||
* @param radios definitiion of radios
|
||||
@ -31,7 +51,7 @@ int cw_radio_update_oper_states(mbag_t radios,int cause)
|
||||
|
||||
int cw_radio_set_admin_state(mbag_t radios,int rid, int state, int cause)
|
||||
{
|
||||
mbag_t radio = mbag_get_mbag(radios,rid,NULL);
|
||||
mbag_t radio = mbag_i_get_mbag(radios,rid,NULL);
|
||||
if (!radio) {
|
||||
cw_dbg(DBG_ELEM_ERR,"Can't set radio administrative state for radio %d - radio does't exists",rid);
|
||||
return 0;
|
||||
|
@ -3,6 +3,25 @@
|
||||
|
||||
#include "mbag.h"
|
||||
|
||||
|
||||
|
||||
|
||||
extern const char CW_RADIO_ADMIN_STATE[];
|
||||
extern const char CW_RADIO_OPER_STATE[];
|
||||
extern const char CW_RADIO_TYPE[];
|
||||
extern const char CW_RADIO_REG_DOMAIN[];
|
||||
extern const char CW_RADIO_BSSID[];
|
||||
extern const char CW_RADIO_SHORT_PREAMBLE[];
|
||||
extern const char CW_RADIO_COUNTRY_STRING[];
|
||||
|
||||
/* Cisco */
|
||||
|
||||
extern const char CW_RADIO_OCCUPANCY_LIMIT[];
|
||||
extern const char CW_RADIO_CFP_PERIOD[];
|
||||
extern const char CW_RADIO_CFP_MAX_DURATION[];
|
||||
|
||||
|
||||
/*
|
||||
enum radiodata{
|
||||
CW_RADIO_ADMIN_STATE=10000,
|
||||
CW_RADIO_OPER_STATE,
|
||||
@ -12,7 +31,6 @@ enum radiodata{
|
||||
CW_RADIO_SHORT_PREAMBLE,
|
||||
CW_RADIO_COUNTRY_STRING,
|
||||
|
||||
/* Cisco */
|
||||
|
||||
CW_RADIO_OCCUPANCY_LIMIT,
|
||||
CW_RADIO_CFP_PERIOD,
|
||||
@ -20,7 +38,9 @@ enum radiodata{
|
||||
|
||||
|
||||
|
||||
};
|
||||
}[];
|
||||
*/
|
||||
|
||||
|
||||
|
||||
int cw_radio_update_oper_states(mbag_t radios,int cause);
|
||||
|
Reference in New Issue
Block a user