more on mods.
FossilOrigin-Name: 92539795329743de76ef8a9a362dccad314b19682f4045ace4a10c432f6f1425
This commit is contained in:
parent
dc5dd3e0e4
commit
0919d85456
@ -930,11 +930,11 @@ extern int cw_send_configuration_update_response(struct conn *conn, int seqnum,
|
||||
struct radioinfo *radioinfo);
|
||||
*/
|
||||
|
||||
#define cw_addelem_ac_name(dst,name) \
|
||||
cw_addelem(dst,CW_ELEM_AC_NAME,name,strlen((char*)(name)))
|
||||
//#define cw_addelem_ac_name(dst,name) \
|
||||
// cw_addelem(dst,CW_ELEM_AC_NAME,name,strlen((char*)(name)))
|
||||
|
||||
#define cw_addelem_session_id(dst,sessid)\
|
||||
cw_addelem_bstr(dst,CW_ELEM_SESSION_ID,sessid)
|
||||
//#define cw_addelem_session_id(dst,sessid)\
|
||||
// cw_addelem_bstr(dst,CW_ELEM_SESSION_ID,sessid)
|
||||
|
||||
|
||||
|
||||
|
14
src/cw/cw.h
14
src/cw/cw.h
@ -24,13 +24,25 @@
|
||||
* see #lw_put_byte
|
||||
*/
|
||||
#define cw_put_byte lw_put_byte
|
||||
|
||||
/**
|
||||
* Put a word to an output buffer.
|
||||
* see #lw_put_word
|
||||
*/
|
||||
#define cw_put_word lw_put_word
|
||||
|
||||
/**
|
||||
* Put a dword
|
||||
* see #lw_put_dword
|
||||
*/
|
||||
#define cw_put_dword lw_put_dword
|
||||
|
||||
/**
|
||||
* Put some bytes
|
||||
* See #lw_put_data
|
||||
*/
|
||||
#define cw_put_data lw_put_data
|
||||
|
||||
#define cw_put_bstr lw_put_bstr
|
||||
#define cw_put_bstr16 lw_put_bstr16
|
||||
|
||||
@ -65,6 +77,8 @@ extern int cw_in_check_generic_resp(struct conn *conn, struct cw_action_in *a,
|
||||
uint8_t * data, int len, struct sockaddr *from);
|
||||
|
||||
|
||||
extern int cw_in_vendor_specific_payload(struct conn *conn, struct cw_action_in *a,
|
||||
uint8_t * data, int len,struct sockaddr *from);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -10,28 +10,30 @@
|
||||
|
||||
/**
|
||||
* Default handler for Vendor Specific Payload message elements.
|
||||
*/
|
||||
int cw_in_vendor_specific_payload(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len,struct sockaddr *from)
|
||||
*/
|
||||
int cw_in_vendor_specific_payload(struct conn *conn, struct cw_action_in *a,
|
||||
uint8_t * data, int len, struct sockaddr *from)
|
||||
{
|
||||
|
||||
cw_action_in_t as,*af;
|
||||
cw_action_in_t as, *af;
|
||||
as = *a;
|
||||
|
||||
as.vendor_id = cw_get_dword(data);
|
||||
as.elem_id = cw_get_word(data+4);
|
||||
as.elem_id = cw_get_word(data + 4);
|
||||
|
||||
|
||||
af = cw_actionlist_in_get(conn->actions->in,&as);
|
||||
af = cw_actionlist_in_get(conn->actions->in, &as);
|
||||
|
||||
if (!af) {
|
||||
cw_dbg(DBG_WARN,"Can't handle Vendor Specific Payload %s/%d, in msg %d (%s) in %s state.",
|
||||
cw_strvendor(as.vendor_id),
|
||||
as.elem_id,as.msg_id,cw_strmsg(as.msg_id),cw_strstate(as.capwap_state));
|
||||
cw_dbg(DBG_WARN,
|
||||
"Can't handle Vendor Specific Payload %s/%d, in msg %d (%s) in %s state.",
|
||||
cw_strvendor(as.vendor_id), as.elem_id, as.msg_id,
|
||||
cw_strmsg(as.msg_id), cw_strstate(as.capwap_state));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (af->start) {
|
||||
int afrc = af->start(conn,af,data+6,len-6,from);
|
||||
int afrc = af->start(conn, af, data + 6, len - 6, from);
|
||||
if (af->mand && afrc) {
|
||||
/* add found mandatory message element
|
||||
to mand list */
|
||||
@ -42,4 +44,3 @@ int cw_in_vendor_specific_payload(struct conn *conn,struct cw_action_in * a,uint
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ int cw_out_radio_operational_states(struct conn *conn, struct cw_action_out *a,
|
||||
|
||||
MAVLITER_DEFINE(it,conn->radios);
|
||||
mavliter_foreach(&it){
|
||||
|
||||
mbag_item_t * radioitem = mavliter_get(&it);
|
||||
mbag_item_t *ositem = mbag_get(radioitem->data,CW_RADIO_OPER_STATE);
|
||||
if (!ositem){
|
||||
|
@ -111,6 +111,19 @@ static cw_action_in_t actions_in[] = {
|
||||
}
|
||||
,
|
||||
|
||||
/* Idle Timeout - Config Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
.msg_id = CW_MSG_CONFIGURATION_STATUS_RESPONSE,
|
||||
.elem_id = CW_ELEM_IDLE_TIMEOUT,
|
||||
.item_id = CW_ITEM_IDLE_TIMEOUT,
|
||||
.start = cw_in_generic2,
|
||||
.min_len = 4,
|
||||
.max_len = 4,
|
||||
.mand = 0
|
||||
}
|
||||
,
|
||||
|
||||
/* Result Code - Config Status Resp */
|
||||
{
|
||||
.capwap_state = CW_STATE_CONFIGURE,
|
||||
@ -275,6 +288,8 @@ static cw_action_out_t actions_out[] = {
|
||||
/* ---------------------------------------------------------------
|
||||
* Configuration Status Request - Out
|
||||
*/
|
||||
|
||||
/* AC Name - Config Status Request */
|
||||
{
|
||||
.msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||
.elem_id = CW_ELEM_AC_NAME,
|
||||
@ -284,9 +299,41 @@ static cw_action_out_t actions_out[] = {
|
||||
.mand = 1
|
||||
}
|
||||
,
|
||||
/* Radio Admin State - Config Status Request */
|
||||
{
|
||||
.msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||
.item_id = CW_ITEM_RADIO_ADMINISTRATIVE_STATE,
|
||||
.out = cw_out_radio_administrative_states,
|
||||
.get = cw_out_get_config,
|
||||
.mand = 1
|
||||
}
|
||||
,
|
||||
|
||||
// {CW_MSG_CONFIGURATION_STATUS_REQUEST, CW_ITEM_RADIO_ADMINISTRATIVE_STATE, 0,
|
||||
// CW_ELEM_RADIO_ADMINISTRATIVE_STATE, NULL, cw_out_radio_administrative_states, cw_out_get_config,1}
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------
|
||||
* Change State Event Request - Out
|
||||
*/
|
||||
{
|
||||
.msg_id = CW_MSG_CHANGE_STATE_EVENT_REQUEST,
|
||||
.item_id = CW_ITEM_RADIO_OPER_STATE,
|
||||
.out = cw_out_radio_operational_states,
|
||||
.get = cw_out_get_config,
|
||||
.mand = 1
|
||||
}
|
||||
,
|
||||
|
||||
|
||||
|
||||
|
||||
/* Radio Ooerational State */
|
||||
// {CW_MSG_CHANGE_STATE_EVENT_REQUEST, CW_ITEM_RADIO_OPER_STATE, 0,
|
||||
// 0, NULL, cw_out_radio_operational_states, cw_out_get_config,1}
|
||||
// ,
|
||||
|
||||
|
||||
|
||||
/* WTP Descriptor */
|
||||
|
@ -5,6 +5,11 @@
|
||||
"wtp_name":"WFAT-004A9902FAC0",
|
||||
"wtp_software_version":"11591,0.1",
|
||||
"radios":{
|
||||
|
||||
"0":{
|
||||
"radio_type":"1"
|
||||
},
|
||||
"1":{
|
||||
"radio_type":"2"
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
#include "cw/log.h"
|
||||
|
||||
#include "wtp_interface.h"
|
||||
#include "cfg.h"
|
||||
|
||||
int configure()
|
||||
{
|
||||
@ -22,6 +23,8 @@ int configure()
|
||||
"Error sending Configuration Status Request to AC at %s: %d - %s.",
|
||||
sock_addr2str(&conn->addr), errno, cw_strerror(rc));
|
||||
}
|
||||
|
||||
cfg_to_json();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -75,32 +75,22 @@ int main()
|
||||
|
||||
cw_dbg_opt_display = DBG_DISP_ASC_DMP | DBG_DISP_COLORS;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
mbag_t b = mbag_create();
|
||||
|
||||
mbag_set_byte(b,1,99);
|
||||
mbag_set_avltree(b,2,mbag_create());
|
||||
mavl_destroy(b);
|
||||
*/
|
||||
|
||||
dtls_init();
|
||||
|
||||
the_conn = conn_create_noq(-1, NULL);
|
||||
struct conn *conn = the_conn;
|
||||
|
||||
conn->radios = mbag_i_create();
|
||||
// mbag_set_mbag(conn->radios,0,mbag_create());
|
||||
// mbag_set_mbag(conn->radios,1,mbag_create());
|
||||
mbag_i_set_mbag(conn->radios,0,mbag_create());
|
||||
mbag_i_set_mbag(conn->radios,1,mbag_create());
|
||||
// mbag_set_mbag(conn->radios,0xff,mbag_create());
|
||||
|
||||
|
||||
// mbag_t r;
|
||||
// r = mbag_get_mbag(conn->radios,0,NULL);
|
||||
// mbag_set_dword(r,CW_RADIO_TYPE,1);
|
||||
// r = mbag_get_mbag(conn->radios,1,NULL);
|
||||
// mbag_set_dword(r,CW_RADIO_TYPE,2);
|
||||
mbag_t r;
|
||||
r = mbag_i_get_mbag(conn->radios,0,NULL);
|
||||
mbag_set_dword(r,CW_RADIO_TYPE,1);
|
||||
r = mbag_i_get_mbag(conn->radios,1,NULL);
|
||||
mbag_set_dword(r,CW_RADIO_TYPE,2);
|
||||
// r = mbag_get_mbag(conn->radios,1,NULL);
|
||||
// mbag_set_dword(r,CW_RADIO_TYPE,1);
|
||||
|
||||
@ -114,7 +104,6 @@ mavl_destroy(b);
|
||||
exit(0);
|
||||
}
|
||||
conn->detected = 1;
|
||||
|
||||
mod->register_actions(&capwap_actions);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user