Read element from message (in progress)
FossilOrigin-Name: 6ee8f267da48de9b865abf5b7565097387e6436118a1cc80a198c3a47294fc5c
This commit is contained in:
parent
af03e1c601
commit
8817d54d14
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Workspace Name="actube" Database="">
|
||||
<Project Name="ac" Path="ac.project" Active="Yes"/>
|
||||
<Project Name="ac" Path="ac.project" Active="No"/>
|
||||
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
||||
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="Yes"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||
|
@ -327,6 +327,8 @@
|
||||
<File Name="src/cw/cw_format_pkt_hdr.c"/>
|
||||
<File Name="src/cw/mavl_cmp_kv.c"/>
|
||||
<File Name="src/cw/mavl_add_kv_byte.c"/>
|
||||
<File Name="src/cw/cw_types_mavl_delete.c"/>
|
||||
<File Name="src/cw/cw_read_elem.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Description/>
|
||||
|
@ -96,22 +96,16 @@ extern void test_sets();
|
||||
#include "cw/file.h"
|
||||
#include "cw/cw_types.h"
|
||||
|
||||
void cw_type_delete(mavldata_t *data){
|
||||
struct cw_Type * type = data->kv.priv;
|
||||
printf("Delete elem of type: %s\n", type->name);
|
||||
if (type->del)
|
||||
type->del(data);
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
mavl_t kv;
|
||||
/* mavl_t kv;
|
||||
mavliter_t kviter;
|
||||
uint8_t bytes[] = { 99,4,5,7 };
|
||||
|
||||
|
||||
kv = mavl_create(mavl_cmp_kv,cw_type_delete);
|
||||
kv = cw_types_mavl_create();
|
||||
//mavl_cmp_kv,cw_type_delete);
|
||||
|
||||
mavldata_t data, *result;
|
||||
|
||||
@ -137,7 +131,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
mavl_destroy(kv);
|
||||
exit(0);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* cw_log_init();
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "mod.h"
|
||||
#include "message_set.h"
|
||||
|
||||
#include "cw_types.h"
|
||||
|
||||
|
||||
int conn_send_msg(struct conn *conn, uint8_t * rawmsg);
|
||||
|
||||
@ -215,6 +217,17 @@ int cw_in_check_generic(struct conn *conn, struct cw_action_in *a, uint8_t * dat
|
||||
}
|
||||
|
||||
|
||||
void cw_read_elem(struct cw_ElemHandler * handler, struct conn * conn,
|
||||
uint8_t * elem_data, int elem_len, struct sockaddr * from){
|
||||
mavldata_t data, *result;
|
||||
char str[30];
|
||||
|
||||
result = handler->type->get(&data,elem_data,elem_len);
|
||||
|
||||
handler->type->to_str(result,str,30);
|
||||
printf("Read %d-%s: %s %s\n", handler->id, handler->name, handler->key, str);
|
||||
/*mavl_add(conn->remote_cfg*/
|
||||
}
|
||||
|
||||
static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
struct sockaddr *from)
|
||||
@ -386,6 +399,9 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
|
||||
elem_len = cw_get_elem_len(elem);
|
||||
|
||||
|
||||
cw_read_elem(handler, conn, cw_get_elem_data(elem), elem_len, from);
|
||||
|
||||
printf ("Would start elem processing now %d - %s\n",handler->id, handler->name);
|
||||
continue;
|
||||
exit(0);
|
||||
|
2
src/cw/cw_read_elem.c
Normal file
2
src/cw/cw_read_elem.c
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
|
@ -36,9 +36,12 @@ struct cw_Type{
|
||||
extern const struct cw_Type cw_type_byte;
|
||||
#define CW_TYPE_BYTE (&cw_type_byte)
|
||||
|
||||
extern const struct mdata_Type cw_type_word;
|
||||
extern const struct mdata_Type cw_type_dword;
|
||||
extern const struct cw_Type cw_type_word;
|
||||
extern const struct cw_Type cw_type_dword;
|
||||
|
||||
void cw_types_mavl_delete(mavldata_t *data);
|
||||
|
||||
#define cw_types_mavl_create()\
|
||||
mavl_create(mavl_cmp_kv, cw_types_mavl_delete)
|
||||
|
||||
#endif
|
||||
|
7
src/cw/cw_types_mavl_delete.c
Normal file
7
src/cw/cw_types_mavl_delete.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include "cw_types.h"
|
||||
|
||||
void cw_types_mavl_delete(mavldata_t *data){
|
||||
const struct cw_Type * type = data->kv.priv;
|
||||
if (type->del)
|
||||
type->del(data);
|
||||
}
|
@ -32,7 +32,7 @@ struct cw_ElemHandler {
|
||||
int proto;
|
||||
int min_len;
|
||||
int max_len;
|
||||
const struct mdata_Type * type;
|
||||
const struct cw_Type * type;
|
||||
const char * key;
|
||||
/*
|
||||
int (*start_in)(struct conn *conn,struct cw_action_in *a,uint8_t*data,int len,struct sockaddr *from);
|
||||
|
@ -53,7 +53,7 @@ static struct cw_ElemHandler handlers[] = {
|
||||
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static struct cw_ElemDef discovery_request_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
|
||||
/* {0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 1, 0},*/
|
||||
{0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA, 1, 0},
|
||||
{0,0,0,00}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user