2014-07-11 22:12:11 +02:00
|
|
|
/*
|
|
|
|
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 <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "capwap.h"
|
|
|
|
#include "sock.h"
|
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
int radioinfo_print(char * str, struct radioinfo * radioinfo)
|
2014-07-11 22:12:11 +02:00
|
|
|
{
|
2014-07-19 20:34:20 +02:00
|
|
|
char * s = str;
|
|
|
|
|
|
|
|
s += sprintf(s,"\t RID %d\n",radioinfo->rid);
|
|
|
|
s += sprintf(s,"\t Modes: ");
|
2014-07-11 22:12:11 +02:00
|
|
|
if(radioinfo->type & CWRADIO_TYPE_B){
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"B");
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
if(radioinfo->type & CWRADIO_TYPE_G){
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"G");
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(radioinfo->type & CWRADIO_TYPE_A){
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=printf(s,"A");
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(radioinfo->type & CWRADIO_TYPE_N){
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"N");
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"\n");
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
return s-str;
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
int wtpinfo_print(char *str, struct wtpinfo * wtpinfo)
|
2014-07-11 22:12:11 +02:00
|
|
|
{
|
2014-07-19 20:34:20 +02:00
|
|
|
char hstr[64];
|
|
|
|
|
|
|
|
char *s = str;
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf (s,"\tWTP Name: %s\n", (!wtpinfo->name ? (uint8_t*)"Not set" : wtpinfo->name) );
|
|
|
|
s+=sprintf (s,"\tLocation: %s\n", (!wtpinfo->location ? (uint8_t*)"Not set" : wtpinfo->location) );
|
|
|
|
|
|
|
|
s+=sprintf (s,"\tMAC Adress: ");
|
2014-07-11 22:12:11 +02:00
|
|
|
if (wtpinfo->macaddress){
|
2014-07-22 07:08:22 +02:00
|
|
|
sock_hwaddrtostr(wtpinfo->macaddress,wtpinfo->macaddress_len,hstr,":");
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"%s\n",hstr);
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"Not set\n");
|
|
|
|
|
|
|
|
sock_addrtostr((struct sockaddr*)&wtpinfo->local_ip,hstr,64);
|
|
|
|
s+=sprintf (s,"\tLocal IP: %s\n",hstr);
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf (s,"\tVendor ID: %d\n", wtpinfo->vendor_id );
|
|
|
|
s+=sprintf (s,"\tModel No.: %s\n", (!wtpinfo->model_no ? (uint8_t*)"Not set" : wtpinfo->model_no) );
|
|
|
|
s+=sprintf (s,"\tSerial No.: %s\n", (!wtpinfo->serial_no ? (uint8_t*)"Not set" : wtpinfo->serial_no) );
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf (s,"\tSoftware Version: %s\n", (!wtpinfo->software_version ? (uint8_t*)"Not set" : wtpinfo->software_version) );
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf (s,"\tMax Radios: %d\n",wtpinfo->max_radios);
|
|
|
|
s+=sprintf (s,"\tRadios in use: %d\n",wtpinfo->radios_in_use);
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf (s,"\tSession ID: ");
|
2014-07-11 22:12:11 +02:00
|
|
|
if (wtpinfo->session_id) {
|
|
|
|
int i;
|
|
|
|
for (i=0; i<wtpinfo->session_id_len; i++)
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"%02X",wtpinfo->session_id[i]);
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
else
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"Not set");
|
|
|
|
s+=sprintf(s,"\n");
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf (s,"\tMAC Type: ");
|
2014-07-11 22:12:11 +02:00
|
|
|
switch (wtpinfo->mac_type){
|
|
|
|
case WTP_MAC_TYPE_LOCAL:
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"local");
|
2014-07-11 22:12:11 +02:00
|
|
|
break;
|
|
|
|
case WTP_MAC_TYPE_SPLIT:
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"split");
|
2014-07-11 22:12:11 +02:00
|
|
|
break;
|
|
|
|
case WTP_MAC_TYPE_BOTH:
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"local, split");
|
2014-07-11 22:12:11 +02:00
|
|
|
break;
|
|
|
|
}
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"\n");
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf (s,"\tFrame Tunnel Mode: ");
|
|
|
|
s+=sprintf(s,"(%08X)",wtpinfo->frame_tunnel_mode);
|
2014-07-11 22:12:11 +02:00
|
|
|
char * c="";
|
|
|
|
if (wtpinfo->frame_tunnel_mode & WTP_FRAME_TUNNEL_MODE_N){
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=printf (s,"%snative",c);c=", ";
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (wtpinfo->frame_tunnel_mode & WTP_FRAME_TUNNEL_MODE_E){
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf (s,"%s802.3",c);c=", ";
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (wtpinfo->frame_tunnel_mode & WTP_FRAME_TUNNEL_MODE_L){
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf (s,"%sLocal bridging",c);c=", ";
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
if (wtpinfo->frame_tunnel_mode == 0)
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s," None");
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"\n");
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"\tRadios: %d\n",wtpinfo->max_radios);
|
2014-07-11 22:12:11 +02:00
|
|
|
int i;
|
2014-07-19 20:34:20 +02:00
|
|
|
|
|
|
|
char ristr[2048];
|
|
|
|
char *r = ristr;
|
2014-07-11 22:12:11 +02:00
|
|
|
for (i=0; i<wtpinfo->max_radios; i++){
|
2014-07-19 20:34:20 +02:00
|
|
|
r+=radioinfo_print(r,&wtpinfo->radioinfo[i+1]);
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
|
2014-07-19 20:34:20 +02:00
|
|
|
s+=sprintf(s,"%s",ristr);
|
|
|
|
|
|
|
|
return s-str;
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|