Work on mods.

FossilOrigin-Name: ee4d813d604eb3804e6cea9247abc74e0259296405cf574ec4b6c6bceb4f8473
This commit is contained in:
7u83@mail.ru
2016-02-27 13:25:32 +00:00
parent 3ca3d0af77
commit 0b25d6f6d0
8 changed files with 53 additions and 236 deletions

View File

@ -63,6 +63,7 @@ UTILOBJS= \
intavltree.o \
cw_util.o \
send.o \
cw_read_wtp_descriptor.o \
cw_read_wtp_descriptor_7.o \
cw_read_wtp_descriptor_versions.o

View File

@ -5,6 +5,10 @@
#include "conn.h"
#include "action.h"
extern int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
struct cw_action_in *a, uint8_t * data, int len);
extern int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
struct cw_action_in *a, uint8_t * data, int len);

View File

@ -2,54 +2,6 @@
#include "capwap.h"
#include "dbg.h"
struct args {
cw_action_in_t *a;
cw_action_in_t **out;
struct avltree *mand;
int n;
};
/*
static int check_mand_cb(void *priv, void *val)
{
cw_action_in_t *a = (cw_action_in_t*)val;
struct args *args = (struct args*) priv;
printf("Na?\n");
return 1;
if ( (args->a->msg_id != a->msg_id) || (args->a->capwap_state != a->capwap_state))
{
printf ("Was soll das denn?\n");
printf("End of fun\n");
return 0;
}
printf("Nu?\n");
return 1;
printf("Found wat %d %d %c\n",a->msg_id,a->elem_id, a->mand ? '*':'-');
if (a->mand) {
int i = a->item_id;
void * rc = avltree_del(args->mand,&i);
if (!rc) {
if (args->out)
args->out[args->n]=a;
args->n++;
}
}
return 1;
}
*/
int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_in_t *a)
{
@ -62,11 +14,9 @@ int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_i
as.elem_id = 0;
as.proto=0;
DEFINE_AVLITER(it,conn->actions->in);
int n=0;
avliter_foreach_from(&it,&as) {
// avliter_foreach(&it) {
cw_action_in_t * ai = avliter_get(&it);
if (ai->msg_id != as.msg_id && ai->capwap_state != as.capwap_state)
@ -74,26 +24,12 @@ int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_i
if (!ai->mand)
continue;
// int i = (intptr_t)ai->item_id;
void * rc = mavl_get(conn->mand,(void*)ai->item_id);
if (!rc) {
out[n++]=ai;
}
}
/*
struct args args;
args.a = &as;
args.mand=conn->mand;
args.out=out;
args.n=0;
avltree_foreach_from_asc(conn->actions->in,&as,check_mand_cb,&args);
*/
return n;
}

View File

@ -2,7 +2,7 @@
#include "capwap.h"
#include "dbg.h"
#include "log.h"
#include "sock.h" //Tube
/**
* @file
* @brief Implementation of Vendor Specific Payload
@ -13,15 +13,15 @@
*/
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;
as = *a;
as.vendor_id = cw_get_dword(data);
as.elem_id = cw_get_word(data+4);
af = cw_actionlist_in_get(conn->actions->in,&as);
//cw_dbg(DBG_ELEM,"From might be: %s\n",sock_addr2str(&conn->addr));
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.",
@ -31,10 +31,15 @@ int cw_in_vendor_specific_payload(struct conn *conn,struct cw_action_in * a,uint
}
if (af->start) {
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 */
stravltree_add(conn->mand, af->item_id);
}
return afrc;
}
return 1;
}