ac descriptor works
FossilOrigin-Name: 8e68ed51a2c8ee448474ab13ef8d0edbd8cfda5b5384684e2ed9ffa1fca4e799
This commit is contained in:
@ -23,12 +23,12 @@ $(OBJDIR)/%.o:%.c
|
||||
$(SNAME) : $(OBJS) $(MODOBJS)
|
||||
@mkdir -p $(LIBARCHDIR)
|
||||
@echo " $(AR) $(SNAME)"
|
||||
$(AR) rcs $(SNAME) $(OBJS) $(MODOBJS)
|
||||
@$(AR) rcs $(SNAME) $(OBJS) $(MODOBJS)
|
||||
|
||||
$(DNAME) : $(OBJS) $(MODOBJS)
|
||||
@mkdir -p $(LIBARCHDIR)
|
||||
@echo " $(CC) $(DNAME)"
|
||||
$(LD) -L$(LIBARCHDIR) $(LDFLAGS) -shared -o $(DNAME) $(OBJS) $(MODOBJS) $(SLIBS) $(LIBS)
|
||||
@$(LD) -L$(LIBARCHDIR) $(LDFLAGS) -shared -o $(DNAME) $(OBJS) $(MODOBJS) $(SLIBS) $(LIBS)
|
||||
|
||||
$(MODNAME) : $(DNAME)
|
||||
cp $(DNAME) $(MODNAME)
|
||||
|
@ -15,7 +15,8 @@ OBJS=\
|
||||
capwap_in_session_id.o \
|
||||
capwap_in_vendor_specific_payload.o \
|
||||
capwap_in_mtu_discovery_padding.o \
|
||||
capwap_out_capwap_control_ip_address.o
|
||||
capwap_out_capwap_control_ip_address.o \
|
||||
capwap_in_capwap_control_ip_address.o
|
||||
|
||||
|
||||
LIBDIR := ../../../lib
|
||||
|
@ -31,47 +31,47 @@
|
||||
static struct cw_ElemHandler handlers[] = {
|
||||
|
||||
{
|
||||
"Discovery Type", /* name */
|
||||
CAPWAP_ELEM_DISCOVERY_TYPE, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
1,1, /* min/max length */
|
||||
CW_TYPE_BYTE, /* type */
|
||||
CW_KEY_DISCOVERY_TYPE, /* Key */
|
||||
cw_in_generic, /* get */
|
||||
cw_out_generic /* put */
|
||||
"Discovery Type", /* name */
|
||||
CAPWAP_ELEM_DISCOVERY_TYPE, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
1,1, /* min/max length */
|
||||
CW_TYPE_BYTE, /* type */
|
||||
CW_KEY_DISCOVERY_TYPE, /* Key */
|
||||
cw_in_generic, /* get */
|
||||
cw_out_generic /* put */
|
||||
}
|
||||
,
|
||||
{
|
||||
"WTP Mac Type", /* name */
|
||||
CAPWAP_ELEM_WTP_MAC_TYPE, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
1,1, /* min/max length */
|
||||
CW_TYPE_BYTE, /* type */
|
||||
CW_KEY_WTP_MAC_TYPE, /* Key */
|
||||
cw_in_generic, /* get */
|
||||
cw_out_generic /* put */
|
||||
"WTP Mac Type", /* name */
|
||||
CAPWAP_ELEM_WTP_MAC_TYPE, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
1,1, /* min/max length */
|
||||
CW_TYPE_BYTE, /* type */
|
||||
CW_KEY_WTP_MAC_TYPE, /* Key */
|
||||
cw_in_generic, /* get */
|
||||
cw_out_generic /* put */
|
||||
}
|
||||
,
|
||||
{
|
||||
"WTP Board Data", /* name */
|
||||
CAPWAP_ELEM_WTP_BOARD_DATA, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
14,1024, /* min/max length */
|
||||
NULL, /* type */
|
||||
CW_KEY_WTP_BOARD_DATA, /* Key */
|
||||
capwap_in_wtp_board_data, /* get */
|
||||
capwap_out_wtp_board_data /* put */
|
||||
"WTP Board Data", /* name */
|
||||
CAPWAP_ELEM_WTP_BOARD_DATA, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
14,1024, /* min/max length */
|
||||
NULL, /* type */
|
||||
CW_KEY_WTP_BOARD_DATA, /* Key */
|
||||
capwap_in_wtp_board_data, /* get */
|
||||
capwap_out_wtp_board_data /* put */
|
||||
}
|
||||
,
|
||||
{
|
||||
"WTP Descriptor", /* name */
|
||||
CAPWAP_ELEM_WTP_DESCRIPTOR, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
33,1024, /* min/max length */
|
||||
NULL, /* type */
|
||||
CW_KEY_WTP_DESCRIPTOR, /* Key */
|
||||
capwap_in_wtp_descriptor, /* get */
|
||||
capwap_out_wtp_descriptor, /* put */
|
||||
"WTP Descriptor", /* name */
|
||||
CAPWAP_ELEM_WTP_DESCRIPTOR, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
33,1024, /* min/max length */
|
||||
NULL, /* type */
|
||||
CW_KEY_WTP_DESCRIPTOR, /* Key */
|
||||
capwap_in_wtp_descriptor, /* get */
|
||||
capwap_out_wtp_descriptor, /* put */
|
||||
}
|
||||
,
|
||||
{
|
||||
@ -136,10 +136,10 @@ static struct cw_ElemHandler handlers[] = {
|
||||
"CAPWAP Control IPv4 Address", /* name */
|
||||
CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
0,0, /* min/max length */
|
||||
6,6, /* min/max length */
|
||||
CW_TYPE_BSTR16, /* type */
|
||||
"capwap-control-ip-address", /* Key */
|
||||
NULL, /* get */
|
||||
capwap_in_capwap_control_ip_address, /* get */
|
||||
capwap_out_capwap_control_ip_address /* put */
|
||||
},
|
||||
|
||||
@ -147,10 +147,10 @@ static struct cw_ElemHandler handlers[] = {
|
||||
"CAPWAP Control IPv6 Address", /* name */
|
||||
CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
0,0, /* min/max length */
|
||||
18,18, /* min/max length */
|
||||
CW_TYPE_BSTR16, /* type */
|
||||
"capwap-control-ip-address", /* Key */
|
||||
NULL, /* get */
|
||||
capwap_in_capwap_control_ip_address, /* get */
|
||||
capwap_out_capwap_control_ip_address /* put */
|
||||
}
|
||||
|
||||
|
70
src/mod/capwap/capwap_in_capwap_control_ip_address.c
Normal file
70
src/mod/capwap/capwap_in_capwap_control_ip_address.c
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
This file is part of actube.
|
||||
|
||||
actube is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
libcapwap is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Implements cw_in_capwap_control_ip_address
|
||||
*/
|
||||
|
||||
#include "mod_capwap.h"
|
||||
|
||||
|
||||
int capwap_in_capwap_control_ip_address(struct cw_ElemHandler *eh,
|
||||
struct cw_ElemHandlerParams *params,
|
||||
uint8_t * data, int len)
|
||||
{
|
||||
char key[CW_KTV_MAX_KEY_LEN];
|
||||
int idx;
|
||||
|
||||
sprintf(key,"%s/address",eh->key);
|
||||
idx = cw_ktv_idx_get(params->conn->remote_cfg,key,0,CW_TYPE_IPADDRESS);
|
||||
|
||||
printf("SKEY is %s , idx: %d\n",key,idx);
|
||||
|
||||
sprintf(key,"%s/address.%d",eh->key,idx+1);
|
||||
cw_ktv_add(params->conn->remote_cfg,key,CW_TYPE_IPADDRESS,data,len-2);
|
||||
|
||||
sprintf(key,"%s/wtps.%d",eh->key,idx+1);
|
||||
cw_ktv_add(params->conn->remote_cfg,key,CW_TYPE_WORD,data+len-2,2);
|
||||
|
||||
/* if (handler-id == CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS) {
|
||||
struct sockaddr_in addr;
|
||||
memcpy(&addr.sin_addr,data,4);
|
||||
addr.sin_family=AF_INET;
|
||||
sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT);
|
||||
memcpy(&acip->ip,&addr,sizeof(addr));
|
||||
acip->index = cw_get_word(data+4);
|
||||
}
|
||||
|
||||
if (a->elem_id == CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS) {
|
||||
struct sockaddr_in6 addr;
|
||||
memset (&addr,0,sizeof(addr));
|
||||
memcpy(&addr.sin6_addr,data,16);
|
||||
addr.sin6_family=AF_INET6;
|
||||
sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT);
|
||||
memcpy(&acip->ip,&addr,sizeof(addr));
|
||||
acip->index = cw_get_word(data+16);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
|
||||
#include "cw/cw.h"
|
||||
#include "cw/dbg.h"
|
||||
#include "mod_capwap.h"
|
||||
|
||||
/*
|
||||
@ -47,40 +50,56 @@ static int put_ip(uint8_t *dst void *priv, cw_acip_t * acip void *data)
|
||||
int capwap_out_capwap_control_ip_address(struct cw_ElemHandler * eh,
|
||||
struct cw_ElemHandlerParams * params, uint8_t * dst)
|
||||
{
|
||||
int i;
|
||||
int wtps;
|
||||
|
||||
|
||||
cw_KTV_t * address;
|
||||
|
||||
char key[CW_KTV_MAX_KEY_LEN];
|
||||
|
||||
i=0;
|
||||
|
||||
sprintf(key,"%s/address.%d",eh->key,i);
|
||||
address = cw_ktv_get(params->conn->local_cfg,key,CW_TYPE_IPADDRESS);
|
||||
|
||||
sprintf(key,"%s/wtps.%d",eh->key,i);
|
||||
wtps = cw_ktv_get_word(params->conn->local_cfg,key,0);
|
||||
|
||||
while (address != NULL) {
|
||||
char str[100];
|
||||
printf("Yea!");
|
||||
address->type->to_str(address,str,10);
|
||||
printf("Hier isses: %s, %d\n",str,wtps);
|
||||
int i;
|
||||
int wtps;
|
||||
cw_KTV_t * address;
|
||||
uint8_t *d;
|
||||
|
||||
d = dst;
|
||||
i=0;
|
||||
do {
|
||||
uint8_t * msg;
|
||||
int l;
|
||||
|
||||
i++;
|
||||
sprintf(key,"%s/address.%d",eh->key,i);
|
||||
address = cw_ktv_get(params->conn->local_cfg,key,CW_TYPE_IPADDRESS);
|
||||
sprintf(key,"%s/wtps.%d",eh->key,i);
|
||||
wtps = cw_ktv_get_word(params->conn->local_cfg,key,0);
|
||||
}
|
||||
wtps = cw_ktv_get_word(params->conn->local_cfg,key,0);
|
||||
i++;
|
||||
if (address==NULL){
|
||||
break;
|
||||
}
|
||||
|
||||
msg = d;
|
||||
|
||||
l = address->type->len(address);
|
||||
|
||||
|
||||
|
||||
|
||||
switch(eh->id){
|
||||
case CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS:
|
||||
if (l!=4){
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS:
|
||||
if (l!=16){
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
l = address->type->put(address,d+4);
|
||||
l+=cw_put_word(dst+4+l,wtps);
|
||||
l+=cw_put_elem_hdr(d,eh->id,l);
|
||||
cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,eh,d+4,l-4);
|
||||
|
||||
d+=l;
|
||||
}while(address != NULL);
|
||||
|
||||
return 10;
|
||||
|
||||
return d-dst;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -28,7 +28,7 @@ int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
|
||||
struct cw_ElemHandlerParams * params, uint8_t * dst)
|
||||
{
|
||||
char key[CW_KTV_MAX_KEY_LEN];
|
||||
int len;
|
||||
int len,l;
|
||||
/* // XXX Dummy WTP Descriptor Header */
|
||||
uint8_t *d;
|
||||
cw_KTV_t * val;
|
||||
@ -75,5 +75,8 @@ int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
|
||||
CW_SUBELEM_WTP_BOOTLOADER_VERSION, key);
|
||||
|
||||
len = d-dst-4;
|
||||
return len + cw_put_elem_hdr(dst,eh->id,len);
|
||||
l = len + cw_put_elem_hdr(dst,eh->id,len);
|
||||
|
||||
cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,eh,dst,l);
|
||||
return l;
|
||||
}
|
||||
|
@ -23,7 +23,9 @@ int capwap_out_ac_descriptor(struct cw_ElemHandler * eh,
|
||||
int capwap_out_capwap_control_ip_address(struct cw_ElemHandler * eh,
|
||||
struct cw_ElemHandlerParams * params, uint8_t * dst);
|
||||
|
||||
|
||||
int capwap_in_capwap_control_ip_address(struct cw_ElemHandler *eh,
|
||||
struct cw_ElemHandlerParams *params,
|
||||
uint8_t * data, int len);
|
||||
|
||||
|
||||
|
||||
|
@ -81,8 +81,9 @@ static struct cw_ElemHandler handlers[] = {
|
||||
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||
static struct cw_ElemDef discovery_request_elements[] ={
|
||||
{0,0, CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
||||
{0,CW_VENDOR_ID_CISCO, CW_CISCO_RAD_NAME, 1, 0},
|
||||
{0,CW_VENDOR_ID_CISCO, CW_CISCO_BOARD_DATA_OPTIONS, 1, 0},
|
||||
{0,0, CAPWAP_ELEM_WTP_BOARD_DATA, 0, 0},
|
||||
{0,CW_VENDOR_ID_CISCO, CW_CISCO_RAD_NAME, 1, 0},
|
||||
{0,CW_VENDOR_ID_CISCO, CW_CISCO_BOARD_DATA_OPTIONS, 0, 0},
|
||||
{0,0,0,00}
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user