Esempio n. 1
0
int ac_global_init()
{
//	mod_set_actions_registered_cb(setup_actions);



    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;
    ac_status.active_wtps = 10;
    ac_status.max_wtps = 200;
    ac_status.security = CW_FLAG_AC_SECURITY_X | CW_FLAG_AC_SECURITY_S;
    ac_status.rmac_field = CW_FLAG_RMAC_SUPPORTED;
    ac_status.dtls_policy = CW_FLAG_DTLS_POLICY_C; // | CW_FLAG_DTLS_POLICY_D;


    mbag_set_bstrv(ac_config, CW_ITEM_AC_HARDWARE_VERSION, 0,
                   bstr_data(conf_hardware_version), bstr_len(conf_hardware_version));
    mbag_set_bstrv(ac_config, CW_ITEM_AC_SOFTWARE_VERSION, 0,
                   bstr_data(conf_software_version), bstr_len(conf_software_version));


    mbag_set_str(ac_config,CW_ITEM_AC_IMAGE_DIR,conf_image_dir);

//	mbag_set_avltree(ac_config, CW_ITEM_AC_IP_LIST, aciplist);


    mbag_set_fun(ac_config, CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, get_iplist,release_iplist,(void*)771);

    return 1;
}
Esempio n. 2
0
int cw_in_ac_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
			int len, struct sockaddr *from)
{

	return cw_read_ac_descriptor(conn->config,data,len,NULL);

	struct cw_ac_status *status = malloc(sizeof(struct cw_ac_status));
	if (!status)
		return 0;

	status->stations = cw_get_word(data);
	status->limit = cw_get_word(data + 2);
	status->active_wtps = cw_get_word(data + 4);
	status->max_wtps = cw_get_word(data + 6);
	status->security = cw_get_byte(data + 8);
	status->rmac_field = cw_get_byte(data + 9);
	status->dtls_policy = cw_get_byte(data + 11);

	cw_dbg(DBG_SUBELEM,
	       "AC Descriptor: WTPs:%d/%d, Stations:%d/%d, Security:%d, Rmac:%d, DTLS-Policy:%d",
	       status->active_wtps, status->max_wtps, status->stations, status->limit,
	       status->security, status->rmac_field, status->dtls_policy);


	mbag_set_ptr(conn->incomming, CW_ITEM_AC_STATUS, status);

	static struct cw_descriptor_subelem_def allowed[] = {
		{0,CW_SUBELEM_AC_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,1},
		{0,CW_SUBELEM_AC_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
		{0,0, NULL,0, 0}
	};

	cw_read_descriptor_subelems(conn->config, data + 12, len - 12, allowed);

	return 1;
}