changed wtp_count to index (naming for more general use)

FossilOrigin-Name: cca49e531e801cdeadab8d26e3892db5c9c89c994e2d9cfa6ce91f307e4d07fb
This commit is contained in:
7u83@maiol.ru 2016-11-07 18:37:02 +00:00
parent 5bfc592a68
commit 11bbcab554
6 changed files with 8 additions and 8 deletions

View File

@ -47,9 +47,9 @@ cw_aciplist_t get_aciplist()
sock_copyaddr(&acip->ip,(struct sockaddr*)&sa); sock_copyaddr(&acip->ip,(struct sockaddr*)&sa);
if (acip->ip.ss_family == AF_INET) if (acip->ip.ss_family == AF_INET)
acip->wtp_count=11; acip->index=11;
else else
acip->wtp_count=3; acip->index=3;
// printf ("Adding IP %s\n",sock_addr2str(&acip->ip)); // printf ("Adding IP %s\n",sock_addr2str(&acip->ip));

View File

@ -37,7 +37,7 @@ static int acip_cmp(const void *x1, const void *x2)
struct cw_acip *ip1 = (struct cw_acip *) x1; struct cw_acip *ip1 = (struct cw_acip *) x1;
struct cw_acip *ip2 = (struct cw_acip *) x2; struct cw_acip *ip2 = (struct cw_acip *) x2;
int r = ip1->wtp_count - ip2->wtp_count; int r = ip1->index - ip2->index;
if (r!=0) if (r!=0)
return r; return r;

View File

@ -5,7 +5,7 @@
struct cw_acip{ struct cw_acip{
struct sockaddr_storage ip; struct sockaddr_storage ip;
uint32_t wtp_count; uint32_t index;
}; };
typedef struct cw_acip cw_acip_t; typedef struct cw_acip cw_acip_t;

View File

@ -64,7 +64,7 @@ int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a,
addr.sin_family=AF_INET; addr.sin_family=AF_INET;
sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT); sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT);
memcpy(&acip->ip,&addr,sizeof(addr)); memcpy(&acip->ip,&addr,sizeof(addr));
acip->wtp_count = cw_get_word(data+4); acip->index = cw_get_word(data+4);
} }
if (a->elem_id == CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS) { if (a->elem_id == CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS) {
@ -74,7 +74,7 @@ int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a,
addr.sin6_family=AF_INET6; addr.sin6_family=AF_INET6;
sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT); sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT);
memcpy(&acip->ip,&addr,sizeof(addr)); memcpy(&acip->ip,&addr,sizeof(addr));
acip->wtp_count = cw_get_word(data+16); acip->index = cw_get_word(data+16);
} }

View File

@ -16,7 +16,7 @@ static int put_ip(uint8_t *dst /*void *priv*/, cw_acip_t * acip /*void *data*/)
uint8_t *d = dst+4; uint8_t *d = dst+4;
d+=cw_put_sockaddr(d,&acip->ip); d+=cw_put_sockaddr(d,&acip->ip);
d+=cw_put_word(d,acip->wtp_count); d+=cw_put_word(d,acip->index);
int fam = sock_addrfamily(&acip->ip); int fam = sock_addrfamily(&acip->ip);
int elem_id=-1; int elem_id=-1;

View File

@ -104,7 +104,7 @@ cw_aciplist_t cw_select_ac(struct conn *conn, mbag_t discs)
/* we missuse the wtp_count to sort by /* we missuse the wtp_count to sort by
* priority and wp_count */ * priority and wp_count */
n->wtp_count |= prio<<16; n->index |= prio<<16;
cw_aciplist_del(resultlist,n); cw_aciplist_del(resultlist,n);
cw_aciplist_add(resultlist,n); cw_aciplist_add(resultlist,n);