2018-03-17 12:32:40 +01:00
|
|
|
|
2016-03-03 20:46:20 +01:00
|
|
|
#include "cw/mod.h"
|
|
|
|
#include "cw/log.h"
|
|
|
|
#include "cw/dbg.h"
|
2018-03-17 12:32:40 +01:00
|
|
|
#include "cw/ktv.h"
|
|
|
|
#include "cw/keys.h"
|
2018-04-04 00:11:24 +02:00
|
|
|
#include "cw/dtls.h"
|
2016-02-23 19:38:10 +01:00
|
|
|
|
|
|
|
#include "mod_capwap.h"
|
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
static int init(struct cw_Mod * mod, mavl_t global_cfg, int role)
|
2016-02-23 19:38:10 +01:00
|
|
|
{
|
2018-03-19 20:00:58 +01:00
|
|
|
cw_dbg(DBG_INFO,"CAPWAP: Inititalizing mod_capwap.");
|
2018-03-30 19:45:27 +02:00
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
switch (role){
|
|
|
|
case CW_ROLE_AC:{
|
|
|
|
cw_dbg(DBG_MOD, "CAPWAP: Initialiazing mod_capwap in AC mode");
|
|
|
|
cw_ktv_add_from_str(global_cfg,
|
|
|
|
"capwap/ac-descriptor/hardware/version",
|
2018-04-25 10:43:27 +02:00
|
|
|
CW_TYPE_BSTR16,NULL,"0.0.0.1");
|
2018-03-17 12:32:40 +01:00
|
|
|
cw_ktv_add_from_str(global_cfg,
|
2018-04-25 10:43:27 +02:00
|
|
|
"capwap/ac-descriptor/hardware/vendor",CW_TYPE_DWORD,NULL,"0");
|
2018-03-17 12:32:40 +01:00
|
|
|
cw_ktv_add_from_str(global_cfg,
|
|
|
|
"capwap/ac-descriptor/software/version",
|
2018-04-25 10:43:27 +02:00
|
|
|
CW_TYPE_BSTR16, NULL, "0.0.0.1");
|
2018-03-17 12:32:40 +01:00
|
|
|
cw_ktv_add_from_str(global_cfg,
|
2018-04-25 10:43:27 +02:00
|
|
|
"capwap/ac-descriptor/software/vendor",CW_TYPE_DWORD, NULL, "0");
|
2018-03-17 12:32:40 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-23 19:38:10 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-03-08 01:20:22 +01:00
|
|
|
static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int elems_len,
|
|
|
|
struct sockaddr *from, int mode)
|
2016-02-23 19:38:10 +01:00
|
|
|
{
|
2018-02-26 12:21:50 +01:00
|
|
|
if (mode != CW_MOD_MODE_CAPWAP)
|
2016-03-08 01:20:22 +01:00
|
|
|
return 0;
|
2016-03-09 18:39:57 +01:00
|
|
|
cw_dbg(DBG_MOD,"CAPWAP detected: yes");
|
2016-02-23 19:38:10 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-04-01 12:44:05 +02:00
|
|
|
|
2018-03-30 19:45:27 +02:00
|
|
|
int static setup_cfg(struct conn * conn)
|
|
|
|
{
|
2018-04-01 12:44:05 +02:00
|
|
|
int security;
|
2018-04-01 13:59:36 +02:00
|
|
|
|
2018-04-01 12:44:05 +02:00
|
|
|
security = cw_setup_dtls(conn,conn->local_cfg,"capwap",CAPWAP_CIPHER);
|
|
|
|
cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
|
|
|
|
|
2018-03-30 19:45:27 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-03-10 08:07:30 +01:00
|
|
|
|
2018-03-26 13:22:55 +02:00
|
|
|
struct cw_Mod mod_capwap = {
|
2018-03-17 12:32:40 +01:00
|
|
|
"capwap", /* name */
|
|
|
|
init, /* init */
|
|
|
|
detect, /* detect */
|
|
|
|
capwap_register_msg_set, /* register_messages */
|
|
|
|
NULL, /* dll_handle */
|
2018-03-30 19:45:27 +02:00
|
|
|
NULL, /* data */
|
|
|
|
setup_cfg /* setup_cfg */
|
2016-02-23 19:38:10 +01:00
|
|
|
};
|