Removed som old code, more comments ...

FossilOrigin-Name: f7e91399da51dadbbb2565554a03af2d1b4623b79319a247f5a1f16de47d13c6
This commit is contained in:
7u83@mail.ru 2015-05-01 18:34:50 +00:00
parent e6e105d7a6
commit 4d8664a2eb
20 changed files with 148 additions and 171 deletions

View File

@ -350,7 +350,7 @@ void config_to_sql(struct conn *conn)
db_put_wtp_prop(wtp_id,-1,cwi->id,str);
}
else{
cw_log(LOG_ERR,"Can_'t converto to str");
cw_log(LOG_ERR,"Can't converto to str");
}
@ -456,7 +456,6 @@ static void wtpman_run(void *arg)
if ( conn->outgoing->count ) {
rc = cw_send_request(conn, CW_MSG_CONFIGURATION_UPDATE_REQUEST);
DBGX("CU RC: %d",rc);
DBGX("MAV MERGE","");
mavl_merge(conn->config,conn->outgoing);

View File

@ -28,7 +28,7 @@ struct wtpman{
uint8_t * session_id;
uint8_t wtp_mactype;
struct wtpinfo wtpinfo;
//struct wtpinfo wtpinfo;
int socklistindex;

View File

@ -49,8 +49,9 @@ LOGOBJS=log.o \
WTPINFOOBJS =\
wtpinfo_set_location.o \
wtpinfo_print.o
#wtpinfo_print.o
#wtpinfo_set_location.o \
wtpinfo_lwreadelem_wtp_descriptor.o \
UTILOBJS= \
cw_setstr.o \
@ -86,7 +87,6 @@ LWAPPOBJS = \
lw_checksum.o \
lw_put_ac_descriptor.o \
lw_put_cisco_path_mtu.o \
lw_put_80211_wtp_wlan_radio_configuration.o \
lw_readelem_vendor_specific.o \
lw_elem_id_to_str.o \
lw_msg_id_to_str.o \
@ -94,6 +94,7 @@ LWAPPOBJS = \
lw_put_sockaddr.o \
lw_put_image_data.o
#lw_put_80211_wtp_wlan_radio_configuration.o \
# lw_readelem_wtp_name.o \
lw_readelem_wtp_board_data.o \
cw_log_debug.o \
@ -112,7 +113,6 @@ LWAPPCISCOOBJS = \
CAPWAPOBJS= \
aciplist.o \
lwmsg_init.o \
wtpinfo_lwreadelem_wtp_descriptor.o \
hdr_print.o \
cw_cisco_id_to_str.o\
cw_strlist_get_str.o \
@ -233,6 +233,7 @@ CWACTION=action.o \
cw_put_image_data.o \
cisco.o \
mbag.o\
mbag_type_word.o\
radio.o \
cw_out_radio_info.o \
capwap_items.o \

View File

@ -337,7 +337,7 @@ CW_MSG_MAXMSG = 26
#define CW_SUBELEM_AC_SOFTWARE_VERSION 5
#include "wtpinfo.h"
//#include "wtpinfo.h"
//#include "acinfo.h"
/* Frame tunnnel mode bits */
@ -348,7 +348,7 @@ CW_MSG_MAXMSG = 26
#include "radioinfo.h"
#include "wtpinfo.h"
//#include "wtpinfo.h"
#define CW_DISCOVERY_TYPE_UNKNOWN 0
@ -360,8 +360,8 @@ CW_MSG_MAXMSG = 26
/* wtpinfo methods */
extern void wtpinfo_set_location(struct wtpinfo *wtpinfo, uint8_t * str, int len);
extern int wtpinfo_set_radioinfo(struct wtpinfo *wtpinfo, uint8_t * msgelem, int len);
//extern void wtpinfo_set_location(struct wtpinfo *wtpinfo, uint8_t * str, int len);
//extern int wtpinfo_set_radioinfo(struct wtpinfo *wtpinfo, uint8_t * msgelem, int len);
/* wtp mac types */
@ -467,8 +467,8 @@ extern void cwsend_join_response(struct conn *conn, int seqnum, int rc,
*/
//extern void cwread_discovery_request(struct wtpinfo *wtpinfo, uint8_t * msg, int len);
extern void process_join_request(struct wtpinfo *wtpinfo, uint8_t * msg, int len);
extern void process_conf_status_request(struct wtpinfo *wtpinfo, uint8_t * msg, int len);
//extern void process_join_request(struct wtpinfo *wtpinfo, uint8_t * msg, int len);
//extern void process_conf_status_request(struct wtpinfo *wtpinfo, uint8_t * msg, int len);
/*
extern void cwread_discovery_response(struct ac_info *acinfo, uint8_t * msg, int len);
@ -497,8 +497,8 @@ extern int cw_readelem_ecn_support(uint8_t * ecn_support, int type, uint8_t * ms
extern int cw_readelem_maximum_message_length(uint16_t * dst, int type, uint8_t * msgelem,
int len);
extern int cw_readelem_ac_name(uint8_t ** dst, int type, uint8_t * msgelem, int len);
extern int cw_readelem_wtp_reboot_statistics(struct wtp_reboot_statistics *s, int type,
uint8_t * msgelem, int len);
//extern int cw_readelem_wtp_reboot_statistics(struct wtp_reboot_statistics *s, int type,
// uint8_t * msgelem, int len);
extern int cw_readelem_cw_local_ip_addr(struct sockaddr *local_ip, int type,
uint8_t * msgelem, int len);
//extern int cw_readelem_radio_administrative_state(struct radioinfo *radioinfo, int type,
@ -895,6 +895,7 @@ static inline int cw_addelem_radio_operational_state(uint8_t * dst, struct radio
cw_put_data(dst+10,data,len))
*/
/*
extern int cw_addelem_vendor_specific_payload(uint8_t * dst, uint32_t vendorid,
uint16_t elemid, uint8_t * data,
uint16_t len);
@ -909,7 +910,7 @@ extern void cw_prepare_change_state_event_request(struct conn *conn,
extern int cw_send_configuration_update_response(struct conn *conn, int seqnum,
struct radioinfo *radioinfo);
*/
#define cw_addelem_ac_name(dst,name) \
cw_addelem(dst,CW_ELEM_AC_NAME,name,strlen((char*)(name)))

View File

@ -128,11 +128,11 @@ int cw_out_cisco_ap_timesync(struct conn *conn,struct cw_action_out * a,uint8_t
* @param name RAD name, zero terminated
* @return number of bytes put
*/
static inline int cw_addelem_cisco_rad_name(uint8_t * dst, uint8_t * name)
{
return cw_addelem_vendor_specific_payload(dst, CW_VENDOR_ID_CISCO, CW_CISCO_RAD_NAME, name,
strlen((char *) name));
}
//static inline int cw_addelem_cisco_rad_name(uint8_t * dst, uint8_t * name)
//{
// return cw_addelem_vendor_specific_payload(dst, CW_VENDOR_ID_CISCO, CW_CISCO_RAD_NAME, name,
// strlen((char *) name));
//}
/**
* Add a Cisco Group Name message element to buffer
@ -140,12 +140,14 @@ static inline int cw_addelem_cisco_rad_name(uint8_t * dst, uint8_t * name)
* @param name Group name, zero terminated
* @return number of bytes put
*/
/*
static inline int cw_addelem_cisco_ap_group_name(uint8_t * dst, uint8_t * name){
return cw_addelem_vendor_specific_payload(dst, CW_VENDOR_ID_CISCO, CW_CISCO_AP_GROUP_NAME, name,
strlen((char *) name));
}
*/
static inline int cw_addelem_cisco_ap_regulatory_domain(uint8_t *dst, struct radioinfo * ri){
uint8_t *d=dst+10;

View File

@ -98,14 +98,17 @@ struct cw_itemdef capwap_itemdefs[] = {
{CW_ITEM_WTP_NAME,CW_ITEM_NONE,MBAG_STR},
{CW_ITEM_LOCATION_DATA,CW_ITEM_NONE,MBAG_STR},
{CW_ITEM_WTP_GROUP_NAME,CW_ITEM_NONE,MBAG_STR},
{CW_ITEM_WTP_HARDWARE_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR},
{CW_ITEM_WTP_SOFTWARE_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR},
{CW_ITEM_WTP_GROUP_NAME,CW_ITEM_NONE,MBAG_STR},
{CW_ITEM_WTP_BOARD_DATA,CW_ITEM_NONE,MBAG_MBAG},
{CW_ITEM_WTP_BOARD_DATA,CW_ITEM_WTP_BOARD_VENDOR,MBAG_VENDORSTR},
{CW_ITEM_AP_MODE_AND_TYPE,CW_ITEM_NONE,MBAG_WORD},
{CW_ITEM_WTP_BOARD_DATA,CW_ITEM_WTP_BOARD_VENDOR},
{CW_ITEM_NONE}

View File

@ -31,7 +31,7 @@
#include "fragman.h"
#include "cwmsg.h"
#include "wtpinfo.h"
//#include "wtpinfo.h"
#include "action.h"
@ -240,7 +240,7 @@ struct cwimage_data;
extern void conn_prepare_request(struct conn *conn, int type);
extern int conn_prepare_image_data_request(struct conn *conn, struct cwimage_data *,
struct image_identifier *id);
extern void conn_detect_capwap(struct conn *conn, struct wtpinfo *wtpinfo);
//extern void conn_detect_capwap(struct conn *conn, struct wtpinfo *wtpinfo);
struct cwrmsg *conn_send_request(struct conn *conn);
struct cwrmsg *conn_wait_for_message(struct conn *conn, time_t timer);

View File

@ -21,7 +21,6 @@
#include <string.h>
#include "wtpinfo.h"
#include "capwap.h"
#include "capwap_items.h"

View File

@ -20,7 +20,6 @@
#include "capwap.h"
#include "capwap_items.h"
#include "wtpinfo.h"
#include "cw_util.h"
#include "dbg.h"

View File

@ -63,8 +63,101 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout)
return -1;
}
DBGX("Found am %p %p",am,am->item_id);
DBGX("Teh ELEM ID found '%s'",am->item_id);
cw_action_out_t *ae;
int len = 0;
while(NULL != (ae=avliter_next(&i))) {
DBGX("Put %d %i %p\n",ae->msg_id,ae->elem_id,ae->item_id);
DBGX("Elem ID %s",ae->item_id);
if ( ae->item_id ) {
DBGX("Item ID: %s %p",ae->item_id,CW_ITEM_NONE);
}
if (ae->msg_id != as.msg_id) {
/* Element is from next msg, close action */
break;
}
if (ae->out) {
int l=0;
l= ae->out(conn, ae, dst+len);
len +=l;
// cw_dbg_elem_colored(DBG_ELEM, conn, ae->msg_id, ae->elem_id,
// dst+len-l,l);
}
//cw_dbg_elem_colored(DBG_ELEM,"Adding element %d to msg %d, len = %d",ae->msg_id,ae->elem_id,l);
};
cw_set_msg_elems_len(msgptr, len);
if (as.msg_id & 1) {
/* It's a request, so we have to set seqnum */
int s = conn_get_next_seqnum(conn);
cw_set_msg_seqnum(msgptr,s);
// printf("Set seqnum to : %d\n",s);
}
return len;
}
/**
* Put a message to a buffer
* This functions assumes, that a message header with is
* alread initilaized in buffer
* Message alements are taken fom actiondef in #conn->action
*/
int cw_put_custum_msg(struct conn *conn, uint8_t * rawout, mbag_t elems)
{
/* rawout is already initialized, so we can get
msg type from buffer */
uint8_t *msgptr = rawout + cw_get_hdr_msg_offset(rawout);
int msg_id = cw_get_msg_type(msgptr);
MAVLITER_DEFINE(it,elems);
mavliter_foreach(&it){
mavliter_get(&it);
cw_action_out_t as;
as.item_id = CW_ITEM_NONE;
as.vendor_id = 0;
}
/* create search paramaters */
cw_action_out_t as;
as.item_id = CW_ITEM_NONE;
as.vendor_id = 0;
uint8_t *dst = msgptr+8;
DEFINE_AVLITER(i,conn->actions->out);
cw_action_out_t *am;
if (! (am=avliter_seek(&i,&as))){
cw_log(LOG_ERR,"Error: Can't create message of type %d (%s) - no definition found.",
as.msg_id,cw_strmsg(as.msg_id));
return -1;
}
cw_action_out_t *ae;
int len = 0;

View File

@ -5,7 +5,7 @@
#include "radioinfo.h"
//#include "acinfo.h"
#include "wtpinfo.h"
//#include "wtpinfo.h"
struct cwmsg{
uint8_t * buffer;

View File

@ -27,7 +27,7 @@
#include "bstr.h"
#include "wtpinfo.h"
//#include "wtpinfo.h"
@ -261,11 +261,11 @@ extern int lw_put_cisco_path_mtu(uint8_t *dst, uint16_t max, uint16_t padding);
/* function proto types */
extern uint16_t lw_checksum(uint8_t *d,int len);
extern int lw_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *msgelem, int len);
//extern int lw_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *msgelem, int len);
extern int lw_readelem_wtp_name(bstr_t * dst, int type, uint8_t * msgelem, int len);
extern int lw_put_80211_wtp_wlan_radio_configuration(uint8_t*dst,struct radioinfo *ri);
//extern int lw_put_80211_wtp_wlan_radio_configuration(uint8_t*dst,struct radioinfo *ri);
extern const char * lw_vendor_id_to_str(uint32_t vendor_id);
extern const char * lw_elem_id_to_str(int elem_id);

View File

@ -1,7 +1,12 @@
#include "mbag.h"
#include "capwap.h"
#include "format.h"
/**
* @file
* @MBAG functions
* @addtogroup MbagFunctions
* @{
*/
static int mbag_bstr16str(void *item,char *dst)
{
@ -47,9 +52,11 @@ const struct mbag_typedef mbag_type_byte = {
"byte",NULL
};
/*
const struct mbag_typedef mbag_type_word = {
"word",NULL
};
*/
const struct mbag_typedef mbag_type_dword = {
"dword",NULL
@ -214,3 +221,4 @@ struct mbag_item *strmbag_item_create(mbag_t s, char *name)
*/
/**@}*/

View File

@ -118,7 +118,7 @@ int cw_send_request(struct conn *conn,int msg_id)
// XXX find a better name for this function
int cw_send_request_2()
int cw_send_custom_request_2(struct conn *conn,int msg_id)
{

View File

@ -9,13 +9,16 @@
#include "stdio.h"
/** Key/String pair, used for string tables. */
/**
*Key/String pair, used for string tables,
*to display message element names and so on...
*/
struct cw_str {
int id;
const char *str;
};
/** Stopper, indicates the laste element in a strlist */
/** Stopper, indicates the last element in a strlist */
#define CW_STR_STOP 0xffffffff

View File

@ -1,128 +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/>.
*/
#ifndef __WTPINFO_H
#define __WTPINFO_H
#include <stdint.h>
#include <sys/socket.h>
#include "radioinfo.h"
#include "bstr.h"
struct wtp_reboot_statistics{
int reboot_count;
int ac_initiated_count;
int link_failure_count;
int sw_failure_count;
int hw_failure_count;
int other_failure_count;
int unknown_failure_count;
int last_failure_type;
};
/* structure to hold info about a wtp */
struct wtpinfo{
uint8_t *ac_name;
uint8_t *name;
uint8_t *group;
uint8_t * location;
uint32_t vendor_id;
uint8_t* model_no;
uint8_t* serial_no;
bstr_t board_id;
bstr_t board_revision;
uint16_t statistics_timer;
int max_radios;
int radios_in_use;
uint8_t frame_tunnel_mode;
uint8_t mac_type;
bstr_t session_id;
struct radioinfo radioinfo[31];
uint8_t * hardware_version;
int hardware_version_len;
uint32_t hardware_vendor_id;
uint8_t * software_version;
int software_version_len;
uint32_t software_vendor_id;
uint8_t * bootloader_version;
int bootloader_version_len;
uint32_t bootloader_vendor_id;
uint16_t encryption_cap;
/** Base MAC address */
bstr_t base_mac;
uint8_t * macaddress;
int macaddress_len;
uint8_t ecn_support;
uint16_t max_msg_len;
uint8_t discovery_type;
struct sockaddr_storage local_ip;
struct wtp_reboot_statistics reboot_statistics;
};
extern int wtpinfo_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *msgelem, int len);
extern int wtpinfo_readelem_wtp_mac_type(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len);
extern int wtpinfo_readelem_wtp_radio_info(struct wtpinfo * wtpinfo,int type,uint8_t *msgelem, int len);
extern int wtpinfo_readelem_wtp_descriptor(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len);
extern int wtpinfo_readelem_wtp_frame_tunnel_mode(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len);
extern int wtpinfo_readelem_discovery_type(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len);
extern int wtpinfo_readelem_location_data(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len);
extern int wtpinfo_readelem_wtp_name(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len);
extern int wtpinfo_readelem_session_id(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len);
//extern int wtpinfo_readelem_ecn_support(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len);
extern int wtpinfo_readelem_cw_local_ip_addr(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len);
extern int wtpinfo_print(char *str, struct wtpinfo * wtpinfo);
#define wtpinfo_readelem_ecn_support(wtpinfo,type,msg,len) cw_readelem_ecn_support(&wtpinfo->ecn_support,type,msg,len)
extern int wtpinfo_lwreadelem_wtp_descriptor(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len);
#define wtpinfo_readelem_ac_name(wtpinfo,type,msg,len) cw_readelem_ac_name(&wtpinfo->ac_name,type,msg,len)
#endif

View File

@ -11,6 +11,7 @@
},
"bssid":"",
"capwap_timers":"2590",
"cisco_ap_mode_and_type":"516",
"idle_timeout":"300",
"location_data":"Germany",
"radios":{
@ -35,5 +36,5 @@
"wtp_frame_tunnel_mode":"4",
"wtp_group_name":"tobias",
"wtp_mac_type":"1",
"wtp_name":"Kaffe-Point"
"wtp_name":"hihihi"
}

View File

@ -27,7 +27,6 @@
#include "capwap/capwap.h"
#include "capwap/capwap_items.h"
#include "capwap/log.h"
#include "capwap/wtpinfo.h"
#include "capwap/sock.h"
#include "capwap/cw_util.h"
#include "capwap/aciplist.h"

View File

@ -2,7 +2,6 @@
#include <string.h>
#include "capwap/wtpinfo.h"
#include "capwap/conn.h"
#include "capwap/capwap_80211.h"
#include "capwap/log.h"

View File

@ -1,8 +1,6 @@
#ifndef __WTP_INTERFACE_H
#define __WTP_INTERFACE_H
#include "capwap/wtpinfo.h"
extern struct wtpinfo * get_wtpinfo();
extern struct conn * get_conn();
#endif