2015-04-05 02:09:23 +02:00
|
|
|
/*
|
|
|
|
This file is part of libcapwap.
|
|
|
|
|
|
|
|
libcapwap 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/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2015-05-04 07:32:30 +02:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief CAPWAP ACtions Header
|
2016-02-23 19:38:10 +01:00
|
|
|
* @defgroup ACTION CAPWAP/LWAPP Actions
|
2015-05-04 07:32:30 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2015-04-05 02:09:23 +02:00
|
|
|
#ifndef __ACTION_H
|
|
|
|
#define __ACTION_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2016-02-28 15:13:10 +01:00
|
|
|
#include "mavl.h"
|
2015-04-05 02:09:23 +02:00
|
|
|
#include "conn.h"
|
2015-04-19 23:27:44 +02:00
|
|
|
#include "mbag.h"
|
2015-04-05 20:27:17 +02:00
|
|
|
#include "strheap.h"
|
2015-04-12 10:19:02 +02:00
|
|
|
#include "intavltree.h"
|
2015-05-01 12:42:52 +02:00
|
|
|
#include "item.h"
|
2016-02-28 15:13:10 +01:00
|
|
|
#include "mlist.h"
|
|
|
|
|
2015-04-05 02:09:23 +02:00
|
|
|
|
2016-02-27 05:35:25 +01:00
|
|
|
struct conn;
|
2015-04-20 21:28:22 +02:00
|
|
|
|
2016-02-28 15:13:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @file action.h
|
|
|
|
* @brief Header for actions
|
|
|
|
*/
|
2015-04-05 02:09:23 +02:00
|
|
|
|
|
|
|
|
2016-02-28 15:13:10 +01:00
|
|
|
/**
|
|
|
|
* @defgroup ACTION Action
|
|
|
|
* @{
|
|
|
|
*/
|
2015-04-05 02:09:23 +02:00
|
|
|
|
2016-02-28 15:13:10 +01:00
|
|
|
/**
|
|
|
|
* Definition of an action for incomming messages
|
|
|
|
*/
|
2015-04-05 02:09:23 +02:00
|
|
|
struct cw_action_in{
|
|
|
|
uint32_t vendor_id;
|
|
|
|
uint8_t proto;
|
|
|
|
uint8_t capwap_state;
|
|
|
|
uint32_t msg_id;
|
|
|
|
uint16_t elem_id;
|
2015-04-12 23:28:55 +02:00
|
|
|
int (*start)(struct conn *conn,struct cw_action_in *a,uint8_t*data,int len,struct sockaddr *from);
|
|
|
|
int (*end)(struct conn *conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from);
|
2015-04-19 23:27:44 +02:00
|
|
|
const struct mbag_typedef * itemtype;
|
2015-05-01 00:16:54 +02:00
|
|
|
const char * item_id;
|
2015-04-05 02:09:23 +02:00
|
|
|
uint16_t min_len;
|
|
|
|
uint16_t max_len;
|
2015-04-07 07:42:36 +02:00
|
|
|
uint8_t mand;
|
2015-04-05 02:09:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-02-28 15:13:10 +01:00
|
|
|
/** a handy type for incomming actions */
|
2015-04-05 02:09:23 +02:00
|
|
|
typedef struct cw_action_in cw_action_in_t;
|
|
|
|
|
2016-02-28 15:13:10 +01:00
|
|
|
/** Definition of an action list for incomming messages */
|
|
|
|
typedef mavl_t cw_actionlist_in_t;
|
2015-04-20 21:28:22 +02:00
|
|
|
|
2015-04-05 02:09:23 +02:00
|
|
|
|
|
|
|
extern cw_actionlist_in_t cw_actionlist_in_create();
|
|
|
|
extern cw_action_in_t * cw_actionlist_in_get(cw_actionlist_in_t t,cw_action_in_t *a);
|
2016-02-28 15:13:10 +01:00
|
|
|
//extern cw_action_in_t * cw_actionlist_in_add(cw_actionlist_in_t t,cw_action_in_t *a);
|
2015-04-05 02:09:23 +02:00
|
|
|
extern int cw_actionlist_in_register_actions(cw_actionlist_in_t t,cw_action_in_t * actions);
|
|
|
|
|
|
|
|
|
2015-04-20 21:28:22 +02:00
|
|
|
|
2016-02-28 15:13:10 +01:00
|
|
|
/**
|
|
|
|
* Definitioni of an action foroutgoing messages
|
|
|
|
* */
|
2015-04-05 02:09:23 +02:00
|
|
|
struct cw_action_out{
|
|
|
|
uint32_t msg_id;
|
2015-05-01 00:16:54 +02:00
|
|
|
const char * item_id;
|
2015-04-05 20:27:17 +02:00
|
|
|
uint32_t vendor_id;
|
2015-04-05 02:09:23 +02:00
|
|
|
uint16_t elem_id;
|
2016-02-28 13:41:45 +01:00
|
|
|
|
2015-04-10 21:44:05 +02:00
|
|
|
int (*init)(struct conn * conn, struct cw_action_out *a, uint8_t * dst);
|
2015-04-05 20:27:17 +02:00
|
|
|
int (*out)(struct conn * conn, struct cw_action_out *a, uint8_t * dst);
|
2015-04-19 23:27:44 +02:00
|
|
|
struct mbag_item *(*get)(struct conn *conn,struct cw_action_out *a);
|
2015-04-07 07:42:36 +02:00
|
|
|
uint8_t mand;
|
2015-04-19 23:27:44 +02:00
|
|
|
struct mbag_typedef * itemtype;
|
2015-04-07 07:42:36 +02:00
|
|
|
void *defval;
|
2015-04-05 02:09:23 +02:00
|
|
|
};
|
2015-04-07 07:42:36 +02:00
|
|
|
|
2016-02-28 13:41:45 +01:00
|
|
|
|
2016-02-28 15:13:10 +01:00
|
|
|
typedef struct cw_action_out cw_action_out_t;
|
|
|
|
typedef struct mavl *cw_actionlist_out_t;
|
|
|
|
|
|
|
|
|
|
|
|
extern cw_actionlist_out_t cw_actionlist_out_create();
|
|
|
|
extern int cw_actionlist_out_register_actions(cw_actionlist_out_t t,cw_action_out_t * actions);
|
|
|
|
mlist_t * cw_actionlist_out_get(cw_actionlist_out_t,int msg_id);
|
|
|
|
|
|
|
|
//extern cw_action_out_t * cw_actionlist_out_add(cw_actionlist_out_t t, struct cw_action_out * a);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2016-02-28 13:41:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-05 02:09:23 +02:00
|
|
|
|
2016-02-28 13:41:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-05 02:09:23 +02:00
|
|
|
extern cw_actionlist_out_t cw_actionlist_out_create();
|
|
|
|
extern cw_action_out_t * cw_actionlist_out_add(cw_actionlist_out_t t, struct cw_action_out * a);
|
|
|
|
extern int cw_actionlist_out_register_actions(cw_actionlist_out_t t,cw_action_out_t * actions);
|
|
|
|
|
2015-04-12 10:19:02 +02:00
|
|
|
/**
|
|
|
|
* Definition CAPWAP modes
|
|
|
|
*/
|
|
|
|
enum capwapmodes {
|
2015-05-04 07:32:30 +02:00
|
|
|
/** Auto -- means auto detect the CAPWAP mode and
|
|
|
|
it set as soon as possible */
|
|
|
|
CW_MODE_AUTO,
|
|
|
|
/** Standard CAPWAP mode as specified in RFC 5415 */
|
|
|
|
CW_MODE_CAPWAP,
|
2015-04-12 10:19:02 +02:00
|
|
|
/** Cisco specific CAPWAP */
|
2015-04-12 19:19:29 +02:00
|
|
|
CW_MODE_CISCO,
|
2015-04-12 10:19:02 +02:00
|
|
|
/** CIPWAP, a mix of standard CAPWAP and some
|
|
|
|
Cisco extension */
|
2015-04-12 19:19:29 +02:00
|
|
|
CW_MODE_CIPWAP,
|
2015-04-12 10:19:02 +02:00
|
|
|
/** Zyxel */
|
2015-05-04 07:32:30 +02:00
|
|
|
CW_MODE_ZYXEL,
|
|
|
|
/** Lancom */
|
2015-05-06 10:11:30 +02:00
|
|
|
CW_MODE_LANCOM,
|
|
|
|
/** Fortinet */
|
|
|
|
CW_MODE_FORTINET
|
2015-04-12 10:19:02 +02:00
|
|
|
};
|
|
|
|
|
2015-04-05 02:09:23 +02:00
|
|
|
|
2016-02-28 13:41:45 +01:00
|
|
|
|
|
|
|
|
2015-04-05 02:09:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
struct cw_actiondef{
|
|
|
|
cw_actionlist_in_t in;
|
|
|
|
cw_actionlist_out_t out;
|
2015-04-05 20:27:17 +02:00
|
|
|
cw_strheap_t strmsg;
|
|
|
|
cw_strheap_t strelem;
|
2015-05-01 12:42:52 +02:00
|
|
|
cw_itemdefheap_t items;
|
2015-05-04 07:32:30 +02:00
|
|
|
cw_itemdefheap_t radioitems;
|
2015-04-11 19:00:51 +02:00
|
|
|
|
2016-02-28 13:41:45 +01:00
|
|
|
mlist_t * mout;
|
|
|
|
|
2015-04-12 10:19:02 +02:00
|
|
|
/** Supported Wireless Binding IDs (WBID) */
|
|
|
|
struct avltree * wbids;
|
2015-04-05 02:09:23 +02:00
|
|
|
};
|
|
|
|
|
2016-02-28 13:41:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
extern struct outelem * cw_actionlist_out_get_mlist(cw_actionlist_out_t t, int msg_id);
|
|
|
|
|
|
|
|
|
2016-03-19 12:57:47 +01:00
|
|
|
typedef int(*cw_action_fun_t)(struct conn *,struct cw_action_in *,uint8_t*,int,struct sockaddr *);
|
|
|
|
|
|
|
|
|
|
|
|
cw_action_fun_t cw_set_msg_end_callback(struct conn *conn,
|
|
|
|
int capwap_state,int msg_id, cw_action_fun_t callback);
|
2015-04-05 02:09:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
#define cw_actionlist_get_node(t,a) avltree_get_node(t,a)
|
|
|
|
|
2015-05-04 07:32:30 +02:00
|
|
|
/**@}*/
|
|
|
|
|
2015-04-05 02:09:23 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|