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"
|
2016-02-27 05:35:25 +01:00
|
|
|
#include "action.h"
|
|
|
|
|
|
|
|
struct cw_actiondef;
|
2016-02-22 18:33:47 +01:00
|
|
|
|
2016-03-08 01:20:22 +01:00
|
|
|
|
|
|
|
enum {
|
2018-02-26 12:21:50 +01:00
|
|
|
CW_MOD_MODE_CAPWAP,
|
2016-03-10 08:07:30 +01:00
|
|
|
MOD_MODE_BINDINGS
|
2016-03-08 01:20:22 +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;
|
2016-02-22 18:33:47 +01:00
|
|
|
/** Initializion method */
|
2016-03-08 01:20:22 +01:00
|
|
|
int (*init) ();
|
2016-03-13 09:37:07 +01:00
|
|
|
|
|
|
|
/** init_config */
|
2018-03-03 17:42:28 +01:00
|
|
|
int (*init_config) (void * /*mbag_t config*/);
|
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
|
|
|
**/
|
2016-03-08 01:20:22 +01:00
|
|
|
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
|
|
|
|
|
|
|
/** used for private data */
|
|
|
|
void *data;
|
2016-02-27 05:35:25 +01:00
|
|
|
|
2016-03-02 13:20:30 +01:00
|
|
|
/** Register actions */
|
2016-03-10 08:07:30 +01:00
|
|
|
int (*register_actions) (struct cw_actiondef * def,int mode);
|
2018-02-25 19:12:28 +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;
|
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-02-25 19:12:28 +01:00
|
|
|
struct cw_actiondef * mod_cache_add(struct conn *conn,struct cw_Mod *c, struct cw_Mod *b);
|
2016-03-08 01:20:22 +01: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-02-25 19:12:28 +01:00
|
|
|
void mod_set_actions_registered_cb(void (*fun) (struct cw_Mod *, struct cw_Mod *, struct cw_actiondef *));
|
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-02-26 12:21:50 +01:00
|
|
|
struct cw_Mod * cw_mod_load(const char * mod_name);
|
2018-02-26 14:13:57 +01:00
|
|
|
struct cw_Mod * cw_mod_add_to_list(struct cw_Mod * mod );
|
2018-02-26 14:44:27 +01:00
|
|
|
struct cw_Mod * cw_mod_detect(struct conn *conn,
|
|
|
|
uint8_t * rawmsg, int len,
|
|
|
|
int elems_len, struct sockaddr *from,
|
|
|
|
int mode);
|
2018-02-26 20:18:53 +01:00
|
|
|
struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
|
|
|
struct cw_Mod * capwap_mod, struct cw_Mod *bindings_mod);
|
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
|