Work on state machine
This commit is contained in:
parent
bf8a8c6d53
commit
e5f5687b2b
17
Makefile
17
Makefile
@ -1,10 +1,6 @@
|
|||||||
.OBJDIR: ./
|
.OBJDIR: ./
|
||||||
|
|
||||||
all:
|
all: ac wtp
|
||||||
$(MAKE) -C src/cw -j16
|
|
||||||
$(MAKE) -C src/mod -j16
|
|
||||||
$(MAKE) -C src/ac -j16
|
|
||||||
$(MAKE) -C src/wtp -j16
|
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@ -13,4 +9,15 @@ clean:
|
|||||||
$(MAKE) -C src/ac clean
|
$(MAKE) -C src/ac clean
|
||||||
$(MAKE) -C src/wtp clean
|
$(MAKE) -C src/wtp clean
|
||||||
|
|
||||||
|
cw:
|
||||||
|
$(MAKE) -C src/cw
|
||||||
|
|
||||||
|
ac: cw mod
|
||||||
|
$(MAKE) -C src/ac
|
||||||
|
|
||||||
|
wtp: cw mod
|
||||||
|
$(MAKE) -C src/wtp
|
||||||
|
|
||||||
|
mod: cw
|
||||||
|
$(MAKE) -C src/mod
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ OBJS = \
|
|||||||
socklist.o \
|
socklist.o \
|
||||||
discovery_cache.o\
|
discovery_cache.o\
|
||||||
shell.o\
|
shell.o\
|
||||||
|
statemachine.o\
|
||||||
|
|
||||||
|
|
||||||
PRG=actube
|
PRG=actube
|
||||||
LIBPATH=-L../../lib/$(KERNEL)/$(ARCH)/ -L/usr/local/lib -L/usr/lib
|
LIBPATH=-L../../lib/$(KERNEL)/$(ARCH)/ -L/usr/local/lib -L/usr/lib
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
int ac_run(cw_Cfg_t * cfg);
|
int ac_run(cw_Cfg_t * cfg);
|
||||||
|
|
||||||
|
#include "statemachine.h"
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
@ -184,6 +184,11 @@ int main (int argc, char *argv[])
|
|||||||
/* parse arguments */
|
/* parse arguments */
|
||||||
parse_args (argc, argv, &bootcfg);
|
parse_args (argc, argv, &bootcfg);
|
||||||
|
|
||||||
|
|
||||||
|
cw_statemachine_run(NULL);
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
|
||||||
global_cfg=cw_cfg_create();
|
global_cfg=cw_cfg_create();
|
||||||
if (!global_cfg){
|
if (!global_cfg){
|
||||||
fprintf(stderr,"Can't create global_cfg: %s\n",strerror(errno));
|
fprintf(stderr,"Can't create global_cfg: %s\n",strerror(errno));
|
||||||
|
@ -86,6 +86,10 @@ static void wtpman_remove(struct wtpman *wtpman)
|
|||||||
|
|
||||||
static void wtpman_run_discovery(void *arg)
|
static void wtpman_run_discovery(void *arg)
|
||||||
{
|
{
|
||||||
|
cw_dbg(DBG_STATE,"Run discovery");
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
|
||||||
struct wtpman *wtpman = (struct wtpman *) arg;
|
struct wtpman *wtpman = (struct wtpman *) arg;
|
||||||
|
|
||||||
time_t timer = cw_timer_start(10);
|
time_t timer = cw_timer_start(10);
|
||||||
@ -270,6 +274,8 @@ void *wtpman_run_data(void *wtpman_arg)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int cw_run_state_machine(struct cw_Conn *conn, time_t * timer)
|
int cw_run_state_machine(struct cw_Conn *conn, time_t * timer)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -280,7 +286,7 @@ int cw_run_state_machine(struct cw_Conn *conn, time_t * timer)
|
|||||||
while (1) {
|
while (1) {
|
||||||
search.state = conn->capwap_state;
|
search.state = conn->capwap_state;
|
||||||
search.prevstate = conn->capwap_prevstate;
|
search.prevstate = conn->capwap_prevstate;
|
||||||
result = mavl_get(conn->msgset->state_machine, &search);
|
result = mavl_get(conn->msgset->statemachine_states, &search);
|
||||||
|
|
||||||
cw_dbg(DBG_STATE, "State transition: [%s -> %s]",
|
cw_dbg(DBG_STATE, "State transition: [%s -> %s]",
|
||||||
cw_strstate(conn->capwap_prevstate),
|
cw_strstate(conn->capwap_prevstate),
|
||||||
@ -655,7 +661,8 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
|||||||
wtpman = malloc(sizeof(struct wtpman));
|
wtpman = malloc(sizeof(struct wtpman));
|
||||||
if (!wtpman)
|
if (!wtpman)
|
||||||
return 0;
|
return 0;
|
||||||
memset(wtpman, 0, sizeof(struct wtpman));
|
|
||||||
|
|
||||||
|
|
||||||
if (socklist[socklistindex].type != SOCKLIST_UNICAST_SOCKET) {
|
if (socklist[socklistindex].type != SOCKLIST_UNICAST_SOCKET) {
|
||||||
|
|
||||||
@ -676,11 +683,6 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
|||||||
sockfd = replyfd; /*//socklist[socklistindex].reply_sockfd; */
|
sockfd = replyfd; /*//socklist[socklistindex].reply_sockfd; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dbgaddrl = sizeof(dbgaddr);
|
dbgaddrl = sizeof(dbgaddr);
|
||||||
getsockname(sockfd, &dbgaddr, &dbgaddrl);
|
getsockname(sockfd, &dbgaddr, &dbgaddrl);
|
||||||
|
|
||||||
@ -688,26 +690,25 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
|
|||||||
sock_addr2str(&dbgaddr, sock_buf), sock_getport(&dbgaddr));
|
sock_addr2str(&dbgaddr, sock_buf), sock_getport(&dbgaddr));
|
||||||
|
|
||||||
|
|
||||||
|
memset(wtpman, 0, sizeof(struct wtpman));
|
||||||
|
|
||||||
|
wtpman->global_cfg = global_cfg;
|
||||||
|
|
||||||
wtpman->conn = cw_conn_create(sockfd, srcaddr, 5);
|
wtpman->conn = cw_conn_create(sockfd, srcaddr, 5);
|
||||||
wtpman->conn->role = CW_ROLE_AC;
|
|
||||||
|
|
||||||
wtpman->conn->data_sock = socklist[socklistindex].data_sockfd;
|
|
||||||
sock_copyaddr(&wtpman->conn->data_addr,
|
|
||||||
(struct sockaddr *) &wtpman->conn->addr);
|
|
||||||
|
|
||||||
if (!wtpman->conn) {
|
if (!wtpman->conn) {
|
||||||
wtpman_destroy(wtpman);
|
wtpman_destroy(wtpman);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wtpman->conn->role = CW_ROLE_AC;
|
||||||
|
|
||||||
|
wtpman->conn->data_sock = socklist[socklistindex].data_sockfd;
|
||||||
|
sock_copyaddr(&wtpman->conn->data_addr,
|
||||||
|
(struct sockaddr *) &wtpman->conn->addr);
|
||||||
|
|
||||||
|
|
||||||
|
// wtpman->conn->mods = conf_mods;
|
||||||
|
|
||||||
|
|
||||||
wtpman->conn->mods = conf_mods;
|
|
||||||
|
|
||||||
wtpman->conn->strict_capwap = conf_strict_capwap;
|
wtpman->conn->strict_capwap = conf_strict_capwap;
|
||||||
wtpman->conn->strict_hdr = conf_strict_headers;
|
wtpman->conn->strict_hdr = conf_strict_headers;
|
||||||
|
@ -31,6 +31,12 @@ struct wtpman {
|
|||||||
|
|
||||||
cw_timer_t echointerval_timer;
|
cw_timer_t echointerval_timer;
|
||||||
|
|
||||||
|
cw_Cfg_t * global_cfg; /**< contains the cfg of AC,
|
||||||
|
visible to all wtpman threads.
|
||||||
|
The global cfg was initally read
|
||||||
|
from a .ckv file on startup.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -641,14 +641,10 @@ struct cw_ac_status {
|
|||||||
*/
|
*/
|
||||||
enum capwap_states {
|
enum capwap_states {
|
||||||
CW_STATE_NONE = 0,
|
CW_STATE_NONE = 0,
|
||||||
/** Discovery State */
|
CAPWAP_STATE_DISCOVERY, /**< Discovery State */
|
||||||
CAPWAP_STATE_DISCOVERY,
|
CAPWAP_STATE_JOIN, /**< Join State */
|
||||||
/** Join State */
|
|
||||||
CAPWAP_STATE_JOIN,
|
|
||||||
CAPWAP_STATE_JOIN_COMPLETE,
|
CAPWAP_STATE_JOIN_COMPLETE,
|
||||||
|
CAPWAP_STATE_CONFIGURE, /**< Config State */
|
||||||
/** Config State */
|
|
||||||
CAPWAP_STATE_CONFIGURE,
|
|
||||||
CAPWAP_STATE_DTLS_SETUP, /**< DTLS Setup */
|
CAPWAP_STATE_DTLS_SETUP, /**< DTLS Setup */
|
||||||
/** Image Data Upload */
|
/** Image Data Upload */
|
||||||
CW_STATE_IMAGE_DATA,
|
CW_STATE_IMAGE_DATA,
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
|
|
||||||
struct cw_StrListElem capwap_strings_state[] = {
|
struct cw_StrListElem capwap_strings_state[] = {
|
||||||
{ CAPWAP_STATE_DISCOVERY, "Discovery" },
|
{ CW_STATE_NONE, "None"},
|
||||||
{ CAPWAP_STATE_JOIN,"Join" },
|
{ CAPWAP_STATE_DISCOVERY, "Discovery" },
|
||||||
{ CAPWAP_STATE_RUN,"Run" },
|
{ CAPWAP_STATE_JOIN,"Join" },
|
||||||
{ CAPWAP_STATE_CONFIGURE,"Configure" },
|
{ CAPWAP_STATE_RUN,"Run" },
|
||||||
{ CW_STATE_IMAGE_DATA,"Image Data" },
|
{ CAPWAP_STATE_CONFIGURE,"Configure" },
|
||||||
{ CAPWAP_STATE_DTLS_SETUP, "DTLS Setup" },
|
{ CW_STATE_IMAGE_DATA,"Image Data" },
|
||||||
{ CAPWAP_STATE_DATA_CHECK, "Data Check" },
|
{ CAPWAP_STATE_DTLS_SETUP, "DTLS Setup" },
|
||||||
{ CAPWAP_STATE_TIMEOUT, "Timeout"},
|
{ CAPWAP_STATE_DATA_CHECK, "Data Check" },
|
||||||
{ CW_STR_STOP,"Undefined" },
|
{ CAPWAP_STATE_TIMEOUT, "Timeout"},
|
||||||
|
{ CW_STR_STOP,"Undefined" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
11
src/cw/cfg.c
11
src/cw/cfg.c
@ -491,6 +491,17 @@ int cw_cfg_get_bool(cw_Cfg_t * cfg, const char * key, const char *def)
|
|||||||
return v.val.boolean;
|
return v.val.boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t cw_cfg_get_byte(cw_Cfg_t * cfg, char *key, const char * def)
|
||||||
|
{
|
||||||
|
struct cw_Val v;
|
||||||
|
const char *s = cw_cfg_get(cfg,key,def);
|
||||||
|
CW_TYPE_BYTE->from_str(&v,s);
|
||||||
|
return v.val.word;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, char *key, const char * def)
|
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, char *key, const char * def)
|
||||||
{
|
{
|
||||||
struct cw_Val v;
|
struct cw_Val v;
|
||||||
|
@ -32,6 +32,7 @@ void cw_cfg_iter_init(cw_Cfg_t * cfg, struct cw_Cfg_iter *cfi, const char *base)
|
|||||||
int cw_cfg_get_bool(cw_Cfg_t * cfg, const char * key, const char *def);
|
int cw_cfg_get_bool(cw_Cfg_t * cfg, const char * key, const char *def);
|
||||||
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, char *key, const char * def);
|
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, char *key, const char * def);
|
||||||
void cw_cfg_set_int(cw_Cfg_t * cfg, const char * key, int val);
|
void cw_cfg_set_int(cw_Cfg_t * cfg, const char * key, int val);
|
||||||
|
uint8_t cw_cfg_get_byte(cw_Cfg_t * cfg, char *key, const char * def);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -93,6 +93,7 @@ printf("Elem: %d %d %d %s\n", data->proto, data->vendor, data->id, handler->name
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cw_dbg(DBG_X,"Hello!");
|
||||||
|
|
||||||
if (handler->put == NULL){
|
if (handler->put == NULL){
|
||||||
if (data->mand){
|
if (data->mand){
|
||||||
@ -122,9 +123,12 @@ printf("Elem: %d %d %d %s\n", data->proto, data->vendor, data->id, handler->name
|
|||||||
cisco/ap-led-flash-config/flash-enable
|
cisco/ap-led-flash-config/flash-enable
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
cw_dbg(DBG_X,"Calling Handler put for %s",handler->name);
|
||||||
|
|
||||||
l = handler->put(handler,¶ms,dst+len);
|
l = handler->put(handler,¶ms,dst+len);
|
||||||
|
|
||||||
|
cw_dbg(DBG_X,"L = %d",l);
|
||||||
|
|
||||||
/* if(l>0)
|
/* if(l>0)
|
||||||
cw_dbg_elem(DBG_ELEM_OUT,conn,type,handler,dst+len,l);
|
cw_dbg_elem(DBG_ELEM_OUT,conn,type,handler,dst+len,l);
|
||||||
* if (strlen(details)){
|
* if (strlen(details)){
|
||||||
|
@ -235,7 +235,7 @@ struct cw_Conn {
|
|||||||
|
|
||||||
|
|
||||||
int detected;
|
int detected;
|
||||||
void * mods;
|
// void * mods;
|
||||||
|
|
||||||
|
|
||||||
int (*msg_start)(struct cw_Conn*conn,struct cw_action_in *a,uint8_t*data,int len,struct sockaddr *from);
|
int (*msg_start)(struct cw_Conn*conn,struct cw_action_in *a,uint8_t*data,int len,struct sockaddr *from);
|
||||||
|
@ -660,6 +660,7 @@ int cw_read_messages(struct cw_Conn *conn)
|
|||||||
{
|
{
|
||||||
uint8_t buf[2024];
|
uint8_t buf[2024];
|
||||||
int len = 2024;
|
int len = 2024;
|
||||||
|
cw_dbg(DBG_X,"Conn cw_read_messages from dsco request");
|
||||||
|
|
||||||
int n = conn->read(conn, buf, len);
|
int n = conn->read(conn, buf, len);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
|
@ -55,7 +55,7 @@ uint32_t cw_dbg_opt_level = 0;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static struct cw_StrListElem color_on[] = {
|
static struct cw_StrListElem theme0[] = {
|
||||||
{DBG_PKT_IN, ANSI_YELLOW},
|
{DBG_PKT_IN, ANSI_YELLOW},
|
||||||
{DBG_PKT_OUT, ANSI_YELLOW ANSI_ITALIC},
|
{DBG_PKT_OUT, ANSI_YELLOW ANSI_ITALIC},
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ static struct cw_StrListElem color_on[] = {
|
|||||||
|
|
||||||
{DBG_INFO, ANSI_DEFAULT},
|
{DBG_INFO, ANSI_DEFAULT},
|
||||||
|
|
||||||
{DBG_STATE, ANSI_BBLACK ANSI_BOLD },
|
{DBG_STATE, ANSI_GREEN ANSI_BOLD},
|
||||||
|
|
||||||
{DBG_RFC, ANSI_BRED},
|
{DBG_RFC, ANSI_BRED},
|
||||||
{DBG_X, "\x1b[31m"},
|
{DBG_X, "\x1b[31m"},
|
||||||
@ -98,6 +98,9 @@ static struct cw_StrListElem color_on[] = {
|
|||||||
{CW_STR_STOP, ""}
|
{CW_STR_STOP, ""}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct cw_StrListElem * color_on = theme0;
|
||||||
|
|
||||||
|
|
||||||
struct cw_StrListElem color_ontext[] = {
|
struct cw_StrListElem color_ontext[] = {
|
||||||
|
|
||||||
/* {DBG_ELEM_DMP, "\x1b[37m"},*/
|
/* {DBG_ELEM_DMP, "\x1b[37m"},*/
|
||||||
@ -132,7 +135,7 @@ static struct cw_StrListElem prefix[] = {
|
|||||||
{DBG_DTLS_DETAIL, " DTLS - "},
|
{DBG_DTLS_DETAIL, " DTLS - "},
|
||||||
{DBG_WARN, " Warning - "},
|
{DBG_WARN, " Warning - "},
|
||||||
{DBG_MOD, " Mod - "},
|
{DBG_MOD, " Mod - "},
|
||||||
{DBG_STATE, " State Machine - "},
|
{DBG_STATE, " STATEMACHINE - "},
|
||||||
{DBG_CFG_SET, " Cfg Set - "},
|
{DBG_CFG_SET, " Cfg Set - "},
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ enum cw_dbg_levels{
|
|||||||
/** Debug Mods */
|
/** Debug Mods */
|
||||||
DBG_MOD,
|
DBG_MOD,
|
||||||
|
|
||||||
DBG_STATE, /**<Debug State machein */
|
DBG_STATE, /**<Debug State machine */
|
||||||
|
|
||||||
DBG_ALL,
|
DBG_ALL,
|
||||||
|
|
||||||
|
@ -103,8 +103,8 @@ void cw_msgset_destroy(struct cw_MsgSet *set)
|
|||||||
mavl_destroy(set->handlers_by_id);
|
mavl_destroy(set->handlers_by_id);
|
||||||
if (set->handlers_by_key)
|
if (set->handlers_by_key)
|
||||||
mavl_destroy(set->handlers_by_key);
|
mavl_destroy(set->handlers_by_key);
|
||||||
if (set->state_machine)
|
if (set->statemachine_states)
|
||||||
mavl_destroy(set->state_machine);
|
mavl_destroy(set->statemachine_states);
|
||||||
free(set);
|
free(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,8 +160,8 @@ struct cw_MsgSet *cw_msgset_create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set->state_machine = mavl_create(cmp_machinestate,NULL,sizeof(cw_StateMachineState_t));
|
set->statemachine_states = mavl_create(cmp_machinestate,NULL,sizeof(cw_StateMachineState_t));
|
||||||
if (set->state_machine == NULL)
|
if (set->statemachine_states == NULL)
|
||||||
{
|
{
|
||||||
cw_msgset_destroy(set);
|
cw_msgset_destroy(set);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -359,7 +359,7 @@ int cw_msgset_add_states(struct cw_MsgSet * set, cw_StateMachineState_t * states
|
|||||||
s=states;
|
s=states;
|
||||||
while (s->state != 0){
|
while (s->state != 0){
|
||||||
const char * repstr;
|
const char * repstr;
|
||||||
mavl_replace(set->state_machine,s,&replaced);
|
mavl_replace(set->statemachine_states,s,&replaced);
|
||||||
|
|
||||||
if (replaced){
|
if (replaced){
|
||||||
repstr = "Replacing";
|
repstr = "Replacing";
|
||||||
|
@ -68,7 +68,7 @@ struct cw_MsgSet {
|
|||||||
mavl_t handlers_by_id;
|
mavl_t handlers_by_id;
|
||||||
mavl_t handlers_by_key;
|
mavl_t handlers_by_key;
|
||||||
mavl_t types_tree;
|
mavl_t types_tree;
|
||||||
mavl_t state_machine;
|
mavl_t statemachine_states;
|
||||||
int (*write_header)(struct cw_ElemHandler * handler, uint8_t * dst, int len);
|
int (*write_header)(struct cw_ElemHandler * handler, uint8_t * dst, int len);
|
||||||
int (*header_len)(struct cw_ElemHandler *handler);
|
int (*header_len)(struct cw_ElemHandler *handler);
|
||||||
};
|
};
|
||||||
|
@ -9,23 +9,23 @@
|
|||||||
#include "cw/cw.h"
|
#include "cw/cw.h"
|
||||||
#include "cw/val.h"
|
#include "cw/val.h"
|
||||||
#include "cw/keys.h"
|
#include "cw/keys.h"
|
||||||
|
#include "cw/cfg.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int put_ac_status(cw_Cfg_t * cfg, cw_Cfg_t * default_cfg, uint8_t *dst, const char * parent_key){
|
||||||
static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char * parent_key){
|
|
||||||
|
|
||||||
uint8_t *d = dst;
|
uint8_t *d = dst;
|
||||||
uint8_t security;
|
uint8_t security;
|
||||||
|
|
||||||
char key[CW_KTV_MAX_KEY_LEN];
|
char key[CW_CFG_MAX_KEY_LEN];
|
||||||
|
|
||||||
|
|
||||||
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/stations",0));
|
d += cw_put_word(d,cw_cfg_get_word(cfg,"ac-descriptor/stations","0"));
|
||||||
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/station-limit",0));
|
d += cw_put_word(d,cw_cfg_get_word(cfg,"ac-descriptor/station-limit","0"));
|
||||||
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/active-wtps",0));
|
d += cw_put_word(d,cw_cfg_get_word(cfg,"ac-descriptor/active-wtps","0"));
|
||||||
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/max-wtps",0));
|
d += cw_put_word(d,cw_cfg_get_word(cfg,"ac-descriptor/max-wtps","0"));
|
||||||
|
|
||||||
d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/security",0));
|
d += cw_put_byte(d,cw_cfg_get_byte(cfg,"ac-descriptor/security",0));
|
||||||
/*
|
/*
|
||||||
security = 0;
|
security = 0;
|
||||||
if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
|
if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
|
||||||
@ -40,14 +40,14 @@ static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char *
|
|||||||
d += cw_put_byte(dst,security);
|
d += cw_put_byte(dst,security);
|
||||||
*/
|
*/
|
||||||
sprintf(key,"%s/%s",parent_key,"ac-descriptor/r-mac-field");
|
sprintf(key,"%s/%s",parent_key,"ac-descriptor/r-mac-field");
|
||||||
d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/r-mac-field",0));
|
d += cw_put_byte(d,cw_cfg_get_byte(cfg,"ac-descriptor/r-mac-field",0));
|
||||||
/*d += cw_put_byte(d,3);*/
|
/*d += cw_put_byte(d,3);*/
|
||||||
|
|
||||||
d += cw_put_byte(d,0);
|
d += cw_put_byte(d,0);
|
||||||
|
|
||||||
|
|
||||||
sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
|
sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
|
||||||
d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/dtls-policy",0));
|
d += cw_put_byte(d,cw_cfg_get_byte(cfg,"ac-descriptor/dtls-policy",0));
|
||||||
|
|
||||||
return d - dst;
|
return d - dst;
|
||||||
}
|
}
|
||||||
@ -58,10 +58,12 @@ int cisco_out_ac_descriptor(struct cw_ElemHandler * eh,
|
|||||||
{
|
{
|
||||||
int len,l;
|
int len,l;
|
||||||
uint8_t *d = dst+4;
|
uint8_t *d = dst+4;
|
||||||
char key[CW_KTV_MAX_KEY_LEN];
|
char key[CW_CFG_MAX_KEY_LEN];
|
||||||
|
|
||||||
d+=put_ac_status(params->local_cfg,
|
cw_dbg(DBG_X,"Putting AC TATUS WIITH KEY: %s",eh->key);
|
||||||
params->global_cfg,
|
|
||||||
|
d+=put_ac_status(params->cfg,
|
||||||
|
params->default_cfg,
|
||||||
d, eh->key);
|
d, eh->key);
|
||||||
|
|
||||||
/* it is important to send software version first,
|
/* it is important to send software version first,
|
||||||
|
Loading…
Reference in New Issue
Block a user