new simplified Makefile
FossilOrigin-Name: a1012388abc39936cf1bf5f7ff48bc721b7983e2342313d7d82afecbd486b267
This commit is contained in:
parent
d8c8bd022e
commit
a2851cdc4c
315
src/cw/Makefile
315
src/cw/Makefile
@ -13,314 +13,9 @@ DNAME := $(LIBARCHDIR)/libcw.so
|
||||
LDFLAGS+=-g -D_REENTRANT -L/usr/local/lib
|
||||
|
||||
|
||||
SOCKOBJS=\
|
||||
sock_create.o\
|
||||
sock_copyaddr.o\
|
||||
sock_strtoaddr.o\
|
||||
sock_cmpaddr.o\
|
||||
sock_addrlen.o \
|
||||
sock_mwait.o\
|
||||
sock_addrtostr.o \
|
||||
sock_setport.o \
|
||||
sock_getport.o \
|
||||
sock_getifaddr.o \
|
||||
sock_getifhwaddr.o \
|
||||
sock_hwaddrtostr.o \
|
||||
sock_set_recvtimeout.o \
|
||||
sock_getbroadcastaddr.o \
|
||||
sock_addrinit.o \
|
||||
sock_set_dontfrag.o \
|
||||
sock_get_primary_if.o \
|
||||
sock_receive.o \
|
||||
sock_getifinfo.o \
|
||||
|
||||
|
||||
LOGOBJS=log.o \
|
||||
log_syslog.o \
|
||||
log_file.o \
|
||||
dbg_strings.o\
|
||||
dbg.o \
|
||||
|
||||
|
||||
WTPINFOOBJS =\
|
||||
#wtpinfo_print.o
|
||||
#wtpinfo_set_location.o \
|
||||
wtpinfo_lwreadelem_wtp_descriptor.o \
|
||||
|
||||
UTILOBJS= \
|
||||
cw_setstr.o \
|
||||
cw_is_printable.o \
|
||||
cw_rand.o \
|
||||
stravltree.o \
|
||||
intavltree.o \
|
||||
cw_util.o \
|
||||
send.o \
|
||||
cw_read_wtp_descriptor.o \
|
||||
cw_read_wtp_descriptor_7.o \
|
||||
cw_read_wtp_descriptor_versions.o \
|
||||
cw_read_descriptor_subelems.o \
|
||||
cw_out_80211_supported_rates.o
|
||||
|
||||
MAVLOBJS= \
|
||||
mavl_del.o \
|
||||
mavl_add.o \
|
||||
mavl_create.o\
|
||||
mavl_get.o\
|
||||
mavl_del_all.o\
|
||||
mavliter_seek.o \
|
||||
mavliter_next.o \
|
||||
mavl_get_node.o \
|
||||
mavl_foreach.o \
|
||||
mavl_foreach_lr.o \
|
||||
mavl_merge.o \
|
||||
mavl_create_conststr.o \
|
||||
mlist.o \
|
||||
cw_load_file.o \
|
||||
cw_save_file.o \
|
||||
cw_filename.o \
|
||||
message_set.o
|
||||
|
||||
|
||||
|
||||
FORMATOBJS = \
|
||||
format_is_utf8.o \
|
||||
format_dot11_fc.o \
|
||||
|
||||
# lw_readelem_vendor_specific.o \
|
||||
|
||||
|
||||
# LWAPP objs
|
||||
LWAPPOBJS = \
|
||||
lw_checksum.o \
|
||||
lw_put_ac_descriptor.o \
|
||||
lw_put_cisco_path_mtu.o \
|
||||
lw_elem_id_to_str.o \
|
||||
lw_msg_id_to_str.o \
|
||||
lw_cisco_id_to_str.o \
|
||||
lw_put_sockaddr.o \
|
||||
lw_put_image_data.o \
|
||||
lw_in_vendor_specific.o
|
||||
|
||||
|
||||
#lw_put_80211_wtp_wlan_radio_configuration.o \
|
||||
# lw_readelem_wtp_name.o \
|
||||
lw_readelem_wtp_board_data.o \
|
||||
cw_log_debug.o \
|
||||
lw_vendor_id_to_str.o \
|
||||
|
||||
|
||||
# LWAPP cisco vendor specific objs
|
||||
#//#LWAPPCISCOOBJS = \
|
||||
# lw_addelem.o
|
||||
|
||||
|
||||
# cw_tohex.o\
|
||||
#capwap_parse_ctrlhdr.o \
|
||||
|
||||
# hdr_print.o \
|
||||
|
||||
CAPWAPOBJS= \
|
||||
cw_iplist.o \
|
||||
aciplist.o \
|
||||
lwmsg_init.o \
|
||||
cw_cisco_id_to_str.o\
|
||||
cw_strlist_get_str.o \
|
||||
cw_strlist_get_id.o \
|
||||
capwap_strings_msg.o \
|
||||
capwap_strings_elem80211.o\
|
||||
acpriolist.o\
|
||||
capwap_strings_state.o \
|
||||
capwap_strings_vendor.o \
|
||||
capwap_strings_elem.o \
|
||||
cw_in_vendor_specific_payload.o \
|
||||
cw_in_mtu_discovery_padding.o\
|
||||
cw_in_wtp_board_data.o \
|
||||
cw_in_check_disc_req.o \
|
||||
cw_in_check_chng_state_evnt_req.o\
|
||||
cw_in_check_disc_resp.o\
|
||||
cw_in_check_cfg_update_req.o\
|
||||
cw_in_check_join_req.o \
|
||||
cw_in_check_cipwap_join_req.o \
|
||||
cw_in_check_join_resp.o \
|
||||
cw_in_check_img_data_req_ac.o \
|
||||
cw_in_check_img_data_req_wtp.o \
|
||||
cw_in_check_img_data_resp.o \
|
||||
cw_in_check_generic_resp.o \
|
||||
cw_in_check_generic_req.o \
|
||||
cw_in_80211_mac_operation.o \
|
||||
cw_read_80211_mac_operation.o \
|
||||
cw_out_generic.o \
|
||||
cw_out_wtp_descriptor.o \
|
||||
cw_out_wtp_reboot_statistics.o \
|
||||
cw_in_wtp_reboot_statistics.o\
|
||||
cw_in_cisco_image_identifier.o\
|
||||
cw_put_radio_operational_states.o \
|
||||
cw_put_ac_status.o \
|
||||
cw_in_ac_descriptor.o\
|
||||
cw_read_ac_descriptor.o\
|
||||
cw_out_capwap_local_ip_address.o\
|
||||
cw_out_wtp_ip_address.o\
|
||||
cw_out_capwap_control_ip_addr_list.o \
|
||||
cw_in_capwap_control_ip_address.o\
|
||||
cw_in_capwap_local_ipv4_address.o \
|
||||
cw_in_capwap_local_ipv6_address.o \
|
||||
cw_in_radio_administrative_state.o \
|
||||
cw_in_radio_administrative_state_wtp.o \
|
||||
cw_radio_set_admin_state.o \
|
||||
cw_put_elem_radio_administrative_state.o\
|
||||
cw_put_elem_radio_operational_state.o \
|
||||
cw_out_radio_administrative_states.o\
|
||||
strheap.o \
|
||||
cw_check_missing_mand.o \
|
||||
md5sum.o \
|
||||
format.o \
|
||||
# action_sources.o \
|
||||
# cw_in_cisco_add_wlan.o
|
||||
# cw_in_radio_operational_state.o\
|
||||
|
||||
DOT11OBJS = \
|
||||
dot11.o \
|
||||
dot11_beacon.o
|
||||
|
||||
# cw_out_ac_descriptor.o \
|
||||
|
||||
|
||||
CAPWAP80211OBJS=\
|
||||
capwap80211_items.o\
|
||||
capwap80211_type_rateset.o \
|
||||
|
||||
# cw_out_radio_operational_states.o\
|
||||
# cw_out_radio_operational_states_7.o\
|
||||
|
||||
#
|
||||
# SSL objects
|
||||
#
|
||||
|
||||
LIBS=
|
||||
|
||||
ifeq ($(WITH_OPENSSL),1)
|
||||
CFLAGS+=$(OPENSSL_CFLAGS)
|
||||
CFLAGS+=-DWITH_OPENSSL
|
||||
DTLSOBJS += dtls_openssl.o \
|
||||
dtls_openssl_accept.o \
|
||||
dtls_openssl_connect.o \
|
||||
dtls_openssl_get_cipher.o \
|
||||
dtls_openssl_bio.o
|
||||
LIBS+=-lssl
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_GNUTLS),1)
|
||||
CFLAGS+=$(GNUTLS_CFLAGS)
|
||||
CFLAGS+=-DWITH_GNUTLS
|
||||
DTLSOBJS+= dtls_gnutls.o \
|
||||
dtls_gnutls_accept.o \
|
||||
dtls_gnutls_connect.o \
|
||||
dtls_gnutls_bio.o \
|
||||
dtls_gnutls_get_cipher.o \
|
||||
dtls_gnutls_get_peers_cert.o
|
||||
LIBS+=-lgnutls
|
||||
endif
|
||||
|
||||
DTLSOBJS+=dtls_bio.o
|
||||
|
||||
CONNOBJS= conn_create.o \
|
||||
conn_process_packet.o \
|
||||
conn_q_add_packet.o \
|
||||
conn_q_get_packet.o \
|
||||
conn_q_recv_packet.o \
|
||||
conn_recv_packet.o \
|
||||
conn_destroy.o \
|
||||
connlist.o \
|
||||
conn_create_noq.o \
|
||||
conn_init.o \
|
||||
conn_send_packet.o \
|
||||
conn_send_data_packet.o \
|
||||
netconn.o \
|
||||
cw_init_data_keep_alive_msg.o \
|
||||
conn_clear_upd.o
|
||||
|
||||
|
||||
# conn_send_msg.o
|
||||
#conn_get_message.o \
|
||||
# conn_send_response.o \
|
||||
# cw_prepare_configuration_status_request.o \
|
||||
# cw_prepare_change_state_event_request.o \
|
||||
conn_prepare_configuration_update_request.o \
|
||||
|
||||
|
||||
#bstr_to_str.o \
|
||||
|
||||
BSTROBJS= bstr_create.o \
|
||||
bstr_create_from_cfgstr.o \
|
||||
bstr16_create_from_cfgstr.o \
|
||||
bstr_replace.o \
|
||||
bstr16cfgstr.o \
|
||||
bstr16_create_from_str.o \
|
||||
bstr_create_from_str.o \
|
||||
bstrv_create_from_str.o
|
||||
|
||||
|
||||
|
||||
FRAGOBJS=fragman.o
|
||||
|
||||
CWACTION=action.o \
|
||||
cw_in_generic.o \
|
||||
cw_in_generic2.o \
|
||||
cw_out_wtp_board_data.o \
|
||||
cw_out_ac_name_with_priority.o \
|
||||
cw_in_ac_name_with_priority.o \
|
||||
cw_out_image_data.o \
|
||||
cipwap_strings_elem.o \
|
||||
capwap_strings_result.o\
|
||||
capwap_strings_board.o \
|
||||
cw_put_msg.o \
|
||||
cw_put_mbag_item.o \
|
||||
cw_put_local_ip_address.o \
|
||||
capwap_action_helpers.o \
|
||||
cw_put_image_data.o \
|
||||
cisco.o \
|
||||
radio.o \
|
||||
cw_in_radio_generic.o\
|
||||
cw_out_radio_generic.o \
|
||||
cw_out_radio_info.o \
|
||||
capwap_items.o \
|
||||
item.o \
|
||||
mod.o
|
||||
|
||||
# cw_process_msg.o \
|
||||
# item_strings.o \
|
||||
#
|
||||
|
||||
MBAGOBJS = \
|
||||
mbag.o\
|
||||
mbag_type_word.o\
|
||||
mbag_type_byte.o\
|
||||
mbag_type_vendorstr.o\
|
||||
mbag_type_sockaddr.o\
|
||||
mbag_type_dword.o\
|
||||
mbag_type_bstr16.o\
|
||||
mbag_type_mbag.o\
|
||||
mbag_set_from_buf.o\
|
||||
mbag_type_str.o \
|
||||
mbag_type_ptr.o \
|
||||
mbag_type_data.o \
|
||||
mbag_get_upd.o
|
||||
|
||||
|
||||
|
||||
|
||||
OBJS=$(CONNOBJS) $(FRAGOBJS) $(SOCKOBJS) $(CAPWAPOBJS) $(WTPINFOOBJS) \
|
||||
$(LOGOBJS) $(UTILOBJS) $(DTLSOBJS) $(BSTROBJS) \
|
||||
$(LWAPPOBJS) \
|
||||
$(LWAPPCISCOOBJS) \
|
||||
$(CWACTION) \
|
||||
$(MAVLOBJS) \
|
||||
$(FORMATOBJS) \
|
||||
$(DOT11OBJS) \
|
||||
$(MBAGOBJS) \
|
||||
$(CAPWAP80211OBJS)
|
||||
|
||||
O:=$(OBJS);
|
||||
SRC=$(wildcard *.c)
|
||||
OBJS=$(patsubst %.c,%.o,$(SRC))
|
||||
#O:=$(OBJS);
|
||||
|
||||
OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))
|
||||
|
||||
@ -328,7 +23,8 @@ OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))
|
||||
all: $(SNAME) $(DNAME)
|
||||
|
||||
|
||||
CFLAGS = -Wall -fPIC -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I /usr/local/include -I../
|
||||
#CFLAGS = -D_XOPEN_SOURCE=500 -std=c90 -pedantic -Wall -fPIC -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I /usr/local/include -I../
|
||||
CFLAGS = -D_XOPEN_SOURCE=500 -Wall -fPIC -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I /usr/local/include -I../
|
||||
|
||||
CFLAGS += $(GNUTLS_CFLAGS) \
|
||||
-DWITH_CW_LOG \
|
||||
@ -355,7 +51,6 @@ $(DNAME) : $(OBJS) $(MODOBJS)
|
||||
@$(CC) $(LDFLAGS) -shared -o $(DNAME) $(OBJS) $(MODOBJS) $(LIBS)
|
||||
|
||||
|
||||
|
||||
SRCS = $(OBJS:.o=.c)
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
This file is part of libcapwap.
|
||||
|
||||
libcapwap 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 Implementation of avliter_seek
|
||||
*/
|
||||
|
||||
|
||||
#include "avltree.h"
|
||||
|
||||
/**
|
||||
* Set an AVL Iterator to a specific position.
|
||||
* @param i AVL Iterator
|
||||
* @param d element to search for
|
||||
* @return element found or NULL if not found
|
||||
*/
|
||||
void * avliter_seek(avliter_t *i,void *d)
|
||||
{
|
||||
if (!i->root)
|
||||
return NULL;
|
||||
|
||||
i->cur=i->root;
|
||||
i->stack_ptr=0;
|
||||
|
||||
int rc;
|
||||
while(i->cur) {
|
||||
|
||||
rc = i->cmp(d,i->cur->data);
|
||||
if (rc==0){
|
||||
i->stack[i->stack_ptr++]=i->cur->right;
|
||||
i->stack[i->stack_ptr++]=i->cur;
|
||||
return avliter_next(i);
|
||||
}
|
||||
|
||||
if (rc<0) {
|
||||
i->stack[i->stack_ptr++]=i->cur->right;
|
||||
i->stack[i->stack_ptr++]=i->cur;
|
||||
|
||||
i->cur=i->cur->left;
|
||||
|
||||
}
|
||||
if (rc>0) {
|
||||
|
||||
i->cur=i->cur->right;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
struct cw_str capwap_strings_item[] = {
|
||||
|
||||
{CW_ITEM_AC_DESCRIPTOR, "AC Descriptor"},
|
||||
{CW_ITEM_AC_IPV4_LIST, "AC IPv4 List"},
|
||||
{CW_ITEM_WTP_DESCRIPTOR,"WTP Descriptor"},
|
||||
|
||||
{CW_STR_STOP,"Unknown"}
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
This file is part of libcapwap.
|
||||
|
||||
libcapwap 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/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "capwap.h"
|
||||
#include "wtpinfo.h"
|
||||
#include "conn.h"
|
||||
#include "log.h"
|
||||
#include "sock.h"
|
||||
|
||||
void conn_detect_capwap(struct conn * conn, struct wtpinfo * wtpinfo)
|
||||
{
|
||||
if (wtpinfo->software_vendor_id == CW_VENDOR_ID_CISCO){
|
||||
cw_dbg(DBG_CW_INFO,"Setting capwap mode *Cisco* on connection %s",sock_addr2str(&conn->addr));
|
||||
conn->capwap_mode = CWMODE_CISCO;
|
||||
return;
|
||||
}
|
||||
|
||||
conn->capwap_mode = CWMODE_STD;
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
|
||||
#include "capwap.h"
|
||||
#include "cw_log.h"
|
||||
#include "sock.h"
|
||||
#include "cw_util.h"
|
||||
|
||||
|
||||
struct cwrmsg * conn_get_response(struct conn * conn)
|
||||
{
|
||||
|
||||
|
||||
struct cwmsg * cwmsg = &conn->req_msg;
|
||||
|
||||
int type = cwmsg->type+1;
|
||||
|
||||
struct cwrmsg * cwrmsg;
|
||||
|
||||
int i;
|
||||
for (i=0; i<conn->max_retransmit; i++) {
|
||||
|
||||
time_t r_timer = cw_timer_start(conn->retransmit_interval);
|
||||
|
||||
while(!cw_timer_timeout(r_timer)){
|
||||
cwrmsg = conn_get_message(conn);
|
||||
if (cwrmsg){
|
||||
cw_dbg(DBG_MSG,"Received message from %s, type=%d - %s"
|
||||
,sock_addr2str(&conn->addr),cwrmsg->type,cw_msgtostr(cwrmsg->type));
|
||||
if (cwrmsg->type == type){
|
||||
return cwrmsg;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (conn->dtls_error)
|
||||
return 0;
|
||||
}
|
||||
cw_dbg(DBG_MSG_ERR,"Retransmitting message, type=%d,seq=%d",cwmsg->type,cwmsg->seqnum);
|
||||
conn_send_cwmsg(conn,&conn->req_msg);
|
||||
|
||||
}
|
||||
cw_dbg(DBG_MSG_ERR,"Max retransmit's reached, message type=%d,seq=%d",cwmsg->type,cwmsg->seqnum);
|
||||
return 0;
|
||||
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
|
||||
#include "conn.h"
|
||||
#include "cw_log.h"
|
||||
#include "sock.h"
|
||||
#include "cw_util.h"
|
||||
|
||||
struct rh_param{
|
||||
struct conn * conn;
|
||||
int *msglist;
|
||||
|
||||
};
|
||||
|
||||
|
||||
static int conn_rh(void *param)
|
||||
{
|
||||
struct rh_param * p = (struct rh_param*)param;
|
||||
int i;
|
||||
int *msglist=p->msglist;
|
||||
|
||||
|
||||
printf("Param %p\n",param);
|
||||
|
||||
|
||||
for (i=0; msglist[i]!=-1; i++){
|
||||
if (msglist[i] == p->conn->cwrmsg.type )
|
||||
return 0;
|
||||
|
||||
}
|
||||
/* unexpected response here */
|
||||
cw_log(LOG_ERR,"Unexpected message from %s",sock_addr2str(&p->conn->addr));
|
||||
cwsend_unknown_response(p->conn,p->conn->cwrmsg.seqnum,p->conn->cwrmsg.type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
struct cwrmsg * conn_wait_for_request(struct conn * conn, int *msglist, time_t timer)
|
||||
{
|
||||
int (*request_handler_save) (void*);
|
||||
void * request_handler_param_save;
|
||||
|
||||
struct rh_param rh_param;
|
||||
|
||||
|
||||
if (msglist){
|
||||
request_handler_save=conn->request_handler;
|
||||
request_handler_param_save=conn->request_handler_param;
|
||||
rh_param.conn=conn;
|
||||
rh_param.msglist=msglist;
|
||||
conn->request_handler=conn_rh;
|
||||
conn->request_handler_param=&rh_param;
|
||||
}
|
||||
|
||||
|
||||
struct cwrmsg * cwrmsg;
|
||||
while (!cw_timer_timeout(timer)){
|
||||
cwrmsg = conn_wait_for_message(conn,timer);
|
||||
if (!cwrmsg){
|
||||
if (!conn_is_error(conn))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
/* response message? no action*/
|
||||
if (! (cwrmsg->type & 1) )
|
||||
continue;
|
||||
|
||||
/* it's a request message */
|
||||
break;
|
||||
}
|
||||
|
||||
if (msglist){
|
||||
conn->request_handler=request_handler_save;
|
||||
conn->request_handler_param=request_handler_param_save;
|
||||
}
|
||||
|
||||
return cwrmsg;
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "mod.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
struct cw_Mod *(*mods_ac[])() = MODS_AC;
|
||||
|
||||
|
||||
struct cw_Mod * cw_get_mod_ac(const char *name)
|
||||
{
|
||||
int i;
|
||||
for (i=0; mods_ac[i];i++){
|
||||
|
||||
struct cw_Mod * m = mods_ac[i]();
|
||||
if (strcmp(m->name,name)==0)
|
||||
return m;
|
||||
}
|
||||
return NULL;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
|
||||
#include "conn.h"
|
||||
#include "capwap.h"
|
||||
|
||||
|
||||
|
||||
void cw_init(struct conn * conn, uint8_t *buffer, int type, int seqnum, struct radioinfo * radioinfo)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void cw_init_response(struct conn * conn, uint8_t *req)
|
||||
{
|
||||
uint8_t *buffer=conn->resp_buffer;
|
||||
int shbytes = cw_get_hdr_msg_offset(req);
|
||||
int dhbytes;
|
||||
memcpy(buffer,req,shbytes);
|
||||
cw_set_hdr_hlen(buffer,2);
|
||||
cw_set_hdr_flags(buffer,CAPWAP_FLAG_HDR_M,1);
|
||||
dhbytes = cw_get_hdr_msg_offset(buffer);
|
||||
|
||||
uint8_t * msgptr = req+shbytes;
|
||||
uint8_t * dmsgptr = buffer+dhbytes;
|
||||
|
||||
cw_set_msg_type(dmsgptr,cw_get_msg_type(msgptr)+1);
|
||||
cw_set_msg_seqnum(dmsgptr,cw_get_msg_seqnum(msgptr));
|
||||
cw_set_msg_flags(dmsgptr,0);
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_cisco.h"
|
||||
|
||||
#include "itemstore.h"
|
||||
|
||||
int cw_put_cisco_wtp_radio_cfg(uint8_t *dst, int rid, cw_itemstore radio)
|
||||
{
|
||||
|
||||
cw_put_byte(dst,rid);
|
||||
|
||||
cw_put_byte(dst+1,0); //?
|
||||
cw_put_word(dst+2,cw_istore_get_word(radio,CW_RADIO_OCCUPANCY_LIMIT);
|
||||
cw_put_byte(dst+4,cw_istore_get_byte(radio,CW_RADIO_CFP_PERIOD));
|
||||
|
||||
cw_put_word(dst+5,cw_istore_get_word(radio,CW_RADIO_CFP_MAX_DURATION,200);
|
||||
|
||||
/* XXX catch rmac shorter or longer than 6*/
|
||||
|
||||
cw_put_bstr(dst+7,cw_istore_get_datari->rmac); /* length MUST be 6 */
|
||||
|
||||
cw_put_word(dst+13,200); // beacon period
|
||||
cw_put_data(dst+15,cw_itemstore_get_datari->country_str,3);
|
||||
cw_put_data(dst+18,ri->country_str2,3);
|
||||
|
||||
cw_put_byte(dst+10+21,10); // gPeriod
|
||||
|
||||
cw_put_dword(dst+10+22,0x3538); // ?
|
||||
|
||||
return 28; //+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_WTP_RADIO_CFG,28);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int cw_out_cisco_wtp_radio_cfg(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
||||
{
|
||||
uint8_t *d = dst;
|
||||
|
||||
|
||||
return 28+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_WTP_RADIO_CFG,28);
|
||||
}
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
This file is part of libcapwap.
|
||||
|
||||
libcapwap 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/>.
|
||||
|
||||
*/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "wtpinfo.h"
|
||||
#include "capwap_80211.h"
|
||||
|
||||
#include "cw_log.h"
|
||||
|
||||
|
||||
int cw_readelem_80211_wtp_radio_info(void *dst,int type,uint8_t *msgelem, int len)
|
||||
{
|
||||
if (type != CWMSGELEM_80211_WTP_RADIO_INFO)
|
||||
return 0;
|
||||
|
||||
if (len!=5){
|
||||
cw_dbg(DBG_MSG_ERR,"Discarding msgelem 80211_WTP_RADIO_INFO, wrong size, len=%d\n",len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*msgelem <1 || *msgelem>31){
|
||||
cw_dbg(DBG_CW_RFC,"Non-standard conform radio id, val=%d (must be between 1 to 31, See RFC 5415");
|
||||
}
|
||||
|
||||
|
||||
// int rid=*msgelem & 0x1f;
|
||||
|
||||
/*
|
||||
wtpinfo->radioinfo[rid].set=1;
|
||||
wtpinfo->radioinfo[rid].rid=rid;
|
||||
wtpinfo->radioinfo[rid].type=ntohl(*(uint32_t*)(msgelem+1));
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,45 +0,0 @@
|
||||
|
||||
/*
|
||||
This file is part of libcapwap.
|
||||
|
||||
libcapwap 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/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "capwap.h"
|
||||
#include "cw_log.h"
|
||||
|
||||
int cw_readelem_radio_operational_state(struct radioinfo * radioinfo, int type,uint8_t *msgelem, int len)
|
||||
{
|
||||
if (type != CW_ELEM_RADIO_OPERATIONAL_STATE)
|
||||
return 0;
|
||||
|
||||
if (len<3)
|
||||
return 0;
|
||||
|
||||
if (len!=3){
|
||||
cw_dbg(DBG_CW_RFC,"Radio operational state size != 3, RFC 5415");
|
||||
}
|
||||
|
||||
|
||||
int radioid = msgelem[0];
|
||||
radioid&=0x1f;
|
||||
radioinfo[radioid].state=msgelem[1];
|
||||
radioinfo[radioid].cause=msgelem[2];
|
||||
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief add wlan msg element implementation
|
||||
*/
|
||||
|
||||
#include "capwap.h"
|
||||
#include "capwap_80211.h"
|
||||
|
||||
#include "cwmsg.h"
|
||||
|
||||
#include "bstr.h"
|
||||
|
||||
|
||||
void cwmsg_addelem_80211_add_wlan(struct cwmsg *cwmsg,struct cwwlan *wlan)
|
||||
{
|
||||
|
||||
uint16_t capab=htons(wlan->capab);
|
||||
uint16_t keylen=htons(wlan->key_length);
|
||||
|
||||
cwmsg_vaddelem(cwmsg,CW_ELEM_80211_ADD_WLAN,
|
||||
&wlan->rid,1,
|
||||
&wlan->wid,1,
|
||||
&capab,2,
|
||||
&wlan->key_index,1,
|
||||
&wlan->key_status,1,
|
||||
&keylen,2,
|
||||
wlan->key,wlan->key_length,
|
||||
wlan->group_tsc,6,
|
||||
&wlan->qos,1,
|
||||
&wlan->auth_type,1,
|
||||
&wlan->mac_mode,1,
|
||||
&wlan->tunnel_mode,1,
|
||||
&wlan->suppress_ssid,1,
|
||||
bstr_data(wlan->ssid),bstr_len(wlan->ssid),
|
||||
NULL
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
|
||||
|
||||
#include "lwapp.h"
|
||||
|
||||
int lw_readelem_80211_wtp_wlan_radio_configuration(int elem_id,uint8_t *elem, int len,struct radioinfo *ri)
|
||||
{
|
||||
if (elem_id != LW_ELEM_80211_WLAN_RADIO_CONFIGURATION)
|
||||
return 1;
|
||||
|
||||
if (len<21){
|
||||
cw_dbg(DBG_ERR,"LWAPP Radio Cfg element too short, %d < 21",len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ri->rid = lw_get_byte(elem);
|
||||
ri->occupancy_limit = lw_get_word(elem+2);
|
||||
|
||||
bstr_replace(ri->bssid,bstr_create(elem+7,6);
|
||||
|
||||
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "capwap80211_types.h"
|
||||
#include "dot11.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int to_str(void *item,char *dst)
|
||||
{
|
||||
mbag_item_t *it= item;
|
||||
|
||||
uint8_t *data = (uint8_t*)it->data;
|
||||
int n=*data;
|
||||
data++;
|
||||
|
||||
char *d=dst;
|
||||
char *space="";
|
||||
int i;
|
||||
for (i=0; i<n; i++){
|
||||
int val = data[i];
|
||||
|
||||
|
||||
d+=sprintf(d,"%s",space);
|
||||
if (val & 0x80){
|
||||
d+=sprintf(d,"*");
|
||||
}
|
||||
|
||||
d+=sprintf(d,"%0.1f",dot11_rate2float(val & 0x7f));
|
||||
|
||||
space=" ";
|
||||
|
||||
}
|
||||
|
||||
return d-dst;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct mbag_item * from_str(const char *src)
|
||||
{
|
||||
mbag_item_t * item = mbag_item_new(CAPWAP80211_TYPE_RATESET);
|
||||
if (!item)
|
||||
return NULL;
|
||||
|
||||
if (strlen(src)==0)
|
||||
return 0;
|
||||
|
||||
uint8_t rates[64];
|
||||
int nrates =0;
|
||||
|
||||
const char *s = src;
|
||||
|
||||
while (*s!=0){
|
||||
while (*s==' ')
|
||||
s++;
|
||||
int m=0;
|
||||
if(*s=='*'){
|
||||
m=0x80;
|
||||
s++;
|
||||
}
|
||||
else{
|
||||
m=0;
|
||||
}
|
||||
|
||||
float val;
|
||||
int n=sscanf(s,"%f",&val);
|
||||
if (n!=1)
|
||||
break;
|
||||
|
||||
int r = dot11_float2rate(val) | m;
|
||||
|
||||
rates[nrates++]=r;
|
||||
|
||||
|
||||
while (*s!=0 && *s!=' ')
|
||||
s++;
|
||||
|
||||
}
|
||||
|
||||
uint8_t *data = malloc(nrates+1);
|
||||
*data=nrates;
|
||||
memcpy(data+1,rates,nrates);
|
||||
|
||||
item->data=data;
|
||||
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
static struct mbag_item * get(const uint8_t *src,int len)
|
||||
{
|
||||
|
||||
mbag_item_t * item = mbag_item_new(MBAG_BIN);
|
||||
if (!item)
|
||||
return NULL;
|
||||
|
||||
uint8_t *data = malloc(len+1);
|
||||
if (!data){
|
||||
free (item);
|
||||
return NULL;
|
||||
}
|
||||
*data=len;
|
||||
memcpy(data+1,src,len);
|
||||
item->data=data;
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
const struct mbag_typedef capwap80211_type_rateset = {
|
||||
.name = "Biary",
|
||||
.del = free,
|
||||
.from_str = from_str,
|
||||
.to_str = to_str,
|
||||
.get = get
|
||||
|
||||
};
|
@ -1,5 +0,0 @@
|
||||
const struct mbag_typedef mbag_type_bstr = {
|
||||
"bstr",free
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "sock.h"
|
||||
|
||||
|
||||
/*
|
||||
char * sock_get_primary_if(int family)
|
||||
{
|
||||
struct ifaddrs *ifap,*ifa;
|
||||
@ -53,4 +53,4 @@ char * sock_get_primary_if(int family)
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
@ -1,73 +0,0 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "wtpinfo.h"
|
||||
|
||||
#include "capwap.h"
|
||||
|
||||
#include "cw_util.h"
|
||||
#include "cw_log.h"
|
||||
|
||||
|
||||
|
||||
static void wtpinfo_readsubelems_wtp_board_data(struct wtpinfo * wtpinfo,uint8_t * msgelem,int len)
|
||||
{
|
||||
int i=0;
|
||||
uint32_t val;
|
||||
do {
|
||||
val = ntohl(*((uint32_t*)(msgelem+i)));
|
||||
int subtype= (val>>16)&0xffff;
|
||||
int sublen = val&0xffff;
|
||||
i+=4;
|
||||
if (sublen+i>len){
|
||||
cw_dbg(DBG_ELEM,"WTP Board data sub-element too long, type=%d,len=%d",subtype,sublen);
|
||||
return;
|
||||
}
|
||||
|
||||
cw_dbg(DBG_ELEM,"Reading WTP board data sub-element, type=%d, len=%d",subtype,sublen);
|
||||
|
||||
switch(subtype){
|
||||
case CWBOARDDATA_MODELNO:
|
||||
bstr_replace(&wtpinfo->model_no,bstr_create(msgelem+i,sublen));
|
||||
break;
|
||||
case CWBOARDDATA_SERIALNO:
|
||||
bstr_replace(&wtpinfo->serial_no,bstr_create(msgelem+i,sublen));
|
||||
break;
|
||||
case CWBOARDDATA_MACADDRESS:
|
||||
wtpinfo->macaddress=realloc(wtpinfo->macaddress,sublen);
|
||||
memcpy(wtpinfo->macaddress,msgelem+i,sublen);
|
||||
wtpinfo->macaddress_len=sublen;
|
||||
break;
|
||||
case CWBOARDDATA_BOARDID:
|
||||
bstr_replace(&wtpinfo->board_id,bstr_create(msgelem+i,sublen));
|
||||
break;
|
||||
case CWBOARDDATA_REVISION:
|
||||
bstr_replace(&wtpinfo->board_revision,bstr_create(msgelem+i,sublen));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
i+=sublen;
|
||||
|
||||
}while(i<len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int wtpinfo_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *msgelem, int len)
|
||||
{
|
||||
|
||||
if (type!=CAPWAP_ELEM_WTP_BOARD_DATA)
|
||||
return 0;
|
||||
if (len<4){
|
||||
cw_dbg(DBG_ELEM,"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d\n",type,len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
wtpinfo->vendor_id = ntohl(*((uint32_t*)msgelem));
|
||||
wtpinfo_readsubelems_wtp_board_data(wtpinfo,msgelem+4,len-4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user