2015-04-05 02:13:28 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "ac.h"
|
|
|
|
#include "conf.h"
|
2016-03-03 20:46:20 +01:00
|
|
|
#include "cw/capwap.h"
|
2018-03-17 18:01:17 +01:00
|
|
|
|
2018-03-30 12:08:46 +02:00
|
|
|
/*#include "cw/aciplist.h"*/
|
2015-04-05 02:13:28 +02:00
|
|
|
#include "socklist.h"
|
2016-03-03 20:46:20 +01:00
|
|
|
#include "cw/sock.h"
|
2016-04-02 09:05:07 +02:00
|
|
|
#include "cw/dbg.h"
|
|
|
|
|
|
|
|
#include "wtpman.h"
|
2018-04-02 21:00:37 +02:00
|
|
|
#include "discovery_cache.h"
|
2015-04-05 02:13:28 +02:00
|
|
|
|
2018-04-02 21:00:37 +02:00
|
|
|
mavl_t actube_global_cfg;
|
2015-04-05 02:13:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-30 12:08:46 +02:00
|
|
|
/*
|
2015-04-05 02:13:28 +02:00
|
|
|
cw_aciplist_t get_aciplist()
|
|
|
|
{
|
|
|
|
int i=0;
|
|
|
|
|
|
|
|
cw_aciplist_t aciplist = cw_aciplist_create();
|
|
|
|
|
|
|
|
if(!aciplist)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (i=0; i<socklist_len;i++){
|
|
|
|
|
|
|
|
if (socklist[i].type != SOCKLIST_UNICAST_SOCKET)
|
|
|
|
break;
|
|
|
|
|
|
|
|
struct sockaddr_storage sa;
|
|
|
|
unsigned int salen=sizeof(sa);
|
|
|
|
if ( getsockname(socklist[i].sockfd,(struct sockaddr*)&sa,&salen)<0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
cw_acip_t * acip;
|
|
|
|
acip = malloc(sizeof(cw_acip_t));
|
|
|
|
if (!acip)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
sock_copyaddr(&acip->ip,(struct sockaddr*)&sa);
|
2016-03-06 12:24:22 +01:00
|
|
|
if (acip->ip.ss_family == AF_INET)
|
2016-11-07 19:37:02 +01:00
|
|
|
acip->index=11;
|
2016-03-06 12:24:22 +01:00
|
|
|
else
|
2016-11-07 19:37:02 +01:00
|
|
|
acip->index=3;
|
2015-04-05 02:13:28 +02:00
|
|
|
|
|
|
|
|
2018-03-30 12:08:46 +02:00
|
|
|
/ * // printf ("Adding IP %s\n",sock_addr2str(&acip->ip));
|
|
|
|
* /
|
2015-04-05 02:13:28 +02:00
|
|
|
cw_aciplist_add(aciplist,acip);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
return aciplist;
|
|
|
|
}
|
|
|
|
|
2018-03-30 12:08:46 +02:00
|
|
|
*/
|
2015-04-05 02:13:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-30 12:08:46 +02:00
|
|
|
/*
|
2015-04-05 02:13:28 +02:00
|
|
|
void * get_iplist(void * arg)
|
|
|
|
{
|
|
|
|
return get_aciplist();
|
|
|
|
}
|
2018-03-30 12:08:46 +02:00
|
|
|
*/
|
2015-04-05 02:13:28 +02:00
|
|
|
|
|
|
|
void release_iplist(void *arg,void *data)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-04-02 09:05:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
int handle_echo_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|
|
|
int len, struct sockaddr *from)
|
|
|
|
{
|
|
|
|
cw_dbg(DBG_X,"Handle Echo Request %p",conn->data);
|
|
|
|
// struct wtpman * wtpman = conn->data;
|
|
|
|
// wtpman_echo_req(wtpman);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*static void setup_actions (struct mod_ac *c, struct mod_ac *b, struct cw_actiondef *actions)
|
|
|
|
{
|
|
|
|
cw_dbg(DBG_X,"Setup Actions! Yea");
|
|
|
|
cw_set_msg_end_callback(actions,CW_STATE_RUN,CW_MSG_ECHO_REQUEST,handle_echo_req);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2018-04-02 21:00:37 +02:00
|
|
|
struct cw_DiscoveryCache * discovery_cache;
|
2015-04-05 02:13:28 +02:00
|
|
|
|
2018-04-02 21:00:37 +02:00
|
|
|
int ac_global_init()
|
|
|
|
{
|
|
|
|
/* initialize discovery cache */
|
|
|
|
discovery_cache = discovery_cache_create(100);
|
|
|
|
if (discovery_cache==NULL)
|
|
|
|
goto errX;
|
2015-04-07 07:42:36 +02:00
|
|
|
|
2015-04-05 02:13:28 +02:00
|
|
|
|
|
|
|
return 1;
|
2018-04-02 21:00:37 +02:00
|
|
|
errX:
|
|
|
|
return 0;
|
2015-04-05 02:13:28 +02:00
|
|
|
}
|