2015-04-05 20:26:33 +02:00
|
|
|
|
2018-03-03 17:42:28 +01:00
|
|
|
#include "mbag.h"
|
2015-04-05 20:26:33 +02:00
|
|
|
#include "action.h"
|
|
|
|
#include "capwap.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cw_in_set_state_none(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len)
|
|
|
|
{
|
|
|
|
conn->capwap_state=CW_STATE_NONE;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
struct mbag_item *cw_out_get_outgoing(struct conn *conn, struct cw_action_out *a)
|
2015-04-05 20:26:33 +02:00
|
|
|
{
|
2015-04-19 23:27:44 +02:00
|
|
|
return mbag_get(conn->outgoing, a->item_id);
|
2015-04-05 20:26:33 +02:00
|
|
|
}
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
struct mbag_item *cw_out_get_incomming(struct conn *conn, struct cw_action_out *a)
|
2015-04-05 20:26:33 +02:00
|
|
|
{
|
2015-04-19 23:27:44 +02:00
|
|
|
return mbag_get(conn->incomming, a->item_id);
|
2015-04-05 20:26:33 +02:00
|
|
|
}
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
struct mbag_item *cw_out_get_local(struct conn *conn, struct cw_action_out *a)
|
2015-04-10 17:14:55 +02:00
|
|
|
{
|
2015-04-19 23:27:44 +02:00
|
|
|
return mbag_get(conn->local,a->item_id);
|
2015-04-10 17:14:55 +02:00
|
|
|
}
|
2015-04-05 20:26:33 +02:00
|
|
|
|
2015-04-20 02:26:24 +02:00
|
|
|
struct mbag_item *cw_out_get_config(struct conn *conn, struct cw_action_out *a)
|
|
|
|
{
|
2016-03-13 18:55:42 +01:00
|
|
|
// printf("cw get config (%d %d %s) %p\n",a->msg_id, a->elem_id,a->item_id, conn->config);
|
2015-04-20 02:26:24 +02:00
|
|
|
return mbag_get(conn->config,a->item_id);
|
|
|
|
}
|
|
|
|
|
2015-04-10 21:44:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
#include "capwap.h"
|
|
|
|
#include "capwap_items.h"
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
#include "rand.h"
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
struct mbag_item * cw_out_get_session_id(struct conn *conn,struct cw_action_out * a)
|
2015-04-10 21:44:05 +02:00
|
|
|
{
|
|
|
|
uint8_t session_id[16];
|
2015-04-18 11:20:24 +02:00
|
|
|
|
|
|
|
int slen;
|
|
|
|
if ( conn->capwap_mode == CW_MODE_CISCO){
|
2015-04-19 16:44:20 +02:00
|
|
|
slen=2;
|
2015-04-18 11:20:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
slen=16;
|
|
|
|
|
|
|
|
int l = cw_rand(session_id,slen);
|
|
|
|
if ( l!=slen ) {
|
2015-04-10 21:44:05 +02:00
|
|
|
cw_log(LOG_ERR,"Can't init session ID.");
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-04-19 23:27:44 +02:00
|
|
|
return mbag_set_bstrn(conn->local,CW_ITEM_SESSION_ID,session_id,slen);
|
2015-04-10 21:44:05 +02:00
|
|
|
}
|
|
|
|
|