Heavy changes ... mbag uses const char * as key
WTP is still not 100% working... FossilOrigin-Name: 9e80cb8f1b62f854b54393e3af75b789125870b1397ccccad6d3442e3395181c
This commit is contained in:
		
							
								
								
									
										11
									
								
								src/ac/db.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/ac/db.c
									
									
									
									
									
								
							@ -150,8 +150,8 @@ errX:
 | 
			
		||||
int db_get_tasks(const char * wtpid)
 | 
			
		||||
{
 | 
			
		||||
		
 | 
			
		||||
	sqlite3_reset(put_wtp_prop_stmt);
 | 
			
		||||
	sqlite3_clear_bindings(put_wtp_prop_stmt);
 | 
			
		||||
	sqlite3_reset(get_tasks_stmt);
 | 
			
		||||
	sqlite3_clear_bindings(get_tasks_stmt);
 | 
			
		||||
 | 
			
		||||
	if(sqlite3_bind_text(get_tasks_stmt,1,wtpid,-1,SQLITE_STATIC))
 | 
			
		||||
		goto errX;
 | 
			
		||||
@ -160,19 +160,20 @@ int db_get_tasks(const char * wtpid)
 | 
			
		||||
 | 
			
		||||
	rc = sqlite3_step(get_tasks_stmt);
 | 
			
		||||
	if (rc == SQLITE_ROW) {
 | 
			
		||||
		DBGX("Have a rowi %s",sqlite3_column_text(get_tasks_stmt,0));
 | 
			
		||||
/*		DBGX("Have a rowi %s",sqlite3_column_text(get_tasks_stmt,0));
 | 
			
		||||
		DBGX("Have a rowi %s",sqlite3_column_text(get_tasks_stmt,1));
 | 
			
		||||
		DBGX("Have a rowi %s",sqlite3_column_text(get_tasks_stmt,2));
 | 
			
		||||
		DBGX("Have a rowi %s",sqlite3_column_text(get_tasks_stmt,3));
 | 
			
		||||
		DBGX("Have a rowi %s",sqlite3_column_text(get_tasks_stmt,4));
 | 
			
		||||
*/
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	DBGX("The SQL RC: %d\n",rc);
 | 
			
		||||
//	DBGX("The SQL RC: %d\n",rc);
 | 
			
		||||
	return 1;
 | 
			
		||||
 | 
			
		||||
errX:
 | 
			
		||||
	if (rc) {
 | 
			
		||||
		cw_log(LOG_ERR,"Can't update database with WTP props: %d - %s",
 | 
			
		||||
		cw_log(LOG_ERR,"Can't get tasks: %d - %s",
 | 
			
		||||
			rc,sqlite3_errmsg(handle));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -338,16 +338,16 @@ void config_to_sql(struct conn *conn)
 | 
			
		||||
	mavliter_foreach(&it){
 | 
			
		||||
		mbag_item_t * i = mavliter_get(&it);
 | 
			
		||||
		
 | 
			
		||||
		struct cw_item * cwi = cw_item_get_by_id(i->id,capwap_itemdefs);
 | 
			
		||||
		struct cw_item * cwi = cw_item_get_by_name(i->id,capwap_itemdefs);
 | 
			
		||||
		if (cwi){
 | 
			
		||||
	//		DBGX("ID %d,%s",i->id,cwi->cfgname);
 | 
			
		||||
			DBGX("ID %d,%s",i->id,cwi->id);
 | 
			
		||||
 | 
			
		||||
	//		printf("%s != %s ?\n",i->type->name,cwi->type->name);
 | 
			
		||||
			char str[256];
 | 
			
		||||
			if (i->type->to_str)
 | 
			
		||||
				i->type->to_str(i,str);
 | 
			
		||||
			
 | 
			
		||||
			db_put_wtp_prop(wtp_id,-1,cwi->cfgname,str);
 | 
			
		||||
			db_put_wtp_prop(wtp_id,-1,cwi->id,str);
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
		else{
 | 
			
		||||
@ -428,8 +428,10 @@ static void wtpman_run(void *arg)
 | 
			
		||||
	conn->capwap_state=CW_STATE_RUN;
 | 
			
		||||
 | 
			
		||||
	// XXX testing ...
 | 
			
		||||
	DBGX("Cofig to sql","");
 | 
			
		||||
	config_to_sql(conn);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	rc = 0;
 | 
			
		||||
	while (wtpman->conn->capwap_state == CW_STATE_RUN) {
 | 
			
		||||
@ -477,10 +479,10 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr)
 | 
			
		||||
 | 
			
		||||
	wtpman->conn->strict_capwap = conf_strict_capwap;
 | 
			
		||||
	wtpman->conn->strict_hdr = conf_strict_headers;
 | 
			
		||||
	wtpman->conn->radios=mbag_create();
 | 
			
		||||
	wtpman->conn->radios=mbag_i_create();
 | 
			
		||||
	wtpman->conn->local = ac_config;
 | 
			
		||||
//wtpman->conn->capwap_mode=0; //CW_MODE_STD; //CISCO;
 | 
			
		||||
//wtpman->conn->capwap_mode=CW_MODE_CISCO;
 | 
			
		||||
wtpman->conn->capwap_mode=CW_MODE_CISCO;
 | 
			
		||||
//wtpman->conn->strict_capwap_hdr=0;
 | 
			
		||||
 | 
			
		||||
	return wtpman;
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user