moved cw_in_capwap_control_ipv4... to cw_in_capwap_control_ip_...
FossilOrigin-Name: b6e1708de08b726d3702680dea700904fb2cb4866d838bdcb6292159a9282eb7
This commit is contained in:
parent
22820a911b
commit
38665bbcc2
@ -150,7 +150,7 @@ CAPWAPOBJS= \
|
||||
cw_in_ac_descriptor.o\
|
||||
cw_out_capwap_local_ip_address.o\
|
||||
cw_out_capwap_control_ip_addr_list.o \
|
||||
cw_in_capwap_control_ipv4_address.o\
|
||||
cw_in_capwap_control_ip_address.o\
|
||||
cw_in_radio_administrative_state.o \
|
||||
cw_in_radio_administrative_state_wtp.o \
|
||||
strheap.o \
|
||||
|
@ -1031,9 +1031,6 @@ extern int cw_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8
|
||||
int len,struct sockaddr *from);
|
||||
extern int cw_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len,struct sockaddr *from);
|
||||
extern int cw_in_capwap_control_ipv4_address(struct conn *conn, struct cw_action_in *a,
|
||||
uint8_t * data, int len, struct sockaddr *from);
|
||||
|
||||
//extern int cw_out_generic(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len);
|
||||
extern int cw_out_generic(struct conn *conn, struct cw_action_out *a, uint8_t * dst); //, struct mbag_item *item);
|
||||
|
||||
|
@ -114,14 +114,14 @@
|
||||
|
||||
#define CW_ACTION_IN_CAPWAP_CONTROL_IPV4_ADDRESS \
|
||||
CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, /* Element ID*/ \
|
||||
cw_in_capwap_control_ipv4_address, 0, /* start/end callback */ \
|
||||
cw_in_capwap_control_ip_address, 0, /* start/end callback */ \
|
||||
MBAG_AVLTREE, /* Type of element */ \
|
||||
CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, /* ID to use store */ \
|
||||
6, 6 /* min/max length */
|
||||
|
||||
#define CW_ACTION_IN_CAPWAP_CONTROL_IPV6_ADDRESS \
|
||||
CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, /* Element ID*/ \
|
||||
cw_in_capwap_control_ipv4_address, 0, /* start/end callback */ \
|
||||
cw_in_capwap_control_ip_address, 0, /* start/end callback */ \
|
||||
MBAG_AVLTREE, /* Type of element */ \
|
||||
CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST, /* ID to use store */ \
|
||||
18,18 /* min/max length */
|
||||
|
@ -92,6 +92,9 @@ extern int cw_in_check_generic_resp(struct conn *conn, struct cw_action_in *a,
|
||||
extern int cw_in_vendor_specific_payload(struct conn *conn, struct cw_action_in *a,
|
||||
uint8_t * data, int len,struct sockaddr *from);
|
||||
|
||||
extern int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a,
|
||||
uint8_t * data, int len, struct sockaddr *from);
|
||||
|
||||
|
||||
/**
|
||||
*@}
|
||||
|
@ -18,14 +18,14 @@
|
||||
|
||||
|
||||
|
||||
int cw_in_capwap_control_ipv4_address(struct conn *conn, struct cw_action_in *a,
|
||||
int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a,
|
||||
uint8_t * data, int len,struct sockaddr *from)
|
||||
{
|
||||
cw_aciplist_t list =
|
||||
mbag_get_mavl_c(conn->incomming,a->item_id,cw_aciplist_create);
|
||||
|
||||
if (!list) {
|
||||
cw_log(LOG_ERR, "Error: Can't allocate CAWAP IP Adress List");
|
||||
cw_log(LOG_ERR, "Error: Can't allocate CAWPAP IP Adress List");
|
||||
return 0;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.msg_id = CW_MSG_DISCOVERY_RESPONSE,
|
||||
.elem_id = CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS,
|
||||
.item_id = CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST,
|
||||
.start = cw_in_capwap_control_ipv4_address,
|
||||
.start = cw_in_capwap_control_ip_address,
|
||||
.min_len = 6,
|
||||
.max_len = 6,
|
||||
.mand = 1
|
||||
@ -62,7 +62,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.msg_id = CW_MSG_DISCOVERY_RESPONSE,
|
||||
.elem_id = CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS,
|
||||
.item_id = CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST,
|
||||
.start = cw_in_capwap_control_ipv4_address, // Change to v6 handler
|
||||
.start = cw_in_capwap_control_ip_address, // Change to v6 handler
|
||||
.min_len = 6,
|
||||
.max_len = 6,
|
||||
.mand = 1
|
||||
|
@ -42,74 +42,67 @@
|
||||
|
||||
|
||||
|
||||
cw_aciplist_t cw_select_ac(struct conn *conn, mbag_t dis)
|
||||
cw_aciplist_t cw_select_ac(struct conn *conn, mbag_t discs)
|
||||
{
|
||||
|
||||
/* create a list for results */
|
||||
cw_aciplist_t resultlist=cw_aciplist_create();
|
||||
if (!resultlist)
|
||||
return NULL;
|
||||
if (!dis)
|
||||
if (!discs)
|
||||
return resultlist;
|
||||
|
||||
|
||||
/*
|
||||
cw_aciplist_t aciplist = cw_aciplist_create();
|
||||
if (!aciplist) {
|
||||
cw_log(LOG_ERROR, "Can't allocate aciplist");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// mbag_t aclist = mbag_get_mbag(conn->config, CW_ITEM_AC_NAME_WITH_PRIORITY);
|
||||
|
||||
*/
|
||||
|
||||
/* get the AC Name with Priority list */
|
||||
cw_acpriolist_t priolist;
|
||||
priolist = mbag_get_mavl(conn->config, CW_ITEM_AC_NAME_WITH_PRIORITY);
|
||||
// if (priolist )
|
||||
if (!priolist )
|
||||
priolist=cw_acpriolist_create();
|
||||
|
||||
|
||||
|
||||
DEFINE_AVLITER(i, dis);
|
||||
/* for each discovery reponse */
|
||||
DEFINE_AVLITER(i, discs);
|
||||
avliter_foreach(&i){
|
||||
|
||||
|
||||
|
||||
mbag_t ac = ((mbag_item_t *) (avliter_get(&i)))->data;
|
||||
|
||||
/* get the ac name */
|
||||
char *ac_name = mbag_get_str(ac, CW_ITEM_AC_NAME,NULL);
|
||||
|
||||
int prio = 256;
|
||||
|
||||
if (ac_name) {
|
||||
/* See if we can find AC Name in Priority List */
|
||||
if (priolist)
|
||||
prio = cw_acpriolist_get(priolist, ac_name);
|
||||
else
|
||||
prio = 256;
|
||||
printf("Prio for %s is %d\n",ac_name,prio);
|
||||
printf("nprio: %d\n",priolist->count);
|
||||
|
||||
}
|
||||
|
||||
/* get the IP list, the current AC has sent */
|
||||
cw_aciplist_t acips =
|
||||
mbag_get_mavl(ac, CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST);
|
||||
|
||||
printf("Number of acips =%d\n",acips->count);
|
||||
|
||||
|
||||
/* for each IP from the current AC add it to the result list
|
||||
* and give it the priority whe have determined */
|
||||
DEFINE_AVLITER(i2, acips);
|
||||
avliter_foreach(&i2){
|
||||
|
||||
|
||||
cw_acip_t *acip = avliter_get(&i2);
|
||||
|
||||
printf("The acip: %s\n",sock_addr2str(&acip->ip));
|
||||
|
||||
cw_acip_t *n = malloc(sizeof(cw_acip_t));
|
||||
memcpy(n,acip,sizeof(cw_acip_t));
|
||||
|
||||
|
||||
/* we missuse the wtp_count to sort by
|
||||
* priority and wp_count */
|
||||
n->wtp_count |= prio<<16;
|
||||
|
||||
cw_aciplist_del(resultlist,n);
|
||||
cw_aciplist_add(resultlist,n);
|
||||
}
|
||||
@ -117,7 +110,6 @@ printf("The acip: %s\n",sock_addr2str(&acip->ip));
|
||||
}
|
||||
|
||||
return resultlist;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user