Mods are detected
FossilOrigin-Name: a2bfbb518739fcc8f547950c91afbff7569cc820dea93d70654c0d313e0ec810
This commit is contained in:
parent
6ebf54dbbd
commit
d53346d250
@ -1,10 +1,10 @@
|
||||
<?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_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="Yes"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "stravltree.h"
|
||||
#include "mod.h"
|
||||
|
||||
#include "message_set.h"
|
||||
|
||||
int conn_send_msg(struct conn *conn, uint8_t * rawmsg);
|
||||
|
||||
@ -189,6 +189,7 @@ static struct cw_MsgSet *load_msg_set(struct conn *conn, uint8_t * rawmsg, int l
|
||||
|
||||
// struct cw_actiondef *ad = mod_cache_add(conn,cmod, bmod);
|
||||
|
||||
|
||||
struct cw_MsgSet * set = cw_mod_get_msg_set(conn,cmod,bmod);
|
||||
|
||||
return set;
|
||||
@ -253,6 +254,8 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
if (!conn->detected) {
|
||||
//struct mod_ac *mod;
|
||||
struct cw_MsgSet *set = load_msg_set(conn, rawmsg, len, elems_len, from);
|
||||
|
||||
|
||||
if (!set) {
|
||||
//cw_log(LOG_ERR, "Error");
|
||||
errno = EAGAIN;
|
||||
@ -264,13 +267,25 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
conn->detected = 1;
|
||||
}
|
||||
|
||||
printf("We have loaded the message set\n");
|
||||
|
||||
cw_dbg_msg(DBG_MSG_IN, conn, rawmsg, len, from);
|
||||
|
||||
/* prepare struct for search operation */
|
||||
struct cw_MsgData search;
|
||||
search.type = cw_get_msg_id(msg_ptr);
|
||||
struct cw_MsgData * message;
|
||||
message = mavl_get(conn->msgset->messages,&search);
|
||||
|
||||
printf("Got Message %d (%s)\n", message->type, message->name);
|
||||
exit(0);
|
||||
/*
|
||||
as.capwap_state = conn->capwap_state;
|
||||
as.msg_id = cw_get_msg_id(msg_ptr);
|
||||
as.vendor_id = 0;
|
||||
as.elem_id = 0;
|
||||
as.proto = 0;
|
||||
|
||||
*/
|
||||
|
||||
/* Search for state/message combination */
|
||||
// afm = cw_actionlist_in_get(conn->actions->in, &as);
|
||||
@ -346,7 +361,7 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
"Element %d (%s) not allowed in msg of type %d (%s), ignoring.",
|
||||
as.elem_id, cw_strelemp(conn->actions, as.elem_id),
|
||||
as.msg_id, cw_strmsg(as.msg_id));
|
||||
/* *
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -454,7 +469,6 @@ int process_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
||||
{
|
||||
|
||||
|
||||
|
||||
uint8_t *msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg);
|
||||
|
||||
|
||||
@ -596,7 +610,7 @@ int conn_process_packet2(struct conn *conn, uint8_t * packet, int len,
|
||||
|
||||
|
||||
cw_dbg_pkt(DBG_PKT_IN, conn, f + 4, *(uint32_t *) f, from);
|
||||
cw_dbg_msg(DBG_MSG_IN, conn, f + 4, *(uint32_t *) f, from);
|
||||
// cw_dbg_msg(DBG_MSG_IN, conn, f + 4, *(uint32_t *) f, from);
|
||||
|
||||
// XXX: Modify fragman to not throw away CAPWAP headers
|
||||
|
||||
@ -607,7 +621,7 @@ int conn_process_packet2(struct conn *conn, uint8_t * packet, int len,
|
||||
}
|
||||
|
||||
/* not fragmented, we have a complete message */
|
||||
cw_dbg_msg(DBG_MSG_IN, conn, packet, len, from);
|
||||
// cw_dbg_msg(DBG_MSG_IN, conn, packet, len, from);
|
||||
return conn->process_message(conn, packet, len, from);
|
||||
}
|
||||
|
||||
|
@ -133,12 +133,13 @@ typedef struct{
|
||||
int op;
|
||||
}cw_msgelemprops_t;
|
||||
|
||||
typedef struct {
|
||||
struct cw_MsgDef{
|
||||
int type;
|
||||
int * states;
|
||||
cw_msgelemprops_t * elements;
|
||||
const char * name;
|
||||
}cw_msgdef_t;
|
||||
};
|
||||
typedef struct cw_MsgDef cw_msgdef_t;
|
||||
|
||||
/**
|
||||
* Get length wireless specific data
|
||||
|
12
src/cw/dbg.c
12
src/cw/dbg.c
@ -36,6 +36,8 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_cisco.h"
|
||||
#include "lwapp_cisco.h"
|
||||
#include "cw.h"
|
||||
#include "message_set.h"
|
||||
|
||||
/**
|
||||
*@addtogroup DBG
|
||||
@ -485,7 +487,15 @@ void cw_dbg_msg(int level, struct conn *conn, uint8_t * packet, int len,
|
||||
// int pplen = len - (msgptr-packet);
|
||||
|
||||
int msg_id = cw_get_msg_id(msgptr);
|
||||
s += sprintf(s, "%s Message (type=%d) ", cw_strmsg(msg_id), msg_id);
|
||||
|
||||
struct cw_MsgData search;
|
||||
search.type = msg_id;
|
||||
struct cw_MsgData * message;
|
||||
message = mavl_get(conn->msgset->messages,&search);
|
||||
|
||||
|
||||
|
||||
s += sprintf(s, "%s Message (type=%d) ", message->name /*cw_strmsg(msg_id)*/, msg_id);
|
||||
if (level == DBG_MSG_IN)
|
||||
s += sprintf(s, "from %s ", sock_addr2str(from));
|
||||
else
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "message_set.h"
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
int type;
|
||||
const char * name;
|
||||
@ -12,6 +13,7 @@ typedef struct {
|
||||
mavl_t elements_tree;
|
||||
mlist_t elements_list;
|
||||
}message2_t;
|
||||
*/
|
||||
|
||||
static inline int cmp_cw_msgelemprops(const void *elem1, const void *elem2){
|
||||
cw_elem_handler_t * e1 = ((cw_msgelemprops_t*)elem1)->elem;
|
||||
@ -98,13 +100,13 @@ static void update_message(message2_t * msg, cw_msgdef_t * src, cw_MsgSet_t * se
|
||||
void cw_msgset_add(cw_MsgSet_t * set,
|
||||
cw_msgdef_t messages[]){
|
||||
|
||||
cw_msgdef_t * m;
|
||||
for (m=messages; m->type !=0; m++){
|
||||
cw_msgdef_t * message;
|
||||
for (message=messages; message->type !=0; message++){
|
||||
message2_t search, *next;
|
||||
|
||||
search.type = m->type;
|
||||
search.type = message->type;
|
||||
|
||||
cw_dbg(DBG_INFO,"Add message: Type:%d - %s",m->type,m->name);
|
||||
cw_dbg(DBG_INFO,"Add message: Type:%d - %s",message->type,message->name);
|
||||
|
||||
next = mavl_find(set->messages,&search);
|
||||
|
||||
@ -125,17 +127,17 @@ void cw_msgset_add(cw_MsgSet_t * set,
|
||||
free(next);
|
||||
return;
|
||||
}
|
||||
next->type=m->type;
|
||||
next->type=message->type;
|
||||
mavl_add(set->messages,next);
|
||||
|
||||
}
|
||||
/* massage is alreaddy in there */
|
||||
if (m->name)
|
||||
next->name=m->name;
|
||||
if (m->states)
|
||||
next->states=m->states;
|
||||
if (message->name)
|
||||
next->name=message->name;
|
||||
if (message->states)
|
||||
next->states=message->states;
|
||||
|
||||
update_message(next,m, set);
|
||||
update_message(next,message, set);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,4 +8,17 @@ extern cw_MsgSet_t * cw_message_set_create();
|
||||
extern void cw_msgset_add(cw_MsgSet_t * set,
|
||||
cw_msgdef_t messages[]);
|
||||
mlist_t cw_msgset_get_msg(cw_MsgSet_t * set, int type);
|
||||
|
||||
|
||||
typedef struct cw_MsgData{
|
||||
int type;
|
||||
const char * name;
|
||||
int * states;
|
||||
mavl_t elements_tree;
|
||||
mlist_t elements_list;
|
||||
};
|
||||
|
||||
typedef struct cw_MsgData message2_t;
|
||||
|
||||
|
||||
#endif
|
@ -97,6 +97,8 @@ struct cw_Mod * cw_mod_detect(struct conn *conn,
|
||||
uint8_t * rawmsg, int len,
|
||||
int elems_len, struct sockaddr *from,
|
||||
int mode);
|
||||
struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
||||
struct cw_Mod * capwap_mod, struct cw_Mod *bindings_mod);
|
||||
|
||||
#define CW_MOD_MAX_MOD_NAME_LEN 128
|
||||
#define CW_MOD_INTERFACE_FUNCTION_NAME_SUFFIX "_get_interface"
|
||||
|
@ -133,12 +133,10 @@ static cw_msgdef_t messages[] = {
|
||||
|
||||
|
||||
struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
|
||||
printf("Register Message set %p\n",set);
|
||||
if (mode != CW_MOD_MODE_CAPWAP)
|
||||
return NULL;
|
||||
cw_msgset_add(set,messages);
|
||||
printf("Done Addin gmessages");
|
||||
exit(0);
|
||||
return set;
|
||||
}
|
||||
|
||||
void test_sets(){
|
||||
|
@ -171,7 +171,8 @@ static struct cw_Mod capwap_ac = {
|
||||
.name = "cisco",
|
||||
.init = init,
|
||||
.detect = detect,
|
||||
.register_actions = register_actions,
|
||||
// .register_actions = register_actions,
|
||||
|
||||
};
|
||||
|
||||
struct cw_Mod *mod_cisco_ac()
|
||||
|
Loading…
Reference in New Issue
Block a user