2013-05-01 14:52:55 +02:00
|
|
|
#ifndef __CAPWAP_AC_HEADER__
|
|
|
|
#define __CAPWAP_AC_HEADER__
|
|
|
|
|
|
|
|
/* standard include */
|
|
|
|
#include "capwap.h"
|
|
|
|
#include "capwap_network.h"
|
|
|
|
#include "capwap_protocol.h"
|
2013-11-02 19:11:01 +01:00
|
|
|
#include "capwap_event.h"
|
2013-05-01 14:52:55 +02:00
|
|
|
#include "capwap_lock.h"
|
2013-11-02 19:11:01 +01:00
|
|
|
#include "capwap_rwlock.h"
|
2013-05-01 14:52:55 +02:00
|
|
|
#include "capwap_list.h"
|
2014-03-26 21:35:52 +01:00
|
|
|
#include "capwap_hash.h"
|
2013-05-01 14:52:55 +02:00
|
|
|
#include "capwap_element.h"
|
|
|
|
|
|
|
|
#include <pthread.h>
|
2014-03-26 21:35:52 +01:00
|
|
|
#include <linux/if_ether.h>
|
2014-10-19 21:37:22 +02:00
|
|
|
#include <json/json.h>
|
2013-05-01 14:52:55 +02:00
|
|
|
|
2014-06-15 09:09:48 +02:00
|
|
|
#include <ac_kmod.h>
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* AC Configuration */
|
|
|
|
#define AC_DEFAULT_CONFIGURATION_FILE "/etc/capwap/ac.conf"
|
|
|
|
|
|
|
|
#define AC_DEFAULT_MAXSTATION 128
|
|
|
|
#define AC_DEFAULT_MAXSESSIONS 128
|
|
|
|
|
|
|
|
/* AC runtime error return code */
|
|
|
|
#define AC_ERROR_SYSTEM_FAILER -1000
|
|
|
|
#define AC_ERROR_LOAD_CONFIGURATION -1001
|
|
|
|
#define AC_ERROR_NETWORK -1002
|
|
|
|
#define AC_ERROR_MEMORY_LEAK 1
|
|
|
|
|
|
|
|
/* Min and max dfa values */
|
2014-03-02 19:31:27 +01:00
|
|
|
#define AC_DTLS_INTERVAL 60000
|
|
|
|
|
|
|
|
#define AC_JOIN_INTERVAL 60000
|
|
|
|
|
|
|
|
#define AC_CHANGE_STATE_PENDING_INTERVAL 25000
|
|
|
|
|
|
|
|
#define AC_DATA_CHECK_INTERVAL 30000
|
|
|
|
|
|
|
|
#define AC_RETRANSMIT_INTERVAL 3000
|
2013-05-01 14:52:55 +02:00
|
|
|
#define AC_MAX_RETRANSMIT 5
|
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
#define AC_DTLS_SESSION_DELETE_INTERVAL 5000
|
|
|
|
|
|
|
|
#define AC_MIN_ECHO_INTERVAL 1000
|
|
|
|
#define AC_ECHO_INTERVAL 30000
|
|
|
|
#define AC_MAX_ECHO_INTERVAL 256000
|
|
|
|
|
|
|
|
#define AC_MAX_DATA_KEEPALIVE_INTERVAL 256000
|
|
|
|
|
|
|
|
#define AC_MIN_DISCOVERY_INTERVAL 2000
|
|
|
|
#define AC_DISCOVERY_INTERVAL 20000
|
|
|
|
#define AC_MAX_DISCOVERY_INTERVAL 180000
|
|
|
|
|
|
|
|
#define AC_DECRYPT_ERROR_PERIOD_INTERVAL 120000
|
|
|
|
#define AC_IDLE_TIMEOUT_INTERVAL 300000
|
|
|
|
#define AC_WTP_FALLBACK_MODE CAPWAP_WTP_FALLBACK_ENABLED
|
|
|
|
|
2014-09-10 21:58:23 +02:00
|
|
|
/* */
|
|
|
|
#define compat_json_object_object_get(obj, key) ({ \
|
|
|
|
json_bool error; struct json_object* result = NULL; \
|
|
|
|
error = json_object_object_get_ex(obj, key, &result); \
|
|
|
|
(error ? result : NULL); \
|
|
|
|
})
|
|
|
|
|
2014-10-19 21:37:22 +02:00
|
|
|
/* */
|
|
|
|
struct ac_if_datachannel {
|
|
|
|
unsigned long index;
|
|
|
|
|
|
|
|
int ifindex;
|
|
|
|
char ifname[IFNAMSIZ];
|
|
|
|
|
|
|
|
int mtu;
|
|
|
|
|
|
|
|
char bridge[IFNAMSIZ];
|
|
|
|
};
|
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
/* */
|
2013-05-01 14:52:55 +02:00
|
|
|
struct ac_state {
|
|
|
|
struct capwap_ecnsupport_element ecn;
|
|
|
|
struct capwap_transport_element transport;
|
|
|
|
struct capwap_timers_element timers;
|
|
|
|
unsigned short decrypterrorreport_interval;
|
|
|
|
struct capwap_idletimeout_element idletimeout;
|
|
|
|
struct capwap_wtpfallback_element wtpfallback;
|
|
|
|
|
|
|
|
/* */
|
2013-05-27 21:33:23 +02:00
|
|
|
struct capwap_acipv4list_element acipv4list;
|
|
|
|
struct capwap_acipv6list_element acipv6list;
|
2013-05-01 14:52:55 +02:00
|
|
|
};
|
|
|
|
|
2014-06-15 09:09:48 +02:00
|
|
|
/* */
|
|
|
|
struct ac_fds {
|
|
|
|
int fdstotalcount;
|
|
|
|
struct pollfd* fdspoll;
|
|
|
|
|
|
|
|
int fdsnetworkcount;
|
|
|
|
|
|
|
|
int msgqueuecount;
|
|
|
|
int msgqueuestartpos;
|
|
|
|
|
|
|
|
struct ac_kmod_event* kmodevents;
|
|
|
|
int kmodeventscount;
|
|
|
|
int kmodeventsstartpos;
|
|
|
|
};
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* AC */
|
|
|
|
struct ac_t {
|
2013-06-16 12:09:57 +02:00
|
|
|
int standalone;
|
2013-05-01 14:52:55 +02:00
|
|
|
int running;
|
2013-06-16 12:09:57 +02:00
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* */
|
|
|
|
struct ac_state dfa;
|
|
|
|
struct capwap_network net;
|
2014-09-10 21:58:23 +02:00
|
|
|
struct capwap_list* addrlist;
|
2013-05-01 14:52:55 +02:00
|
|
|
unsigned short mtu;
|
|
|
|
|
|
|
|
struct capwap_array* binding;
|
|
|
|
|
|
|
|
struct capwap_acname_element acname;
|
|
|
|
struct capwap_acdescriptor_element descriptor;
|
|
|
|
|
2013-11-02 19:11:01 +01:00
|
|
|
/* Sessions message queue */
|
|
|
|
int fdmsgsessions[2];
|
|
|
|
|
2014-06-15 09:09:48 +02:00
|
|
|
/* */
|
|
|
|
struct ac_kmod_handle kmodhandle;
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* Sessions */
|
|
|
|
struct capwap_list* sessions;
|
2013-11-02 19:11:01 +01:00
|
|
|
struct capwap_list* sessionsthread;
|
|
|
|
capwap_rwlock_t sessionslock;
|
2013-05-01 14:52:55 +02:00
|
|
|
|
2014-10-19 21:37:22 +02:00
|
|
|
/* Authorative Stations */
|
|
|
|
struct capwap_hash* authstations;
|
|
|
|
capwap_rwlock_t authstationslock;
|
|
|
|
|
|
|
|
/* Data Channel Interfaces */
|
|
|
|
struct capwap_hash* ifdatachannel;
|
|
|
|
capwap_rwlock_t ifdatachannellock;
|
2014-03-26 21:35:52 +01:00
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* Dtls */
|
|
|
|
int enabledtls;
|
|
|
|
struct capwap_dtls_context dtlscontext;
|
2013-07-23 22:10:26 +02:00
|
|
|
|
|
|
|
/* Backend Management */
|
2013-08-07 21:48:22 +02:00
|
|
|
char* backendacid;
|
|
|
|
char* backendversion;
|
2013-07-23 22:10:26 +02:00
|
|
|
struct capwap_array* availablebackends;
|
2013-05-01 14:52:55 +02:00
|
|
|
};
|
|
|
|
|
2013-11-02 19:11:01 +01:00
|
|
|
/* AC session thread */
|
|
|
|
struct ac_session_thread_t {
|
|
|
|
pthread_t threadid;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* AC session message queue item */
|
2014-10-19 21:37:22 +02:00
|
|
|
#define AC_MESSAGE_QUEUE_CLOSE_THREAD 1
|
|
|
|
#define AC_MESSAGE_QUEUE_CLOSE_ALLSESSIONS 2
|
|
|
|
#define AC_MESSAGE_QUEUE_UPDATE_CONFIGURATION 3
|
2013-11-02 19:11:01 +01:00
|
|
|
|
|
|
|
struct ac_session_msgqueue_item_t {
|
|
|
|
unsigned long message;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
pthread_t threadid;
|
|
|
|
} message_close_thread;
|
2014-10-19 21:37:22 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct json_object* jsonroot;
|
|
|
|
} message_configuration;
|
2013-11-02 19:11:01 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
extern struct ac_t g_ac;
|
|
|
|
|
|
|
|
/* Primary thread */
|
|
|
|
int ac_execute(void);
|
2014-06-15 09:09:48 +02:00
|
|
|
int ac_execute_update_fdspool(struct ac_fds* fds);
|
2013-05-01 14:52:55 +02:00
|
|
|
|
|
|
|
int ac_valid_binding(unsigned short binding);
|
|
|
|
void ac_update_statistics(void);
|
|
|
|
|
|
|
|
#endif /* __CAPWAP_AC_HEADER__ */
|