Working on mods.

FossilOrigin-Name: 7652cbc79f78c5605c07225eb1b5500286f3246b61cb1b96734d0f208570ae67
This commit is contained in:
7u83@mail.ru 2016-02-23 07:58:05 +00:00
parent b2710dc698
commit 82047233c0
5 changed files with 33 additions and 3 deletions

View File

@ -525,6 +525,8 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr)
return NULL;
}
wtpman->conn->mods = conf_mods;
wtpman->conn->strict_capwap = conf_strict_capwap;
wtpman->conn->strict_hdr = conf_strict_headers;
wtpman->conn->radios = mbag_i_create();

View File

@ -184,7 +184,7 @@ struct conn {
struct sockaddr *from);
int detected;
void * mods;
};

View File

@ -167,6 +167,19 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
}
if (!conn->detected) {
if (conn->mods){
struct mod_ac ** mods = (struct mod_ac **)conn->mods;
int i;
for (i=0; mods[i]; i++){
if (mods[i]->detect){
mods[i]->detect(conn,rawmsg,len,from);
}
}
}
}
/* prepare struct for search operation */
as.capwap_state = conn->capwap_state;

View File

@ -2,6 +2,7 @@
#define __MOD_H
#include <stddef.h>
#include <stdint.h>
#include "sock.h"
#include "conn.h"
@ -16,7 +17,7 @@ struct mod_ac
This function ifter receiving and disassembling a complete
CAPWAP message. Either on Discovery Request or Join Request
**/
int (*detect)(struct conn *conn,const char *rawmsg, int rawlen,struct sockaddr *from);
int (*detect)(struct conn *conn,const uint8_t *rawmsg, int rawlen,struct sockaddr *from);
};

View File

@ -1,5 +1,7 @@
#include "capwap/mod.h"
#include "capwap/log.h"
#include "mod_cipwap.h"
@ -10,11 +12,23 @@ int cipwap_init()
}
static int detect(struct conn *conn,const uint8_t *rawmsg, int rawlen,struct sockaddr *from)
{
cw_log(LOG_INFO,"Detecting ...");
return 0;
}
static struct mod_ac cipwap_ac = {
.name ="cipwap",
.init = cipwap_init,
.name ="cipwap"
.detect = detect
};
struct mod_ac * mod_cipwap_ac(){
return &cipwap_ac;
};