Beispiel #1
0
static void setup(struct async **as,
	struct sdirs **sdirs, struct conf ***confs)
{
	if(as) *as=setup_async();
	if(sdirs) *sdirs=setup_sdirs();
	if(confs) *confs=setup_conf();
	fail_unless(!recursive_delete(BASE));
}
Beispiel #2
0
static void setup(
	struct sdirs **sdirs, struct fdirs **fdirs, struct conf ***confs)
{
	if(sdirs) *sdirs=setup_sdirs();
	if(fdirs) *fdirs=setup_fdirs(*sdirs);
	if(confs) *confs=setup_conf();
	fail_unless(!recursive_delete(BASE));
}
Beispiel #3
0
static FF_PKT *setup(struct conf ***confs)
{
	FF_PKT *ff;
	fail_unless(!recursive_delete(BASE));

	// Create the root directory, so that we can figure out the absolute
	// path to it, then delete it so that the root directory can be
	// included when setting up the expected file system.
	fail_unless(!mkdir(BASE, 0777));
	fail_unless(realpath(BASE, fullpath)!=NULL);
	fail_unless(!recursive_delete(BASE));

	fail_unless((ff=find_files_init(send_file_callback))!=NULL);
	*confs=setup_conf();
	return ff;
}
Beispiel #4
0
static void run_test(int expected_ret,
	int slist_entries,
	enum protocol protocol,
	void setup_callback(struct asfd *asfd, struct slist *slist))
{
	int result;
	struct slist *slist=NULL;
	const char *conffile=BASE "/burp.conf";
	struct asfd *asfd;
	struct conf **confs;
	const char *buf;

	if(protocol==PROTO_1)
		buf=MIN_CLIENT_CONF "protocol=1\n";
	else
		buf=MIN_CLIENT_CONF "protocol=2\n";

	base64_init();

	asfd=asfd_mock_setup(&reads, &writes);
	confs=setup_conf();

	fail_unless(recursive_delete(BASE)==0);

	build_file(conffile, buf);
	fail_unless(!conf_load_global_only(conffile, confs));

	if(slist_entries)
		slist=build_slist_phase1(BASE, protocol, slist_entries);

	setup_callback(asfd, slist);

	result=do_restore_client(asfd, confs,
		ACTION_RESTORE, 0 /* vss_restore */);
	fail_unless(result==expected_ret);

	slist_free(&slist);
	tear_down(&asfd, &confs);
}
Beispiel #5
0
static void setup(struct conf ***globalcs, struct conf ***cconfs)
{
	alloc_counters_reset();
	if(globalcs) *globalcs=setup_conf();
	if(cconfs) *cconfs=setup_conf();
}
Beispiel #6
0
int main()
{

	signal (SIGINT, sig_handler);

	wtpconf_preinit();

	if (!read_config("./wtp_uci.conf")) {
		return 1;
	}
//	cw_dbg_opt_level = conf_dbg_level;


	if (!wtpconf_init()){
		return 1;
	};

	cw_dbg_opt_display = DBG_DISP_ASC_DMP | DBG_DISP_COLORS;

	dtls_init();


	the_conn = conn_create_noq(-1, NULL);
	struct conn *conn = the_conn;

	conn->radios = mbag_i_create();
	conn->radios_upd=mbag_i_create(); 

	mbag_i_set_mbag(conn->radios,0,mbag_create());
	mbag_i_set_mbag(conn->radios_upd,0,mbag_create());



#define CWMOD "cisco"
#define CWBIND "cisco"
//#define CWMOD "capwap"
//#define CWBIND "capwap80211"


	struct mod_wtp *mod = modload_wtp(CWMOD);
	if (!mod) {
		printf("Can't load mod capwap\n");
		exit(0);
	}
	mod->init();

	mod->register_actions(&capwap_actions,MOD_MODE_CAPWAP);
	mod = modload_wtp(CWBIND);
	if (!mod) {
		printf("Can't load mod capwap80211\n");
		exit(0);
	}

	int rc = mod->register_actions(&capwap_actions,MOD_MODE_BINDINGS);

	conn->detected = 1;
	conn->dtls_verify_peer=0;
	conn->dtls_mtu = 12000;


	conn->actions = &capwap_actions;

	conn->outgoing = mbag_create();
	conn->incomming = mbag_create();
	conn->local = mbag_create();
	conn->config = mbag_create();

	the_conn->strict_capwap = 0;

	cfg_from_json(conn);
	setup_conf(conn);

	mbag_t r;
//	r  = mbag_i_get_mbag(conn->radios,0,NULL);
	r = conn->radios;
	MAVLITER_DEFINE(it,r);
	mavliter_foreach(&it){
		struct mbag_item *i=mavliter_get(&it);
		printf("RID = %d\n",i->iid);
		printf("DATA: %p\n",i->data);
		mbag_t radio= (mbag_t)i->data;
		struct mbag_item *mri = mbag_get(radio,CW_RADIOITEM80211_WTP_RADIO_INFORMATION);
		
	if (!mri){
printf("Setting to 8 %p %p\n",mri,r);
		mbag_set_dword(radio,CW_RADIOITEM80211_WTP_RADIO_INFORMATION,1);
	}
	else{
		printf("MRI %p\n",mri);
	}

		
	}
	



	mod_init_config(mod,conn->config);
	cfg_to_json();

	mbag_t mb = mbag_get_mbag(conn->config, CW_ITEM_WTP_BOARD_DATA, NULL);
	printf("mbag %p\n", mb);


	cw_acpriolist_t acprios = cw_acpriolist_create();
	cw_acpriolist_set(acprios, "Master AC", strlen("Master AC"), 1);
	cw_acpriolist_set(acprios, "AC8new", strlen("AC8new"), 12);



	mbag_set_byte(conn->local, CW_ITEM_WTP_MAC_TYPE, CW_WTP_MAC_TYPE_SPLIT);
	mbag_set_byte(conn->local, CW_ITEM_WTP_FRAME_TUNNEL_MODE, CW_WTP_FRAME_TUNNEL_MODE_E);
	conn->wbid=1;




//	cw_set_msg_end_callback(conn->actions,CW_STATE_RUN,CW_MSG_CONFIGURATION_UPDATE_REQUEST,handle_update_req);


	if (!discovery())
		return -1;
	if (!join())
		return -1;

	if (!configure())
		return -1;

	cw_dbg(DBG_X,"Saveing config 0");

	cfg_to_json();

	changestate();


	run();

	//image_update();

	return 0;
}