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/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
#define MOD_MAXMODS 8
|
|
|
|
|
|
|
|
enum {
|
2016-03-10 08:07:30 +01:00
|
|
|
MOD_MODE_CAPWAP,
|
|
|
|
MOD_MODE_BINDINGS
|
2016-03-08 01:20:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mod_ac {
|
2016-02-22 18:33:47 +01:00
|
|
|
/** Name of the mod */
|
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 */
|
|
|
|
int (*init_config) (mbag_t config);
|
|
|
|
|
2016-02-22 18:33:47 +01:00
|
|
|
/** Detect capwap
|
2016-03-08 01:20:22 +01:00
|
|
|
This function is called after receiving and disassembling a complete
|
2016-02-22 18:33:47 +01:00
|
|
|
CAPWAP message. Either on Discovery Request or Join Request
|
|
|
|
**/
|
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);
|
2016-02-22 09:20:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-03-02 13:20:30 +01:00
|
|
|
/**
|
|
|
|
* We define here struct mod_wtp in case we need
|
|
|
|
* different methods for WTP and AC later
|
|
|
|
*/
|
|
|
|
#define mod_wtp mod_ac
|
2016-02-22 09:20:57 +01:00
|
|
|
|
2016-03-08 01:20:22 +01:00
|
|
|
extern struct mod_ac mod_null;
|
|
|
|
|
2016-03-13 09:37:07 +01:00
|
|
|
|
2016-03-08 01:20:22 +01:00
|
|
|
#define MOD_NULL (&mod_null)
|
|
|
|
|
2016-03-27 04:48:36 +02:00
|
|
|
struct cw_actiondef * mod_cache_add(struct conn *conn,struct mod_ac *c, struct mod_ac *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)
|
|
|
|
|
2016-03-27 04:48:36 +02:00
|
|
|
void mod_set_actions_registered_cb(void (*fun) (struct mod_ac *, struct mod_ac *, struct cw_actiondef *));
|
|
|
|
|
|
|
|
extern int mod_caching;
|
|
|
|
|
|
|
|
#define mod_set_caching(var) (mod_caching=var)
|
|
|
|
#define mod_get_caching() (mod_caching)
|
|
|
|
|
|
|
|
|
2016-02-22 09:20:57 +01:00
|
|
|
#endif
|