From e4753145f6b84ff0e7251a2e1b1723e3aeceb086 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Mon, 13 Apr 2015 08:34:01 +0000 Subject: [PATCH] Not needed anymore. FossilOrigin-Name: 91d7440258eb83e19f8ad57a6102ce7c61da2026efa03893c2e419834a888711 --- src/capwap/acinfo.c | 186 ------------------- src/capwap/wtpinfo_readelem_wtp_descriptor.c | 126 ------------- 2 files changed, 312 deletions(-) delete mode 100644 src/capwap/acinfo.c delete mode 100644 src/capwap/wtpinfo_readelem_wtp_descriptor.c diff --git a/src/capwap/acinfo.c b/src/capwap/acinfo.c deleted file mode 100644 index 10475363..00000000 --- a/src/capwap/acinfo.c +++ /dev/null @@ -1,186 +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 . - -*/ - -#include -#include -#include -#include - -#include "capwap.h" -#include "log.h" -#include "cw_util.h" - -#include "acinfo.h" - -#include "sock.h" - - -/* -int acinfo_readelem_ac_name(struct ac_info * acinfo,int type, uint8_t *msgelem, int len) -{ - if (type != CWMSGELEM_AC_NAME) - return 0; - cw_setstr(&acinfo->ac_name,msgelem,len); - return 1; -} -*/ - - -int acinfo_readelem_ac_descriptor(struct ac_info * acinfo,int type, uint8_t *msgelem, int len) -{ - if (type != CW_ELEM_AC_DESCRIPTOR) - return 0; - - if (len<12) - return -1; - - uint32_t val; - - /* read stations and limit */ - val = ntohl(*((uint32_t*)msgelem)); - acinfo->stations = val>>16; - acinfo->limit = val&0xffff; - - - /* read active wtps and max wtps */ - val = ntohl(*((uint32_t*)(msgelem+4))); - acinfo->active_wtps = val>>16; - acinfo->max_wtps = val&0xffff; - - /* read active wtps and max wtps */ - val = ntohl(*((uint32_t*)(msgelem+8))); - acinfo->security = val >>24; - acinfo->rmac= (val >> 16)&0xff; - acinfo->dtls_policy=val&0xf; - - int sub=12; - int sublen; - - -printf("Now trying sublens\n"); - - while (sub>16; -printf("sublen type = %d\n",subtype); - - if (sub+sublen>len) - return -1; - - - switch (subtype){ - case 4: - cw_setstr(&acinfo->hardware_version,msgelem+sub,sublen); - break; - case 5: - cw_setstr(&acinfo->software_version,msgelem+sub,sublen); - break; - } - sub+=sublen; - - } - - - return 1; -} - - - - -int acinfo_readelem_ctrl_ip_addr(struct ac_info * acinfo, int type, uint8_t*msgelem,int len) -{ - -/* - switch (type){ - case CW_ELEM_CONTROL_IPV4_ADDRESS: - { - if (len!=6) - return -1; - - if (!acinfo->aciplist) - return 1; - - - ACIP * acip = malloc(sizeof(ACIP)); - if (!acip) { - cw_log(LOG_ERR,"Can't allocate memory for acv4ip: %s",strerror(errno)); - return 1; - } - - struct sockaddr_in addr; - memcpy(&addr.sin_addr,msgelem,4); - addr.sin_family=AF_INET; - memcpy(&acip->ip,&addr,sizeof(addr)); - - acip->wtp_count = ntohs( * ((uint16_t*)(msgelem+4))); - aciplist_add(acinfo->aciplist,acip); - -// printf ("Read AC IP Elem %s\n",sock_addr2str(&acip->ip)); -// printf ("WTP COUNT HERE %d\n",acip->wtp_count); - - return 1; - - } - case CW_ELEM_CONTROL_IPV6_ADDRESS: - { - if (len!=18) - return -1; - - if (!acinfo->aciplist) - return 1; - - - ACIP * acip = malloc(sizeof(ACIP)); - if (!acip) { - cw_log(LOG_ERR,"Can't allocate memory for acv4ip: %s",strerror(errno)); - return 1; - } - - struct sockaddr_in6 addr; - memcpy(&addr.sin6_addr,msgelem,16); - addr.sin6_family=AF_INET6; - memcpy(&acip->ip,&addr,sizeof(addr)); - acip->wtp_count = ntohs( * ((uint16_t*)(msgelem+16))); - - aciplist_add(acinfo->aciplist,acip); - - return 1; - } - - } - - return 0; -*/ - -} - - - diff --git a/src/capwap/wtpinfo_readelem_wtp_descriptor.c b/src/capwap/wtpinfo_readelem_wtp_descriptor.c deleted file mode 100644 index fe2f9f1c..00000000 --- a/src/capwap/wtpinfo_readelem_wtp_descriptor.c +++ /dev/null @@ -1,126 +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 . - -*/ - - -#include "capwap.h" -#include "wtpinfo.h" - -#include "cw_util.h" -#include "cw_log.h" - - - - -static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len, int capwap_mode) -{ - if (type != CW_ELEM_WTP_DESCRIPTOR) - return 0; - - if (len<6) - return -1; - - wtpinfo->max_radios=*msgelem; - wtpinfo->radios_in_use=*(msgelem+1); - - int ncrypt; - int i=2; - - switch (capwap_mode){ - case CWMODE_CISCO: - wtpinfo->encryption_cap = ntohs( *((uint16_t*)(msgelem+2)) ); - i=4; - break; - default: - { - ncrypt= *(msgelem+2); - if (ncrypt == 0 ){ - /* non-conform */ - cw_dbg(DBG_CW_RFC,"Non-standard-conform WTP descriptor detected (See RFC 5415)"); - i=3; - } - else - i=ncrypt*3+3; - - } - - - - } - - - do { - if (i+8>len) - { - cw_dbg(DBG_MSG_ERR,"WTP descriptor subelement to long, length=%d>%d",i+8,len); - return -1; - } - - uint32_t vendor_id=ntohl(*((uint32_t*)(msgelem+i))); - - uint32_t val = ntohl(*((uint32_t*)(msgelem+i+4))); - int subtype= (val>>16)&0xffff; - int sublen = val&0xffff; - i+=8; - - if (sublen+i>len){ - cw_dbg(DBG_MSG_ERR,"WTP descriptor subelement too long, length = %d",sublen); - return -1; - } - - cw_dbg(DBG_MSG,"Reading WTP descriptor subelement, type=%d,len=%d",subtype,sublen); - - switch(subtype){ - case CW_SUBELEM_WTP_HARDWARE_VERSION: - wtpinfo->hardware_vendor_id=vendor_id; - cw_setstr(&wtpinfo->hardware_version,msgelem+i,sublen); - wtpinfo->hardware_version_len=sublen; - break; - case CW_SUBELEM_WTP_SOFTWARE_VERSION: - wtpinfo->software_vendor_id=vendor_id; - - bstr_replace(&wtpinfo->software_version,bstr_create(msgelem+i,sublen)); - wtpinfo->software_version_len=sublen; - break; - case CW_SUBELEM_WTP_BOOTLOADER_VERSION: - wtpinfo->bootloader_vendor_id=vendor_id; - cw_setstr(&wtpinfo->bootloader_version,msgelem+i,sublen); - wtpinfo->bootloader_version_len=sublen; - break; - default: - cw_dbg(DBG_MSG_ERR,"Unknown WTP descriptor subelement, type = %d",subtype); - break; - } - i+=sublen; - - }while(i