Introducing mavl and mbag.
FossilOrigin-Name: 383bc0c7d65716c38a10aea87ab94c240e581cd2193f55fdfcbe644ef3dec0ff
This commit is contained in:
		@ -1,8 +1,8 @@
 | 
			
		||||
#include "capwap/capwap.h"
 | 
			
		||||
#include "capwap/itemstore.h"
 | 
			
		||||
#include "capwap/mbag.h"
 | 
			
		||||
 | 
			
		||||
extern struct ac_status ac_global_status;
 | 
			
		||||
extern int ac_global_init();
 | 
			
		||||
extern cw_itemstore_t ac_config;	
 | 
			
		||||
extern mbag_t ac_config;	
 | 
			
		||||
extern struct cw_actiondef capwap_actions;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,7 @@ struct cw_ac_status ac_status;
 | 
			
		||||
 | 
			
		||||
struct cw_actiondef capwap_actions;
 | 
			
		||||
 | 
			
		||||
cw_itemstore_t ac_config;
 | 
			
		||||
mbag_t ac_config;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
cw_aciplist_t get_aciplist()
 | 
			
		||||
@ -77,9 +77,9 @@ void release_iplist(void *arg,void *data)
 | 
			
		||||
 | 
			
		||||
int ac_global_init()
 | 
			
		||||
{
 | 
			
		||||
	ac_config = cw_itemstore_create();
 | 
			
		||||
	cw_itemstore_set_str(ac_config, CW_ITEM_AC_NAME, conf_acname);
 | 
			
		||||
	cw_itemstore_set_ptr(ac_config, CW_ITEM_AC_STATUS, &ac_status);
 | 
			
		||||
	ac_config = mbag_create();
 | 
			
		||||
	mbag_set_str(ac_config, CW_ITEM_AC_NAME, conf_acname);
 | 
			
		||||
	mbag_set_ptr(ac_config, CW_ITEM_AC_STATUS, &ac_status);
 | 
			
		||||
 | 
			
		||||
	ac_status.stations = 0;
 | 
			
		||||
	ac_status.limit = 1000;
 | 
			
		||||
@ -90,18 +90,18 @@ int ac_global_init()
 | 
			
		||||
	ac_status.dtls_policy = CW_FLAG_DTLS_POLICY_C | CW_FLAG_DTLS_POLICY_D;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	cw_itemstore_set_vendorstr(ac_config, CW_ITEM_AC_HARDWARE_VERSION, 0,
 | 
			
		||||
	mbag_set_vendorstr(ac_config, CW_ITEM_AC_HARDWARE_VERSION, 0,
 | 
			
		||||
				 bstr_data(conf_hardware_version), bstr_len(conf_hardware_version));
 | 
			
		||||
	cw_itemstore_set_vendorstr(ac_config, CW_ITEM_AC_SOFTWARE_VERSION, 0,
 | 
			
		||||
	mbag_set_vendorstr(ac_config, CW_ITEM_AC_SOFTWARE_VERSION, 0,
 | 
			
		||||
				 bstr_data(conf_software_version), bstr_len(conf_software_version));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	cw_itemstore_set_str(ac_config,CW_ITEM_AC_IMAGE_DIR,conf_image_dir);
 | 
			
		||||
	mbag_set_str(ac_config,CW_ITEM_AC_IMAGE_DIR,conf_image_dir);
 | 
			
		||||
 | 
			
		||||
//	cw_itemstore_set_avltree(ac_config, CW_ITEM_AC_IP_LIST, aciplist);
 | 
			
		||||
//	mbag_set_avltree(ac_config, CW_ITEM_AC_IP_LIST, aciplist);
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	cw_itemstore_set_fun(ac_config, CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, get_iplist,release_iplist,(void*)771);
 | 
			
		||||
	mbag_set_fun(ac_config, CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, get_iplist,release_iplist,(void*)771);
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -131,15 +131,15 @@ conn->capwap_mode=CW_MODE_CIPWAP;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	wtpman->conn->local = ac_config;
 | 
			
		||||
	wtpman->conn->outgoing = cw_itemstore_create();
 | 
			
		||||
	wtpman->conn->incomming = cw_itemstore_create();
 | 
			
		||||
	wtpman->conn->outgoing = mbag_create();
 | 
			
		||||
	wtpman->conn->incomming = mbag_create();
 | 
			
		||||
 | 
			
		||||
	while (!cw_timer_timeout(timer)
 | 
			
		||||
	       && wtpman->conn->capwap_state == CW_STATE_DISCOVERY) {
 | 
			
		||||
		cw_read_messages(wtpman->conn);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	struct cw_item *wn = cw_itemstore_get(wtpman->conn->incomming, CW_ITEM_WTP_NAME);
 | 
			
		||||
	struct mbag_item *wn = mbag_get(wtpman->conn->incomming, CW_ITEM_WTP_NAME);
 | 
			
		||||
 | 
			
		||||
	if (wn) {
 | 
			
		||||
		//printf("WTP Name: %s\n", wn->data);
 | 
			
		||||
@ -293,10 +293,10 @@ static int wtpman_join(void *arg, time_t timer)
 | 
			
		||||
	wtpman->conn->capwap_state = CW_STATE_JOIN;
 | 
			
		||||
	wtpman->conn->actions = &capwap_actions;
 | 
			
		||||
 | 
			
		||||
//      wtpman->conn->itemstore = cw_itemstore_create();
 | 
			
		||||
//      wtpman->conn->itemstore = mbag_create();
 | 
			
		||||
 | 
			
		||||
	wtpman->conn->outgoing = cw_itemstore_create();
 | 
			
		||||
	wtpman->conn->incomming = cw_itemstore_create();
 | 
			
		||||
	wtpman->conn->outgoing = mbag_create();
 | 
			
		||||
	wtpman->conn->incomming = mbag_create();
 | 
			
		||||
	wtpman->conn->local = ac_config;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -437,7 +437,7 @@ static void wtpman_run(void *arg)
 | 
			
		||||
	if (conn->capwap_state == CW_STATE_IMAGE_DATA) {
 | 
			
		||||
		/* Image upload */
 | 
			
		||||
		const char *filename =
 | 
			
		||||
		    cw_itemstore_get_str(conn->outgoing, CW_ITEM_IMAGE_FILENAME,NULL);
 | 
			
		||||
		    mbag_get_str(conn->outgoing, CW_ITEM_IMAGE_FILENAME,NULL);
 | 
			
		||||
		if (!filename) {
 | 
			
		||||
			cw_log(LOG_ERR,
 | 
			
		||||
			       "Can't send image to %s. No Image Filename Item found.",
 | 
			
		||||
@ -458,13 +458,13 @@ static void wtpman_run(void *arg)
 | 
			
		||||
		CLOCK_DEFINE(clk);
 | 
			
		||||
		cw_clock_start(&clk);
 | 
			
		||||
 | 
			
		||||
		cw_item_t *eof = cw_itemstore_set_const_ptr(conn->outgoing, CW_ITEM_IMAGE_FILEHANDLE,
 | 
			
		||||
		mbag_item_t *eof = mbag_set_const_ptr(conn->outgoing, CW_ITEM_IMAGE_FILEHANDLE,
 | 
			
		||||
					   infile);
 | 
			
		||||
 | 
			
		||||
		int rc=0;
 | 
			
		||||
	        while (conn->capwap_state == CW_STATE_IMAGE_DATA && rc==0 && eof!=NULL) {
 | 
			
		||||
			rc = cw_send_request(conn, CW_MSG_IMAGE_DATA_REQUEST);
 | 
			
		||||
			eof = cw_itemstore_get(conn->outgoing,CW_ITEM_IMAGE_FILEHANDLE);
 | 
			
		||||
			eof = mbag_get(conn->outgoing,CW_ITEM_IMAGE_FILEHANDLE);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user