Inital commit.
FossilOrigin-Name: db7698bb220820c184e89340dbb642a7b97d2e9ccfd3baad58ae496b64b32263
This commit is contained in:
parent
6de87bb433
commit
d50b1b411a
19
src/cw/cipwap_items.c
Normal file
19
src/cw/cipwap_items.c
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "item.h"
|
||||
|
||||
#include "cipwap_items.h"
|
||||
|
||||
|
||||
|
||||
const char CIPWAP_ITEM_SSH_ENABLE[]="ssh_enable";
|
||||
const char CIPWAP_ITEM_TELNET_ENABLE[]="telnet_enable";
|
||||
|
||||
struct cw_itemdef cipwap_itemdefs[] = {
|
||||
|
||||
{CIPWAP_ITEM_TELNET_ENABLE,CW_ITEM_NONE,MBAG_BYTE},
|
||||
{CIPWAP_ITEM_SSH_ENABLE,CW_ITEM_NONE,MBAG_BYTE},
|
||||
{CW_ITEM_NONE}
|
||||
|
||||
};
|
||||
|
9
src/cw/cipwap_items.h
Normal file
9
src/cw/cipwap_items.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef __CIPWAP_ITEMS_H
|
||||
#define __CIPWAP_ITEMS_H
|
||||
|
||||
extern const char CIPWAP_ITEM_SSH_ENABLE[];
|
||||
extern const char CIPWAP_ITEM_TELNET_ENABLE[];
|
||||
|
||||
extern struct cw_itemdef cipwap_itemdefs[];
|
||||
|
||||
#endif
|
24
src/cw/cw_out_radio_administrative_states.c
Normal file
24
src/cw/cw_out_radio_administrative_states.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include "cw.h"
|
||||
#include "dbg.h"
|
||||
|
||||
|
||||
int cw_out_radio_administrative_states(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
||||
{
|
||||
cw_dbg(DBG_X,"Radio admin updater");
|
||||
|
||||
|
||||
|
||||
int l=0;
|
||||
MAVLITER_DEFINE(it,conn->radios_upd);
|
||||
mavliter_foreach(&it){
|
||||
struct mbag_item *i = mavliter_get(&it);
|
||||
if ( i->type != MBAG_MBAG ) {
|
||||
continue;
|
||||
}
|
||||
l+=cw_put_elem_radio_administrative_state(dst+l,i->iid,i->data);
|
||||
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
11
src/cw/cw_put_elem_radio_administrative_state.c
Normal file
11
src/cw/cw_put_elem_radio_administrative_state.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include "cw.h"
|
||||
#include "capwap_items.h"
|
||||
|
||||
int cw_put_elem_radio_administrative_state(uint8_t *dst,int radio_id,mbag_t radio)
|
||||
{
|
||||
cw_put_byte(dst+4,radio_id);
|
||||
cw_put_byte(dst+5,mbag_get_byte(radio,CW_RADIOITEM_ADMIN_STATE,CW_RADIO_ADMIN_STATE_DISABLED));
|
||||
return 2 + cw_put_elem_hdr(dst,CW_ELEM_RADIO_ADMINISTRATIVE_STATE,2);
|
||||
}
|
||||
|
||||
|
36
src/cw/cw_put_elem_radio_operational_state.c
Normal file
36
src/cw/cw_put_elem_radio_operational_state.c
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
#include "cw.h"
|
||||
|
||||
/**
|
||||
* Put an Operational State message element to a buffer.
|
||||
* @param dst Destination buffer
|
||||
* @param rid Radio ID
|
||||
* @param os Operational State
|
||||
* @param d7mode puts the Operational Stae element in CAPWAP draft 7 mode.
|
||||
* @return Number of byes put
|
||||
*/
|
||||
int cw_put_elem_radio_operational_state(uint8_t * dst, int rid, int os, int d7mode)
|
||||
{
|
||||
uint8_t *d=dst;
|
||||
|
||||
/* Put the radio ID */
|
||||
cw_put_byte(d+4,rid);
|
||||
|
||||
if ( d7mode ){
|
||||
/* Isolate Oper Sate from cause */
|
||||
uint8_t o=os>>8;
|
||||
|
||||
/* Invert oper state for Cisco, if oper state is 2 or 1 */
|
||||
if (o!=0 && o<=2) {
|
||||
/* 2 becomes 1 and 1 becomes 2 */
|
||||
os = (os & 0x00ff ) | ((3-o)<<8);
|
||||
}
|
||||
}
|
||||
|
||||
/* Put oper state */
|
||||
cw_put_word(d+5,os);
|
||||
d+=3+cw_put_elem_hdr(d,CW_ELEM_RADIO_OPERATIONAL_STATE,3);
|
||||
|
||||
return d-dst;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user