int cw_cisco_get_wlan_(mbag_t wlan, uint8_t *data, int len)
{
	mbag_set_word(wlan,"enc_capab", cw_get_word(data+1));

	int wlan_id=cw_get_word(data+3);
	mbag_set_word(wlan,"wlan_id",wlan_id);

	mbag_set_dword(wlan,"enc_policy",cw_get_dword(data+5));
	mbag_set_bstr16n(wlan,"key",data+9,32);

	mbag_set_byte(wlan,"key_index",cw_get_byte(data+41));
	mbag_set_byte(wlan,"key_shared",cw_get_byte(data+42));
	
	mbag_set_byte(wlan,"wpa_len",cw_get_byte(data+43));
	mbag_set_bstr16n(wlan,"wpa_data",data+44,32);

	mbag_set_byte(wlan,"rsn_len",cw_get_byte(data+76));
	mbag_set_bstr16n(wlan,"rsn_data",data+77,64);

	mbag_set_bstr16n(wlan,"reserved",data+141,49);

	mbag_set_byte(wlan,"wme_len",cw_get_byte(data+190));	
	mbag_set_bstr16n(wlan,"wme_data",data+191,32);	

	mbag_set_byte(wlan,"dot11e_len",cw_get_byte(data+223));	
	mbag_set_bstr16n(wlan,"dot11e_data",data+224,32);	

	mbag_set_byte(wlan,"qos",cw_get_byte(data+256));	

//	mbag_set_byte(wlan,"ssid_broadcast",cw_get_byte(data+257));
	mbag_set_byte(wlan,"ssid_broadcast",cw_get_byte(data+435));
	mbag_set_byte(wlan,"aironet_ie",cw_get_byte(data+436));

	mbag_set_bstr16n(wlan,"reserved2",data+258,40);


	mbag_set_byte(wlan,"dtim_period",cw_get_byte(data+554));
	mbag_set_bstr16n(wlan,"wlan_name",data+558,32);
	mbag_set_byte(wlan,"allow_aaa_override",cw_get_byte(data+591));
	mbag_set_byte(wlan,"max_clients",cw_get_byte(data+593));

	
	mbag_set_bstr16n(wlan,"ssid",data+622,len-622);

	return 0;
}
Exemple #2
0
/** 
 * Update all radio operational states.
 * @param radios definitiion of radios
 * @param cause cause to set
 */ 
int cw_radio_update_oper_states(mbag_t radios,int cause)
{
	MAVLITER_DEFINE(it,radios);
	mavliter_foreach(&it){
		mbag_item_t * i = mavliter_get(&it);
		
		/* Get admin state of the radio, set disabled (2) if admin state is
		   not defined */
		int admin_state = mbag_get_byte(i->data,CW_RADIO_ADMIN_STATE,2);
		mbag_set_word(i->data,CW_RADIO_OPER_STATE,(admin_state<<8) | cause );

	}
	return 1;
}
Exemple #3
0
int static do_save(mbag_t itemstore, struct conn *conn, struct cw_action_in *a,
		   uint8_t * data, int len, struct sockaddr *from)
{

	if (a->itemtype == MBAG_BYTE) {
		mbag_set_byte(itemstore, a->item_id, *data);
		return 1;
	}
	if (a->itemtype == MBAG_WORD) {
		mbag_set_word(itemstore, a->item_id, cw_get_word(data));
		return 1;
	}
	if (a->itemtype == MBAG_DWORD) {
		mbag_set_dword(itemstore, a->item_id, cw_get_dword(data));
		return 1;
	}
	if (a->itemtype == MBAG_STR) {
		mbag_set_strn(itemstore, a->item_id, (char *) data, len);
		return 1;
	}
	if (a->itemtype == MBAG_BSTR) {
		mbag_set_bstrn(itemstore, a->item_id, data, len);
		return 1;
	}

	if (a->itemtype == MBAG_BSTR16) {
		mbag_set_bstr16n(itemstore, a->item_id, data, len);
		return 1;
	}

/*	if (a->itemtype == MBAG_DATA) {
		mbag_set_data(itemstore, a->item_id, data, len);
		return 1;
	}
*/
	if (a->itemtype == MBAG_VENDORSTR) {
		mbag_set_bstrv(itemstore, a->item_id,
				   cw_get_dword(data), data + 4, len - 4);
		return 1;
	}

	cw_log(LOG_ERR,
	       "Can't handle item type %d in definition for incomming msg %d (%s) - %d, cw_in_generic.",
	       a->itemtype, a->msg_id, cw_strmsg(a->msg_id), a->elem_id);
	return 0;


}
Exemple #4
0
int cw_radio_set_admin_state(mbag_t radios,int rid, int state, int cause)
{
	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;
	}
	mbag_set_byte(radio,CW_RADIO_ADMIN_STATE,state);

	if (cause < 0)
		return 1;


	/* Set operational state for next config update response. */

	mbag_set_word(radio,CW_RADIO_OPER_STATE, (state<<8) | 3);

	return 1;
}
Exemple #5
0
int static do_save(mbag_t itemstore, struct conn *conn, struct cw_action_in *a,
		   uint8_t * data, int len, struct sockaddr *from)
{
	const cw_itemdef_t * idef = cw_itemdef_get(conn->actions->items,a->item_id,CW_ITEM_NONE);

	if (!idef) {
		cw_log(LOG_ERR,"No itemdef found for %s",a->item_id);
		return 0;
	}




	if (idef->type == MBAG_BYTE) {
		mbag_set_byte(itemstore, a->item_id, *data);
		return 1;
	}
	if (idef->type == MBAG_WORD) {
		mbag_set_word(itemstore, a->item_id, cw_get_word(data));
		return 1;
	}
	if (idef->type == MBAG_DWORD) {
		mbag_set_dword(itemstore, a->item_id, cw_get_dword(data));
		return 1;
	}
	if (idef->type == MBAG_STR) {
		mbag_set_strn(itemstore, a->item_id, (char *) data, len);
		return 1;
	}
	if (idef->type == MBAG_BSTR) {
		mbag_set_bstrn(itemstore, a->item_id, data, len);
		return 1;
	}

	if (idef->type == MBAG_BSTR16) {
		mbag_set_bstr16n(itemstore, a->item_id, data, len);
		return 1;
	}

/*	if (idef->type == MBAG_DATA) {
		mbag_set_data(itemstore, a->item_id, data, len);
		return 1;
	}
*/
	if (idef->type == MBAG_VENDORSTR) {
		mbag_set_bstrv(itemstore, a->item_id,
				   cw_get_dword(data), data + 4, len - 4);
		return 1;
	}



//	printf("Idef: %s\n",idef->type->name);



	cw_log(LOG_ERR,
	       "Can't handle item type %d in definition for incomming msg %d (%s) - %d, cw_in_generic.",
	       idef->type, a->msg_id, cw_strmsg(a->msg_id), a->elem_id);
	return 0;


}