Working on mods.
FossilOrigin-Name: 7652cbc79f78c5605c07225eb1b5500286f3246b61cb1b96734d0f208570ae67
This commit is contained in:
parent
b2710dc698
commit
82047233c0
@ -525,6 +525,8 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
wtpman->conn->radios = mbag_i_create();
|
wtpman->conn->radios = mbag_i_create();
|
||||||
|
@ -184,7 +184,7 @@ struct conn {
|
|||||||
struct sockaddr *from);
|
struct sockaddr *from);
|
||||||
|
|
||||||
|
|
||||||
|
int detected;
|
||||||
void * mods;
|
void * mods;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -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 */
|
/* prepare struct for search operation */
|
||||||
as.capwap_state = conn->capwap_state;
|
as.capwap_state = conn->capwap_state;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define __MOD_H
|
#define __MOD_H
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
@ -16,7 +17,7 @@ struct mod_ac
|
|||||||
This function ifter receiving and disassembling a complete
|
This function ifter receiving and disassembling a complete
|
||||||
CAPWAP message. Either on Discovery Request or Join Request
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
#include "capwap/mod.h"
|
#include "capwap/mod.h"
|
||||||
|
#include "capwap/log.h"
|
||||||
|
|
||||||
#include "mod_cipwap.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 = {
|
static struct mod_ac cipwap_ac = {
|
||||||
|
.name ="cipwap",
|
||||||
.init = cipwap_init,
|
.init = cipwap_init,
|
||||||
.name ="cipwap"
|
.detect = detect
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct mod_ac * mod_cipwap_ac(){
|
struct mod_ac * mod_cipwap_ac(){
|
||||||
return &cipwap_ac;
|
return &cipwap_ac;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user