2016-03-02 13:20:30 +01:00
|
|
|
/*
|
|
|
|
This file is part of actube.
|
|
|
|
|
|
|
|
actube is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
libcapwap is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2018-02-25 19:12:28 +01:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief module definitions
|
|
|
|
*/
|
|
|
|
|
2016-02-22 09:20:57 +01:00
|
|
|
#ifndef __MOD_H
|
|
|
|
#define __MOD_H
|
|
|
|
|
|
|
|
#include <stddef.h>
|
2016-02-23 08:58:05 +01:00
|
|
|
#include <stdint.h>
|
2016-02-22 09:20:57 +01:00
|
|
|
|
2016-03-03 20:46:20 +01:00
|
|
|
#include "sock.h"
|
|
|
|
#include "conn.h"
|
2018-03-17 12:32:40 +01:00
|
|
|
|
2016-02-27 05:35:25 +01:00
|
|
|
|
2016-03-08 01:20:22 +01:00
|
|
|
enum {
|
2018-02-26 12:21:50 +01:00
|
|
|
CW_MOD_MODE_CAPWAP,
|
2018-03-12 11:22:06 +01:00
|
|
|
CW_MOD_MODE_BINDINGS
|
2016-03-08 01:20:22 +01:00
|
|
|
};
|
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
|
2018-03-03 17:42:28 +01:00
|
|
|
|
|
|
|
|
2018-02-25 19:12:28 +01:00
|
|
|
struct cw_Mod {
|
|
|
|
/** Name of the module */
|
2016-02-22 09:20:57 +01:00
|
|
|
const char *name;
|
2018-03-17 12:32:40 +01:00
|
|
|
|
2016-02-22 18:33:47 +01:00
|
|
|
/** Initializion method */
|
2018-03-17 12:32:40 +01:00
|
|
|
int (*init) (struct cw_Mod *mod, mavl_t global_cfg, int role);
|
2016-03-13 09:37:07 +01:00
|
|
|
|
2016-02-22 18:33:47 +01:00
|
|
|
/** Detect capwap
|
2018-02-25 19:12:28 +01:00
|
|
|
* This function is called after receiving and disassembling a complete
|
|
|
|
* CAPWAP message. Either on Discovery Request or Join Request.
|
|
|
|
* @param conn current connection
|
|
|
|
* @return 0 if notdetected
|
2016-02-22 18:33:47 +01:00
|
|
|
**/
|
2022-08-13 09:47:12 +02:00
|
|
|
int (*detect) (struct cw_Conn * conn, const uint8_t * rawmsg, int rawlen,
|
2018-03-17 12:32:40 +01:00
|
|
|
int elems_len, struct sockaddr * from, int mode);
|
2016-02-23 19:38:10 +01:00
|
|
|
|
2016-02-27 05:35:25 +01:00
|
|
|
|
2018-02-26 18:28:12 +01:00
|
|
|
struct cw_MsgSet * (*register_messages)(struct cw_MsgSet * set, int mode);
|
2018-02-26 09:04:53 +01:00
|
|
|
|
|
|
|
/**
|
2018-02-26 09:15:59 +01:00
|
|
|
* Handle returned by dlopen, if this module was loaded
|
|
|
|
* dynamically with dlopen. If this module was statically
|
|
|
|
* linked, dll_handle is NULL.
|
|
|
|
*/
|
|
|
|
void * dll_handle;
|
2018-03-17 12:32:40 +01:00
|
|
|
|
|
|
|
/** used for private data */
|
|
|
|
void *data;
|
2018-03-30 19:45:27 +02:00
|
|
|
|
2022-08-13 09:47:12 +02:00
|
|
|
int (*setup_cfg)(struct cw_Conn *conn);
|
2018-05-15 07:51:01 +02:00
|
|
|
|
2016-02-22 09:20:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-02-25 19:12:28 +01:00
|
|
|
extern struct cw_Mod mod_null;
|
2016-03-08 01:20:22 +01:00
|
|
|
|
2016-03-13 09:37:07 +01:00
|
|
|
|
2016-03-08 01:20:22 +01:00
|
|
|
#define MOD_NULL (&mod_null)
|
|
|
|
|
2018-03-26 13:21:42 +02:00
|
|
|
/*
|
2022-08-13 09:47:12 +02:00
|
|
|
struct cw_actiondef * mod_cache_add(struct cw_Conn *conn,struct cw_Mod *c, struct cw_Mod *b);
|
2018-03-26 13:21:42 +02:00
|
|
|
*/
|
2016-02-22 09:20:57 +01:00
|
|
|
|
2016-03-13 09:37:07 +01:00
|
|
|
#define mod_init_config(mod,cfg) (mod->init_config ? mod->init_config(cfg):1)
|
|
|
|
|
2018-03-26 13:21:42 +02:00
|
|
|
/*
|
2018-02-25 19:12:28 +01:00
|
|
|
void mod_set_actions_registered_cb(void (*fun) (struct cw_Mod *, struct cw_Mod *, struct cw_actiondef *));
|
2018-03-26 13:21:42 +02:00
|
|
|
*/
|
2016-03-27 04:48:36 +02:00
|
|
|
|
|
|
|
extern int mod_caching;
|
|
|
|
|
|
|
|
#define mod_set_caching(var) (mod_caching=var)
|
|
|
|
#define mod_get_caching() (mod_caching)
|
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
struct cw_Mod * cw_mod_load(const char * mod_name, mavl_t global_cfg, int role);
|
2018-02-26 14:13:57 +01:00
|
|
|
struct cw_Mod * cw_mod_add_to_list(struct cw_Mod * mod );
|
2022-08-13 09:47:12 +02:00
|
|
|
struct cw_Mod * cw_mod_detect(struct cw_Conn *conn,
|
2018-02-26 14:44:27 +01:00
|
|
|
uint8_t * rawmsg, int len,
|
|
|
|
int elems_len, struct sockaddr *from,
|
|
|
|
int mode);
|
2022-08-13 09:47:12 +02:00
|
|
|
struct cw_MsgSet *cw_mod_get_msg_set(struct cw_Conn *conn,
|
2018-02-26 20:18:53 +01:00
|
|
|
struct cw_Mod * capwap_mod, struct cw_Mod *bindings_mod);
|
2018-02-26 12:21:50 +01:00
|
|
|
|
2018-03-12 11:22:06 +01:00
|
|
|
void cw_mod_set_path(const char * path);
|
2018-03-11 00:56:41 +01:00
|
|
|
|
2018-02-26 12:21:50 +01:00
|
|
|
#define CW_MOD_MAX_MOD_NAME_LEN 128
|
|
|
|
#define CW_MOD_INTERFACE_FUNCTION_NAME_SUFFIX "_get_interface"
|
2016-03-27 04:48:36 +02:00
|
|
|
|
2016-02-22 09:20:57 +01:00
|
|
|
#endif
|