Compare commits
	
		
			32 Commits
		
	
	
		
			6dc8d80102
			...
			typeless
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 34f5589a17 | |||
| e3ccf2a93c | |||
| 276a282369 | |||
| d127263d80 | |||
| c3b921292b | |||
| 744e1b55c2 | |||
| 2098cabad1 | |||
| 49905b2aa0 | |||
| e571a27c75 | |||
| a59a25baa5 | |||
| 57890907ae | |||
| 86956ff1ce | |||
| 50d11c0c62 | |||
| 2316a1125f | |||
| 3ee1d725a5 | |||
| d94239679d | |||
| 23360febfa | |||
| 05963edc98 | |||
| 815c627e14 | |||
| 06822df49a | |||
| 19e38b332f | |||
| 65153617b7 | |||
| 226c4b832a | |||
| 196f56b988 | |||
| aa3d83d8a4 | |||
| ee16f3794f | |||
| 6405a937d2 | |||
| c7a934c64b | |||
| e26f9dbfd8 | |||
| c422200a9a | |||
| 301298dcdc | |||
| d4c80b5ebb | 
							
								
								
									
										39
									
								
								INSTALL
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								INSTALL
									
									
									
									
									
								
							@ -1,38 +1,35 @@
 | 
			
		||||
pre-requisites to build actube
 | 
			
		||||
==============================
 | 
			
		||||
 | 
			
		||||
Compile 
 | 
			
		||||
=======
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
On FreeBSD 10.2
 | 
			
		||||
FreeBSD 
 | 
			
		||||
----------------
 | 
			
		||||
 | 
			
		||||
pkg install libconfuse
 | 
			
		||||
pkg install wget
 | 
			
		||||
pkg install libnettle
 | 
			
		||||
pkg install nettle
 | 
			
		||||
cd src/contrib
 | 
			
		||||
sh install_libmavl
 | 
			
		||||
cd ..
 | 
			
		||||
make
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Ubuntu 14.04
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
Ubuntu
 | 
			
		||||
------
 | 
			
		||||
 | 
			
		||||
apt-get install build-essential clang
 | 
			
		||||
apt-get install nettle-dev
 | 
			
		||||
apt-get install libgnutls28-dev
 | 
			
		||||
apt-get install libssl-dev
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
pre-requisites to build wtp
 | 
			
		||||
===========================
 | 
			
		||||
 | 
			
		||||
Ubuntu 14.04
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
apt-get install cmake
 | 
			
		||||
apt-get install libnl-genl-3-dev
 | 
			
		||||
apt install libedit-dev
 | 
			
		||||
apt install bmake
 | 
			
		||||
cd src/contrib
 | 
			
		||||
sudo ./install_libuci.sh
 | 
			
		||||
sh install_libmavl
 | 
			
		||||
cd ..
 | 
			
		||||
bmake
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,13 +5,15 @@ include ../Defs.mak
 | 
			
		||||
OBJS = \
 | 
			
		||||
	wtplist.o wtpman.o conf.o ac_main.o \
 | 
			
		||||
	dataman.o \
 | 
			
		||||
	ac_interface.o \
 | 
			
		||||
	socklist.o \
 | 
			
		||||
	discovery_cache.o\
 | 
			
		||||
	shell.o\
 | 
			
		||||
	rpc.o\
 | 
			
		||||
	statemachine.o\
 | 
			
		||||
 | 
			
		||||
ACTOBJS = \
 | 
			
		||||
	act.o 
 | 
			
		||||
 | 
			
		||||
ACTPRG=act
 | 
			
		||||
PRG=actube
 | 
			
		||||
LIBPATH=-L../../lib/$(KERNEL)/$(ARCH)/ -L/usr/local/lib -L/usr/lib 
 | 
			
		||||
 | 
			
		||||
@ -23,22 +25,33 @@ LIBS+=-lc
 | 
			
		||||
LIBS+=-lnettle
 | 
			
		||||
LIBS+=-lssl
 | 
			
		||||
LIBS+=-lcrypto
 | 
			
		||||
LIBS+=-ledit
 | 
			
		||||
 | 
			
		||||
INCL_DIRS=-I../ -I/usr/local/include -I./ -I../../include
 | 
			
		||||
#FLAGS=-DWITH_IPV6 -DWITH_OPENSSL -DSYS_ARCH="$(ARCH)" -DSYS_ARCH="XXX"
 | 
			
		||||
FLAGS=-DWITH_IPV6 -DUSE_OPENSSL -DSYS_ARCH='"$(ARCH)"'
 | 
			
		||||
FLAGS=-DWITH_IPV6 -DUSE_OPENSSL -DSYS_ARCH='"$(KERNEL)/$(ARCH)"'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.c.o:
 | 
			
		||||
	@echo "  $(CC) "$<
 | 
			
		||||
	$(CC) $(FLAGS) $(INCL_DIRS) -c $(CFLAGS) $< -o $@
 | 
			
		||||
 | 
			
		||||
all: $(PRG) $(ACTPRG)
 | 
			
		||||
 | 
			
		||||
$(PRG): $(OBJS) 
 | 
			
		||||
#	$(CC) $(AC_OBJS) ../mod/modload_ac.o -o $(AC_NAME) $(LDFLAGS) $(LIBS)
 | 
			
		||||
	$(CC) $(OBJS) -o $(PRG) $(LIBPATH) $(LDFLAGS) $(LIBS) 
 | 
			
		||||
 | 
			
		||||
$(ACTPRG): $(ACTOBJS)
 | 
			
		||||
	$(CC) $(ACTOBJS) -o $(ACTPRG) $(LIBPATH) $(LDFLAGS) $(LIBS) -ledit 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clean: 
 | 
			
		||||
	rm  -f $(PRG) $(OBJS)
 | 
			
		||||
	rm -f $(PRG) $(OBJS)
 | 
			
		||||
	rm -f $(ACTPRG) $(ACTOBJS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,9 +1,7 @@
 | 
			
		||||
#ifndef __ACTUBE_AC_H
 | 
			
		||||
#define __ACTUBE_AC_H
 | 
			
		||||
 | 
			
		||||
#include "mavl.h"
 | 
			
		||||
#include "cw/mavltypes.h"
 | 
			
		||||
 | 
			
		||||
#include "cw/cfg.h"
 | 
			
		||||
 | 
			
		||||
extern struct ac_status ac_global_status;
 | 
			
		||||
 | 
			
		||||
@ -19,7 +17,8 @@ enum {
 | 
			
		||||
	AC_PROTO_UNKNOWN
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void start_shell();
 | 
			
		||||
int start_rpc(cw_Cfg_t *global_cfg);
 | 
			
		||||
int test_shell();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -1,103 +0,0 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
 | 
			
		||||
#include "cw/sock.h"
 | 
			
		||||
 | 
			
		||||
#include "socklist.h"
 | 
			
		||||
#include "conf.h"
 | 
			
		||||
 | 
			
		||||
#include "cw/capwap.h"
 | 
			
		||||
/*//#include "cw/capwap_80211.h"*/
 | 
			
		||||
/*#include "cw/aciplist.h"*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
int pr(void *x,void *y){
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
struct radioinfo * get_radioinfo()
 | 
			
		||||
{
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
struct ac_info * get_acinfo()
 | 
			
		||||
{
 | 
			
		||||
	
 | 
			
		||||
	struct ac_info * acinfo;
 | 
			
		||||
	acinfo = malloc(sizeof(struct ac_info));
 | 
			
		||||
	if(!acinfo)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	memset(acinfo,0,sizeof(struct ac_info));
 | 
			
		||||
	acinfo->ac_name=conf_acname;
 | 
			
		||||
 | 
			
		||||
	acinfo->stations=10;
 | 
			
		||||
	acinfo->limit=10000;
 | 
			
		||||
	acinfo->active_wtps=10;
 | 
			
		||||
	acinfo->max_wtps=conf_max_wtps;
 | 
			
		||||
	acinfo->rmac=1; 	
 | 
			
		||||
 | 
			
		||||
	acinfo->vendor_id=conf_vendor_id;
 | 
			
		||||
 | 
			
		||||
	acinfo->hardware_version=(uint8_t*)conf_hardware_version;
 | 
			
		||||
	acinfo->software_version=(uint8_t*)conf_software_version;
 | 
			
		||||
	acinfo->cisco_hardware_version=(uint8_t*)conf_cisco_hardware_version;
 | 
			
		||||
	acinfo->cisco_software_version=(uint8_t*)conf_cisco_software_version;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (conf_dtls_psk)
 | 
			
		||||
		acinfo->security|=AC_SECURITY_S;
 | 
			
		||||
	if (conf_sslkeyfilename && conf_sslcertfilename)
 | 
			
		||||
		acinfo->security|=AC_SECURITY_X;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//	acinfo->dtls_policy = AC_DTLS_POLICY_C | AC_DTLS_POLICY_D ;
 | 
			
		||||
//	acinfo->ac_ips = conf_ac_ips;
 | 
			
		||||
//	acinfo->ac_ips_len=conf_ac_ips_len;
 | 
			
		||||
 | 
			
		||||
//	acinfo->salist=conf_salist;
 | 
			
		||||
//	acinfo->salist_len=conf_salist_len;
 | 
			
		||||
 | 
			
		||||
//	acinfo->salist = conf_ac_ips;
 | 
			
		||||
//	acinfo->salist_len = conf_ac_ips_len;
 | 
			
		||||
 | 
			
		||||
	//acinfo->aciplist=get_aciplist();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	aciplist_foreach(acinfo->aciplist,pr,NULL);
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
	int i;
 | 
			
		||||
	for (i=1; i<=4; i++){
 | 
			
		||||
		acinfo->radioinfos[i].type= 
 | 
			
		||||
			CW_80211_RADIO_TYPE_B |
 | 
			
		||||
			CW_80211_RADIO_TYPE_A | 
 | 
			
		||||
			CW_80211_RADIO_TYPE_G | 
 | 
			
		||||
			CW_80211_RADIO_TYPE_N;
 | 
			
		||||
//		acinfo->radioinfos[i].type=0xffffffff; 
 | 
			
		||||
		acinfo->radioinfos[i].rid=i;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	return acinfo;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
get_join_result()
 | 
			
		||||
{
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
@ -33,7 +33,6 @@
 | 
			
		||||
 | 
			
		||||
#include "socklist.h"
 | 
			
		||||
 | 
			
		||||
#include "db.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "cw/capwap_crypto.h"
 | 
			
		||||
@ -53,8 +52,34 @@ int ac_run(cw_Cfg_t * cfg);
 | 
			
		||||
#include "statemachine.h"
 | 
			
		||||
 | 
			
		||||
#include <getopt.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/un.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
void tshell_run(int fd)
 | 
			
		||||
{
 | 
			
		||||
	int rc;
 | 
			
		||||
	printf("listening\n");
 | 
			
		||||
	rc = listen(fd,5);
 | 
			
		||||
	printf("listen returned %d\n",rc);
 | 
			
		||||
	clientsock = accept (sockfd, (struct sockaddr*) &client, &client_size);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tshell()
 | 
			
		||||
{
 | 
			
		||||
	printf("tshell start\n");
 | 
			
		||||
	struct sockaddr_un addr;
 | 
			
		||||
 | 
			
		||||
	int fd = socket(AF_UNIX, SOCK_STREAM, 0);
 | 
			
		||||
	memset(&addr, 0, sizeof(addr));
 | 
			
		||||
	addr.sun_family = AF_UNIX;
 | 
			
		||||
	strncpy(addr.sun_path, "./tsocket", sizeof(addr.sun_path)-1);
 | 
			
		||||
	bind(fd, (struct sockaddr*)&addr, sizeof(addr));
 | 
			
		||||
	while(1);
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
struct bootcfg {
 | 
			
		||||
	const char * cfgfilename;
 | 
			
		||||
@ -67,7 +92,7 @@ static int parse_args (int argc, char *argv[], struct bootcfg * bootcfg)
 | 
			
		||||
	
 | 
			
		||||
	bootcfg->cfgfilename = "config.ckv";
 | 
			
		||||
	
 | 
			
		||||
	while ( (c = getopt (argc, argv, "vc:d:p:")) != -1) {
 | 
			
		||||
	while ( (c = getopt (argc, argv, "hvc:d:p:")) != -1) {
 | 
			
		||||
		
 | 
			
		||||
		switch (c) {
 | 
			
		||||
			case 'c':
 | 
			
		||||
@ -78,12 +103,18 @@ static int parse_args (int argc, char *argv[], struct bootcfg * bootcfg)
 | 
			
		||||
				exit(EXIT_SUCCESS);
 | 
			
		||||
				break;
 | 
			
		||||
			case 'd':{
 | 
			
		||||
				int b = cw_strlist_get_id(cw_dbg_strings, optarg);
 | 
			
		||||
                                if (!cw_dbg_set_level_from_str(optarg)){
 | 
			
		||||
                                        fprintf(stderr,"Invalid debug option: %s\n",optarg);
 | 
			
		||||
                                        exit(EXIT_FAILURE);
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
					 
 | 
			
		||||
/*				int b = cw_strlist_get_id(cw_dbg_strings, optarg);
 | 
			
		||||
				if (b==-1){
 | 
			
		||||
					fprintf(stderr,"Invalid debug option: %s\n",optarg);
 | 
			
		||||
					exit(EXIT_FAILURE);
 | 
			
		||||
				}
 | 
			
		||||
				cw_dbg_set_level(b, 1);
 | 
			
		||||
				cw_dbg_set_level(b, 1);*/
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@ -176,13 +207,10 @@ int main (int argc, char *argv[])
 | 
			
		||||
	int rc = 0;
 | 
			
		||||
	struct bootcfg bootcfg;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* parse arguments */
 | 
			
		||||
	parse_args (argc, argv, &bootcfg);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	global_cfg=cw_cfg_create();
 | 
			
		||||
	if (!global_cfg){
 | 
			
		||||
		fprintf(stderr,"Can't create global_cfg: %s\n",strerror(errno));
 | 
			
		||||
@ -197,7 +225,6 @@ int main (int argc, char *argv[])
 | 
			
		||||
		goto errX;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	cw_log_name = "AC-Tube";
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@ -229,12 +256,8 @@ int main (int argc, char *argv[])
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
		
 | 
			
		||||
	start_shell();
 | 
			
		||||
 | 
			
		||||
	/* Init DTLS library */
 | 
			
		||||
	dtls_init();
 | 
			
		||||
@ -250,16 +273,22 @@ int main (int argc, char *argv[])
 | 
			
		||||
	if (!dataman_list_init())
 | 
			
		||||
		goto errX;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	ac_conf_init(global_cfg);
 | 
			
		||||
 | 
			
		||||
	cw_cfg_dump(global_cfg);
 | 
			
		||||
	if (!start_rpc(global_cfg))
 | 
			
		||||
		goto errX;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//	cw_cfg_dump(global_cfg);
 | 
			
		||||
		
 | 
			
		||||
	cw_log (LOG_INFO, "Starting AC-Tube, Name=%s, ID=%s", cw_cfg_get(global_cfg,"capwap/ac-name",NULL), conf_acid);
 | 
			
		||||
	rc = ac_run(global_cfg);
 | 
			
		||||
 | 
			
		||||
errX:
 | 
			
		||||
	if (global_cfg)
 | 
			
		||||
		mavl_destroy(global_cfg);
 | 
			
		||||
		cw_cfg_destroy(global_cfg);
 | 
			
		||||
 | 
			
		||||
	if (discovery_cache)
 | 
			
		||||
		discovery_cache_destroy(discovery_cache);
 | 
			
		||||
@ -302,8 +331,8 @@ int ac_run(cw_Cfg_t * cfg)
 | 
			
		||||
		
 | 
			
		||||
		conf_parse_listen_addr (s, addr, port, &proto);
 | 
			
		||||
		socklist_add_unicast (addr, port, proto,
 | 
			
		||||
				cw_cfg_get_bool(cfg,"actube/ipv4","true"),
 | 
			
		||||
				cw_cfg_get_bool(cfg,"actube/ipv6","true")
 | 
			
		||||
				cw_cfg_get_bool(cfg,"actube/ipv4",1),
 | 
			
		||||
				cw_cfg_get_bool(cfg,"actube/ipv6",1)
 | 
			
		||||
				);
 | 
			
		||||
        }
 | 
			
		||||
	if (!i) {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										401
									
								
								src/ac/act.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										401
									
								
								src/ac/act.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,401 @@
 | 
			
		||||
/*	$NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $	*/
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1992, 1993
 | 
			
		||||
 *	The Regents of the University of California.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * This code is derived from software contributed to Berkeley by
 | 
			
		||||
 * Christos Zoulas of Cornell University.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 | 
			
		||||
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
			
		||||
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 | 
			
		||||
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 | 
			
		||||
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 | 
			
		||||
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
			
		||||
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 | 
			
		||||
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 | 
			
		||||
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * test.c: A little test program
 | 
			
		||||
 */
 | 
			
		||||
#include <sys/wait.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <dirent.h>
 | 
			
		||||
#include <locale.h>
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/un.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "histedit.h"
 | 
			
		||||
 | 
			
		||||
#include "cw/cfg.h"
 | 
			
		||||
#include "cw/sock.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int continuation = 0;
 | 
			
		||||
volatile sig_atomic_t gotsig = 0;
 | 
			
		||||
 | 
			
		||||
static	unsigned char	complete(EditLine *, int);
 | 
			
		||||
static	char   *prompt(EditLine *);
 | 
			
		||||
static	void	sig(int);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
FILE * act_f;
 | 
			
		||||
 | 
			
		||||
static int 
 | 
			
		||||
get_result(FILE *f, char *str,int len)
 | 
			
		||||
{
 | 
			
		||||
	int n = len;
 | 
			
		||||
	char *rc;
 | 
			
		||||
	rc = fgets (str, len, f);
 | 
			
		||||
	if (rc==NULL)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	n = strlen(str);
 | 
			
		||||
	if (n==1 && str[0]=='\n')
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	return  1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static char *
 | 
			
		||||
prompt(EditLine *el )
 | 
			
		||||
{
 | 
			
		||||
	static char str[64];
 | 
			
		||||
	char str2[64];
 | 
			
		||||
	int rc;
 | 
			
		||||
 | 
			
		||||
	fprintf(act_f,"@prompt\n");
 | 
			
		||||
	rc = get_result(act_f,str,64);
 | 
			
		||||
	while(rc){
 | 
			
		||||
		rc=get_result(act_f,str2,64);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	return (continuation ? "> " : str);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
sig(int i)
 | 
			
		||||
{
 | 
			
		||||
	gotsig = i;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static unsigned char
 | 
			
		||||
complete(EditLine *el, int ch __attribute__((__unused__)))
 | 
			
		||||
{
 | 
			
		||||
	DIR *dd = opendir(".");
 | 
			
		||||
	struct dirent *dp;
 | 
			
		||||
	const char* ptr;
 | 
			
		||||
	const LineInfo *lf = el_line(el);
 | 
			
		||||
	size_t len;
 | 
			
		||||
	int res = CC_ERROR;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Find the last word
 | 
			
		||||
	 */
 | 
			
		||||
	for (ptr = lf->cursor - 1;
 | 
			
		||||
	    !isspace((unsigned char)*ptr) && ptr > lf->buffer; ptr--)
 | 
			
		||||
		continue;
 | 
			
		||||
	len = lf->cursor - ++ptr;
 | 
			
		||||
 | 
			
		||||
	for (dp = readdir(dd); dp != NULL; dp = readdir(dd)) {
 | 
			
		||||
		if (len > strlen(dp->d_name))
 | 
			
		||||
			continue;
 | 
			
		||||
		if (strncmp(dp->d_name, ptr, len) == 0) {
 | 
			
		||||
			if (el_insertstr(el, &dp->d_name[len]) == -1)
 | 
			
		||||
				res = CC_ERROR;
 | 
			
		||||
			else
 | 
			
		||||
				res = CC_REFRESH;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	closedir(dd);
 | 
			
		||||
	return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *cfgfilename = "config.ckv";
 | 
			
		||||
const char *srvaddr;
 | 
			
		||||
const char *prgname;
 | 
			
		||||
 | 
			
		||||
static int 
 | 
			
		||||
parse_args (int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
	int c;
 | 
			
		||||
	opterr = 1;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	while ( (c = getopt (argc, argv, "hvc:s:")) != -1) {
 | 
			
		||||
		
 | 
			
		||||
		switch (c) {
 | 
			
		||||
			case 'c':
 | 
			
		||||
				cfgfilename = optarg;
 | 
			
		||||
				break;
 | 
			
		||||
			case 'v':
 | 
			
		||||
				printf("ACT shell for ACTube version 0.0.1, %s\n", SYS_ARCH);
 | 
			
		||||
				exit(EXIT_SUCCESS);
 | 
			
		||||
				break;
 | 
			
		||||
			case 's':
 | 
			
		||||
				srvaddr = optarg;
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
/*			case 'd':{
 | 
			
		||||
                                if (!cw_dbg_set_level_from_str(optarg)){
 | 
			
		||||
                                        fprintf(stderr,"Invalid debug option: %s\n",optarg);
 | 
			
		||||
                                        exit(EXIT_FAILURE);
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
				break;
 | 
			
		||||
			} */
 | 
			
		||||
 | 
			
		||||
			case '?':
 | 
			
		||||
				exit(EXIT_FAILURE);
 | 
			
		||||
			default:
 | 
			
		||||
			case 'h':
 | 
			
		||||
				printf("Usage:\n");
 | 
			
		||||
				printf("%s [-v | -h | -s <dst> | -c <cfg> ]\n",argv[0]);
 | 
			
		||||
				printf(" -c: specify config file\n");
 | 
			
		||||
				printf(" -s: specify adress to connect to \n");
 | 
			
		||||
				printf(" -v: print version info\n");
 | 
			
		||||
 | 
			
		||||
				exit(EXIT_SUCCESS);
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int create_tcp_fd(const char *addr)
 | 
			
		||||
{
 | 
			
		||||
	struct sockaddr server;
 | 
			
		||||
	
 | 
			
		||||
	int rc;
 | 
			
		||||
	int sockfd;
 | 
			
		||||
 | 
			
		||||
	memset(&server,0,sizeof(server));
 | 
			
		||||
	rc = sock_strtoaddr (addr, (struct sockaddr*) &server);
 | 
			
		||||
	
 | 
			
		||||
	if (! rc) {
 | 
			
		||||
		fprintf(stderr, "Can't parse address '%s', %s\n", addr, strerror (errno));
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	sockfd = socket ( ( (struct sockaddr*) &server)->sa_family, SOCK_STREAM, 0);
 | 
			
		||||
 | 
			
		||||
	rc = connect(sockfd, (struct sockaddr*)&server, sizeof(server));
 | 
			
		||||
 | 
			
		||||
	if (rc ) {
 | 
			
		||||
		fprintf(stderr,"%s: Error, can't connt to %s %s\n",prgname,addr,strerror(errno));
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return sockfd;	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static FILE *act_connect(const char *srvaddr)
 | 
			
		||||
{
 | 
			
		||||
	int fd;
 | 
			
		||||
	if (srvaddr==NULL){
 | 
			
		||||
		fprintf(stderr,"%s: Error, no address given.\n",prgname);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	fd=create_tcp_fd(srvaddr);
 | 
			
		||||
	if (fd==-1)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	return fdopen(fd,"a+");
 | 
			
		||||
 | 
			
		||||
//	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
main(int argc , char *argv[])
 | 
			
		||||
{
 | 
			
		||||
	prgname = argv[0];	
 | 
			
		||||
	parse_args(argc,argv);
 | 
			
		||||
 | 
			
		||||
	act_f = act_connect(srvaddr);
 | 
			
		||||
	if (act_f==NULL){
 | 
			
		||||
		return (EXIT_FAILURE);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	EditLine *el = NULL;
 | 
			
		||||
	int num;
 | 
			
		||||
	const char *buf;
 | 
			
		||||
	Tokenizer *tok;
 | 
			
		||||
#if 0
 | 
			
		||||
	int lastevent = 0;
 | 
			
		||||
#endif
 | 
			
		||||
	int ncontinuation;
 | 
			
		||||
	History *hist;
 | 
			
		||||
	HistEvent ev;
 | 
			
		||||
 | 
			
		||||
	(void) setlocale(LC_CTYPE, "");
 | 
			
		||||
	(void) signal(SIGINT, sig);
 | 
			
		||||
	(void) signal(SIGQUIT, sig);
 | 
			
		||||
	(void) signal(SIGHUP, sig);
 | 
			
		||||
	(void) signal(SIGTERM, sig);
 | 
			
		||||
 | 
			
		||||
	hist = history_init();		/* Init the builtin history	*/
 | 
			
		||||
					/* Remember 100 events		*/
 | 
			
		||||
	history(hist, &ev, H_SETSIZE, 100);
 | 
			
		||||
 | 
			
		||||
	tok  = tok_init(NULL);		/* Initialize the tokenizer	*/
 | 
			
		||||
 | 
			
		||||
					/* Initialize editline		*/
 | 
			
		||||
	el = el_init(*argv, stdin, stdout, stderr);
 | 
			
		||||
 | 
			
		||||
	el_set(el, EL_EDITOR, "emacs");	/* Default editor is vi		*/
 | 
			
		||||
	el_set(el, EL_SIGNAL, 0);	/* Handle signals gracefully	*/
 | 
			
		||||
 | 
			
		||||
	el_set(el, EL_PROMPT_ESC, prompt, '\1');/* Set the prompt function */
 | 
			
		||||
 | 
			
		||||
			/* Tell editline to use this history interface	*/
 | 
			
		||||
	el_set(el, EL_HIST, history, hist);
 | 
			
		||||
 | 
			
		||||
					/* Add a user-defined function	*/
 | 
			
		||||
	el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
 | 
			
		||||
 | 
			
		||||
					/* Bind tab to it		*/
 | 
			
		||||
	el_set(el, EL_BIND, "^I", "ed-complete", NULL);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Bind j, k in vi command mode to previous and next line, instead
 | 
			
		||||
	 * of previous and next history.
 | 
			
		||||
	 */
 | 
			
		||||
	el_set(el, EL_BIND, "-a", "k", "ed-prev-line", NULL);
 | 
			
		||||
	el_set(el, EL_BIND, "-a", "j", "ed-next-line", NULL);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Source the user's defaults file.
 | 
			
		||||
	 */
 | 
			
		||||
	el_source(el, NULL);
 | 
			
		||||
 | 
			
		||||
	while ((buf = el_gets(el, &num)) != NULL && num != 0)  {
 | 
			
		||||
		int ac, cc, co;
 | 
			
		||||
		const char **av;
 | 
			
		||||
		const LineInfo *li;
 | 
			
		||||
		li = el_line(el);
 | 
			
		||||
		if (gotsig) {
 | 
			
		||||
			(void) fprintf(stderr, "Got signal %d.\n", (int)gotsig);
 | 
			
		||||
			gotsig = 0;
 | 
			
		||||
			el_reset(el);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!continuation && num == 1)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		ac = cc = co = 0;
 | 
			
		||||
		ncontinuation = tok_line(tok, li, &ac, &av, &cc, &co);
 | 
			
		||||
		if (ncontinuation < 0) {
 | 
			
		||||
			(void) fprintf(stderr, "Internal error\n");
 | 
			
		||||
			continuation = 0;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* Simpler */
 | 
			
		||||
		history(hist, &ev, continuation ? H_APPEND : H_ENTER, buf);
 | 
			
		||||
 | 
			
		||||
		continuation = ncontinuation;
 | 
			
		||||
		ncontinuation = 0;
 | 
			
		||||
		if (continuation)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (strcmp(av[0], "history") == 0) {
 | 
			
		||||
			int rv;
 | 
			
		||||
 | 
			
		||||
			switch (ac) {
 | 
			
		||||
			case 1:
 | 
			
		||||
				for (rv = history(hist, &ev, H_LAST); rv != -1;
 | 
			
		||||
				    rv = history(hist, &ev, H_PREV))
 | 
			
		||||
					(void) fprintf(stdout, "%4d %s",
 | 
			
		||||
					    ev.num, ev.str);
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			case 2:
 | 
			
		||||
				if (strcmp(av[1], "clear") == 0)
 | 
			
		||||
					 history(hist, &ev, H_CLEAR);
 | 
			
		||||
				else
 | 
			
		||||
					 goto badhist;
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			case 3:
 | 
			
		||||
				if (strcmp(av[1], "load") == 0)
 | 
			
		||||
					 history(hist, &ev, H_LOAD, av[2]);
 | 
			
		||||
				else if (strcmp(av[1], "save") == 0)
 | 
			
		||||
					 history(hist, &ev, H_SAVE, av[2]);
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			badhist:
 | 
			
		||||
			default:
 | 
			
		||||
				(void) fprintf(stderr,
 | 
			
		||||
				    "Bad history arguments\n");
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		} else if (el_parse(el, ac, av) == -1) {
 | 
			
		||||
			char str[2000];
 | 
			
		||||
			int i;
 | 
			
		||||
			char * sp ="";
 | 
			
		||||
			str[0]=0;
 | 
			
		||||
 | 
			
		||||
			for (i=0; i<ac; i++){
 | 
			
		||||
				fprintf(act_f,"%s%s",sp,av[i]);
 | 
			
		||||
				sp=" ";
 | 
			
		||||
			}
 | 
			
		||||
			fprintf(act_f,"\n");
 | 
			
		||||
 | 
			
		||||
			fflush(act_f);
 | 
			
		||||
			do {
 | 
			
		||||
				int n;
 | 
			
		||||
				fgets (str, 2000, act_f);
 | 
			
		||||
				n = strlen(str);
 | 
			
		||||
//				printf("LEN: %d\n",n);
 | 
			
		||||
				if (n==1 && str[0]=='\n')
 | 
			
		||||
					break;
 | 
			
		||||
				fprintf(stdout,"%s",str);
 | 
			
		||||
			}while(!feof(act_f));
 | 
			
		||||
 | 
			
		||||
			fflush(stdout);
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		tok_reset(tok);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	el_end(el);
 | 
			
		||||
	tok_end(tok);
 | 
			
		||||
	history_end(hist);
 | 
			
		||||
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										119
									
								
								src/ac/conf.c
									
									
									
									
									
								
							
							
						
						
									
										119
									
								
								src/ac/conf.c
									
									
									
									
									
								
							@ -15,37 +15,20 @@
 | 
			
		||||
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <sys/utsname.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "cw/capwap.h"
 | 
			
		||||
#include "cw/sock.h"
 | 
			
		||||
 | 
			
		||||
#include "cw/log.h"
 | 
			
		||||
#include "cw/dbg.h"
 | 
			
		||||
#include "cw/cw_util.h"
 | 
			
		||||
#include "cw/dtls.h"
 | 
			
		||||
 | 
			
		||||
     #include <sys/param.h>
 | 
			
		||||
     #include <sys/time.h>
 | 
			
		||||
     #include <sys/socket.h>
 | 
			
		||||
     #include <net/if.h>
 | 
			
		||||
 | 
			
		||||
#include "cw/dbg.h"
 | 
			
		||||
#include "cw/cw.h"
 | 
			
		||||
#include "cw/cfg.h"
 | 
			
		||||
#include "conf.h"
 | 
			
		||||
#include "ac.h"
 | 
			
		||||
#include "cw/cfg.h"
 | 
			
		||||
 | 
			
		||||
#include "cw/mavltypes.h"
 | 
			
		||||
 | 
			
		||||
/*uint8_t conf_macaddress[12];
 | 
			
		||||
uint8_t conf_macaddress[12];
 | 
			
		||||
uint8_t conf_macaddress_len = 0;
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
long conf_strict_capwap = 1;
 | 
			
		||||
long conf_strict_headers = 0;
 | 
			
		||||
/*int conf_capwap_mode = CW_MODE_CAPWAP;*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -53,28 +36,23 @@ char *conf_acid = NULL;
 | 
			
		||||
 | 
			
		||||
char *conf_primary_if = NULL;
 | 
			
		||||
 | 
			
		||||
long conf_max_wtps = CONF_DEFAULT_MAXWTPS;
 | 
			
		||||
char *conf_logfilename = CONF_DEFAULT_LOGFILENAME;
 | 
			
		||||
struct sockaddr_storage *conf_salist = NULL;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
char **conf_mcast_groups = 0;
 | 
			
		||||
int conf_mcast_groups_len = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct sockaddr_storage *conf_bsalist = NULL;
 | 
			
		||||
//struct sockaddr_storage *conf_bsalist = NULL;
 | 
			
		||||
 | 
			
		||||
int conf_salist_len = 0;
 | 
			
		||||
int conf_bsalist_len = 0;
 | 
			
		||||
//int conf_salist_len = 0;
 | 
			
		||||
//int conf_bsalist_len = 0;
 | 
			
		||||
 | 
			
		||||
struct sockaddr *conf_ac_ips;
 | 
			
		||||
int conf_ac_ips_len;
 | 
			
		||||
//struct sockaddr *conf_ac_ips;
 | 
			
		||||
//int conf_ac_ips_len;
 | 
			
		||||
 | 
			
		||||
char *conf_sslcertfilename = NULL;
 | 
			
		||||
char *conf_sslkeyfilename = NULL;
 | 
			
		||||
char *conf_sslkeypass = NULL;
 | 
			
		||||
char *conf_dtls_psk = NULL;
 | 
			
		||||
//char *conf_sslcertfilename = NULL;
 | 
			
		||||
//char *conf_sslkeyfilename = NULL;
 | 
			
		||||
//char *conf_sslkeypass = NULL;
 | 
			
		||||
//char *conf_dtls_psk = NULL;
 | 
			
		||||
 | 
			
		||||
int conf_security = 0;
 | 
			
		||||
long conf_vendor_id = CONF_DEFAULT_VENDOR_ID;
 | 
			
		||||
@ -123,11 +101,10 @@ static int init_ac_name(cw_Cfg_t * cfg)
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	s= cw_cfg_get(cfg,"capwap/ac-name",NULL);
 | 
			
		||||
	s= (char*)cw_cfg_get(cfg,"capwap/ac-name",NULL);
 | 
			
		||||
	if (s!=NULL)
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
//	primary_if = sock_get_primary_if(AF_INET6);
 | 
			
		||||
	if (!primary_if)
 | 
			
		||||
		primary_if = sock_get_primary_if(AF_INET);
 | 
			
		||||
 | 
			
		||||
@ -158,41 +135,6 @@ static int init_ac_name(cw_Cfg_t * cfg)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int init_dtls()
 | 
			
		||||
{
 | 
			
		||||
	if (conf_dtls_psk != NULL) {
 | 
			
		||||
/*
 | 
			
		||||
		//              conf_security=CW_SECURITY_FLAGS_S;
 | 
			
		||||
*/
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int init_vendor_id()
 | 
			
		||||
{
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int init_control_port()
 | 
			
		||||
{
 | 
			
		||||
	char str[30];
 | 
			
		||||
	sprintf(str, "%d", CONF_DEFAULT_CONTROL_PORT);
 | 
			
		||||
	conf_control_port =
 | 
			
		||||
	    (char *) cw_setstr((uint8_t **) & conf_control_port, (uint8_t *) str,
 | 
			
		||||
			       strlen(str));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef WITH_LWAPP
 | 
			
		||||
	sprintf(str, "%d", CONF_DEFAULT_LW_CONTROL_PORT);
 | 
			
		||||
	conf_lw_control_port = strdup(str);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#include <ifaddrs.h>
 | 
			
		||||
 | 
			
		||||
static int init_listen_addrs(cw_Cfg_t * cfg)
 | 
			
		||||
@ -247,7 +189,7 @@ static int init_listen_addrs(cw_Cfg_t * cfg)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	rc = 1;
 | 
			
		||||
      errX:
 | 
			
		||||
      /*errX:*/
 | 
			
		||||
	freeifaddrs(ifap);
 | 
			
		||||
	return rc;
 | 
			
		||||
}
 | 
			
		||||
@ -304,13 +246,12 @@ int init_bcast_addrs(cw_Cfg_t *cfg)
 | 
			
		||||
	struct cw_Cfg_iter cfi;
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
//printf("BCAST INIT\n");
 | 
			
		||||
        cw_cfg_iter_init(cfg, &cfi, "actube/bcast");
 | 
			
		||||
	if (cw_cfg_iter_next(&cfi,NULL) != NULL)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	if (!cw_cfg_get_bool(cfg,"actube/ipv4", "true"))
 | 
			
		||||
	if (!cw_cfg_get_bool(cfg,"actube/ipv4", 1))
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	/*t = mavl_create_ptr(); */
 | 
			
		||||
@ -348,16 +289,16 @@ int init_bcast_addrs(cw_Cfg_t *cfg)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		if (ifa->ifa_broadaddr) {
 | 
			
		||||
			char *s,*sr;
 | 
			
		||||
			char *s; //,*sr;
 | 
			
		||||
			sock_addrtostr(ifa->ifa_broadaddr, str, 100,1);
 | 
			
		||||
			*strchr(str, ':') = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			s = cw_strdup(str);
 | 
			
		||||
			sr = mavl_add_str(t, s);
 | 
			
		||||
			mavl_add_str(t, s);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			printf("BCAST = %p --- %p: %s\n",str,s,str);
 | 
			
		||||
//			printf("BCAST = %p --- %p: %s\n",str,s,str);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
@ -497,7 +438,7 @@ char *conf_mods_dir = NULL;
 | 
			
		||||
 */ 
 | 
			
		||||
static int init_mods(cw_Cfg_t *cfg){
 | 
			
		||||
 | 
			
		||||
	int n, i;
 | 
			
		||||
	int  i;
 | 
			
		||||
	struct cw_Cfg_entry *e;
 | 
			
		||||
	const char * modname;
 | 
			
		||||
 | 
			
		||||
@ -604,28 +545,10 @@ int conf_parse_listen_addr(const char *addrstr, char *saddr, char *port, int *pr
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){
 | 
			
		||||
 | 
			
		||||
	if (cfg && cfg->filename && cfg->line)
 | 
			
		||||
		fprintf(stderr, "ERROR in %s:%d: ", 
 | 
			
		||||
			cfg->filename, cfg->line);
 | 
			
		||||
	else if (cfg && cfg->filename)
 | 
			
		||||
		fprintf(stderr, "ERROR in %s:", cfg->filename);
 | 
			
		||||
	vfprintf(stderr, fmt, ap);
 | 
			
		||||
	fprintf(stderr,"\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void free_config()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ac_conf_init(cw_Cfg_t *cfg)
 | 
			
		||||
{
 | 
			
		||||
	printf("ac conf\n");
 | 
			
		||||
	init_listen_addrs(cfg);
 | 
			
		||||
	init_bcast_addrs(cfg);
 | 
			
		||||
	init_ac_name(cfg);
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <confuse.h>
 | 
			
		||||
#include <sys/ioctl.h>
 | 
			
		||||
#include <net/if.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,12 +6,14 @@
 | 
			
		||||
#
 | 
			
		||||
#capwap/ac-name
 | 
			
		||||
#
 | 
			
		||||
capwap/ac-name: actube
 | 
			
		||||
capwap/ac-name: actube_X
 | 
			
		||||
 | 
			
		||||
capwap/ssl-cipher: DHE-RSA:RSA:AES-256-CBC:AES-128-CBC:SHA1:PSK
 | 
			
		||||
capwap/ssl-psk-enable: false
 | 
			
		||||
capwap/ssl-psk: 123456
 | 
			
		||||
capwap/ssl-dhbits: 1024
 | 
			
		||||
capwap/ssl-keyfile:  "../../ssl/intermediate-ca/int-ca.key"
 | 
			
		||||
capwap/ssl-certfile: "../../ssl/intermediate-ca/int-ca.crt"
 | 
			
		||||
 | 
			
		||||
cisco/ssl-keyfile:  "../../ssl/intermediate-ca/int-ca.key"
 | 
			
		||||
cisco/ssl-certfile: "../../ssl/intermediate-ca/int-ca.crt"
 | 
			
		||||
@ -38,32 +40,36 @@ actube/mod.0: cisco
 | 
			
		||||
actube/mod.1: capwap
 | 
			
		||||
actube/mod.2: capwap80211
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ac-descriptor/dtls-policy:  1
 | 
			
		||||
ac-descriptor/hardware/vendor: 4232704
 | 
			
		||||
ac-descriptor/hardware/version: .x01000001
 | 
			
		||||
ac-descriptor/max-wtps : 200
 | 
			
		||||
ac-descriptor/active-wtps:  2
 | 
			
		||||
ac-descriptor/r-mac-field: 1
 | 
			
		||||
ac-descriptor/reserved1 : 0
 | 
			
		||||
ac-descriptor/security : 2
 | 
			
		||||
ac-descriptor/software/vendor : 0
 | 
			
		||||
ac-descriptor/software/version: v0.0.1
 | 
			
		||||
ac-descriptor/station-limit: 1000
 | 
			
		||||
ac-descriptor/stations: 0
 | 
			
		||||
#actube/rpc/listen: unix:/tmp/actube
 | 
			
		||||
actube/rpc/listen: tcp:127.0.0.1:5000
 | 
			
		||||
actube/rpc/enable: true
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
capwap-control-ip-address/address.0: 192.168.0.14
 | 
			
		||||
capwap/ac-descriptor/dtls-policy:  1
 | 
			
		||||
capwap/ac-descriptor/hardware/vendor: 4232704
 | 
			
		||||
capwap/ac-descriptor/hardware/version: .x01000001
 | 
			
		||||
capwap/ac-descriptor/max-wtps : 200
 | 
			
		||||
capwap/ac-descriptor/active-wtps:  2
 | 
			
		||||
capwap/ac-descriptor/r-mac-field: 1
 | 
			
		||||
cawpap/ac-descriptor/reserved1 : 0
 | 
			
		||||
capwap/ac-descriptor/security : 2
 | 
			
		||||
capwap/ac-descriptor/software/vendor : 0
 | 
			
		||||
capwap/ac-descriptor/software/version: v0.0.1
 | 
			
		||||
capwap/ac-descriptor/station-limit: 1000
 | 
			
		||||
capwap/ac-descriptor/stations: 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
capwap/control-ip-address/address.0: 192.168.0.24
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# CAPWAP Timers
 | 
			
		||||
#
 | 
			
		||||
capwap-timers/change-state-pending-timer: Word: 3
 | 
			
		||||
capwap-timers/data-check-timer: Word: 10
 | 
			
		||||
capwap-timers/echo-interval :Byte: 30
 | 
			
		||||
capwap-timers/max-discovery-interval :Byte: 10
 | 
			
		||||
capwap/timers/change-state-pending-timer: Word: 3
 | 
			
		||||
capwap/timers/data-check-timer: Word: 10
 | 
			
		||||
capwap/timers/echo-interval :Byte: 30
 | 
			
		||||
capwap/timers/max-discovery-interval :Byte: 10
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -114,8 +114,10 @@ int dataman_process_keep_alive(struct netconn *nc, uint8_t *rawmsg, int len)
 | 
			
		||||
 | 
			
		||||
			((uint16_t*)sessid)[0]=sessid_len;
 | 
			
		||||
			memcpy(bstr16_data(sessid),cw_get_elem_data(elem),sessid_len);
 | 
			
		||||
 | 
			
		||||
			struct wtpman * wtpman = wtplist_get_by_session_id(sessid);
 | 
			
		||||
			
 | 
			
		||||
			stop();
 | 
			
		||||
			struct wtpman * wtpman =NULL;
 | 
			
		||||
//			struct wtpman * wtpman = wtplist_get_by_session_id(sessid);
 | 
			
		||||
			if (wtpman){
 | 
			
		||||
				if (!dm->wtpman)
 | 
			
		||||
					dm->wtpman=wtpman;
 | 
			
		||||
 | 
			
		||||
@ -114,7 +114,6 @@ void discovery_cache_add(struct cw_DiscoveryCache *cache,
 | 
			
		||||
		cw_dbg(DBG_X,"//////////////////////////   ADDD CAHCE ///////////////////////");
 | 
			
		||||
		char str[128];
 | 
			
		||||
	sock_addrtostr(addr,str,128,1);
 | 
			
		||||
	printf("Add addr: %s\n",str);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	struct cw_DiscoveryCacheElem * cur = cache->queue+cache->qpos;
 | 
			
		||||
@ -159,7 +158,6 @@ int discovery_cache_get(struct cw_DiscoveryCache * cache,struct sockaddr *addr,
 | 
			
		||||
	cw_dbg(DBG_X,"DISCOVERY CACHE ---------------------------- GET ENTER");
 | 
			
		||||
	char str[128];
 | 
			
		||||
	sock_addrtostr(addr,str,128,1);
 | 
			
		||||
	printf("Add addr: %s\n",str);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	search_ptr = &search;
 | 
			
		||||
@ -169,7 +167,6 @@ int discovery_cache_get(struct cw_DiscoveryCache * cache,struct sockaddr *addr,
 | 
			
		||||
		cw_dbg(DBG_X,"DISCOVERY CACHE ---------------------------- FOUND 1 with Port");
 | 
			
		||||
		char str[128];
 | 
			
		||||
		sock_addrtostr(addr,str,128,1);
 | 
			
		||||
		printf("Add addr: %s\n",str);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -196,7 +193,6 @@ int discovery_cache_get(struct cw_DiscoveryCache * cache,struct sockaddr *addr,
 | 
			
		||||
	cw_dbg(DBG_X,"DISCOVERY CACHE ---------------------------- DOUND BY ADDR");
 | 
			
		||||
	char str[128];
 | 
			
		||||
	sock_addrtostr(addr,str,128,1);
 | 
			
		||||
	printf("Add addr: %s\n",str);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -207,7 +203,7 @@ int discovery_cache_get(struct cw_DiscoveryCache * cache,struct sockaddr *addr,
 | 
			
		||||
	{
 | 
			
		||||
	cw_dbg(DBG_X,"DISCOVERY CACHE ---------------------------- DOUND BY ADDR");
 | 
			
		||||
	char str[128];
 | 
			
		||||
	sock_addrtostr(&elem->addr,str,128,1);
 | 
			
		||||
	sock_addrtostr((struct sockaddr*)&elem->addr,str,128,1);
 | 
			
		||||
	printf("ELEM addr: %s\n",str);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										722
									
								
								src/ac/rpc.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										722
									
								
								src/ac/rpc.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,722 @@
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/un.h>
 | 
			
		||||
#include <sys/wait.h>
 | 
			
		||||
 | 
			
		||||
#include <arpa/telnet.h>
 | 
			
		||||
#include <histedit.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "cw/sock.h"
 | 
			
		||||
#include "cw/log.h"
 | 
			
		||||
#include "cw/dbg.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "cw/connlist.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "wtplist.h"
 | 
			
		||||
 | 
			
		||||
#include "ac.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct rpcdata{
 | 
			
		||||
 | 
			
		||||
	FILE *in;
 | 
			
		||||
	FILE *out;
 | 
			
		||||
 | 
			
		||||
	char prompt[1024];
 | 
			
		||||
	cw_Cfg_t * update_cfg;
 | 
			
		||||
	cw_Cfg_t * global_cfg;
 | 
			
		||||
	char *history[2000];
 | 
			
		||||
	char line[4096];
 | 
			
		||||
	int pos;
 | 
			
		||||
	char esc[8];
 | 
			
		||||
	int escpos;
 | 
			
		||||
	int quit;
 | 
			
		||||
 | 
			
		||||
	History *hist;
 | 
			
		||||
	HistEvent ev;
 | 
			
		||||
	Tokenizer *tok;
 | 
			
		||||
	EditLine *el;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct sockdata{
 | 
			
		||||
	const char *name;
 | 
			
		||||
	int fd;
 | 
			
		||||
	cw_Cfg_t * global_cfg;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int select_cmd(struct rpcdata *sd, const char *cmd);
 | 
			
		||||
int list_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
int cfg_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
int ucfg_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
int set_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
int del_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
int send_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
int wlan0_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
int exit_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
int prompt_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
int global_cfg_cmd(struct rpcdata *sd, const char * cmd);
 | 
			
		||||
 | 
			
		||||
//void show_cfg (FILE *out, mavl_t ktv);
 | 
			
		||||
int show_aps (FILE *out);
 | 
			
		||||
 | 
			
		||||
struct cw_Conn * find_ap(const char *name);
 | 
			
		||||
 | 
			
		||||
struct command{
 | 
			
		||||
	char * cmd;
 | 
			
		||||
	int (*fun)(struct rpcdata *sd, const char *cmd);
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static struct command cmdlist[]={
 | 
			
		||||
	{"exit",exit_cmd},
 | 
			
		||||
	{"bumm",exit_cmd},
 | 
			
		||||
	{"cfg", cfg_cmd },
 | 
			
		||||
	{"del", del_cmd },
 | 
			
		||||
	{"ucfg", ucfg_cmd},
 | 
			
		||||
	{"list", list_cmd },
 | 
			
		||||
	{"select", select_cmd },
 | 
			
		||||
	{"send", send_cmd},
 | 
			
		||||
	{"set", set_cmd },
 | 
			
		||||
	{"wlan0",wlan0_cmd},
 | 
			
		||||
	{"global_cfg", global_cfg_cmd},
 | 
			
		||||
 | 
			
		||||
	{"@prompt",prompt_cmd},
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	{NULL,NULL}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void finish_cmd(FILE *f)
 | 
			
		||||
{
 | 
			
		||||
	fprintf(f,"\n");
 | 
			
		||||
	fflush(f);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int prompt_cmd(struct rpcdata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	const char *acname = cw_cfg_get(sd->global_cfg,"capwap/ac-name","actube");
 | 
			
		||||
 | 
			
		||||
	fprintf(sd->out,"%s[%s]:>\n",acname,sd->prompt);
 | 
			
		||||
	finish_cmd(sd->out);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int global_cfg_cmd(struct rpcdata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	cw_cfg_fdump(sd->out,sd->global_cfg);
 | 
			
		||||
	finish_cmd(sd->out);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int select_cmd(struct rpcdata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	char ap [CAPWAP_MAX_WTP_NAME_LEN];
 | 
			
		||||
	sscanf(cmd,"%s",ap);
 | 
			
		||||
	strcpy(sd->prompt,ap);
 | 
			
		||||
	finish_cmd(sd->out);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int list_cmd(struct rpcdata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	show_aps(sd->out);
 | 
			
		||||
	finish_cmd(sd->out);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int exit_cmd(struct rpcdata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
		//fprintf(sd->out,"Unknown command: '%s'\n\r\n\r",cmd);
 | 
			
		||||
 | 
			
		||||
//	printf("Exitcmd %s\n",cmd);
 | 
			
		||||
	//fprintf(sd->out,"END: %s\n\r",cmd);
 | 
			
		||||
	finish_cmd(sd->out);
 | 
			
		||||
	fflush(sd->out);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cfg_cmd(struct rpcdata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	conn = find_ap(sd->prompt);
 | 
			
		||||
	if (conn==NULL){
 | 
			
		||||
		fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		cw_cfg_fdump(sd->out,conn->remote_cfg);
 | 
			
		||||
	}
 | 
			
		||||
	finish_cmd(sd->out);
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ucfg_cmd(struct rpcdata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
//	struct cw_Conn * conn;
 | 
			
		||||
	stop();
 | 
			
		||||
//	show_cfg(sd->out,sd->update_cfg);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#include "wtpman.h"
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
send_cmd(struct rpcdata * sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	conn = find_ap(sd->prompt);
 | 
			
		||||
	if (conn==NULL){
 | 
			
		||||
		fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		conn->update_cfg=sd->update_cfg;
 | 
			
		||||
	}
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
wlan0_cmd(struct rpcdata * sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	stop();
 | 
			
		||||
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	conn = find_ap(sd->prompt);
 | 
			
		||||
	if (conn==NULL){
 | 
			
		||||
		fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		FILE *f=fopen("wlan0.ktv","r");
 | 
			
		||||
//		cw_ktv_read_file(f,sd->update_cfg,conn->msgset->types_tree);
 | 
			
		||||
		//conn->update_cfg=sd->update_cfg;
 | 
			
		||||
		fclose(f);
 | 
			
		||||
	}
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int set_cmd(struct rpcdata *sd, const char *str)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	cw_Cfg_t *cfg;
 | 
			
		||||
	cfg = cw_cfg_create();
 | 
			
		||||
 | 
			
		||||
	cw_cfg_read_from_string(str,cfg);
 | 
			
		||||
 | 
			
		||||
	cw_cfg_fdump(sd->out,cfg);
 | 
			
		||||
 | 
			
		||||
	cw_cfg_destroy(cfg);
 | 
			
		||||
 | 
			
		||||
	finish_cmd(sd->out);
 | 
			
		||||
 | 
			
		||||
//	cw_ktv_init_str_reader(&r,str,strlen(str));
 | 
			
		||||
	
 | 
			
		||||
//	cw_ktv_parse_string(&r,key,type,val);
 | 
			
		||||
	/*cw_ktv_parse_string(key,type,val, 2048);*/
 | 
			
		||||
	
 | 
			
		||||
//	fprintf(sd->out,"%s %s\n",key,val);
 | 
			
		||||
//	cw_ktv_add(sd->update_cfg,key,CW_TYPE_STR,NULL,val,strlen(val));
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int del_cmd(struct rpcdata *sd, const char *str)
 | 
			
		||||
{
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	sscanf(str,"%s",key);
 | 
			
		||||
	stop();
 | 
			
		||||
//	cw_ktv_del_sub(sd->update_cfg,key);
 | 
			
		||||
//
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
void show_cfg (FILE *out, mavl_t ktv)
 | 
			
		||||
{
 | 
			
		||||
	char value[500];
 | 
			
		||||
	struct cw_Val * data;
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	const struct cw_Type * type;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	mavliter_init(&it,ktv);
 | 
			
		||||
 | 
			
		||||
	mavliter_foreach(&it){
 | 
			
		||||
		
 | 
			
		||||
		data = mavliter_get(&it);
 | 
			
		||||
		type = data->type;
 | 
			
		||||
		type->to_str(data,value,0);
 | 
			
		||||
		
 | 
			
		||||
		fprintf(out,"%s :%s: %s\n",data->key,type->get_type_name(data), value);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void print_mw(FILE *f, int w, const char * str)
 | 
			
		||||
{
 | 
			
		||||
	int n,i;
 | 
			
		||||
	fprintf(f, "%.*s",w,str);
 | 
			
		||||
	n=strlen(str);
 | 
			
		||||
 | 
			
		||||
	if ( n>w ){
 | 
			
		||||
		fprintf(f,"> ");
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	n = w-n;
 | 
			
		||||
 | 
			
		||||
	for(i=0;i<(n+2);i++){
 | 
			
		||||
		fprintf(f,"%c",' ');
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int  show_aps (FILE *out)
 | 
			
		||||
{
 | 
			
		||||
	struct connlist * cl;
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	
 | 
			
		||||
	cl = wtplist_get_connlist();
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	mavliter_init (&it, cl->by_addr);
 | 
			
		||||
	print_mw (out, 16, "AP Name");
 | 
			
		||||
	print_mw (out, 16, "AP Model");
 | 
			
		||||
	print_mw (out, 14, "Vendor");
 | 
			
		||||
	print_mw (out, 16, "IP ");
 | 
			
		||||
	fprintf(out,"\n");
 | 
			
		||||
 | 
			
		||||
	mavliter_foreach (&it) {
 | 
			
		||||
		char addr[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
		const char *vendor;
 | 
			
		||||
 | 
			
		||||
		struct cw_Conn * conn;
 | 
			
		||||
		conn = mavliter_get_ptr (&it);
 | 
			
		||||
 | 
			
		||||
		print_mw(out,16,cw_cfg_get(conn->remote_cfg, "capwap/wtp-name", "Unknown"));
 | 
			
		||||
		print_mw(out,16,cw_cfg_get(conn->remote_cfg, "capwap/wtp-board-data/model-no", "Unknown"));
 | 
			
		||||
		vendor = cw_cfg_get(conn->remote_cfg, "capwap/wtp-board-data/vendor", "0");
 | 
			
		||||
		print_mw(out,14,vendor);	
 | 
			
		||||
		sock_addr2str_p (&conn->addr, addr);
 | 
			
		||||
		print_mw(out,16,addr);
 | 
			
		||||
		fprintf(out,"\n");
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct cw_Conn * find_ap(const char *name)
 | 
			
		||||
{
 | 
			
		||||
	
 | 
			
		||||
	struct connlist * cl;
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
 | 
			
		||||
	cl = wtplist_get_connlist();
 | 
			
		||||
	
 | 
			
		||||
	mavliter_init (&it, cl->by_addr);
 | 
			
		||||
	mavliter_foreach (&it) {
 | 
			
		||||
		const char *wtpname;
 | 
			
		||||
		struct cw_Conn * conn;
 | 
			
		||||
		conn = mavliter_get_ptr (&it);
 | 
			
		||||
		
 | 
			
		||||
		wtpname = cw_cfg_get (conn->remote_cfg, "capwap/wtp-name", NULL);
 | 
			
		||||
		
 | 
			
		||||
		if (wtpname == NULL)
 | 
			
		||||
			continue;
 | 
			
		||||
		
 | 
			
		||||
		if(strcmp(wtpname,name)==0){
 | 
			
		||||
			return conn;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void con (FILE *out)
 | 
			
		||||
{
 | 
			
		||||
	stop();
 | 
			
		||||
 | 
			
		||||
/*	
 | 
			
		||||
	struct connlist * cl;
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	
 | 
			
		||||
	cl = wtplist_get_connlist();
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	mavliter_init (&it, cl->by_addr);
 | 
			
		||||
	fprintf (out, "IP\t\t\twtp-name\n");
 | 
			
		||||
	mavliter_foreach (&it) {
 | 
			
		||||
		cw_Val_t * result;
 | 
			
		||||
		char addr[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
		char wtp_name[CAPWAP_MAX_WTP_NAME_LEN];
 | 
			
		||||
		struct cw_Conn * conn;
 | 
			
		||||
		conn = mavliter_get_ptr (&it);
 | 
			
		||||
		
 | 
			
		||||
		sock_addr2str_p (&conn->addr, addr);
 | 
			
		||||
		
 | 
			
		||||
		result = cw_ktv_get (conn->remote_cfg, "wtp-name", NULL);
 | 
			
		||||
		
 | 
			
		||||
		if (result == NULL) {
 | 
			
		||||
			strcpy (wtp_name, "");
 | 
			
		||||
			
 | 
			
		||||
		} else {
 | 
			
		||||
			result->type->to_str (result, wtp_name, CAPWAP_MAX_WTP_NAME_LEN);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		fprintf (out, "Con!! %s\t\t%s\n", addr, wtp_name);
 | 
			
		||||
		
 | 
			
		||||
		{
 | 
			
		||||
			stop();
 | 
			
		||||
 | 
			
		||||
			mavl_t update;
 | 
			
		||||
//			update = cw_ktv_create();
 | 
			
		||||
//			cw_ktv_set_byte(update,"radio.255/admin-state",1);
 | 
			
		||||
//			conn->update_cfg=update;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		fprintf(out,"\n");
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
	*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct command * find_cmd(const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct command * search,*result;
 | 
			
		||||
	
 | 
			
		||||
	result=NULL;
 | 
			
		||||
	search = cmdlist;
 | 
			
		||||
	while (search->cmd!=NULL){
 | 
			
		||||
		if (strncmp(cmd,search->cmd,strlen(cmd))==0){
 | 
			
		||||
			if (result==NULL)
 | 
			
		||||
				result = search;
 | 
			
		||||
			else 
 | 
			
		||||
				return NULL;
 | 
			
		||||
		}
 | 
			
		||||
		search ++;
 | 
			
		||||
	}
 | 
			
		||||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int execute_cmd (struct rpcdata * sd, const char *str)
 | 
			
		||||
{
 | 
			
		||||
	char cmd[1024];
 | 
			
		||||
	char args[1024];
 | 
			
		||||
	int n;
 | 
			
		||||
	struct cw_Val_Reader reader;
 | 
			
		||||
	struct command * searchcmd;
 | 
			
		||||
 | 
			
		||||
	args[0]=0;
 | 
			
		||||
	
 | 
			
		||||
	n = sscanf (str, "%s", cmd);
 | 
			
		||||
	if (n<=0)
 | 
			
		||||
		return 0;
 | 
			
		||||
	
 | 
			
		||||
	searchcmd = find_cmd(cmd);
 | 
			
		||||
	if (searchcmd!=NULL){
 | 
			
		||||
		if (searchcmd->fun != NULL){
 | 
			
		||||
			return searchcmd->fun(sd, str+strlen(cmd));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else{
 | 
			
		||||
		fprintf(sd->out,"Unknown command: '%s'\n",cmd);
 | 
			
		||||
		finish_cmd(sd->out);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	char type[128];
 | 
			
		||||
	char val[2048];
 | 
			
		||||
 | 
			
		||||
	key[0]=0;
 | 
			
		||||
	type[0]=0;
 | 
			
		||||
	val[0]=0;
 | 
			
		||||
 | 
			
		||||
	stop();
 | 
			
		||||
//	cw_ktv_init_str_reader(&reader,str, strlen(str));
 | 
			
		||||
//	n = cw_ktv_parse_string(&reader, key,type,val);
 | 
			
		||||
	
 | 
			
		||||
	if (n==-1){
 | 
			
		||||
		int i;
 | 
			
		||||
		fprintf(sd->out,"Error on pos %d\n",reader.pos);
 | 
			
		||||
		fprintf(sd->out,"%s",str);
 | 
			
		||||
		for(i=0;i<reader.pos;i++){
 | 
			
		||||
			fprintf(sd->out," ");
 | 
			
		||||
		}
 | 
			
		||||
		fprintf(sd->out,"^\n");
 | 
			
		||||
		fprintf(sd->out,"%s\n",reader.error);
 | 
			
		||||
	}
 | 
			
		||||
	else{
 | 
			
		||||
		fprintf(sd->out,"%s :%s: %s\n", key,type,val);
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	n = sscanf (str, "%s%s", cmd, args);
 | 
			
		||||
 | 
			
		||||
	if (n<=0)
 | 
			
		||||
		return 0;
 | 
			
		||||
	/*printf("CMD: %s, ARGS:\n",cmd);*/
 | 
			
		||||
	
 | 
			
		||||
	if (strcmp (cmd, "s") == 0) {
 | 
			
		||||
		show_aps (sd->out);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	if (strcmp (cmd, "con")==0){
 | 
			
		||||
		con(sd->out);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct esc_strings {
 | 
			
		||||
	char *str;
 | 
			
		||||
	char * result;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct esc_strings estr[] = {
 | 
			
		||||
	{"\x1b[H", "home"},
 | 
			
		||||
	{"\x1b[F", "end"},
 | 
			
		||||
	{"\x1b[A", "up"},
 | 
			
		||||
	{"\x1b[B", "donw"},
 | 
			
		||||
	{"\x1b[D", "left"},
 | 
			
		||||
	{"\x1b[C", "right"},
 | 
			
		||||
 | 
			
		||||
	{NULL,NULL}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void rpc_loop (FILE *file, cw_Cfg_t *global_cfg)
 | 
			
		||||
{
 | 
			
		||||
	struct rpcdata sd;
 | 
			
		||||
	int c;
 | 
			
		||||
	c=0;
 | 
			
		||||
 | 
			
		||||
	char str[2048];
 | 
			
		||||
	
 | 
			
		||||
	sd.in = file;
 | 
			
		||||
	sd.out = file;	
 | 
			
		||||
	sd.global_cfg=global_cfg;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	sprintf(sd.prompt,"%s","*");
 | 
			
		||||
	sd.quit=0;
 | 
			
		||||
 | 
			
		||||
	do {
 | 
			
		||||
 | 
			
		||||
		str[0]=0;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		fgets (str, sizeof (str), file);
 | 
			
		||||
 | 
			
		||||
		if (execute_cmd (&sd, str)) {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	} while (c != EOF);
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void * run_rpc_server (void * arg)
 | 
			
		||||
{
 | 
			
		||||
	char sockstr[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
	struct sockdata * sockdata;
 | 
			
		||||
	int clientsock;
 | 
			
		||||
        struct sockaddr_storage client;
 | 
			
		||||
	socklen_t client_size;
 | 
			
		||||
 | 
			
		||||
	sockdata = (struct sockdata *)arg;
 | 
			
		||||
 | 
			
		||||
	memset(&client,0,sizeof(client));
 | 
			
		||||
	client_size=sizeof(client);
 | 
			
		||||
 | 
			
		||||
	cw_dbg(DBG_INFO,"Starting RPC Service, listening on: %s (sock fd: %d)",sockdata->name, sockdata->fd);
 | 
			
		||||
 | 
			
		||||
	while(1){
 | 
			
		||||
		clientsock = accept (sockdata->fd, (struct sockaddr*) &client, &client_size);
 | 
			
		||||
		if (clientsock == -1){
 | 
			
		||||
			cw_log (LOG_ERR, "Accept error  '%s', %s", "addr", strerror (errno));
 | 
			
		||||
			return NULL;
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (clientsock > 0) {
 | 
			
		||||
			sock_addr2str_p (&client, sockstr);
 | 
			
		||||
			cw_dbg (DBG_INFO, "Accepting RPC session from %s", sockstr);
 | 
			
		||||
			rpc_loop (fdopen (clientsock, "a+"),sockdata->global_cfg);
 | 
			
		||||
			close (clientsock);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		//cw_dbg (DBG_INFO,"Accepting shell session %i, %s", rc, strerror (errno));
 | 
			
		||||
	}	
 | 
			
		||||
	
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int create_tcp_fd(const char *name)
 | 
			
		||||
{
 | 
			
		||||
	struct sockaddr_storage server; //, client;
 | 
			
		||||
	
 | 
			
		||||
	int rc;
 | 
			
		||||
	const char * addr = name;
 | 
			
		||||
	int sockfd;
 | 
			
		||||
	int yes;
 | 
			
		||||
	
 | 
			
		||||
	rc = sock_strtoaddr (addr, (struct sockaddr*) &server);
 | 
			
		||||
	
 | 
			
		||||
	if (! rc) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't parse address '%s', %s", addr, strerror (errno));
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	sockfd = socket ( ( (struct sockaddr*) &server)->sa_family, SOCK_STREAM, 0);
 | 
			
		||||
	yes = 1;
 | 
			
		||||
	/* reuse address */
 | 
			
		||||
	setsockopt (sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof (yes));
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	/* bind address */
 | 
			
		||||
	rc =  bind (sockfd, (struct sockaddr*) &server, sizeof (struct sockaddr));
 | 
			
		||||
	
 | 
			
		||||
	if (rc) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't bind socket address '%s', %s", addr, strerror (errno));
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	return sockfd;	
 | 
			
		||||
}
 | 
			
		||||
static int create_unix_fd(const char *name)
 | 
			
		||||
{
 | 
			
		||||
        //struct sockaddr_storage client;
 | 
			
		||||
	//socklen_t client_size;
 | 
			
		||||
	struct sockaddr_un addr;
 | 
			
		||||
	int rc,fd;
 | 
			
		||||
 | 
			
		||||
	unlink(name);
 | 
			
		||||
	fd = socket(PF_UNIX, SOCK_STREAM, 0);
 | 
			
		||||
 | 
			
		||||
	sock_addrinit((struct sockaddr_storage*)&addr,AF_UNIX);
 | 
			
		||||
	strncpy(addr.sun_path, name, sizeof(addr.sun_path)-1);
 | 
			
		||||
	rc = bind(fd, (struct sockaddr*)&addr, sizeof(addr));
 | 
			
		||||
	if (rc) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't bind socket 'unix:%s', %s", name, strerror (errno));
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	//int clientsock = accept (fd, (struct sockaddr*) &client, &client_size);
 | 
			
		||||
 | 
			
		||||
	return fd;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int start_rpc(cw_Cfg_t *global_cfg)
 | 
			
		||||
{
 | 
			
		||||
	struct sockdata * sockdata;
 | 
			
		||||
	const char *sockname;
 | 
			
		||||
	int rc; //, type;
 | 
			
		||||
	int fd;
 | 
			
		||||
 | 
			
		||||
	rc = cw_cfg_get_bool(global_cfg,"actube/rpc/enable",1);
 | 
			
		||||
	if (!rc)
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	sockdata = malloc(sizeof(struct sockdata));
 | 
			
		||||
	if (sockdata==NULL)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	memset(sockdata,0,sizeof(struct sockdata));
 | 
			
		||||
 | 
			
		||||
	sockdata->global_cfg = global_cfg;
 | 
			
		||||
	sockdata->fd=-1;
 | 
			
		||||
 | 
			
		||||
	sockname = cw_cfg_get(global_cfg,"actube/rpc/listen",NULL);
 | 
			
		||||
	
 | 
			
		||||
	if (sockname==NULL) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't get RPC listen address from global_cfg 'actube/rpc/listen");
 | 
			
		||||
		goto errX;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (strncmp("unix:",sockname,strlen("unix:"))==0){
 | 
			
		||||
		fd = create_unix_fd(strchr(sockname,':')+1);
 | 
			
		||||
		if (fd==-1)
 | 
			
		||||
			goto errX;
 | 
			
		||||
		sockdata->name=cw_strdup(sockname);
 | 
			
		||||
		sockdata->fd=fd;
 | 
			
		||||
	}else if (strncmp("tcp:",sockname,strlen("tcp:"))==0){
 | 
			
		||||
		fd = create_tcp_fd(strchr(sockname,':')+1);
 | 
			
		||||
		if (fd==-1)
 | 
			
		||||
			goto errX;
 | 
			
		||||
		sockdata->name=cw_strdup(sockname);
 | 
			
		||||
		sockdata->fd=fd;
 | 
			
		||||
	}else {
 | 
			
		||||
		fd = create_tcp_fd(sockname);
 | 
			
		||||
		if (fd==-1)
 | 
			
		||||
			goto errX;
 | 
			
		||||
		sockdata->name=cw_strdup(sockname);
 | 
			
		||||
		sockdata->fd=fd;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	rc = listen (sockdata->fd, 5);
 | 
			
		||||
	if (rc) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't listen on address '%s', %s", "addr", strerror (errno));
 | 
			
		||||
		goto errX;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	pthread_t thread;
 | 
			
		||||
	pthread_create (&thread, NULL, run_rpc_server,
 | 
			
		||||
	                sockdata);
 | 
			
		||||
	return 1;
 | 
			
		||||
errX:
 | 
			
		||||
	if (sockdata->fd!=-1)
 | 
			
		||||
		close(sockdata->fd);
 | 
			
		||||
	if (sockdata->name)
 | 
			
		||||
		free((void*)sockdata->name);
 | 
			
		||||
 | 
			
		||||
	free(sockdata);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										514
									
								
								src/ac/shell.c
									
									
									
									
									
								
							
							
						
						
									
										514
									
								
								src/ac/shell.c
									
									
									
									
									
								
							@ -1,514 +0,0 @@
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
 | 
			
		||||
#include "cw/sock.h"
 | 
			
		||||
#include "cw/log.h"
 | 
			
		||||
#include "cw/dbg.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "cw/connlist.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "wtplist.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct shelldata{
 | 
			
		||||
	FILE *out;
 | 
			
		||||
	char prompt[1024];
 | 
			
		||||
	mavl_t update_cfg;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void select_cmd(struct shelldata *sd, const char *cmd);
 | 
			
		||||
void list_cmd(struct shelldata *sd, const char * cmd);
 | 
			
		||||
void cfg_cmd(struct shelldata *sd, const char * cmd);
 | 
			
		||||
void ucfg_cmd(struct shelldata *sd, const char * cmd);
 | 
			
		||||
void set_cmd(struct shelldata *sd, const char * cmd);
 | 
			
		||||
void del_cmd(struct shelldata *sd, const char * cmd);
 | 
			
		||||
void send_cmd(struct shelldata *sd, const char * cmd);
 | 
			
		||||
void wlan0_cmd(struct shelldata *sd, const char * cmd);
 | 
			
		||||
//void show_cfg (FILE *out, mavl_t ktv);
 | 
			
		||||
void show_aps (FILE *out);
 | 
			
		||||
 | 
			
		||||
struct cw_Conn * find_ap(const char *name);
 | 
			
		||||
 | 
			
		||||
struct command{
 | 
			
		||||
	char * cmd;
 | 
			
		||||
	void (*fun)();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static struct command cmdlist[]={
 | 
			
		||||
	{"cfg", cfg_cmd },
 | 
			
		||||
	{"del", del_cmd },
 | 
			
		||||
	{"ucfg", ucfg_cmd},
 | 
			
		||||
	{"list", list_cmd },
 | 
			
		||||
	{"select", select_cmd },
 | 
			
		||||
	{"send", send_cmd},
 | 
			
		||||
	{"set", set_cmd },
 | 
			
		||||
	{"wlan0",wlan0_cmd},
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	{NULL,NULL}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void select_cmd(struct shelldata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	char ap [CAPWAP_MAX_WTP_NAME_LEN];
 | 
			
		||||
	sscanf(cmd,"%s",ap);
 | 
			
		||||
	strcpy(sd->prompt,ap);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void list_cmd(struct shelldata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	show_aps(sd->out);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cfg_cmd(struct shelldata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	conn = find_ap(sd->prompt);
 | 
			
		||||
	if (conn==NULL){
 | 
			
		||||
		fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		stop();
 | 
			
		||||
//		show_cfg(sd->out,conn->remote_cfg);
 | 
			
		||||
	}
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ucfg_cmd(struct shelldata *sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
	stop();
 | 
			
		||||
//	show_cfg(sd->out,sd->update_cfg);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#include "wtpman.h"
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
send_cmd(struct shelldata * sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	conn = find_ap(sd->prompt);
 | 
			
		||||
	if (conn==NULL){
 | 
			
		||||
		fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		conn->update_cfg=sd->update_cfg;
 | 
			
		||||
	}
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
wlan0_cmd(struct shelldata * sd, const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	stop();
 | 
			
		||||
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	conn = find_ap(sd->prompt);
 | 
			
		||||
	if (conn==NULL){
 | 
			
		||||
		fprintf(sd->out,"WTP '%s' not found\n",sd->prompt);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		FILE *f=fopen("wlan0.ktv","r");
 | 
			
		||||
//		cw_ktv_read_file(f,sd->update_cfg,conn->msgset->types_tree);
 | 
			
		||||
		//conn->update_cfg=sd->update_cfg;
 | 
			
		||||
		fclose(f);
 | 
			
		||||
	}
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void set_cmd(struct shelldata *sd, const char *str)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
	struct cw_Val_Reader r;
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	char type[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	char val[2048];
 | 
			
		||||
 | 
			
		||||
	stop();
 | 
			
		||||
 | 
			
		||||
//	cw_ktv_init_str_reader(&r,str,strlen(str));
 | 
			
		||||
	
 | 
			
		||||
	cw_ktv_parse_string(&r,key,type,val);
 | 
			
		||||
	/*cw_ktv_parse_string(key,type,val, 2048);*/
 | 
			
		||||
	
 | 
			
		||||
	fprintf(sd->out,"%s :%s: %s\n",key,type,val);
 | 
			
		||||
	cw_ktv_add(sd->update_cfg,key,CW_TYPE_STR,NULL,val,strlen(val));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void del_cmd(struct shelldata *sd, const char *str)
 | 
			
		||||
{
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	sscanf(str,"%s",key);
 | 
			
		||||
	stop();
 | 
			
		||||
//	cw_ktv_del_sub(sd->update_cfg,key);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
void show_cfg (FILE *out, mavl_t ktv)
 | 
			
		||||
{
 | 
			
		||||
	char value[500];
 | 
			
		||||
	struct cw_Val * data;
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	const struct cw_Type * type;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	mavliter_init(&it,ktv);
 | 
			
		||||
 | 
			
		||||
	mavliter_foreach(&it){
 | 
			
		||||
		
 | 
			
		||||
		data = mavliter_get(&it);
 | 
			
		||||
		type = data->type;
 | 
			
		||||
		type->to_str(data,value,0);
 | 
			
		||||
		
 | 
			
		||||
		fprintf(out,"%s :%s: %s\n",data->key,type->get_type_name(data), value);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
void show_aps (FILE *out)
 | 
			
		||||
{
 | 
			
		||||
	stop();
 | 
			
		||||
/*	struct connlist * cl;
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	
 | 
			
		||||
	cl = wtplist_get_connlist();
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	mavliter_init (&it, cl->by_addr);
 | 
			
		||||
	fprintf (out, "IP\t\t\twtp-name\n");
 | 
			
		||||
	mavliter_foreach (&it) {
 | 
			
		||||
		cw_Val_t * result;
 | 
			
		||||
		char addr[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
		char wtp_name[CAPWAP_MAX_WTP_NAME_LEN];
 | 
			
		||||
		struct cw_Conn * conn;
 | 
			
		||||
		conn = mavliter_get_ptr (&it);
 | 
			
		||||
		
 | 
			
		||||
		sock_addr2str_p (&conn->addr, addr);
 | 
			
		||||
 | 
			
		||||
		stop();		
 | 
			
		||||
//		result = cw_ktv_get (conn->remote_cfg, "wtp-name", NULL);
 | 
			
		||||
		
 | 
			
		||||
		if (result == NULL) {
 | 
			
		||||
			strcpy (wtp_name, "");
 | 
			
		||||
			
 | 
			
		||||
		} else {
 | 
			
		||||
			result->type->to_str (result, wtp_name, CAPWAP_MAX_WTP_NAME_LEN);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		fprintf (out, "%s\t\t%s\n", addr, wtp_name);
 | 
			
		||||
	}
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
	*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct cw_Conn * find_ap(const char *name)
 | 
			
		||||
{
 | 
			
		||||
stop();
 | 
			
		||||
/*	
 | 
			
		||||
	struct connlist * cl;
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
 | 
			
		||||
	cl = wtplist_get_connlist();
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	mavliter_init (&it, cl->by_addr);
 | 
			
		||||
	mavliter_foreach (&it) {
 | 
			
		||||
		cw_Val_t * result;
 | 
			
		||||
		char wtp_name[CAPWAP_MAX_WTP_NAME_LEN];
 | 
			
		||||
		struct cw_Conn * conn;
 | 
			
		||||
		conn = mavliter_get_ptr (&it);
 | 
			
		||||
		
 | 
			
		||||
		result = cw_ktv_get (conn->remote_cfg, "wtp-name", NULL);
 | 
			
		||||
		
 | 
			
		||||
		if (result == NULL) {
 | 
			
		||||
			strcpy (wtp_name, "");
 | 
			
		||||
			
 | 
			
		||||
		} else {
 | 
			
		||||
			result->type->to_str (result, wtp_name, CAPWAP_MAX_WTP_NAME_LEN);
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
		printf("cmp '%s' : '%s'\n",wtp_name,name);
 | 
			
		||||
		
 | 
			
		||||
		if(strcmp(wtp_name,name)==0){
 | 
			
		||||
			return conn;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
	*/
 | 
			
		||||
	/*wtplist_unlock();*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void con (FILE *out)
 | 
			
		||||
{
 | 
			
		||||
	stop();
 | 
			
		||||
 | 
			
		||||
/*	
 | 
			
		||||
	struct connlist * cl;
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	wtplist_lock();
 | 
			
		||||
	
 | 
			
		||||
	cl = wtplist_get_connlist();
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	mavliter_init (&it, cl->by_addr);
 | 
			
		||||
	fprintf (out, "IP\t\t\twtp-name\n");
 | 
			
		||||
	mavliter_foreach (&it) {
 | 
			
		||||
		cw_Val_t * result;
 | 
			
		||||
		char addr[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
		char wtp_name[CAPWAP_MAX_WTP_NAME_LEN];
 | 
			
		||||
		struct cw_Conn * conn;
 | 
			
		||||
		conn = mavliter_get_ptr (&it);
 | 
			
		||||
		
 | 
			
		||||
		sock_addr2str_p (&conn->addr, addr);
 | 
			
		||||
		
 | 
			
		||||
		result = cw_ktv_get (conn->remote_cfg, "wtp-name", NULL);
 | 
			
		||||
		
 | 
			
		||||
		if (result == NULL) {
 | 
			
		||||
			strcpy (wtp_name, "");
 | 
			
		||||
			
 | 
			
		||||
		} else {
 | 
			
		||||
			result->type->to_str (result, wtp_name, CAPWAP_MAX_WTP_NAME_LEN);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		fprintf (out, "Con!! %s\t\t%s\n", addr, wtp_name);
 | 
			
		||||
		
 | 
			
		||||
		{
 | 
			
		||||
			stop();
 | 
			
		||||
 | 
			
		||||
			mavl_t update;
 | 
			
		||||
//			update = cw_ktv_create();
 | 
			
		||||
//			cw_ktv_set_byte(update,"radio.255/admin-state",1);
 | 
			
		||||
//			conn->update_cfg=update;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		fprintf(out,"\n");
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	wtplist_unlock();
 | 
			
		||||
	*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct command * find_cmd(const char *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct command * search;
 | 
			
		||||
	
 | 
			
		||||
	search = cmdlist;
 | 
			
		||||
	while (search->cmd!=NULL){
 | 
			
		||||
		if (strncmp(cmd,search->cmd,strlen(cmd))==0){
 | 
			
		||||
			return search;
 | 
			
		||||
		}
 | 
			
		||||
		search ++;
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void execute_cmd (struct shelldata * sd, const char *str)
 | 
			
		||||
{
 | 
			
		||||
	char cmd[1024];
 | 
			
		||||
	char args[1024];
 | 
			
		||||
	int n;
 | 
			
		||||
	struct cw_Val_Reader reader;
 | 
			
		||||
	struct command * searchcmd;
 | 
			
		||||
 | 
			
		||||
	args[0]=0;
 | 
			
		||||
	
 | 
			
		||||
	n = sscanf (str, "%s", cmd);
 | 
			
		||||
	if (n<=0)
 | 
			
		||||
		return;
 | 
			
		||||
	
 | 
			
		||||
	searchcmd = find_cmd(cmd);
 | 
			
		||||
	
 | 
			
		||||
	if (searchcmd!=NULL){
 | 
			
		||||
		if (searchcmd->fun != NULL){
 | 
			
		||||
			fprintf(sd->out,"%s %s\n", searchcmd->cmd,str+strlen(cmd));
 | 
			
		||||
			searchcmd->fun(sd, str+strlen(cmd));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else{
 | 
			
		||||
		fprintf(sd->out,"Unknown command: '%s'\n",cmd);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	char type[128];
 | 
			
		||||
	char val[2048];
 | 
			
		||||
 | 
			
		||||
	key[0]=0;
 | 
			
		||||
	type[0]=0;
 | 
			
		||||
	val[0]=0;
 | 
			
		||||
 | 
			
		||||
	stop();
 | 
			
		||||
//	cw_ktv_init_str_reader(&reader,str, strlen(str));
 | 
			
		||||
//	n = cw_ktv_parse_string(&reader, key,type,val);
 | 
			
		||||
	
 | 
			
		||||
	if (n==-1){
 | 
			
		||||
		int i;
 | 
			
		||||
		fprintf(sd->out,"Error on pos %d\n",reader.pos);
 | 
			
		||||
		fprintf(sd->out,"%s",str);
 | 
			
		||||
		for(i=0;i<reader.pos;i++){
 | 
			
		||||
			fprintf(sd->out," ");
 | 
			
		||||
		}
 | 
			
		||||
		fprintf(sd->out,"^\n");
 | 
			
		||||
		fprintf(sd->out,"%s\n",reader.error);
 | 
			
		||||
	}
 | 
			
		||||
	else{
 | 
			
		||||
		fprintf(sd->out,"%s :%s: %s\n", key,type,val);
 | 
			
		||||
	}
 | 
			
		||||
	return;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	n = sscanf (str, "%s%s", cmd, args);
 | 
			
		||||
 | 
			
		||||
	if (n<=0)
 | 
			
		||||
		return;
 | 
			
		||||
	/*printf("CMD: %s, ARGS:\n",cmd);*/
 | 
			
		||||
	
 | 
			
		||||
	if (strcmp (cmd, "s") == 0) {
 | 
			
		||||
		show_aps (sd->out);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	if (strcmp (cmd, "con")==0){
 | 
			
		||||
		con(sd->out);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void shell_loop (FILE *file)
 | 
			
		||||
{
 | 
			
		||||
	struct shelldata sd;
 | 
			
		||||
	int c;
 | 
			
		||||
	c=0;
 | 
			
		||||
	/*	setvbuf(file,NULL,_IONBF,0);
 | 
			
		||||
		fflush(file);
 | 
			
		||||
	*/
 | 
			
		||||
	
 | 
			
		||||
	char str[2048];
 | 
			
		||||
	stop();
 | 
			
		||||
//	sd.update_cfg = cw_ktv_create();
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	sd.out = file;
 | 
			
		||||
	sprintf(sd.prompt,"%s","*");
 | 
			
		||||
	
 | 
			
		||||
	do {
 | 
			
		||||
		fprintf (file, "actube[%s]:>", sd.prompt);
 | 
			
		||||
		fflush (file);
 | 
			
		||||
		str[0]=0;
 | 
			
		||||
		fgets (str, sizeof (str), file);
 | 
			
		||||
		execute_cmd (&sd, str);
 | 
			
		||||
		
 | 
			
		||||
	} while (c != EOF);
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void * run_shell (void * arg)
 | 
			
		||||
{
 | 
			
		||||
	struct sockaddr_storage server, client;
 | 
			
		||||
	socklen_t client_size;
 | 
			
		||||
	char sockstr[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
	
 | 
			
		||||
	int rc;
 | 
			
		||||
	const char * addr = "127.0.0.1:5000";
 | 
			
		||||
	int sockfd, clientsock;
 | 
			
		||||
	int yes;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	cw_dbg(DBG_INFO,"Staring shelli listening at: %s",addr);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	rc = sock_strtoaddr (addr, (struct sockaddr*) &server);
 | 
			
		||||
	
 | 
			
		||||
	if (! rc) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't parse address '%s', %s", addr, strerror (errno));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	sockfd = socket ( ( (struct sockaddr*) &server)->sa_family, SOCK_STREAM, 0);
 | 
			
		||||
	
 | 
			
		||||
	yes = 1;
 | 
			
		||||
	/* reuse address */
 | 
			
		||||
	setsockopt (sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof (yes));
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	/* bind address */
 | 
			
		||||
	rc =  bind (sockfd, (struct sockaddr*) &server, sizeof (server));
 | 
			
		||||
	
 | 
			
		||||
	if (rc) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't bind socket address '%s', %s", addr, strerror (errno));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	rc = listen (sockfd, 5);
 | 
			
		||||
	
 | 
			
		||||
	if (rc) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't listen on address '%s', %s", addr, strerror (errno));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	client_size = sizeof (client);
 | 
			
		||||
while(1){
 | 
			
		||||
	
 | 
			
		||||
	clientsock = accept (sockfd, (struct sockaddr*) &client, &client_size);
 | 
			
		||||
	
 | 
			
		||||
	if (clientsock > 0) {
 | 
			
		||||
		sock_addr2str_p (&client, sockstr);
 | 
			
		||||
		cw_dbg (DBG_INFO, "Acceptiong session from %s", sockstr);
 | 
			
		||||
		cw_dbg (DBG_INFO, "Start shell");
 | 
			
		||||
		shell_loop (fdopen (clientsock, "a+"));
 | 
			
		||||
		cw_dbg (DBG_INFO, "Stop shell");
 | 
			
		||||
		close (clientsock);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	cw_dbg (DBG_INFO,"Accepting shell session %i, %s", rc, strerror (errno));
 | 
			
		||||
}	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void start_shell()
 | 
			
		||||
{
 | 
			
		||||
	pthread_t thread;
 | 
			
		||||
	pthread_create (&thread, NULL, run_shell,
 | 
			
		||||
	                NULL);
 | 
			
		||||
}
 | 
			
		||||
@ -131,7 +131,7 @@ struct mavl * cw_statemachine_load_states (struct mavl * statemachine_states, cw
 | 
			
		||||
                        cw_strstate(s->state));
 | 
			
		||||
                s++;
 | 
			
		||||
        }
 | 
			
		||||
        return 1;
 | 
			
		||||
        return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -78,7 +78,7 @@ struct wtpman * wtplist_get(const struct sockaddr * addr)
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct wtpman * wtplist_get_by_session_id(bstr16_t *session_id)
 | 
			
		||||
struct wtpman * wtplist_get_by_session_id(bstr16_t session_id)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Conn  search;
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,7 @@ extern struct wtpman * wtplist_add(struct wtpman * wtpman);
 | 
			
		||||
extern void wtplist_remove(struct wtpman * wtpman);
 | 
			
		||||
extern void wtplist_lock();
 | 
			
		||||
extern void wtplist_unlock();
 | 
			
		||||
extern struct wtpman * wtplist_get_by_session_id(bstr16_t *session_id);
 | 
			
		||||
extern struct wtpman * wtplist_get_by_session_id(bstr16_t session_id);
 | 
			
		||||
struct connlist * wtplist_get_connlist(void);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										269
									
								
								src/ac/wtpman.c
									
									
									
									
									
								
							
							
						
						
									
										269
									
								
								src/ac/wtpman.c
									
									
									
									
									
								
							@ -64,11 +64,13 @@ static void wtpman_run_discovery(void *arg)
 | 
			
		||||
 | 
			
		||||
	wtpman->conn->capwap_state = CAPWAP_STATE_DISCOVERY;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	while (!cw_timer_timeout(timer)
 | 
			
		||||
	       && wtpman->conn->capwap_state == CAPWAP_STATE_DISCOVERY) {
 | 
			
		||||
		int rc;
 | 
			
		||||
		rc = cw_read_messages(wtpman->conn);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		if (cw_result_is_ok(rc)) {
 | 
			
		||||
			wtpman->conn->capwap_state = CAPWAP_STATE_JOIN;
 | 
			
		||||
 | 
			
		||||
@ -85,7 +87,6 @@ static void wtpman_run_discovery(void *arg)
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -165,7 +166,7 @@ static int wtpman_join(void *arg)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void wtpman_image_data(struct wtpman *wtpman)
 | 
			
		||||
void wtpman_image_data(struct wtpman *wtpman)
 | 
			
		||||
{
 | 
			
		||||
/*	char sock_buf[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
	struct cw_Conn *conn = wtpman->conn;
 | 
			
		||||
@ -299,12 +300,12 @@ int cw_run_state_machine(struct cw_Conn *conn, time_t * timer)
 | 
			
		||||
 | 
			
		||||
static void *wtpman_main(void *arg)
 | 
			
		||||
{
 | 
			
		||||
	mavl_t r;
 | 
			
		||||
	//mavl_t r;
 | 
			
		||||
	int rc;
 | 
			
		||||
	time_t timer;
 | 
			
		||||
	char sock_buf[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
	//char sock_buf[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
	struct cw_Conn *conn;
 | 
			
		||||
	int last_state;
 | 
			
		||||
//	int last_state;
 | 
			
		||||
	struct wtpman *wtpman = (struct wtpman *) arg;
 | 
			
		||||
 | 
			
		||||
	wtpman->conn->seqnum = 0;
 | 
			
		||||
@ -345,8 +346,8 @@ static void *wtpman_main(void *arg)
 | 
			
		||||
 | 
			
		||||
	while (1) {
 | 
			
		||||
 | 
			
		||||
		int wait_join;
 | 
			
		||||
		int wait_change_state;
 | 
			
		||||
		//int wait_join;
 | 
			
		||||
		//int wait_change_state;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -396,7 +397,7 @@ static void *wtpman_main(void *arg)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* dtls is established, goto join state */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
	conn->capwap_state = CAPWAP_STATE_JOIN;
 | 
			
		||||
	if (!wtpman_join(wtpman)) {
 | 
			
		||||
		wtpman_remove(wtpman);
 | 
			
		||||
@ -409,182 +410,14 @@ static void *wtpman_main(void *arg)
 | 
			
		||||
	       sock_addr2str_p(&conn->addr, sock_buf),
 | 
			
		||||
	       format_bin2hex(conn->session_id, 16));
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
	exit(0);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
//	cw_dbg(DBG_INFO, "Creating data thread");
 | 
			
		||||
//	pthread_t thread;
 | 
			
		||||
//	pthread_create(&thread, NULL, (void *) wtpman_run_data, (void *) wtpman);
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
	/* here the WTP has joined, now we assume an image data request  
 | 
			
		||||
	   or a configuration status request. Nothing else. 
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	rc = 0;
 | 
			
		||||
	while (!cw_timer_timeout(timer)
 | 
			
		||||
	       && wtpman->conn->capwap_state == CAPWAP_STATE_CONFIGURE) {
 | 
			
		||||
		rc = cw_read_messages(wtpman->conn);
 | 
			
		||||
		if (rc < 0) {
 | 
			
		||||
			if (errno != EAGAIN)
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cw_dbg_ktv_dump(conn->remote_cfg, DBG_INFO,
 | 
			
		||||
			"-------------dump------------", "DMP",
 | 
			
		||||
			"---------end dump --------");
 | 
			
		||||
 | 
			
		||||
	if (!cw_result_is_ok(rc)) {
 | 
			
		||||
		cw_dbg(DBG_INFO, "WTP Problem: %s", cw_strrc(rc));
 | 
			
		||||
		wtpman_remove(wtpman);
 | 
			
		||||
		return NULL;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (conn->capwap_state == CW_STATE_IMAGE_DATA) {
 | 
			
		||||
		wtpman_image_data(wtpman);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	conn->capwap_state = CAPWAP_STATE_RUN;
 | 
			
		||||
/*
 | 
			
		||||
	// XXX testing ...
 | 
			
		||||
//	DBGX("Cofig to sql", "");
 | 
			
		||||
//	props_to_sql(conn,conn->incomming,0);
 | 
			
		||||
//	radios_to_sql(conn);
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
	/*conn->msg_end=msg_end_handler; */
 | 
			
		||||
	/* The main run loop */
 | 
			
		||||
	reset_echointerval_timer(wtpman);
 | 
			
		||||
 | 
			
		||||
	rc = 0;
 | 
			
		||||
	while (wtpman->conn->capwap_state == CAPWAP_STATE_RUN) {
 | 
			
		||||
		rc = cw_read_messages(wtpman->conn);
 | 
			
		||||
		if (rc < 0) {
 | 
			
		||||
			if (errno != EAGAIN)
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
/*//		cw_dbg(DBG_X, "Time left: %d",
 | 
			
		||||
// */
 | 
			
		||||
		/*cw_timer_timeleft(wtpman->echointerval_timer); */
 | 
			
		||||
 | 
			
		||||
		if (cw_timer_timeout(wtpman->echointerval_timer)) {
 | 
			
		||||
 | 
			
		||||
			cw_dbg(DBG_INFO, "Lost connection to WTP:%s",
 | 
			
		||||
			       sock_addr2str_p(&conn->addr, sock_buf));
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
/*
 | 
			
		||||
//		mavl_del_all(conn->outgoing);
 | 
			
		||||
//		conn_clear_upd(conn,1);
 | 
			
		||||
 | 
			
		||||
//	props_to_sql(conn,conn->incomming,0);
 | 
			
		||||
//	radios_to_sql(conn);
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		r = db_get_update_tasks(conn,
 | 
			
		||||
					sock_addr2str(&conn->addr, sock_buf));
 | 
			
		||||
		if (r) {
 | 
			
		||||
 | 
			
		||||
			/*              
 | 
			
		||||
			   //                   if (!conn->outgoing->count)
 | 
			
		||||
			   //                           continue;
 | 
			
		||||
			 */
 | 
			
		||||
			cw_dbg(DBG_INFO, "Updating WTP %s",
 | 
			
		||||
			       sock_addr2str(&conn->addr, sock_buf));
 | 
			
		||||
 | 
			
		||||
			rc = cw_send_request(conn,
 | 
			
		||||
					     CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
//			mavl_merge(conn->config, conn->outgoing);
 | 
			
		||||
//			mavl_destroy(conn->outgoing);
 | 
			
		||||
//			conn->outgoing = mbag_create();
 | 
			
		||||
//			props_to_sql(conn,conn->incomming,0);
 | 
			
		||||
//			radios_to_sql(conn);
 | 
			
		||||
//			mavl_destroy(r);
 | 
			
		||||
*/
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		r = db_get_radio_tasks(conn,
 | 
			
		||||
				       sock_addr2str(&conn->addr, sock_buf));
 | 
			
		||||
		if (r) {
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
			//			if (!conn->radios_upd->count)
 | 
			
		||||
//				continue;
 | 
			
		||||
*/
 | 
			
		||||
			cw_dbg(DBG_INFO, "Updating Radios for %s",
 | 
			
		||||
			       sock_addr2str(&conn->addr, sock_buf));
 | 
			
		||||
			rc = cw_send_request(conn,
 | 
			
		||||
					     CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
//			conn_clear_upd(conn,1);
 | 
			
		||||
 | 
			
		||||
//			mavl_destroy(conn->radios_upd);
 | 
			
		||||
//			conn->radios_upd=mbag_i_create();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//			radios_to_sql(conn);
 | 
			
		||||
*/
 | 
			
		||||
			/*
 | 
			
		||||
			   rc = cw_send_request(conn, CW_MSG_CONFIGURATION_UPDATE_REQUEST);
 | 
			
		||||
			   mavl_merge(conn->config, conn->outgoing);
 | 
			
		||||
			   mavl_destroy(conn->outgoing);
 | 
			
		||||
			   conn->outgoing = mbag_create();
 | 
			
		||||
			   config_to_sql(conn);
 | 
			
		||||
			   radios_to_sql(conn);
 | 
			
		||||
			   mavl_destroy(r);
 | 
			
		||||
			 */
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	db_ping_wtp(sock_addr2str_p(&conn->addr, sock_buf), "");
 | 
			
		||||
	wtpman_remove(wtpman);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void wtpman_run_dtls(void *arg)
 | 
			
		||||
{
 | 
			
		||||
	char sock_buf[SOCK_ADDR_BUFSIZE];
 | 
			
		||||
	struct wtpman *wtpman = (struct wtpman *) arg;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* reject connections to our multi- or broadcast sockets */
 | 
			
		||||
	if (socklist[wtpman->socklistindex].type != SOCKLIST_UNICAST_SOCKET) {
 | 
			
		||||
		cw_dbg(DBG_DTLS,
 | 
			
		||||
		       "Dropping connection from %s to non-unicast socket.",
 | 
			
		||||
		       sock_addr2str_p(&wtpman->conn->addr, sock_buf));
 | 
			
		||||
		wtpman_remove(wtpman);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
/*//      time_t timer = cw_timer_start(wtpman->conn->wait_dtls);*/
 | 
			
		||||
 | 
			
		||||
	/* establish dtls session */
 | 
			
		||||
	if (!wtpman_dtls_setup(wtpman)) {
 | 
			
		||||
		wtpman_remove(wtpman);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	wtpman_main(arg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void wtpman_destroy(struct wtpman *wtpman)
 | 
			
		||||
{
 | 
			
		||||
@ -600,25 +433,35 @@ void wtpman_destroy(struct wtpman *wtpman)
 | 
			
		||||
 | 
			
		||||
static void copy(struct cw_ElemHandlerParams * params)
 | 
			
		||||
{
 | 
			
		||||
	struct wtpman * wtpman;
 | 
			
		||||
	struct cw_Conn * conn;
 | 
			
		||||
	wtpman = (struct wtpman*)params->conn->data;
 | 
			
		||||
	conn = (struct cw_Conn*)params->conn;
 | 
			
		||||
//	struct wtpman * wtpman;
 | 
			
		||||
	//struct cw_Conn * conn;
 | 
			
		||||
	//wtpman = (struct wtpman*)params->conn->data;
 | 
			
		||||
	//conn = (struct cw_Conn*)params->conn;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	cw_dbg(DBG_X,"-------------  Here is the config we ve got from WTP ---------------- ");
 | 
			
		||||
	cw_cfg_dump(params->cfg);
 | 
			
		||||
	cw_dbg(DBG_X,"-------------  This was the config we ve got from WTP ---------------- ");
 | 
			
		||||
	cw_dbg(DBG_X,"Now copying:");
 | 
			
		||||
	cw_cfg_copy(params->cfg,conn->local_cfg);
 | 
			
		||||
	cw_dbg(DBG_X,"Copying done.");
 | 
			
		||||
//	cw_dbg(DBG_X,"-------------  Here is the config we ve got from WTP ---------------- ");
 | 
			
		||||
//	cw_cfg_dump(params->cfg);
 | 
			
		||||
//	cw_dbg(DBG_X,"-------------  This was the config we ve got from WTP ---------------- ");
 | 
			
		||||
//	cw_dbg(DBG_X,"Now copying:");
 | 
			
		||||
//	cw_cfg_copy(params->cfg,conn->local_cfg,0,"");
 | 
			
		||||
        cw_cfg_copy(params->cfg, params->conn->remote_cfg,DBG_CFG_UPDATES,"GlobalCfg");
 | 
			
		||||
 | 
			
		||||
//	cw_dbg(DBG_X,"Copying done.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int discovery_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Conn * conn = (struct cw_Conn*)params->conn;
 | 
			
		||||
	char filename[200];
 | 
			
		||||
 | 
			
		||||
	cw_dbg(DBG_X,"DISCOVERY Callback");
 | 
			
		||||
	copy(params);
 | 
			
		||||
 | 
			
		||||
	const char * wtpname = cw_cfg_get(conn->remote_cfg,"capwap/wtp-name","default");
 | 
			
		||||
	sprintf(filename,"wtp-discovery-%s.ckv",wtpname);
 | 
			
		||||
	cw_cfg_save(filename,params->cfg,NULL);
 | 
			
		||||
	cw_cfg_clear(params->cfg);
 | 
			
		||||
		
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -629,7 +472,7 @@ static int join_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, in
 | 
			
		||||
 | 
			
		||||
	cw_dbg(DBG_X,"JOIN Callback");
 | 
			
		||||
	copy(params);
 | 
			
		||||
	const char * wtpname = cw_cfg_get(conn->local_cfg,"wtp-name","default");
 | 
			
		||||
	const char * wtpname = cw_cfg_get(conn->remote_cfg,"capwap/wtp-name","default");
 | 
			
		||||
	sprintf(filename,"wtp-join-%s.ckv",wtpname);
 | 
			
		||||
	cw_cfg_save(filename,params->cfg,NULL);
 | 
			
		||||
	cw_cfg_clear(params->cfg);
 | 
			
		||||
@ -646,26 +489,33 @@ static int update_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr,
 | 
			
		||||
	cw_dbg(DBG_X,"UPDATE Callback");
 | 
			
		||||
	copy(params);
 | 
			
		||||
 | 
			
		||||
	const char * wtpname = cw_cfg_get(conn->local_cfg,"wtp-name","default");
 | 
			
		||||
	const char * wtpname = cw_cfg_get(conn->remote_cfg,"capwap/wtp-name","default");
 | 
			
		||||
	sprintf(filename,"wtp-status-%s.ckv",wtpname);
 | 
			
		||||
	cw_cfg_save(filename,params->cfg,NULL);
 | 
			
		||||
stop();	
 | 
			
		||||
//stop();	
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int event_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Conn * conn = (struct cw_Conn*)params->conn;
 | 
			
		||||
	char filename[200];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	cw_dbg(DBG_X,"WTP EVENT Callback");
 | 
			
		||||
	copy(params);
 | 
			
		||||
 | 
			
		||||
	const char * wtpname = cw_cfg_get(conn->remote_cfg,"capwap/wtp-name","default");
 | 
			
		||||
	sprintf(filename,"wtp-event-%s.ckv",wtpname);
 | 
			
		||||
	cw_cfg_save(filename,conn->remote_cfg,NULL);
 | 
			
		||||
//stop();	
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static setup_complete(struct cw_Conn *conn)
 | 
			
		||||
{
 | 
			
		||||
	struct wtpman * wtpman = (struct wtpman *)conn->data;
 | 
			
		||||
//	wtpman->pjoin = cw_msgset_set_postprocess(conn->msgset,CAPWAP_MSG_JOIN_REQUEST,join_cb);
 | 
			
		||||
//	wtpman->pupdate = cw_msgset_set_postprocess(conn->msgset,CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,update_cb);
 | 
			
		||||
	cw_dbg(DBG_X,"SETUP COMPLETE");
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
 | 
			
		||||
			     int dtlsmode, cw_Cfg_t * global_cfg)
 | 
			
		||||
@ -710,7 +560,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
 | 
			
		||||
 | 
			
		||||
	wtpman->global_cfg = global_cfg;
 | 
			
		||||
 | 
			
		||||
	wtpman->conn = cw_conn_create(sockfd, srcaddr, 5);
 | 
			
		||||
	wtpman->conn = cw_conn_create(sockfd, srcaddr, 100);
 | 
			
		||||
	if (!wtpman->conn) {
 | 
			
		||||
		wtpman_destroy(wtpman);
 | 
			
		||||
		return NULL;
 | 
			
		||||
@ -723,6 +573,13 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
 | 
			
		||||
	wtpman->conn->role = CW_ROLE_AC;
 | 
			
		||||
	wtpman->conn->data=wtpman;
 | 
			
		||||
 | 
			
		||||
	wtpman->conn->cfg_list[0]=wtpman->conn->update_cfg;
 | 
			
		||||
	wtpman->conn->cfg_list[1]=wtpman->conn->remote_cfg;
 | 
			
		||||
	wtpman->conn->cfg_list[2]=wtpman->conn->local_cfg;
 | 
			
		||||
	wtpman->conn->cfg_list[3]=wtpman->conn->global_cfg;
 | 
			
		||||
	wtpman->conn->cfg_list[4]=NULL;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	wtpman->conn->data_sock = socklist[socklistindex].data_sockfd;
 | 
			
		||||
	sock_copyaddr(&wtpman->conn->data_addr,
 | 
			
		||||
		      (struct sockaddr *) &wtpman->conn->addr);
 | 
			
		||||
@ -739,6 +596,10 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
 | 
			
		||||
			CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
 | 
			
		||||
			update_cb);
 | 
			
		||||
 | 
			
		||||
	cw_conn_set_msg_cb(wtpman->conn,
 | 
			
		||||
			CAPWAP_MSG_WTP_EVENT_REQUEST,
 | 
			
		||||
			event_cb);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -747,7 +608,7 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
 | 
			
		||||
	wtpman->conn->strict_capwap = conf_strict_capwap;
 | 
			
		||||
	wtpman->conn->strict_hdr = conf_strict_headers;
 | 
			
		||||
 | 
			
		||||
	wtpman->conn->setup_complete = setup_complete;
 | 
			
		||||
//	wtpman->conn->setup_complete = setup_complete;
 | 
			
		||||
/*
 | 
			
		||||
//	wtpman->conn->radios = mbag_i_create();
 | 
			
		||||
//	wtpman->conn->radios_upd = mbag_i_create();
 | 
			
		||||
@ -775,8 +636,8 @@ struct wtpman *wtpman_create(int socklistindex, struct sockaddr *srcaddr,
 | 
			
		||||
			    cw_mod_get_msg_set(wtpman->conn, cmod, bmod);
 | 
			
		||||
			wtpman->conn->detected = 1;
 | 
			
		||||
			cmod->setup_cfg(wtpman->conn);
 | 
			
		||||
	               if (wtpman->conn->setup_complete)
 | 
			
		||||
        	                wtpman->conn->setup_complete(wtpman->conn);
 | 
			
		||||
//	               if (wtpman->conn->setup_complete)
 | 
			
		||||
//        	                wtpman->conn->setup_complete(wtpman->conn);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,6 @@ CWSRC=\
 | 
			
		||||
	cw_in_capwap_local_ipv4_address.c\
 | 
			
		||||
	cw_in_capwap_local_ipv6_address.c\
 | 
			
		||||
	cw_in_generic_with_index.c\
 | 
			
		||||
	cw_in_generic_struct.c\
 | 
			
		||||
	cw_in_radio_generic_struct.c\
 | 
			
		||||
	cw_in_idx_generic.c\
 | 
			
		||||
	cw_in_idx_generic_struct.c\
 | 
			
		||||
@ -67,6 +66,7 @@ CWSRC=\
 | 
			
		||||
	cw_write_radio_element.c\
 | 
			
		||||
	cw_detect_nat.c\
 | 
			
		||||
	cw_read_from.c \
 | 
			
		||||
	cw_in_generic_struct.c\
 | 
			
		||||
 | 
			
		||||
#	cw_in_check_disc_req.c\
 | 
			
		||||
#	cw_in_check_img_data_req_ac.c\
 | 
			
		||||
@ -210,6 +210,7 @@ MISCSRC=\
 | 
			
		||||
	val.c \
 | 
			
		||||
	discovery.c\
 | 
			
		||||
	message.c\
 | 
			
		||||
	cw_out_radio_generic_struct.c\
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#	intavltree.c\
 | 
			
		||||
@ -228,7 +229,6 @@ DTLSSRC+=\
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
RADIOSRC=\
 | 
			
		||||
	cw_out_radio_generic_struct.c\
 | 
			
		||||
	
 | 
			
		||||
#	cw_in_radio_generic.c\
 | 
			
		||||
#	cw_out_radio_generic.c\
 | 
			
		||||
 | 
			
		||||
@ -25,4 +25,8 @@
 | 
			
		||||
#define ANSI_ITALIC	"\x1b[3m"
 | 
			
		||||
#define ANSI_BOLD	"\x1b[1m"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define ANSI_HOME	"[H"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif /* __ANSI_COLORS_H */
 | 
			
		||||
 | 
			
		||||
@ -240,7 +240,7 @@
 | 
			
		||||
#define CAPWAP_ELEM_ECN_SUPPORT				53
 | 
			
		||||
#define CAPWAP_ELEM_IDLE_TIMEOUT			23
 | 
			
		||||
#define CW_ELEM_IMAGE_DATA				24
 | 
			
		||||
#define CW_ELEM_IMAGE_IDENTIFIER			25
 | 
			
		||||
#define CAPWAP_ELEM_IMAGE_IDENTIFIER			25
 | 
			
		||||
#define CW_ELEM_IMAGE_INFORMATION			26
 | 
			
		||||
#define CW_ELEM_INITIATE_DOWNLOAD			27
 | 
			
		||||
#define CAPWAP_ELEM_LOCATION_DATA			28
 | 
			
		||||
 | 
			
		||||
@ -83,10 +83,17 @@ enum radioelems {
 | 
			
		||||
	CW_ELEM80211_WTP_RADIO_CONFIGURATION=1046,
 | 
			
		||||
	/** IEEE 802.11 WTP Radio Fail Alarm Indication */
 | 
			
		||||
	CW_ELEM80211_WTP_RADIO_FAIL_ALARM_IDICATION=1047,
 | 
			
		||||
	/** IEEE 802.11 Radio Information Message Element */
 | 
			
		||||
	CAPWAP80211_ELEM_WTP_RADIO_INFORMATION = 1048
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** IEEE 802.11 Radio Information Message Element */
 | 
			
		||||
#define CAPWAP80211_ELEM_WTP_RADIO_INFORMATION		1048
 | 
			
		||||
/** IEEE 802.11 Antenna Message element */
 | 
			
		||||
#define CAPWAP80211_ELEM_ANTENNA			1025
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *@}
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ struct cw_StrListElem capwap_strings_elem[] = {
 | 
			
		||||
	{CAPWAP_ELEM_ECN_SUPPORT, "ECN Support"},
 | 
			
		||||
	{CAPWAP_ELEM_IDLE_TIMEOUT, "Idle Timeout"},
 | 
			
		||||
	{CW_ELEM_IMAGE_DATA, "Image Data"},
 | 
			
		||||
	{CW_ELEM_IMAGE_IDENTIFIER, "Image Identifier"},
 | 
			
		||||
	{CAPWAP_ELEM_IMAGE_IDENTIFIER, "Image Identifier"},
 | 
			
		||||
	{CW_ELEM_IMAGE_INFORMATION, "Image Information"},
 | 
			
		||||
	{CW_ELEM_INITIATE_DOWNLOAD, "Initiate Download"},
 | 
			
		||||
	{CAPWAP_ELEM_LOCATION_DATA, "Location Data"},
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										99
									
								
								src/cw/cfg.c
									
									
									
									
									
								
							
							
						
						
									
										99
									
								
								src/cw/cfg.c
									
									
									
									
									
								
							@ -83,12 +83,22 @@ static void del(void *ptr)
 | 
			
		||||
 | 
			
		||||
cw_Cfg_t *cw_cfg_create()
 | 
			
		||||
{
 | 
			
		||||
	return mavl_create(cmp, del, sizeof(struct cw_Cfg_entry));
 | 
			
		||||
	cw_Cfg_t * cfg;
 | 
			
		||||
	cfg = malloc(sizeof(cw_Cfg_t));
 | 
			
		||||
	if (cfg == NULL)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	memset(cfg,0,sizeof(cw_Cfg_t));
 | 
			
		||||
	cfg->cfg = mavl_create(cmp, del, sizeof(struct cw_Cfg_entry));
 | 
			
		||||
	if (cfg->cfg==NULL){
 | 
			
		||||
		cw_cfg_destroy(cfg);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	return cfg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int cw_cfg_set(cw_Cfg_t * cfg, const char *key, const char *val)
 | 
			
		||||
{
 | 
			
		||||
	cw_dbg(DBG_CFG_SET, "%s: %s",key,val);
 | 
			
		||||
	cw_dbg(cfg->dbg_level, "%s%s: %s",cfg->dbg_prefix,key,val);
 | 
			
		||||
 | 
			
		||||
	struct cw_Cfg_entry e;
 | 
			
		||||
	int replaced;
 | 
			
		||||
@ -101,7 +111,7 @@ int cw_cfg_set(cw_Cfg_t * cfg, const char *key, const char *val)
 | 
			
		||||
		free((void *) e.key);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	void *rc = mavl_replace(cfg, &e, &replaced);
 | 
			
		||||
	void *rc = mavl_replace(cfg->cfg, &e, &replaced);
 | 
			
		||||
	if (!rc) {
 | 
			
		||||
		del(&e);
 | 
			
		||||
		return 0;
 | 
			
		||||
@ -116,7 +126,7 @@ const char *cw_cfg_get(cw_Cfg_t * cfg, const char *key, const char *def)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Cfg_entry e, *r;
 | 
			
		||||
	e.key = key;
 | 
			
		||||
	r = mavl_get(cfg, &e);
 | 
			
		||||
	r = mavl_get(cfg->cfg, &e);
 | 
			
		||||
	if (!r)
 | 
			
		||||
		return def;
 | 
			
		||||
	return r->val;
 | 
			
		||||
@ -129,7 +139,7 @@ const char *cw_cfg_get_l(cw_Cfg_t ** cfg, const char * key, const char *def)
 | 
			
		||||
	for(i=0; cfg[i]!=NULL; i++){
 | 
			
		||||
//		cw_dbg(DBG_X,"GET_L IN: %p",cfg[i]);
 | 
			
		||||
		e.key = key;
 | 
			
		||||
		r = mavl_get(cfg[i], &e);
 | 
			
		||||
		r = mavl_get(cfg[i]->cfg, &e);
 | 
			
		||||
		if (r!=NULL)
 | 
			
		||||
			return r->val;
 | 
			
		||||
	}
 | 
			
		||||
@ -167,7 +177,7 @@ void cw_cfg_dump(cw_Cfg_t * cfg)
 | 
			
		||||
{
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	struct cw_Cfg_entry *e;
 | 
			
		||||
	mavliter_init(&it, cfg);
 | 
			
		||||
	mavliter_init(&it, cfg->cfg);
 | 
			
		||||
	mavliter_foreach(&it) {
 | 
			
		||||
 | 
			
		||||
		e = mavliter_get(&it);
 | 
			
		||||
@ -176,6 +186,20 @@ void cw_cfg_dump(cw_Cfg_t * cfg)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cw_cfg_fdump(FILE *f, cw_Cfg_t * cfg)
 | 
			
		||||
{
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	struct cw_Cfg_entry *e;
 | 
			
		||||
	mavliter_init(&it, cfg->cfg);
 | 
			
		||||
	mavliter_foreach(&it) {
 | 
			
		||||
 | 
			
		||||
		e = mavliter_get(&it);
 | 
			
		||||
		fprintf(f,"%s: '%s'\n", e->key, e->val);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct parser {
 | 
			
		||||
	int line;
 | 
			
		||||
@ -471,11 +495,26 @@ int cw_cfg_load(const char *filename, cw_Cfg_t * cfg)
 | 
			
		||||
	return errno;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int cw_cfg_read_from_string(const char *str, cw_Cfg_t *cfg)
 | 
			
		||||
{
 | 
			
		||||
	int errs;
 | 
			
		||||
	FILE * f = fmemopen((void*)str,strlen(str),"rb");
 | 
			
		||||
	if(!f)
 | 
			
		||||
		return errno;
 | 
			
		||||
	errs = cw_cfg_read_from_file(f, cfg);
 | 
			
		||||
	fclose(f);
 | 
			
		||||
 | 
			
		||||
	if (errs)
 | 
			
		||||
		errno = EINVAL;
 | 
			
		||||
	return errno;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int cw_cfg_write_to_file(FILE *f, cw_Cfg_t * cfg)
 | 
			
		||||
{
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	struct cw_Cfg_entry *e;
 | 
			
		||||
	mavliter_init(&it, cfg);
 | 
			
		||||
	mavliter_init(&it, cfg->cfg);
 | 
			
		||||
	mavliter_foreach(&it) {
 | 
			
		||||
		int n;
 | 
			
		||||
		e = mavliter_get(&it);
 | 
			
		||||
@ -519,7 +558,7 @@ void cw_cfg_iter_init(cw_Cfg_t * cfg, struct cw_Cfg_iter *cfi, const char *base)
 | 
			
		||||
	struct cw_Cfg_entry search;
 | 
			
		||||
	search.key = base;
 | 
			
		||||
 | 
			
		||||
	mavliter_init(&(cfi->it), cfg);
 | 
			
		||||
	mavliter_init(&(cfi->it), cfg->cfg);
 | 
			
		||||
	mavliter_seek(&(cfi->it), &search, 0);
 | 
			
		||||
	cfi->base = base;
 | 
			
		||||
}
 | 
			
		||||
@ -601,7 +640,7 @@ uint8_t cw_cfg_get_byte_l(cw_Cfg_t ** cfgs, char *key, uint8_t def)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, char *key, uint16_t def)
 | 
			
		||||
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, const char *key, uint16_t def)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Val v;
 | 
			
		||||
	const char *s = cw_cfg_get(cfg,key,NULL);
 | 
			
		||||
@ -611,6 +650,19 @@ uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, char *key, uint16_t def)
 | 
			
		||||
	return v.val.word;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t cw_cfg_get_word_l(cw_Cfg_t ** cfg, const char *key, uint16_t def)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Val v;
 | 
			
		||||
	const char *s = cw_cfg_get_l(cfg,key,NULL);
 | 
			
		||||
	if (s==NULL)
 | 
			
		||||
		return def;
 | 
			
		||||
	CW_TYPE_WORD->from_str(&v,s);
 | 
			
		||||
	return v.val.word;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
int cw_cfg_get_word(cw_Cfg_t * cfg, char *key, const char * def)
 | 
			
		||||
{
 | 
			
		||||
@ -642,7 +694,7 @@ int cw_cfg_get_next_index(cw_Cfg_t * cfg, const char *key)
 | 
			
		||||
	search.key=ikey;
 | 
			
		||||
	/*//result = ktvn(ktv,&search);*/
 | 
			
		||||
	
 | 
			
		||||
	result = mavl_get_last(cfg,&search);
 | 
			
		||||
	result = mavl_get_last(cfg->cfg,&search);
 | 
			
		||||
	if (result == NULL){
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
@ -684,10 +736,10 @@ int cw_cfg_set_val(cw_Cfg_t * cfg, const char *key, const struct cw_Type *type,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void cw_cfg_copy(cw_Cfg_t *src, cw_Cfg_t *dst)
 | 
			
		||||
void cw_cfg_copy(cw_Cfg_t *src, cw_Cfg_t *dst,int dbg_level,const char *dbg_prefix)
 | 
			
		||||
{
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	mavliter_init(&it, src);
 | 
			
		||||
	mavliter_init(&it, src->cfg);
 | 
			
		||||
	mavliter_foreach(&it) {
 | 
			
		||||
		int exists;
 | 
			
		||||
		struct cw_Cfg_entry * old_elem,*e, new_elem;
 | 
			
		||||
@ -705,7 +757,7 @@ void cw_cfg_copy(cw_Cfg_t *src, cw_Cfg_t *dst)
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		old_elem = mavl_insert(dst,&new_elem,&exists);
 | 
			
		||||
		old_elem = mavl_insert(dst->cfg,&new_elem,&exists);
 | 
			
		||||
 | 
			
		||||
/*		cw_dbg(DBG_X, "CPY: %s: %s -> %s [%d]",new_elem.key,new_elem.val,old_elem->val,exists);
 | 
			
		||||
		if (exists){
 | 
			
		||||
@ -716,9 +768,7 @@ void cw_cfg_copy(cw_Cfg_t *src, cw_Cfg_t *dst)
 | 
			
		||||
*/
 | 
			
		||||
		
 | 
			
		||||
		if (!exists){
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			cw_dbg(DBG_CFG_SET, "New: %s: %s",new_elem.key,new_elem.val);
 | 
			
		||||
			cw_dbg(dbg_level, "%s: [undef] -> %s",new_elem.key,new_elem.val);
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -730,11 +780,12 @@ void cw_cfg_copy(cw_Cfg_t *src, cw_Cfg_t *dst)
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		cw_dbg(DBG_CFG_SET, "Replace: %s: %s (old: %s)",new_elem.key, new_elem.val, old_elem->val);
 | 
			
		||||
		if(dst->del){
 | 
			
		||||
			dst->del(old_elem);
 | 
			
		||||
		cw_dbg(dbg_level, "%s: %s -> %s",new_elem.key,old_elem->val,new_elem.val);
 | 
			
		||||
//		cw_dbg(DBG_X, "Replace: %s: %s (old: %s)",new_elem.key, new_elem.val, old_elem->val);
 | 
			
		||||
		if(dst->cfg->del){
 | 
			
		||||
			dst->cfg->del(old_elem);
 | 
			
		||||
		}
 | 
			
		||||
		memcpy(old_elem,&new_elem,dst->data_size);
 | 
			
		||||
		memcpy(old_elem,&new_elem,dst->cfg->data_size);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -742,13 +793,15 @@ void cw_cfg_copy(cw_Cfg_t *src, cw_Cfg_t *dst)
 | 
			
		||||
 | 
			
		||||
void cw_cfg_destroy(cw_Cfg_t *cfg)
 | 
			
		||||
{
 | 
			
		||||
	mavl_destroy(cfg);
 | 
			
		||||
	if (cfg->cfg)
 | 
			
		||||
		mavl_destroy(cfg->cfg);
 | 
			
		||||
	free(cfg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void cw_cfg_clear(cw_Cfg_t *cfg)
 | 
			
		||||
{
 | 
			
		||||
	mavl_del_all(cfg);
 | 
			
		||||
	mavl_del_all(cfg->cfg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -757,7 +810,7 @@ int cw_cfg_base_exists(cw_Cfg_t * cfg, const char *key)
 | 
			
		||||
        struct cw_Cfg_entry e, *result;
 | 
			
		||||
//cw_dbg(DBG_X,"LOOX FOR: %s",key);
 | 
			
		||||
        e.key=key;
 | 
			
		||||
        result = mavl_get_first(cfg,&e);
 | 
			
		||||
        result = mavl_get_first(cfg->cfg,&e);
 | 
			
		||||
        if (result == NULL)
 | 
			
		||||
                return 0;
 | 
			
		||||
//cw_dbg(DBG_X,"BASEXXX: %s",result->key);
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								src/cw/cfg.h
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/cw/cfg.h
									
									
									
									
									
								
							@ -7,7 +7,14 @@
 | 
			
		||||
 | 
			
		||||
#define CW_CFG_MAX_KEY_LEN 1024
 | 
			
		||||
 | 
			
		||||
typedef struct mavl cw_Cfg_t;
 | 
			
		||||
struct cw_Cfg {
 | 
			
		||||
	struct mavl * cfg;
 | 
			
		||||
	const char *name;
 | 
			
		||||
	int dbg_level;
 | 
			
		||||
	const char *dbg_prefix;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct cw_Cfg cw_Cfg_t;
 | 
			
		||||
 | 
			
		||||
cw_Cfg_t * cw_cfg_create();
 | 
			
		||||
int cw_cfg_set(cw_Cfg_t *cfg,const char *key, const char *val);
 | 
			
		||||
@ -32,14 +39,14 @@ struct cw_Cfg_entry *cw_cfg_iter_next(struct cw_Cfg_iter *cfi, const char *key);
 | 
			
		||||
void cw_cfg_iter_init(cw_Cfg_t * cfg, struct cw_Cfg_iter *cfi, const char *base);
 | 
			
		||||
 | 
			
		||||
int cw_cfg_get_bool(cw_Cfg_t * cfg, const char * key, int def);
 | 
			
		||||
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, char *key, uint16_t def);
 | 
			
		||||
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, const char *key, uint16_t def);
 | 
			
		||||
void cw_cfg_set_int(cw_Cfg_t * cfg, const char * key, int val);
 | 
			
		||||
uint8_t cw_cfg_get_byte(cw_Cfg_t * cfg, char *key, uint8_t def);
 | 
			
		||||
bstr16_t cw_cfg_get_bstr16(cw_Cfg_t * cfg, const char * key, const char *def);
 | 
			
		||||
int cw_cfg_set_bstr16(cw_Cfg_t * cfg, const char * key, bstr16_t str);
 | 
			
		||||
int cw_cfg_get_next_index(cw_Cfg_t * cfg, const char *key);
 | 
			
		||||
const char *cw_cfg_get_l(cw_Cfg_t ** cfg, const char * key, const char *def);
 | 
			
		||||
void cw_cfg_copy(cw_Cfg_t *src, cw_Cfg_t *dst);
 | 
			
		||||
void cw_cfg_copy(cw_Cfg_t *src, cw_Cfg_t *dst,int dbg_level,const char *dbg_prefix);
 | 
			
		||||
void cw_cfg_destroy(cw_Cfg_t *cfg);
 | 
			
		||||
void cw_cfg_clear(cw_Cfg_t *cfg);
 | 
			
		||||
int cw_cfg_base_exists(cw_Cfg_t * cfg, const char *key);
 | 
			
		||||
@ -48,6 +55,9 @@ cw_Val_t * cw_cfg_get_val_l(cw_Cfg_t ** cfgs, const char *key, const struct cw_T
 | 
			
		||||
int cw_cfg_base_exists_l(cw_Cfg_t ** cfgs, const char *key);
 | 
			
		||||
int cw_cfg_save(const char *filename, cw_Cfg_t *cfg, const char *format, ...);
 | 
			
		||||
 | 
			
		||||
uint16_t cw_cfg_get_word_l(cw_Cfg_t ** cfg, const char *key, uint16_t def);
 | 
			
		||||
void cw_cfg_fdump(FILE *f, cw_Cfg_t * cfg);
 | 
			
		||||
int cw_cfg_read_from_string(const char *str, cw_Cfg_t *cfg);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -61,6 +61,7 @@ void cw_conn_init(struct cw_Conn * conn)
 | 
			
		||||
	conn->update_cfg = cw_cfg_create();
 | 
			
		||||
	conn->remote_cfg = cw_cfg_create();
 | 
			
		||||
	conn->local_cfg = cw_cfg_create();
 | 
			
		||||
	conn->cfg_list[0]=NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int cw_conn_set_msg_cb(struct cw_Conn *conn, int type, cw_MsgCallbackFun fun)
 | 
			
		||||
@ -139,7 +140,7 @@ struct cw_Conn * cw_conn_create(int sock, struct sockaddr * addr, int qsize)
 | 
			
		||||
/*	conn->send_data_packet = conn_send_data_packet;*/
 | 
			
		||||
 | 
			
		||||
	conn->last_seqnum_received=-1;
 | 
			
		||||
	conn->mtu=600;
 | 
			
		||||
	conn->mtu=1480;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	conn->cur_packet=0;
 | 
			
		||||
@ -149,7 +150,7 @@ struct cw_Conn * cw_conn_create(int sock, struct sockaddr * addr, int qsize)
 | 
			
		||||
	conn->write = conn->send_packet;
 | 
			
		||||
	conn->read = conn->recv_packet;
 | 
			
		||||
 | 
			
		||||
	conn->dtls_mtu = 600;
 | 
			
		||||
	conn->dtls_mtu = 1480;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -349,7 +350,8 @@ static int process_elements(struct cw_Conn *conn, uint8_t * rawmsg, int len,
 | 
			
		||||
 | 
			
		||||
	/* pre-check message */
 | 
			
		||||
	if (payloadlen - 8 != elems_len) {
 | 
			
		||||
 | 
			
		||||
//printf ("The elems_len is %d\n",elems_len);
 | 
			
		||||
//printf ("The len = %d\n",len);
 | 
			
		||||
		if (conn->strict_hdr) {
 | 
			
		||||
			cw_dbg(DBG_MSG_ERR,
 | 
			
		||||
			       "Discarding message from %s, msgelems len=%d, payload len=%d, (Strict CAPWAP) ",
 | 
			
		||||
@ -365,7 +367,7 @@ static int process_elements(struct cw_Conn *conn, uint8_t * rawmsg, int len,
 | 
			
		||||
			       "Packet from from %s has %d bytes of extra data, ignoring.",
 | 
			
		||||
			       sock_addr2str(&conn->addr, sock_buf),
 | 
			
		||||
			       payloadlen - 8 - elems_len);
 | 
			
		||||
			elems_len = len - 8;
 | 
			
		||||
			//elems_len = len - 8;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (elems_len > payloadlen - 8) {
 | 
			
		||||
@ -474,25 +476,27 @@ static int process_elements(struct cw_Conn *conn, uint8_t * rawmsg, int len,
 | 
			
		||||
 | 
			
		||||
	elems_ptr = cw_get_msg_elems_ptr(msg_ptr);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	cw_dbg(DBG_MSG_PARSING, "*** Parsing message of type %d - (%s) ***",
 | 
			
		||||
	       message->type, message->name);
 | 
			
		||||
/*	if (cw_dbg_is_level(DBG_ELEM_IN)){
 | 
			
		||||
		cw_dbg(DBG_MSG_PARSING, "Parsing message of type %d - (%s)",
 | 
			
		||||
		       message->type, message->name);
 | 
			
		||||
	}*/
 | 
			
		||||
 | 
			
		||||
	memset(¶ms,0,sizeof(struct cw_ElemHandlerParams));
 | 
			
		||||
	
 | 
			
		||||
	params.mand_found = mavl_create_conststr();
 | 
			
		||||
	params.unrecognized = mlist_create(NULL, NULL, sizeof(uint8_t *));
 | 
			
		||||
 | 
			
		||||
	params.cfg = cw_cfg_create(); 
 | 
			
		||||
	params.cfg_list[0]=params.cfg;
 | 
			
		||||
	params.cfg_list[1]=conn->local_cfg;
 | 
			
		||||
	params.cfg_list[2]=conn->global_cfg;
 | 
			
		||||
	params.cfg_list[3]=NULL;
 | 
			
		||||
	params.cfg = cw_cfg_create();
 | 
			
		||||
	params.cfg->dbg_level = DBG_ELEM_DETAIL_IN;
 | 
			
		||||
	params.cfg->dbg_prefix = "    ";
 | 
			
		||||
 | 
			
		||||
	params.cfg_list=conn->cfg_list;
 | 
			
		||||
 | 
			
		||||
	params.from = from;
 | 
			
		||||
	params.msgdata = message;
 | 
			
		||||
	params.msgset=conn->msgset;
 | 
			
		||||
	params.conn = conn;
 | 
			
		||||
	params.dbg_level = DBG_ELEM_IN;
 | 
			
		||||
 | 
			
		||||
	cw_decode_elements(¶ms,elems_ptr, elems_len);
 | 
			
		||||
 | 
			
		||||
@ -502,8 +506,8 @@ static int process_elements(struct cw_Conn *conn, uint8_t * rawmsg, int len,
 | 
			
		||||
	if (params.mand_found)
 | 
			
		||||
		cw_check_missing_mand(message, params.mand_found,conn->msgset->handlers_by_key);
 | 
			
		||||
 | 
			
		||||
	cw_dbg(DBG_MSG_PARSING, "*** End parsing message of type %d (%s) ***",
 | 
			
		||||
	       message->type, message->name);
 | 
			
		||||
//	cw_dbg(DBG_MSG_PARSING, "*** End parsing message of type %d (%s) ***",
 | 
			
		||||
//	       message->type, message->name);
 | 
			
		||||
 | 
			
		||||
	if (params.mand_found)
 | 
			
		||||
		mavl_destroy(params.mand_found);
 | 
			
		||||
@ -530,7 +534,7 @@ static int process_elements(struct cw_Conn *conn, uint8_t * rawmsg, int len,
 | 
			
		||||
 | 
			
		||||
			cw_send_error_response(conn, rawmsg, result_code);
 | 
			
		||||
		} else if (result_code == 0) {
 | 
			
		||||
			cw_cfg_set_int(conn->update_cfg, "result-code",
 | 
			
		||||
			cw_cfg_set_int(conn->update_cfg, "capwap/result-code",
 | 
			
		||||
					 result_code);
 | 
			
		||||
			if (ui->next) {
 | 
			
		||||
				conn->capwap_prevstate = conn->capwap_state;
 | 
			
		||||
 | 
			
		||||
@ -78,14 +78,16 @@ struct cw_Conn {
 | 
			
		||||
	cw_Cfg_t * local_cfg;	/**< local_cfg contains overrides for global_cfg 
 | 
			
		||||
				     wich are related to this conn object. */
 | 
			
		||||
	
 | 
			
		||||
	mavl_t remote_cfg;	/**< contains the configuration we now from the 
 | 
			
		||||
	cw_Cfg_t * remote_cfg;	/**< contains the configuration we now from the 
 | 
			
		||||
				     device this conn object ist connected to.
 | 
			
		||||
				     Typically this is what we have got from discovery
 | 
			
		||||
				     response or join response in WTP mode. 
 | 
			
		||||
				     And in AC mode this contains date receive from 
 | 
			
		||||
				     configuration status request.  */
 | 
			
		||||
 | 
			
		||||
	mavl_t update_cfg;
 | 
			
		||||
	cw_Cfg_t * update_cfg;
 | 
			
		||||
 | 
			
		||||
	cw_Cfg_t * cfg_list[10];
 | 
			
		||||
	
 | 
			
		||||
	bstr16_t session_id;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,6 @@ void conn_q_add_packet(struct cw_Conn * conn,uint8_t *packet,int len)
 | 
			
		||||
	conn->q[qwpos]=malloc(len+4);
 | 
			
		||||
	if (conn->q[qwpos]==NULL)
 | 
			
		||||
		return;
 | 
			
		||||
	
 | 
			
		||||
	*((uint32_t*)(conn->q[qwpos]))=len;
 | 
			
		||||
	memcpy(conn->q[qwpos]+4,packet,len);	
 | 
			
		||||
	conn->qwpos=qwpos+1;
 | 
			
		||||
 | 
			
		||||
@ -29,6 +29,7 @@
 | 
			
		||||
 | 
			
		||||
int conn_recv_packet_(struct cw_Conn *conn, uint8_t * buf, int len, int flags)
 | 
			
		||||
{
 | 
			
		||||
	printf("conn_recv\n");
 | 
			
		||||
	int n;
 | 
			
		||||
	while ((n = recv(conn->sock, (char *) buf, len, flags)) < 0) {
 | 
			
		||||
		if (errno != EINTR) {
 | 
			
		||||
 | 
			
		||||
@ -14,6 +14,43 @@ int conn_send_msg(struct cw_Conn * conn, uint8_t *rawmsg)
 | 
			
		||||
	packetlen = cw_get_hdr_msg_total_len(rawmsg);
 | 
			
		||||
 | 
			
		||||
	cw_dbg_msg(DBG_MSG_OUT, conn,rawmsg, packetlen,(struct sockaddr*)&conn->addr);
 | 
			
		||||
	{
 | 
			
		||||
	int type;
 | 
			
		||||
	uint8_t *msgptr;
 | 
			
		||||
	msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg);
 | 
			
		||||
	struct cw_MsgData * msg;
 | 
			
		||||
	type = cw_get_msg_type(msgptr);
 | 
			
		||||
	msg = cw_msgset_get_msgdata(conn->msgset,type);
 | 
			
		||||
	uint8_t *elems_ptr;
 | 
			
		||||
 | 
			
		||||
	int offset = cw_get_hdr_msg_offset(rawmsg);
 | 
			
		||||
 | 
			
		||||
	uint8_t *msg_ptr = rawmsg + offset;
 | 
			
		||||
	int elems_len = cw_get_msg_elems_len(msg_ptr);
 | 
			
		||||
	elems_ptr = cw_get_msg_elems_ptr(msg_ptr);
 | 
			
		||||
	cw_Cfg_t * cfg = cw_cfg_create();
 | 
			
		||||
	cfg->dbg_level = DBG_ELEM_DETAIL_OUT;
 | 
			
		||||
	cfg->dbg_prefix = "    ";
 | 
			
		||||
 | 
			
		||||
	struct cw_ElemHandlerParams params;
 | 
			
		||||
	memset(¶ms,0,sizeof(struct cw_ElemHandlerParams));
 | 
			
		||||
	
 | 
			
		||||
	params.cfg=cfg;
 | 
			
		||||
	params.msgset=conn->msgset;
 | 
			
		||||
	params.msgdata=msg;
 | 
			
		||||
	params.mand_found = mavl_create_conststr();
 | 
			
		||||
	params.dbg_level = DBG_ELEM_OUT;
 | 
			
		||||
 | 
			
		||||
	cw_decode_elements( ¶ms, elems_ptr,elems_len);
 | 
			
		||||
	cw_cfg_destroy(cfg);
 | 
			
		||||
	if (params.mand_found){
 | 
			
		||||
		cw_check_missing_mand(msg, params.mand_found,conn->msgset->handlers_by_key);
 | 
			
		||||
		mavl_destroy(params.mand_found);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* Zyxel doesn't count msg element length from
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										116
									
								
								src/cw/cw.c
									
									
									
									
									
								
							
							
						
						
									
										116
									
								
								src/cw/cw.c
									
									
									
									
									
								
							@ -1,6 +1,7 @@
 | 
			
		||||
#include "cw.h"
 | 
			
		||||
#include "log.h"
 | 
			
		||||
#include "dbg.h"
 | 
			
		||||
#include "keys.h"
 | 
			
		||||
 | 
			
		||||
int cw_in_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
 | 
			
		||||
		uint8_t * elem_data, int elem_len)
 | 
			
		||||
@ -117,13 +118,15 @@ int cw_out_radio_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerP
 | 
			
		||||
	int radios;
 | 
			
		||||
	len =0;
 | 
			
		||||
	
 | 
			
		||||
	radios = cw_cfg_get_byte_l(params->cfg_list,"wtp-descriptor/max-radios",0);
 | 
			
		||||
	radios = cw_cfg_get_byte_l(params->cfg_list,"capwap/wtp-descriptor/max-radios",0);
 | 
			
		||||
	for(i=0;i<radios;i++){
 | 
			
		||||
 | 
			
		||||
		type = (struct cw_Type*)handler->type;
 | 
			
		||||
		start = params->msgset->header_len(handler)+len;
 | 
			
		||||
 | 
			
		||||
		sprintf(key,"radio.%d/%s",i,handler->key);
 | 
			
		||||
//printf("RADIO KEY: %s\n",key);
 | 
			
		||||
		
 | 
			
		||||
//		cw_dbg(DBG_X,"KEY: %s",key);
 | 
			
		||||
 | 
			
		||||
		l = type->write(params->cfg_list, key,dst+start+1,handler->param);
 | 
			
		||||
@ -156,3 +159,114 @@ int cw_header_len(struct cw_ElemHandler * handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Put the "status part" of an an AC Descriptor to memory
 | 
			
		||||
 * @param cfg_list Cfg list to read status from
 | 
			
		||||
 * @param dst Where to put the status to
 | 
			
		||||
 * @param parent_key prefix to each key
 | 
			
		||||
 */
 | 
			
		||||
int 
 | 
			
		||||
cw_put_ac_status(uint8_t *dst, cw_Cfg_t ** cfg_list, const char * parent_key){
 | 
			
		||||
 | 
			
		||||
	uint8_t *d = dst;
 | 
			
		||||
	
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	
 | 
			
		||||
	/* put statiosn */
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,"stations");
 | 
			
		||||
	d += cw_put_word(d,cw_cfg_get_word_l(cfg_list,key,0));
 | 
			
		||||
 | 
			
		||||
	/* put station limit */
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,"station-limit");
 | 
			
		||||
	d += cw_put_word(d,cw_cfg_get_word_l(cfg_list,key,0));
 | 
			
		||||
 | 
			
		||||
	/* Put number of active WTPs */
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,"active-wtps");
 | 
			
		||||
	d += cw_put_word(d,cw_cfg_get_word_l(cfg_list,key,0));
 | 
			
		||||
 | 
			
		||||
	/* Put max WTPs */
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,"max-wtps");
 | 
			
		||||
	d += cw_put_word(d,cw_cfg_get_word_l(cfg_list,key,0));
 | 
			
		||||
 | 
			
		||||
	/* Put security flags */	
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,"security");
 | 
			
		||||
	d += cw_put_byte(d,cw_cfg_get_byte_l(cfg_list,key,0));
 | 
			
		||||
 | 
			
		||||
	/* Put rmac-filed */
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,"rmac-field");
 | 
			
		||||
	d += cw_put_byte(d,cw_cfg_get_byte_l(cfg_list,key,0));
 | 
			
		||||
	
 | 
			
		||||
	/* reserved field, must be zero - RFC5415 */
 | 
			
		||||
	d += cw_put_byte(d,0); 
 | 
			
		||||
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,"dtls-policy");
 | 
			
		||||
	d += cw_put_byte(d,cw_cfg_get_byte_l(cfg_list,key,0));
 | 
			
		||||
 | 
			
		||||
	return d - dst;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * Put a descripter sub element like harware vendor/version etc.
 | 
			
		||||
 * Used when putting AC Descriptors or WTP Descriptors
 | 
			
		||||
 * @param dst Where to write to
 | 
			
		||||
 * @param cfg_list list of cfgs
 | 
			
		||||
 * @subelem_id Id of subelement
 | 
			
		||||
 * @parent_key parent key
 | 
			
		||||
 */
 | 
			
		||||
int 
 | 
			
		||||
cw_put_descriptor_subelem (uint8_t *dst, cw_Cfg_t ** cfg_list,
 | 
			
		||||
                                 int subelem_id, const char * parent_key )
 | 
			
		||||
{
 | 
			
		||||
	char key[256];
 | 
			
		||||
	uint32_t vendor;
 | 
			
		||||
	//bstr16_t version;
 | 
			
		||||
	const char *vendor_s;
 | 
			
		||||
 | 
			
		||||
	uint8_t *d;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/*        d += cw_put_dword(d, bstrv_get_vendor_id(v));
 | 
			
		||||
	d += cw_put_dword(d, (subelem_id << 16) | bstrv_len(v));
 | 
			
		||||
	d += cw_put_data(d, bstrv_data(v), bstrv_len(v));
 | 
			
		||||
	*/
 | 
			
		||||
	sprintf (key, "%s/%s", parent_key, CW_SKEY_VENDOR);
 | 
			
		||||
	vendor_s = cw_cfg_get_l (cfg_list, key, NULL);
 | 
			
		||||
	
 | 
			
		||||
	if (vendor_s == NULL) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't put subelem %s, no value of type Dword found.", key);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	vendor = atoi(vendor_s);	
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	sprintf (key, "%s/%s", parent_key, CW_SKEY_VERSION);
 | 
			
		||||
	cw_Val_t * val = cw_cfg_get_val_l(cfg_list, key, CW_TYPE_BSTR16);
 | 
			
		||||
 | 
			
		||||
	//version = cw_cfg_get_bstr16 (cfg, key, NULL);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (val == NULL) {
 | 
			
		||||
		cw_log (LOG_ERR, "Can't put subelem %s, no value of type Bstr16 found.", key);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	d = dst;
 | 
			
		||||
	
 | 
			
		||||
	/* put vendor */
 | 
			
		||||
	d += cw_put_dword(d, vendor); //->type->put (vendor, d);
 | 
			
		||||
	
 | 
			
		||||
	/* put version */
 | 
			
		||||
	
 | 
			
		||||
	d += cw_put_dword (d, (subelem_id << 16) | val->type->len(val));
 | 
			
		||||
//	d += cw_put_bstr16(d, version);
 | 
			
		||||
	d += val->type->put(val,d);
 | 
			
		||||
 | 
			
		||||
	cw_val_destroy(val);
 | 
			
		||||
 | 
			
		||||
//	free(version);
 | 
			
		||||
	
 | 
			
		||||
	return d-dst;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								src/cw/cw.h
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/cw/cw.h
									
									
									
									
									
								
							@ -353,7 +353,7 @@ int cw_check_missing_mand(struct cw_MsgData *msgdata, mavl_t keys, mavl_t handle
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern int cw_read_descriptor_subelems(mavl_t store, const char * key, uint8_t * data, int len,
 | 
			
		||||
extern int cw_read_descriptor_subelems(cw_Cfg_t * store, const char * key, uint8_t * data, int len,
 | 
			
		||||
				       struct cw_DescriptorSubelemDef *elems);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@ -362,7 +362,7 @@ int cw_read_wtp_descriptor(mavl_t mbag, struct cw_Conn *conn,
 | 
			
		||||
				  struct cw_DescriptorSubelemDef *allowed);
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
int cw_read_wtp_descriptor(mavl_t mbag, struct cw_Conn *conn,
 | 
			
		||||
int cw_read_wtp_descriptor(cw_Cfg_t * mbag, struct cw_Conn *conn,
 | 
			
		||||
			   struct cw_ElemHandler *eh, uint8_t * data, int len,
 | 
			
		||||
			   struct cw_DescriptorSubelemDef *allowed);
 | 
			
		||||
 | 
			
		||||
@ -373,19 +373,19 @@ int cw_write_radio_element(struct cw_ElemHandler * handler, struct cw_ElemHandle
 | 
			
		||||
			 uint8_t * dst);
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
extern int cw_read_wtp_descriptor_7(mavl_t mbag, struct cw_Conn *conn,
 | 
			
		||||
extern int cw_read_wtp_descriptor_7(cw_Cfg_t * cfg, struct cw_Conn *conn,
 | 
			
		||||
				    struct cw_ElemHandler *eh, uint8_t * data, int len,
 | 
			
		||||
				    struct cw_DescriptorSubelemDef *allowed);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cw_read_ac_descriptor(mavl_t store,
 | 
			
		||||
int cw_read_ac_descriptor(cw_Cfg_t * store,
 | 
			
		||||
			   struct cw_ElemHandler *eh,
 | 
			
		||||
			   struct cw_ElemHandlerParams * params,
 | 
			
		||||
			   uint8_t *data, int len, 
 | 
			
		||||
			struct cw_DescriptorSubelemDef *allowed);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cw_setup_dtls(struct cw_Conn * conn, mavl_t cfg, const char *prefix, char  * default_cipher);
 | 
			
		||||
int cw_setup_dtls(struct cw_Conn * conn, cw_Cfg_t * cfg, const char *prefix, char  * default_cipher);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -552,8 +552,13 @@ int cw_write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len);
 | 
			
		||||
int cw_header_len(struct cw_ElemHandler * handler);
 | 
			
		||||
 | 
			
		||||
int cw_compose_message(struct cw_Conn *conn, uint8_t * rawout);
 | 
			
		||||
int cw_put_ac_status(uint8_t *dst, cw_Cfg_t ** cfg_list, const char * parent_key);
 | 
			
		||||
int cw_put_descriptor_subelem (uint8_t *dst, cw_Cfg_t ** cfg_list,
 | 
			
		||||
                                 int subelem_id, const char * parent_key );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cw_send_request(struct cw_Conn *conn,int msg_id);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *@}
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,9 @@ int cw_check_missing_mand(struct cw_MsgData *msgdata, mavl_t keys, mavl_t handle
 | 
			
		||||
	char *mandkey, *result;
 | 
			
		||||
	mlist_t missing;
 | 
			
		||||
	int count;
 | 
			
		||||
 | 
			
		||||
	if (msgdata==NULL)
 | 
			
		||||
		return 0;
 | 
			
		||||
	
 | 
			
		||||
	missing = mlist_create_conststr();
 | 
			
		||||
	if (missing==NULL){
 | 
			
		||||
 | 
			
		||||
@ -18,9 +18,9 @@ void cw_dbg_set_level (int level, int on)
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			if (on)
 | 
			
		||||
				cw_dbg_opt_level |= (1 << (level));
 | 
			
		||||
				cw_dbg_opt_level |= (level);
 | 
			
		||||
			else 
 | 
			
		||||
				cw_dbg_opt_level &= (0xffffffff) ^ (1 << (level));
 | 
			
		||||
				cw_dbg_opt_level &= (0xffffffff) ^ (level);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,7 @@ int cw_dbg_set_level_from_str(const char *level)
 | 
			
		||||
	switch(*level){
 | 
			
		||||
		case '-':
 | 
			
		||||
		case '!':
 | 
			
		||||
		case '~':
 | 
			
		||||
			on =0;
 | 
			
		||||
			slevel=level+1;
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@ int cw_in_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerP
 | 
			
		||||
{
 | 
			
		||||
	cw_dbg(DBG_X,"STRUCT KEY: %s",handler->key);
 | 
			
		||||
	stop();
 | 
			
		||||
	const char * key;
 | 
			
		||||
/*	const char * key;
 | 
			
		||||
	char tmpkey[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
@ -22,11 +22,8 @@ int cw_in_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerP
 | 
			
		||||
		key = handler->key;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
printf("CW_IN_GENERIC STRUCT: %s\n",key);	
 | 
			
		||||
//printf("CW_IN_GENERIC STRUCT: %s\n",key);	
 | 
			
		||||
 | 
			
		||||
/*	int (*mkkey)(struct cw_ElemHandler * handler, char *dst, struct cw_ElemHandlerParams * params, 
 | 
			
		||||
		uint8_t*data, int len);
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
	if (!handler->type){
 | 
			
		||||
		cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);
 | 
			
		||||
@ -34,6 +31,6 @@ printf("CW_IN_GENERIC STRUCT: %s\n",key);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cw_ktv_read_struct(params->cfg,handler->type,key,elem_data,elem_len);
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
	return CAPWAP_RESULT_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -7,9 +7,6 @@ int cw_out_generic_with_index(struct cw_ElemHandler * eh,
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst)
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	int idx;
 | 
			
		||||
	cw_Val_t * result, search;
 | 
			
		||||
	int len,start;
 | 
			
		||||
	uint8_t * ob;
 | 
			
		||||
	struct cw_Cfg_entry *e;
 | 
			
		||||
@ -18,7 +15,6 @@ int cw_out_generic_with_index(struct cw_ElemHandler * eh,
 | 
			
		||||
	int i,l;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	idx = 0;
 | 
			
		||||
	ob = dst;
 | 
			
		||||
 | 
			
		||||
	cw_cfg_iter_init(params->cfg_list[0], &cfi, eh->key);
 | 
			
		||||
@ -42,31 +38,5 @@ int cw_out_generic_with_index(struct cw_ElemHandler * eh,
 | 
			
		||||
 | 
			
		||||
	return ob-dst;
 | 
			
		||||
	
 | 
			
		||||
	stop();
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	do {
 | 
			
		||||
		sprintf(key,"%s.%d",eh->key,idx);
 | 
			
		||||
		search.key=key;
 | 
			
		||||
		result = mavl_get_first(params->cfg,&search);
 | 
			
		||||
		if (result==NULL)
 | 
			
		||||
			break;
 | 
			
		||||
		if (strncmp(result->key,key,strlen(key))!=0)
 | 
			
		||||
			break;
 | 
			
		||||
	
 | 
			
		||||
		start = params->msgset->header_len(eh);
 | 
			
		||||
		len = cw_put_byte(ob+start,idx);
 | 
			
		||||
		
 | 
			
		||||
		len += result->type->put(result,ob+start+len);
 | 
			
		||||
 | 
			
		||||
		ob += params->msgset->write_header(eh,ob,len);
 | 
			
		||||
		
 | 
			
		||||
		idx++;
 | 
			
		||||
		
 | 
			
		||||
	}while(1);
 | 
			
		||||
 | 
			
		||||
	return ob-dst;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -133,11 +133,11 @@ int cw_out_traverse(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	char current[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	int stack[10];
 | 
			
		||||
	stack[0]=0;
 | 
			
		||||
	//char current[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	//int stack[10];
 | 
			
		||||
	//stack[0]=0;
 | 
			
		||||
 | 
			
		||||
	current[0]=0;
 | 
			
		||||
	//current[0]=0;
 | 
			
		||||
 | 
			
		||||
	stop();
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,7 @@ cw_ValStruct_t acstatus [] = {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cw_read_ac_descriptor(mavl_t store,
 | 
			
		||||
int cw_read_ac_descriptor(cw_Cfg_t * store,
 | 
			
		||||
			   struct cw_ElemHandler *eh,
 | 
			
		||||
			   struct cw_ElemHandlerParams * params,
 | 
			
		||||
			   uint8_t *data, int len, 
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@
 | 
			
		||||
#include "keys.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cw_read_descriptor_subelems(mavl_t cfg, const char *parent_key,
 | 
			
		||||
int cw_read_descriptor_subelems(cw_Cfg_t *cfg, const char *parent_key,
 | 
			
		||||
				uint8_t * data, int len,
 | 
			
		||||
				struct cw_DescriptorSubelemDef *elems)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,7 @@ static struct cw_DescriptorSubelemDef allowed_default[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cw_read_wtp_descriptor(mavl_t cfg, struct cw_Conn *conn,
 | 
			
		||||
int cw_read_wtp_descriptor(cw_Cfg_t * cfg, struct cw_Conn *conn,
 | 
			
		||||
			   struct cw_ElemHandler *eh, uint8_t * data, int len,
 | 
			
		||||
			   struct cw_DescriptorSubelemDef *allowed)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ static struct cw_DescriptorSubelemDef allowed_default[] = {
 | 
			
		||||
/**
 | 
			
		||||
 * Read WTP Descriptor in Cisco-Style (Draft 7)
 | 
			
		||||
 */
 | 
			
		||||
int cw_read_wtp_descriptor_7(mavl_t cfg, struct cw_Conn *conn,
 | 
			
		||||
int cw_read_wtp_descriptor_7(cw_Cfg_t * cfg, struct cw_Conn *conn,
 | 
			
		||||
			     struct cw_ElemHandler *eh, uint8_t * data, int len,
 | 
			
		||||
			     struct cw_DescriptorSubelemDef *allowed)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -50,10 +50,10 @@ int cw_setup_dtls(struct cw_Conn *conn, cw_Cfg_t * cfg, const char *prefix,
 | 
			
		||||
	conn->dtls_cipher = cw_cfg_get(cfg, key, default_cipher);
 | 
			
		||||
 | 
			
		||||
	sprintf(key, "%s/%s", prefix, "ssl-psk");
 | 
			
		||||
	conn->dtls_psk = cw_cfg_get(cfg, key, NULL);
 | 
			
		||||
	conn->dtls_psk = (bstr16_t)cw_cfg_get(cfg, key, NULL);
 | 
			
		||||
 | 
			
		||||
	sprintf(key, "%s/%s", prefix, "ssl-psk-enable");
 | 
			
		||||
	conn->dtls_psk_enable = cw_cfg_get_bool(cfg, key, "flase");
 | 
			
		||||
	conn->dtls_psk_enable = cw_cfg_get_bool(cfg, key, 0);
 | 
			
		||||
 | 
			
		||||
	if (conn->dtls_psk_enable) {
 | 
			
		||||
		security |= CAPWAP_FLAG_AC_SECURITY_S;
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,7 @@ int cw_write_radio_element(struct cw_ElemHandler * handler, struct cw_ElemHandle
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	cw_Val_t *elem, search;
 | 
			
		||||
//	cw_Val_t *elem;
 | 
			
		||||
	int len;
 | 
			
		||||
	uint8_t * d;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										119
									
								
								src/cw/dbg.c
									
									
									
									
									
								
							
							
						
						
									
										119
									
								
								src/cw/dbg.c
									
									
									
									
									
								
							@ -63,14 +63,13 @@ static struct cw_StrListElem theme0[] = {
 | 
			
		||||
	{DBG_PKT_DMP_OUT, ANSI_BYELLOW ANSI_ITALIC},
 | 
			
		||||
	
 | 
			
		||||
	{DBG_MSG_IN, ANSI_BLUE ANSI_BOLD},
 | 
			
		||||
	{DBG_MSG_PARSING, ANSI_BLUE },
 | 
			
		||||
	
 | 
			
		||||
	{DBG_MSG_OUT, ANSI_BLUE ANSI_BOLD ANSI_ITALIC},
 | 
			
		||||
	{DBG_MSG_ASSEMBLY, ANSI_BLUE ANSI_ITALIC},
 | 
			
		||||
	{DBG_MSG_COMPOSE, ANSI_BLUE ANSI_ITALIC},
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	{DBG_MSG_IN_DMP, ANSI_BBLUE },
 | 
			
		||||
	{DBG_MSG_OUT_DMP, ANSI_BBLUE ANSI_ITALIC},
 | 
			
		||||
	{DBG_MSG_DMP_IN, ANSI_BBLUE },
 | 
			
		||||
	{DBG_MSG_DMP_OUT, ANSI_BBLUE ANSI_ITALIC},
 | 
			
		||||
	
 | 
			
		||||
	{DBG_ELEM_IN, ANSI_DEFAULT},
 | 
			
		||||
	{DBG_ELEM_OUT, ANSI_DEFAULT ANSI_ITALIC},
 | 
			
		||||
@ -79,7 +78,7 @@ static struct cw_StrListElem theme0[] = {
 | 
			
		||||
	{DBG_PKT_ERR, ANSI_RED},
 | 
			
		||||
	{DBG_ELEM_ERR, ANSI_RED},
 | 
			
		||||
	
 | 
			
		||||
	{DBG_SUBELEM, ANSI_BBLACK},
 | 
			
		||||
//	{DBG_SUBELEM, ANSI_BBLACK},
 | 
			
		||||
	{DBG_DTLS, ANSI_MAGENTA ANSI_BOLD},
 | 
			
		||||
	{DBG_DTLS_DETAIL, ANSI_MAGENTA},
 | 
			
		||||
	{DBG_DTLS_BIO, ANSI_BMAGENTA},
 | 
			
		||||
@ -92,9 +91,9 @@ static struct cw_StrListElem theme0[] = {
 | 
			
		||||
	{DBG_X, "\x1b[31m"},
 | 
			
		||||
	{DBG_WARN, ANSI_CYAN},
 | 
			
		||||
	{DBG_MOD, ANSI_WHITE},
 | 
			
		||||
	{DBG_CFG_DMP, ANSI_BCYAN }, 
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
//	{DBG_CFG_DMP, ANSI_BCYAN }, 
 | 
			
		||||
	{DBG_CFG_UPDATES,ANSI_GREEN},	
 | 
			
		||||
 | 
			
		||||
	{CW_STR_STOP, ""}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -104,7 +103,8 @@ static struct cw_StrListElem * color_on = theme0;
 | 
			
		||||
struct cw_StrListElem color_ontext[] = {
 | 
			
		||||
 | 
			
		||||
/*	{DBG_ELEM_DMP, "\x1b[37m"},*/
 | 
			
		||||
	{DBG_ELEM_DMP, ANSI_BBLACK ANSI_ITALIC},
 | 
			
		||||
	{DBG_ELEM_DMP_OUT, ANSI_BBLACK ANSI_ITALIC},
 | 
			
		||||
	{DBG_ELEM_DMP_IN,  ANSI_BBLACK},
 | 
			
		||||
 | 
			
		||||
	{CW_STR_STOP, ""}
 | 
			
		||||
};
 | 
			
		||||
@ -117,31 +117,31 @@ static struct cw_StrListElem color_off[] = {
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
static struct cw_StrListElem prefix[] = {
 | 
			
		||||
	{DBG_INFO, " Info -"},
 | 
			
		||||
	{DBG_PKT_IN, " Pkt IN -"},
 | 
			
		||||
	{DBG_PKT_OUT, " Pkt Out -"},
 | 
			
		||||
	{DBG_MSG_IN, " Msg IN -"},
 | 
			
		||||
	{DBG_MSG_OUT, " Msg Out -"},
 | 
			
		||||
	{DBG_INFO, 		"Info -"},
 | 
			
		||||
	{DBG_PKT_IN, 		"Pkt In  -"},
 | 
			
		||||
	{DBG_PKT_OUT, 		"Pkt Out -"},
 | 
			
		||||
	{DBG_MSG_IN, 		"Msg In  - "},
 | 
			
		||||
	{DBG_MSG_OUT,		"Msg Out - "},
 | 
			
		||||
 | 
			
		||||
	{DBG_ELEM_IN, " Msg Element -"},
 | 
			
		||||
	{DBG_ELEM_OUT, " Msg Element -"},
 | 
			
		||||
	{DBG_ELEM_IN, 		"  Msg Element -"},
 | 
			
		||||
	{DBG_ELEM_OUT,		"  Msg Element -"},
 | 
			
		||||
	
 | 
			
		||||
	{DBG_MSG_ERR, " Msg Error -"},
 | 
			
		||||
	{DBG_PKT_ERR, " Pkt Error -"},
 | 
			
		||||
	{DBG_ELEM_ERR, " Elem Error -"},
 | 
			
		||||
	{DBG_RFC, " RFC -"},
 | 
			
		||||
	{DBG_SUBELEM, " Sub-Element - "},
 | 
			
		||||
	{DBG_DTLS, " DTLS - "},
 | 
			
		||||
	{DBG_DTLS_DETAIL, " DTLS - "},
 | 
			
		||||
	{DBG_WARN, " Warning - "},
 | 
			
		||||
	{DBG_MOD, " Mod - "},
 | 
			
		||||
	{DBG_STATE, " STATEMACHINE - "},
 | 
			
		||||
	{DBG_CFG_SET, "    Cfg Set - "},
 | 
			
		||||
	{DBG_MSG_ERR, 		"  Msg Error -"},
 | 
			
		||||
	{DBG_PKT_ERR, 		"  Pkt Error -"},
 | 
			
		||||
	{DBG_ELEM_ERR, 		"  Elem Error -"},
 | 
			
		||||
	{DBG_RFC, 		"  RFC -"},
 | 
			
		||||
	{DBG_DTLS, 		"DTLS - "},
 | 
			
		||||
	{DBG_DTLS_DETAIL,	 "DTLS - "},
 | 
			
		||||
	{DBG_WARN,	 	"  Warning - "},
 | 
			
		||||
	{DBG_MOD, 		"Mod - "},
 | 
			
		||||
	{DBG_STATE, 		"STATEMACHINE - "},
 | 
			
		||||
	{DBG_CFG_UPDATES,	"Cfg - "},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{DBG_X, "XXXXX - "},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{CW_STR_STOP, ""}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -183,10 +183,13 @@ const char *get_dbg_color_ontext(int level)
 | 
			
		||||
 | 
			
		||||
int cw_dbg_is_level(int level)
 | 
			
		||||
{
 | 
			
		||||
	if (level >= DBG_ALL ){
 | 
			
		||||
	if (level > 1 && (level &1))
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	return (cw_dbg_opt_level & (1<<level));
 | 
			
		||||
 | 
			
		||||
/*	if (level >= DBG_ALL ){
 | 
			
		||||
		return 1;
 | 
			
		||||
	}*/
 | 
			
		||||
	return (cw_dbg_opt_level & (level));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -197,11 +200,11 @@ static void cw_dbg_vlog_line(struct cw_LogWriter * writer,
 | 
			
		||||
	char fbuf[512];
 | 
			
		||||
 | 
			
		||||
	if ( writer->colored){
 | 
			
		||||
		sprintf(fbuf,"DBG: %s%s %s%s%s",
 | 
			
		||||
		sprintf(fbuf,"DBG: %s%s%s%s%s",
 | 
			
		||||
			prefix_color,prefix,textcolor,format,DBG_CLR_OFF);
 | 
			
		||||
	}
 | 
			
		||||
	else{
 | 
			
		||||
		sprintf(fbuf,"DBG: %s %s",
 | 
			
		||||
		sprintf(fbuf,"DBG: %s%s",
 | 
			
		||||
			prefix,format);
 | 
			
		||||
				
 | 
			
		||||
	}
 | 
			
		||||
@ -268,7 +271,7 @@ void cw_dbg_pkt(int level, struct cw_Conn *conn, uint8_t * packet, int len,
 | 
			
		||||
 | 
			
		||||
	cw_dbg(level, "%s", buf);
 | 
			
		||||
		
 | 
			
		||||
	if (cw_dbg_is_level(DBG_PKT_DMP)) {
 | 
			
		||||
//	if (cw_dbg_is_level(DBG_PKT_DMP)) {
 | 
			
		||||
		int dlevel;
 | 
			
		||||
		if (level == DBG_PKT_IN){
 | 
			
		||||
			dlevel=DBG_PKT_DMP_IN;
 | 
			
		||||
@ -277,7 +280,7 @@ void cw_dbg_pkt(int level, struct cw_Conn *conn, uint8_t * packet, int len,
 | 
			
		||||
			dlevel=DBG_PKT_DMP_OUT;
 | 
			
		||||
		}
 | 
			
		||||
		cw_dbg_dmp(dlevel,packet,len,"");
 | 
			
		||||
	} 
 | 
			
		||||
//	} 
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -352,16 +355,16 @@ void cw_dbg_msg(int level, struct cw_Conn *conn, uint8_t * packet, int len,
 | 
			
		||||
	cw_dbg(level, "%s", buf);
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	if (cw_dbg_is_level(DBG_MSG_DMP)){
 | 
			
		||||
//	if (cw_dbg_is_level(DBG_MSG_DMP)){
 | 
			
		||||
		int dlevel;
 | 
			
		||||
		if(level==DBG_MSG_IN){
 | 
			
		||||
			dlevel = DBG_MSG_IN_DMP;
 | 
			
		||||
			dlevel = DBG_MSG_DMP_IN;
 | 
			
		||||
		}
 | 
			
		||||
		else{
 | 
			
		||||
			dlevel = DBG_MSG_OUT_DMP;
 | 
			
		||||
			dlevel = DBG_MSG_DMP_OUT;
 | 
			
		||||
		}
 | 
			
		||||
		cw_dbg_dmp(dlevel,packet,len,"");
 | 
			
		||||
	}
 | 
			
		||||
//	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -410,9 +413,11 @@ void cw_dbg_elem(int level, struct cw_Conn *conn, int msg,
 | 
			
		||||
			handler->name,len);
 | 
			
		||||
	
 | 
			
		||||
	if (cw_dbg_is_level(DBG_ELEM_DMP)) {
 | 
			
		||||
		/*dmp = cw_format_dump(msgbuf,len,NULL);*/
 | 
			
		||||
		
 | 
			
		||||
		cw_dbg_dmp(DBG_ELEM_DMP,msgbuf,len,"");
 | 
			
		||||
		if (level == DBG_ELEM_OUT)
 | 
			
		||||
			cw_dbg_dmp(DBG_ELEM_DMP_OUT,msgbuf,len,"");
 | 
			
		||||
		else 
 | 
			
		||||
			cw_dbg_dmp(DBG_ELEM_DMP_IN,msgbuf,len,"");
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return;
 | 
			
		||||
@ -421,38 +426,6 @@ void cw_dbg_elem(int level, struct cw_Conn *conn, int msg,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void cw_dbg_ktv_dump(mavl_t ktv, uint32_t dbglevel, 
 | 
			
		||||
		const char *header, const char *prefix, const char *footer )
 | 
			
		||||
{
 | 
			
		||||
	char value[500];
 | 
			
		||||
	struct cw_Val * data;
 | 
			
		||||
	mavliter_t it;
 | 
			
		||||
	const struct cw_Type * type;
 | 
			
		||||
	
 | 
			
		||||
	if (header != NULL)
 | 
			
		||||
		cw_dbg (dbglevel, header);
 | 
			
		||||
	
 | 
			
		||||
	mavliter_init(&it,ktv);
 | 
			
		||||
 | 
			
		||||
	mavliter_foreach(&it){
 | 
			
		||||
		
 | 
			
		||||
		data = mavliter_get(&it);
 | 
			
		||||
		type = data->type;
 | 
			
		||||
		type->to_str(data,value,0);
 | 
			
		||||
		
 | 
			
		||||
		cw_dbg(dbglevel,"%s%s :%s: %s",prefix,data->key,type->get_type_name(data), value);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	if (footer != NULL)
 | 
			
		||||
		cw_dbg (dbglevel, footer);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										112
									
								
								src/cw/dbg.h
									
									
									
									
									
								
							
							
						
						
									
										112
									
								
								src/cw/dbg.h
									
									
									
									
									
								
							@ -47,95 +47,101 @@
 | 
			
		||||
 * Debug levels
 | 
			
		||||
 */ 
 | 
			
		||||
enum cw_dbg_levels{
 | 
			
		||||
	/** Show headers of incomming CAPWAP packets */
 | 
			
		||||
	DBG_PKT_IN=0,
 | 
			
		||||
	
 | 
			
		||||
	/** Show headers of outgoing CAPWAP packets */
 | 
			
		||||
	DBG_PKT_OUT,
 | 
			
		||||
	/** Show headers of incomming/outgoing CAPWAP packets */
 | 
			
		||||
	DBG_PKT_IN 	= (1<<0), 
 | 
			
		||||
	DBG_PKT_OUT 	= (1<<1),	
 | 
			
		||||
 | 
			
		||||
	/** Hex-dump incomming/outgoing CAPWAP packets */
 | 
			
		||||
	DBG_PKT_DMP_IN	= (1<<3),
 | 
			
		||||
	DBG_PKT_DMP_OUT = (1<<4),
 | 
			
		||||
 | 
			
		||||
	/** Incomming CAPWAP packets with errors, wich would
 | 
			
		||||
	    usually silently discarded */ 
 | 
			
		||||
	DBG_PKT_ERR,
 | 
			
		||||
 | 
			
		||||
	/** Dump content of incomming packets */
 | 
			
		||||
	DBG_PKT_DMP,
 | 
			
		||||
 | 
			
		||||
	/** Display incomming CAPWAP/LWAPP messages */
 | 
			
		||||
	DBG_MSG_IN,
 | 
			
		||||
 | 
			
		||||
	/** Display outgoing CAPWAP/LWAPP messages */
 | 
			
		||||
	DBG_MSG_OUT,
 | 
			
		||||
 | 
			
		||||
	DBG_MSG_DMP,
 | 
			
		||||
	DBG_PKT_ERR	= (1<<5),
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	/** Display incomming/outgoing CAPWAP/LWAPP messages */
 | 
			
		||||
	DBG_MSG_IN	= (1<<6),
 | 
			
		||||
	DBG_MSG_OUT	= (1<<7),
 | 
			
		||||
 | 
			
		||||
	/** Show hex-dump of messages */
 | 
			
		||||
	DBG_MSG_DMP_IN	= (1<<8),
 | 
			
		||||
	DBG_MSG_DMP_OUT	= (1<<9),
 | 
			
		||||
 | 
			
		||||
	/** Message errors */
 | 
			
		||||
	DBG_MSG_ERR,
 | 
			
		||||
	DBG_MSG_ERR	= (1<<10),
 | 
			
		||||
 | 
			
		||||
	/** Show message elements in incomming messages */
 | 
			
		||||
	DBG_ELEM_IN,
 | 
			
		||||
 | 
			
		||||
	/** Show message elements assembled for outgoing messages */
 | 
			
		||||
	DBG_ELEM_OUT,
 | 
			
		||||
	/** Show message elements in incomming/outgoing messages */
 | 
			
		||||
	DBG_ELEM_IN	= (1<<11),
 | 
			
		||||
	DBG_ELEM_OUT	= (1<<12),
 | 
			
		||||
 | 
			
		||||
	/** Show message element details  */
 | 
			
		||||
	DBG_ELEM_DETAIL,
 | 
			
		||||
	DBG_ELEM_DETAIL_IN = (1<<13),
 | 
			
		||||
	DBG_ELEM_DETAIL_OUT = (1<<14),
 | 
			
		||||
 | 
			
		||||
	/** Error in msg elements */
 | 
			
		||||
	DBG_ELEM_ERR,
 | 
			
		||||
 | 
			
		||||
	/** Show subelements */
 | 
			
		||||
	DBG_SUBELEM,
 | 
			
		||||
 | 
			
		||||
	/** Show dump of subelements */
 | 
			
		||||
	DBG_SUBELEM_DMP,
 | 
			
		||||
	DBG_ELEM_ERR	= (1<<15),
 | 
			
		||||
 | 
			
		||||
	/** hex dump elements */	
 | 
			
		||||
	DBG_ELEM_DMP,
 | 
			
		||||
	DBG_ELEM_DMP	= (1<<16),
 | 
			
		||||
 | 
			
		||||
	/** General infos, like CAPWAP state */
 | 
			
		||||
	DBG_INFO,	
 | 
			
		||||
	DBG_INFO	= (1<<17),	
 | 
			
		||||
 | 
			
		||||
	/** Misc. warnings */
 | 
			
		||||
	DBG_WARN,
 | 
			
		||||
	DBG_WARN	= (1<<18),
 | 
			
		||||
 | 
			
		||||
	/** RFC related */
 | 
			
		||||
	DBG_RFC,
 | 
			
		||||
	DBG_RFC		= (1<<19),
 | 
			
		||||
 | 
			
		||||
	/** DTLS related messages */
 | 
			
		||||
	DBG_DTLS,
 | 
			
		||||
	DBG_DTLS	= (1<<20),
 | 
			
		||||
 | 
			
		||||
	/** DTLS BIOs in/out */
 | 
			
		||||
	DBG_DTLS_BIO,
 | 
			
		||||
	DBG_DTLS_BIO	= (1<<21),
 | 
			
		||||
 | 
			
		||||
	/** Dump DTLS BIO i/o */
 | 
			
		||||
	DBG_DTLS_BIO_DMP,
 | 
			
		||||
	DBG_DTLS_BIO_DMP = (1<<22),
 | 
			
		||||
 | 
			
		||||
	/** Show DTLS Details */
 | 
			
		||||
	DBG_DTLS_DETAIL,
 | 
			
		||||
	DBG_DTLS_DETAIL	= (1<<23),
 | 
			
		||||
	
 | 
			
		||||
	DBG_CFG_DMP,
 | 
			
		||||
//	DBG_CFG_DMP	= (1<<20),
 | 
			
		||||
 | 
			
		||||
	DBG_CFG_SET,
 | 
			
		||||
//	DBG_CFG_SET	= (1<<21),
 | 
			
		||||
 | 
			
		||||
	/** Debug Mods */
 | 
			
		||||
	DBG_MOD,
 | 
			
		||||
	DBG_MOD		= (1<<24),
 | 
			
		||||
	
 | 
			
		||||
	DBG_STATE, /**<Debug State machine */
 | 
			
		||||
       	/**Debug State machine */
 | 
			
		||||
	DBG_STATE	= (1<<25),
 | 
			
		||||
	
 | 
			
		||||
	DBG_ALL, 
 | 
			
		||||
	
 | 
			
		||||
	DBG_PKT_DMP_OUT,
 | 
			
		||||
	DBG_PKT_DMP_IN,
 | 
			
		||||
	DBG_MSG_COMPOSE	= (1<<26),
 | 
			
		||||
 | 
			
		||||
	DBG_CFG_UPDATES	= (1<<27),
 | 
			
		||||
 | 
			
		||||
	DBG_ELEM_VNDR	= (1<<28),
 | 
			
		||||
	
 | 
			
		||||
	DBG_MSG_IN_DMP,
 | 
			
		||||
	DBG_MSG_OUT_DMP,
 | 
			
		||||
	
 | 
			
		||||
	DBG_MSG_ASSEMBLY,
 | 
			
		||||
	DBG_MSG_PARSING,
 | 
			
		||||
	
 | 
			
		||||
	DBG_X
 | 
			
		||||
 | 
			
		||||
	DBG_X		= (1<<30),
 | 
			
		||||
	DBG_ALL 	= (0x7fffffff),
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	DBG_ELEM_DMP_IN	= 7,
 | 
			
		||||
	DBG_ELEM_DMP_OUT = 9,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define DBG_MSG (DBG_MSG_IN | DBG_MSG_OUT)
 | 
			
		||||
#define DBG_PKT (DBG_PKT_IN | DBG_PKT_OUT)
 | 
			
		||||
#define DBG_ELEM (DBG_ELEM_IN | DBG_ELEM_OUT)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define DBG_LN __FILE__,__LINE__
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -35,44 +35,62 @@
 | 
			
		||||
 * Debug strings
 | 
			
		||||
 */
 | 
			
		||||
struct cw_StrListElem cw_dbg_strings[] = {
 | 
			
		||||
	{ DBG_INFO,	"info",  },
 | 
			
		||||
	{ DBG_PKT_IN,	"pkt_in"  },
 | 
			
		||||
	{ DBG_PKT_OUT,	"pkt_out" },
 | 
			
		||||
	{ DBG_PKT_ERR,	"pkt_err" },
 | 
			
		||||
	{ DBG_PKT_DMP,	"pkt_dmp" },
 | 
			
		||||
	{ DBG_MSG_IN,	"msg_in"  },
 | 
			
		||||
	{ DBG_MSG_OUT,	"msg_out" },
 | 
			
		||||
	{ DBG_MSG_DMP,	"msg_dmp" },
 | 
			
		||||
	{ DBG_INFO,		"info",  },
 | 
			
		||||
	{ DBG_PKT_IN,		"pkt_in"  },
 | 
			
		||||
	{ DBG_PKT_OUT,		"pkt_out" },
 | 
			
		||||
	{ DBG_PKT_ERR,		"pkt_err" },
 | 
			
		||||
	{ DBG_PKT_DMP_IN,	"pkt_dmp_in" },
 | 
			
		||||
	{ DBG_PKT_DMP_OUT,	"pkt_dmp_out" },
 | 
			
		||||
 | 
			
		||||
	{ DBG_MSG_IN,		"msg_in"  },
 | 
			
		||||
	{ DBG_MSG_OUT,		"msg_out" },
 | 
			
		||||
	{ DBG_MSG_DMP_IN,	"msg_dmp_in"  },
 | 
			
		||||
	{ DBG_MSG_DMP_OUT,	"msg_dmp_out" },
 | 
			
		||||
	
 | 
			
		||||
	{ DBG_MSG_ERR,	"msg_err"},
 | 
			
		||||
	{ DBG_MSG_ERR,		"msg_err"},
 | 
			
		||||
 | 
			
		||||
	{ DBG_RFC,	"rfc", 	 },
 | 
			
		||||
	{ DBG_ELEM_IN,  "elem_in"},
 | 
			
		||||
	{ DBG_ELEM_OUT, "elem_out"},
 | 
			
		||||
	{ DBG_ELEM_DMP, "elem_dmp"},
 | 
			
		||||
	{ DBG_RFC,		"rfc", 	 },
 | 
			
		||||
 | 
			
		||||
	{ DBG_SUBELEM,	"subelem"},
 | 
			
		||||
	{ DBG_SUBELEM_DMP, "subelem_dmp" },
 | 
			
		||||
	{ DBG_ELEM_IN,  	"elem_in"},
 | 
			
		||||
	{ DBG_ELEM_OUT, 	"elem_out"},
 | 
			
		||||
	{ DBG_ELEM_DMP, 	"elem_dmp"},
 | 
			
		||||
	{ DBG_ELEM_ERR, 	"elem_err" },
 | 
			
		||||
	{ DBG_ELEM_DETAIL_IN, 	"elem_detail_in" },
 | 
			
		||||
	{ DBG_ELEM_DETAIL_OUT, 	"elem_detail_out" },
 | 
			
		||||
	{ DBG_ELEM_VNDR,	"elem_vndr"},	
 | 
			
		||||
	
 | 
			
		||||
	{ DBG_ELEM_DETAIL, "elem_detail"},
 | 
			
		||||
	{ DBG_DTLS, 		"dtls" },
 | 
			
		||||
	{ DBG_DTLS_BIO,		"dtls_bio" },
 | 
			
		||||
	{ DBG_DTLS_BIO_DMP,	"dtls_bio_dmp"},
 | 
			
		||||
	{ DBG_DTLS_DETAIL, 	"dtls_detail"},
 | 
			
		||||
 | 
			
		||||
	{ DBG_ELEM_ERR, "elem_err" },
 | 
			
		||||
	
 | 
			
		||||
	{ DBG_DTLS, "dtls" },
 | 
			
		||||
	{ DBG_DTLS_BIO, "dtls_bio" },
 | 
			
		||||
	{ DBG_DTLS_BIO_DMP, "dtls_bio_dmp"},
 | 
			
		||||
	{ DBG_DTLS_DETAIL, "dtls_detail"},
 | 
			
		||||
 | 
			
		||||
	{ DBG_CFG_SET, "cfg_set" },
 | 
			
		||||
	{ DBG_CFG_UPDATES, 	"cfg_updates" },
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	{DBG_CFG_DMP, "cfg_dmp" },
 | 
			
		||||
//	{DBG_CFG_DMP, "cfg_dmp" },
 | 
			
		||||
	
 | 
			
		||||
	{ DBG_WARN, "warn" },
 | 
			
		||||
	
 | 
			
		||||
	{ DBG_MOD,"mod"},
 | 
			
		||||
	{ DBG_STATE, "state" },
 | 
			
		||||
	{ DBG_ALL, "all"},
 | 
			
		||||
	{ DBG_WARN,		"warn" },
 | 
			
		||||
		
 | 
			
		||||
	{ DBG_MOD,		"mod"},
 | 
			
		||||
	{ DBG_STATE,		"state" },
 | 
			
		||||
	{ DBG_MSG_COMPOSE,	"msg_compose" },
 | 
			
		||||
 | 
			
		||||
	{ (DBG_MSG_IN | DBG_MSG_OUT), "msg" },
 | 
			
		||||
	{ (DBG_PKT_IN | DBG_PKT_OUT), "pkt" },
 | 
			
		||||
	{ (DBG_ELEM_IN | DBG_ELEM_OUT), "elem" },
 | 
			
		||||
	{ (DBG_ELEM_DETAIL_IN | DBG_ELEM_DETAIL_OUT), "elem_detail" },
 | 
			
		||||
	{ (DBG_ELEM_IN | DBG_ELEM_OUT | DBG_ELEM_DMP | DBG_ELEM_DETAIL_IN | DBG_ELEM_DETAIL_OUT), "elem_all" },
 | 
			
		||||
 | 
			
		||||
	{ (	DBG_MSG_IN | DBG_MSG_OUT | 
 | 
			
		||||
		DBG_ELEM_IN | DBG_ELEM_OUT |
 | 
			
		||||
		DBG_MSG_ERR | DBG_ELEM_ERR |
 | 
			
		||||
		DBG_PKT_ERR | DBG_RFC | DBG_WARN
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		| DBG_STATE), 			"std" },
 | 
			
		||||
 | 
			
		||||
	{ DBG_ALL, 		"all"},
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	{ CW_STR_STOP, NULL } 
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -69,7 +69,7 @@ void cw_discovery_results_add(struct cw_DiscoveryResults *dis,
 | 
			
		||||
	} else {
 | 
			
		||||
		/* Get priority for AC from 
 | 
			
		||||
		 * ac-name-with-priority list */
 | 
			
		||||
		sprintf(key, "ac-name-with-priority/%s", acname);
 | 
			
		||||
		sprintf(key, "capwap/ac-name-with-priority/%s", acname);
 | 
			
		||||
		e.prio = cw_cfg_get_byte(wtp_cfg, key, 255);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -78,7 +78,7 @@ void cw_discovery_results_add(struct cw_DiscoveryResults *dis,
 | 
			
		||||
	do {
 | 
			
		||||
		const char *ipval;
 | 
			
		||||
 | 
			
		||||
		sprintf(key, "capwap-control-ip-address.%d/wtps", i);
 | 
			
		||||
		sprintf(key, "capwap/control-ip-address.%d/wtps", i);
 | 
			
		||||
		e.wtps = cw_cfg_get_word(ac_cfg, key, 65535);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -86,7 +86,7 @@ void cw_discovery_results_add(struct cw_DiscoveryResults *dis,
 | 
			
		||||
		if (e.wtps == 65535)
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
		sprintf(key, "capwap-control-ip-address.%d/address", i);
 | 
			
		||||
		sprintf(key, "capwap/control-ip-address.%d/address", i);
 | 
			
		||||
		ipval = cw_cfg_get(ac_cfg, key, "");
 | 
			
		||||
 | 
			
		||||
		sprintf(key, "%04d%05d%04d", e.prio, e.wtps, dis->nr);
 | 
			
		||||
@ -98,7 +98,7 @@ void cw_discovery_results_add(struct cw_DiscoveryResults *dis,
 | 
			
		||||
		if (e.cfg == NULL)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		cw_cfg_copy(ac_cfg,e.cfg);
 | 
			
		||||
		cw_cfg_copy(ac_cfg,e.cfg,0,"");
 | 
			
		||||
		
 | 
			
		||||
		strcpy(e.ip,ipval);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -224,7 +224,7 @@ int dtls_openssl_set_certs(struct cw_Conn * conn, struct dtls_openssl_data *d)
 | 
			
		||||
{
 | 
			
		||||
	int rc;
 | 
			
		||||
	if (conn->dtls_key_file && conn->dtls_cert_file){
 | 
			
		||||
		SSL_CTX_set_default_passwd_cb_userdata(d->ctx, conn->dtls_key_pass);
 | 
			
		||||
		SSL_CTX_set_default_passwd_cb_userdata(d->ctx, (char*)conn->dtls_key_pass);
 | 
			
		||||
		SSL_CTX_set_default_passwd_cb(d->ctx, pem_passwd_cb);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -291,18 +291,18 @@ return 1;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
static unsigned int psk_server_cb(SSL *ssl,const char *identity, unsigned char * psk, unsigned int max_psk_len)
 | 
			
		||||
{
 | 
			
		||||
	BIO * b = SSL_get_rbio(ssl);
 | 
			
		||||
	struct cw_Conn * conn = BIO_get_data(b); /*->ptr;*/
 | 
			
		||||
	
 | 
			
		||||
	struct cw_Conn * conn = BIO_get_data(b); //->ptr;
 | 
			
		||||
 | 
			
		||||
	int l = bstr16_len(conn->dtls_psk) < max_psk_len ? bstr16_len(conn->dtls_psk) : max_psk_len;
 | 
			
		||||
	memcpy(psk,conn->dtls_psk,l);
 | 
			
		||||
	return l;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -323,10 +323,8 @@ struct dtls_openssl_data * dtls_openssl_data_create(struct cw_Conn * conn, const
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	rc = SSL_CTX_get_security_level(d->ctx);
 | 
			
		||||
	printf("Security Level is %d\n");
 | 
			
		||||
 | 
			
		||||
	SSL_CTX_set_security_level(d->ctx,0);
 | 
			
		||||
	printf("Security Level is %d\n");
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ int dtls_openssl_accept(struct cw_Conn *conn)
 | 
			
		||||
	
 | 
			
		||||
	if (!conn->dtls_data)
 | 
			
		||||
		conn->dtls_data =
 | 
			
		||||
		    dtls_openssl_data_create(conn, DTLSv1_server_method(),
 | 
			
		||||
		    dtls_openssl_data_create(conn, DTLS_server_method(),
 | 
			
		||||
					     dtls_openssl_bio_method());
 | 
			
		||||
 | 
			
		||||
	d = (struct dtls_openssl_data *) conn->dtls_data;
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
#ifndef __KEYS_H
 | 
			
		||||
#define __KEYS_H
 | 
			
		||||
 | 
			
		||||
#define CW_KEY_WTP_DESCRIPTOR "wtp-descriptor"
 | 
			
		||||
//#define CW_KEY_WTP_DESCRIPTOR "capwap/wtp-descriptor"
 | 
			
		||||
 | 
			
		||||
#define CW_SKEY_HARDWARE "hardware"
 | 
			
		||||
#define CW_SKEY_SOFTWARE "software"
 | 
			
		||||
@ -15,8 +15,8 @@
 | 
			
		||||
#define CW_SKEY_RADIOS_IN_USE	"radios-in-use"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define CW_KEY_WTP_NAME		"wtp-name"
 | 
			
		||||
#define CW_KEY_DISCOVERY_TYPE	"discovery-type"
 | 
			
		||||
//#define CW_KEY_WTP_NAME		"wtp-name"
 | 
			
		||||
//#define CW_KEY_DISCOVERY_TYPE	"discovery-type"
 | 
			
		||||
#define CW_KEY_WTP_MAC_TYPE	"wtp-mac-type"
 | 
			
		||||
#define CW_KEY_WTP_FRAME_TUNNEL_MODE	"wtp-frame-tunnel-mode"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -11,6 +11,8 @@ int cw_encode_elements(struct cw_ElemHandlerParams *params, mlist_t elements_lis
 | 
			
		||||
	struct mlistelem * elem;
 | 
			
		||||
 | 
			
		||||
	len =0;
 | 
			
		||||
	params->len=len;
 | 
			
		||||
 | 
			
		||||
	mlist_foreach(elem,elements_list){
 | 
			
		||||
		int l;
 | 
			
		||||
		struct cw_ElemData * data;
 | 
			
		||||
@ -20,8 +22,8 @@ int cw_encode_elements(struct cw_ElemHandlerParams *params, mlist_t elements_lis
 | 
			
		||||
		handler = cw_msgset_get_elemhandler(params->msgset,data->proto,data->vendor,data->id);
 | 
			
		||||
		params->elemdata = data;
 | 
			
		||||
 | 
			
		||||
		cw_dbg(DBG_MSG_ASSEMBLY,"    Add Elem: %d %d %d %s", data->proto, data->vendor, data->id, handler->name);
 | 
			
		||||
		if (handler==NULL){
 | 
			
		||||
			cw_dbg(DBG_MSG_COMPOSE,"    Add Elem: %d %d %d %s", data->proto, data->vendor, data->id, handler->name);
 | 
			
		||||
			cw_log(LOG_ERR,"Can't put message element %d %d %d, no handler defined.",
 | 
			
		||||
					data->proto,data->vendor,data->id);
 | 
			
		||||
			continue;
 | 
			
		||||
@ -29,6 +31,7 @@ int cw_encode_elements(struct cw_ElemHandlerParams *params, mlist_t elements_lis
 | 
			
		||||
 | 
			
		||||
		if (handler->put == NULL){
 | 
			
		||||
			if (data->mand){
 | 
			
		||||
				cw_dbg(DBG_MSG_COMPOSE,"    Add Elem: %d %d %d %s", data->proto, data->vendor, data->id, handler->name);
 | 
			
		||||
				cw_log(LOG_ERR,"Error: Can't add mandatory message element %d - %s, no put method defined",
 | 
			
		||||
					handler->id, handler->name);
 | 
			
		||||
				
 | 
			
		||||
@ -38,24 +41,22 @@ int cw_encode_elements(struct cw_ElemHandlerParams *params, mlist_t elements_lis
 | 
			
		||||
 | 
			
		||||
		if (!data->mand){
 | 
			
		||||
			if (!cw_cfg_base_exists(params->cfg_list[0],handler->key)){
 | 
			
		||||
//				cw_dbg(DBG_X,"nothing todo");
 | 
			
		||||
				cw_dbg(DBG_MSG_COMPOSE,"    Add Elem: %d %d %d %s - (skip)", 
 | 
			
		||||
						data->proto, data->vendor, data->id, handler->name);
 | 
			
		||||
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		l = handler->put(handler,params,dst+len);
 | 
			
		||||
		cw_dbg(DBG_MSG_COMPOSE,"    Add Elem: %d %d %d %s - (%d bytes)", 
 | 
			
		||||
				data->proto, data->vendor, data->id, handler->name,l);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/*	if(l>0)
 | 
			
		||||
			cw_dbg_elem(DBG_ELEM_OUT,conn,type,handler,dst+len,l);
 | 
			
		||||
	*	if (strlen(details)){
 | 
			
		||||
			cw_dbg(DBG_ELEM_DETAIL,"  %s",params.debug_details);
 | 
			
		||||
		}
 | 
			
		||||
	*/	len += l;
 | 
			
		||||
		len += l;
 | 
			
		||||
		params->len=len;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	return len;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -91,17 +92,15 @@ int cw_compose_message(struct cw_Conn *conn, uint8_t * rawout)
 | 
			
		||||
		msg->preprocess(conn);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cw_dbg(DBG_MSG_ASSEMBLY,"*** Assembling message of type %d (%s) ***", 
 | 
			
		||||
	cw_dbg(DBG_MSG_COMPOSE,"Composing message of type %d (%s) ***", 
 | 
			
		||||
			msg->type, msg->name);
 | 
			
		||||
	
 | 
			
		||||
	dst = msgptr+8;
 | 
			
		||||
	len =0;
 | 
			
		||||
//cw_dbg(DBG_X,"setting with update CFG");
 | 
			
		||||
	params.conn=conn;
 | 
			
		||||
	params.cfg_list[0]=conn->update_cfg;
 | 
			
		||||
	params.cfg_list[1]=conn->local_cfg;
 | 
			
		||||
	params.cfg_list[2]=conn->global_cfg;
 | 
			
		||||
	params.cfg_list[3]=NULL;
 | 
			
		||||
	params.rawmsg = rawout;
 | 
			
		||||
	params.cfg_list=conn->cfg_list;
 | 
			
		||||
	params.msgset=conn->msgset;
 | 
			
		||||
	params.msgdata=msg;
 | 
			
		||||
	params.debug_details=details;
 | 
			
		||||
@ -114,7 +113,7 @@ int cw_compose_message(struct cw_Conn *conn, uint8_t * rawout)
 | 
			
		||||
		
 | 
			
		||||
		data =  mlistelem_dataptr(elem);
 | 
			
		||||
		handler = cw_msgset_get_elemhandler(conn->msgset,data->proto,data->vendor,data->id);
 | 
			
		||||
		cw_dbg(DBG_MSG_ASSEMBLY,"    Add Elem: %d %d %d %s", data->proto, data->vendor, data->id, handler->name);
 | 
			
		||||
		cw_dbg(DBG_MSG_COMPOSE,"    Add Elem: %d %d %d %s", data->proto, data->vendor, data->id, handler->name);
 | 
			
		||||
		if (handler==NULL){
 | 
			
		||||
			cw_log(LOG_ERR,"Can't put message element %d %d %d, no handler defined.",
 | 
			
		||||
					data->proto,data->vendor,data->id);
 | 
			
		||||
@ -151,8 +150,8 @@ int cw_compose_message(struct cw_Conn *conn, uint8_t * rawout)
 | 
			
		||||
//	}
 | 
			
		||||
 | 
			
		||||
	cw_set_msg_elems_len(msgptr, len);
 | 
			
		||||
	cw_dbg(DBG_MSG_ASSEMBLY,"*** Done assenmbling message of type %d (%s) ***", 
 | 
			
		||||
			msg->type, msg->name);
 | 
			
		||||
	//cw_dbg(DBG_MSG_COMPOSE,"*** Done assenmbling message of type %d (%s) ***", 
 | 
			
		||||
//			msg->type, msg->name);
 | 
			
		||||
	if (type & 1) {
 | 
			
		||||
		/* It's a request, so we have to set seqnum */
 | 
			
		||||
		int s = conn_get_next_seqnum(conn);
 | 
			
		||||
@ -161,8 +160,8 @@ int cw_compose_message(struct cw_Conn *conn, uint8_t * rawout)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
	printf ("----------------------------------- redecode -----------------------------\n");
 | 
			
		||||
	uint8_t *elems_ptr;
 | 
			
		||||
//	printf ("----------------------------------- redecode -----------------------------\n");
 | 
			
		||||
/*	uint8_t *elems_ptr;
 | 
			
		||||
 | 
			
		||||
	int offset = cw_get_hdr_msg_offset(rawout);
 | 
			
		||||
 | 
			
		||||
@ -178,7 +177,7 @@ int cw_compose_message(struct cw_Conn *conn, uint8_t * rawout)
 | 
			
		||||
	params.msgset=conn->msgset;
 | 
			
		||||
	params.msgdata=msg;
 | 
			
		||||
	params.mand_found = mavl_create_conststr();
 | 
			
		||||
 | 
			
		||||
	params.dbg_level = DBG_ELEM_OUT;
 | 
			
		||||
 | 
			
		||||
	cw_decode_elements( ¶ms, elems_ptr,elems_len);
 | 
			
		||||
	cw_cfg_destroy(cfg);
 | 
			
		||||
@ -186,8 +185,8 @@ int cw_compose_message(struct cw_Conn *conn, uint8_t * rawout)
 | 
			
		||||
		cw_check_missing_mand(msg, params.mand_found,conn->msgset->handlers_by_key);
 | 
			
		||||
		mavl_destroy(params.mand_found);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	printf ("----------------------------------- end redecode -----------------------------\n");
 | 
			
		||||
*/
 | 
			
		||||
//	printf ("----------------------------------- end redecode -----------------------------\n");
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -222,7 +221,10 @@ int cw_decode_element(struct cw_ElemHandlerParams *params, int proto,
 | 
			
		||||
	elem_data_search.id = elem_id;
 | 
			
		||||
	elem_data_search.proto = proto;
 | 
			
		||||
	elem_data_search.vendor = vendor;
 | 
			
		||||
	elem_data = mavl_get(params->msgdata->elements_tree, &elem_data_search);
 | 
			
		||||
	if (params->msgdata)
 | 
			
		||||
		elem_data = mavl_get(params->msgdata->elements_tree, &elem_data_search);
 | 
			
		||||
	else
 | 
			
		||||
		elem_data = NULL;
 | 
			
		||||
	if (!elem_data) {
 | 
			
		||||
		cw_dbg(DBG_ELEM_ERR, "Element %d - %s, not allowed here",
 | 
			
		||||
		       elem_id, handler->name);
 | 
			
		||||
@ -251,8 +253,9 @@ int cw_decode_element(struct cw_ElemHandlerParams *params, int proto,
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cw_dbg_elem(DBG_ELEM_IN, NULL, params->msgdata->type, handler,
 | 
			
		||||
		    data, len);
 | 
			
		||||
	if (!handler->flags || cw_dbg_is_level(DBG_ELEM_VNDR))
 | 
			
		||||
		cw_dbg_elem(params->dbg_level, NULL, params->msgdata->type, handler,
 | 
			
		||||
			    data, len);
 | 
			
		||||
 | 
			
		||||
	if (handler->get == NULL) {
 | 
			
		||||
		cw_log(LOG_ERR, "No get method defined for %d %s", handler->id,
 | 
			
		||||
@ -274,7 +277,6 @@ int cw_decode_elements(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr
 | 
			
		||||
 | 
			
		||||
	//mand_found = mavl_create_conststr();
 | 
			
		||||
	//unrecognized = mlist_create(NULL,NULL,sizeof(uint8_t*));
 | 
			
		||||
 | 
			
		||||
	cw_foreach_elem(elem, elems_ptr, elems_len) {
 | 
			
		||||
		int rc;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -119,7 +119,7 @@ void cw_mod_set_path(const char *path)
 | 
			
		||||
 * @param mod_name Name of the module
 | 
			
		||||
 * @return a pointer to the module interface
 | 
			
		||||
 */
 | 
			
		||||
struct cw_Mod *cw_mod_load(const char *mod_name, mavl_t global_cfg, int role)
 | 
			
		||||
struct cw_Mod *cw_mod_load(const char *mod_name, cw_Cfg_t * global_cfg, int role)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_Mod search;
 | 
			
		||||
	struct cw_Mod *mod;
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,7 @@
 | 
			
		||||
 | 
			
		||||
#include "sock.h"
 | 
			
		||||
#include "conn.h"
 | 
			
		||||
 | 
			
		||||
#include "cfg.h"
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
	CW_MOD_MODE_CAPWAP,
 | 
			
		||||
@ -44,7 +44,7 @@ struct cw_Mod {
 | 
			
		||||
	const char *name;
 | 
			
		||||
 | 
			
		||||
	/** Initializion method */
 | 
			
		||||
	int (*init) (struct cw_Mod *mod, mavl_t global_cfg, int role);
 | 
			
		||||
	int (*init) (struct cw_Mod *mod, cw_Cfg_t * global_cfg, int role);
 | 
			
		||||
 | 
			
		||||
	/** Detect capwap 
 | 
			
		||||
	 * This function is called after receiving and disassembling a complete 
 | 
			
		||||
@ -93,7 +93,7 @@ extern int mod_caching;
 | 
			
		||||
#define mod_set_caching(var) (mod_caching=var)
 | 
			
		||||
#define mod_get_caching() (mod_caching)
 | 
			
		||||
 | 
			
		||||
struct cw_Mod * cw_mod_load(const char * mod_name, mavl_t global_cfg, int role);
 | 
			
		||||
struct cw_Mod * cw_mod_load(const char * mod_name, cw_Cfg_t * global_cfg, int role);
 | 
			
		||||
struct cw_Mod * cw_mod_add_to_list(struct cw_Mod * mod );
 | 
			
		||||
struct cw_Mod * cw_mod_detect(struct cw_Conn *conn, 
 | 
			
		||||
			uint8_t * rawmsg, int len,
 | 
			
		||||
 | 
			
		||||
@ -384,6 +384,9 @@ int cw_msgset_add_states(struct cw_MsgSet * set, cw_StateMachineState_t * states
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Find message data to a specific message
 | 
			
		||||
 * @param set message set
 | 
			
		||||
@ -392,9 +395,14 @@ int cw_msgset_add_states(struct cw_MsgSet * set, cw_StateMachineState_t * states
 | 
			
		||||
 */
 | 
			
		||||
struct cw_MsgData *cw_msgset_get_msgdata(struct cw_MsgSet *set, int type)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_MsgData search;
 | 
			
		||||
 | 
			
		||||
	struct cw_MsgData search, *result;
 | 
			
		||||
	search.type = type;
 | 
			
		||||
	return mavl_get(set->msgdata, &search);
 | 
			
		||||
	result = mavl_get(set->msgdata, &search);
 | 
			
		||||
	if (result != NULL)
 | 
			
		||||
		return result;
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef int (*cw_MsgCallbackFun)(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len);
 | 
			
		||||
 | 
			
		||||
@ -24,17 +24,20 @@ struct cw_ElemData{
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct cw_ElemHandlerParams {
 | 
			
		||||
	struct cw_Conn * conn;  /**< a connection the message belongs to*/
 | 
			
		||||
	struct cw_MsgSet * msgset;
 | 
			
		||||
	struct cw_Conn * conn;  	/**< a connection the message belongs to*/
 | 
			
		||||
	uint8_t * rawmsg;
 | 
			
		||||
	struct cw_MsgSet * msgset;	/**< msgset to use */
 | 
			
		||||
	struct cw_MsgData * msgdata; 
 | 
			
		||||
	struct cw_ElemData * elemdata;
 | 
			
		||||
	struct sockaddr *from;
 | 
			
		||||
	mavl_t mand_found;
 | 
			
		||||
	mlist_t unrecognized;
 | 
			
		||||
//	cw_Val_t * elem;
 | 
			
		||||
	mavl_t mand_found;		/**< used to ad the keys of mand. msg elements
 | 
			
		||||
					     found while parsing */
 | 
			
		||||
	mlist_t unrecognized;		/**< to catch ids of unreconized mss elements */
 | 
			
		||||
	char * debug_details;
 | 
			
		||||
	uint32_t dbg_level;
 | 
			
		||||
	cw_Cfg_t * cfg;
 | 
			
		||||
	cw_Cfg_t * cfg_list[10];
 | 
			
		||||
	cw_Cfg_t ** cfg_list;
 | 
			
		||||
	int len;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -57,7 +60,7 @@ struct cw_ElemHandler {
 | 
			
		||||
	int (*mkkey)(const char *pkey, uint8_t*data, int len, char *dst);
 | 
			
		||||
	int (*patch)(uint8_t *dst, void *data );
 | 
			
		||||
	void * param;
 | 
			
		||||
 | 
			
		||||
	uint8_t flags;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -35,8 +35,9 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef __FreeBSD__
 | 
			
		||||
#define HAVE_SIN_LEN
 | 
			
		||||
#define HAVE_SIN6_LEN
 | 
			
		||||
#define HAVE_SIN_LEN 1
 | 
			
		||||
#define HAVE_SIN6_LEN 1
 | 
			
		||||
#define HAVE_SS_LEN 1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -68,7 +69,7 @@ extern int sock_getport(struct sockaddr *addr);
 | 
			
		||||
extern int sock_setport(struct sockaddr *addr, int port);
 | 
			
		||||
extern int sock_getbroadcastaddr(const struct sockaddr *addr,
 | 
			
		||||
				 struct sockaddr *broadcastaddr);
 | 
			
		||||
extern void sock_addrinit(struct sockaddr *addr, int type);
 | 
			
		||||
extern void sock_addrinit(struct sockaddr_storage *addr, int type);
 | 
			
		||||
extern int sock_set_dontfrag(int sock, int val);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,19 +4,31 @@
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <arpa/inet.h>
 | 
			
		||||
#include <netinet/in.h>
 | 
			
		||||
#include <sys/un.h>
 | 
			
		||||
 | 
			
		||||
void sock_addrinit(struct sockaddr *addr,int type)
 | 
			
		||||
#include "sock.h"
 | 
			
		||||
 | 
			
		||||
void sock_addrinit(struct sockaddr_storage *addr,int type)
 | 
			
		||||
{
 | 
			
		||||
	int len;
 | 
			
		||||
	switch (type){
 | 
			
		||||
		case AF_INET:
 | 
			
		||||
			memset(addr,0,sizeof(struct sockaddr_in));
 | 
			
		||||
			addr->sa_family=type;
 | 
			
		||||
#ifdef HAVE_SIN_LEN
 | 
			
		||||
			addr_sa_len=sizeof(struct sockaddr_in);
 | 
			
		||||
#endif
 | 
			
		||||
			return;
 | 
			
		||||
 | 
			
		||||
			len=sizeof(struct sockaddr_in);
 | 
			
		||||
			break;
 | 
			
		||||
		case AF_INET6:
 | 
			
		||||
			len=sizeof(struct sockaddr_in6);
 | 
			
		||||
			break;
 | 
			
		||||
		case AF_UNIX:
 | 
			
		||||
			len = sizeof(struct sockaddr_un);
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			len=0;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	memset(addr,0,len);
 | 
			
		||||
	addr->ss_family=type;
 | 
			
		||||
#ifdef HAVE_SS_LEN
 | 
			
		||||
	addr->ss_len=len;
 | 
			
		||||
#endif	
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -31,6 +31,7 @@
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/un.h>
 | 
			
		||||
#include <arpa/inet.h>
 | 
			
		||||
#include <netinet/in.h>
 | 
			
		||||
 | 
			
		||||
@ -88,7 +89,7 @@ char *sock_addrtostr(const struct sockaddr *sa, char *s, size_t maxlen, int addp
 | 
			
		||||
		}
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
#endif				/* AF_LINLK */
 | 
			
		||||
#endif	/* AF_LINLK */
 | 
			
		||||
 | 
			
		||||
#ifdef AF_PACKET
 | 
			
		||||
		case AF_PACKET:
 | 
			
		||||
@ -103,11 +104,17 @@ char *sock_addrtostr(const struct sockaddr *sa, char *s, size_t maxlen, int addp
 | 
			
		||||
			sprintf(sp, "%02X", sl->sll_addr[i]);
 | 
			
		||||
		}
 | 
			
		||||
			break;
 | 
			
		||||
#endif				/* AF_PACKET */
 | 
			
		||||
#endif	/* AF_PACKET */
 | 
			
		||||
		case AF_UNIX:
 | 
			
		||||
		{
 | 
			
		||||
			struct sockaddr_un *addr = (struct sockaddr_un *) sa;
 | 
			
		||||
			snprintf(s, maxlen, "%s", addr->sun_path);
 | 
			
		||||
		}
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		default:
 | 
			
		||||
			strncpy(s, "Unknown AF", maxlen);
 | 
			
		||||
			snprintf(s,maxlen, "Unknown AF: %d", sa->sa_family);
 | 
			
		||||
			return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	return s;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										25
									
								
								src/cw/val.h
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								src/cw/val.h
									
									
									
									
									
								
							@ -23,7 +23,7 @@
 | 
			
		||||
 | 
			
		||||
//#define CW_KTV_MAX_KEY_LEN 1024
 | 
			
		||||
 | 
			
		||||
typedef struct mavl cw_Cfg_t;
 | 
			
		||||
typedef struct cw_Cfg cw_Cfg_t;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @struct cw_Val
 | 
			
		||||
@ -146,12 +146,6 @@ struct cw_ValIndexed{
 | 
			
		||||
};
 | 
			
		||||
typedef struct cw_ValIndexed cw_ValIndexed_t;
 | 
			
		||||
 | 
			
		||||
int cw_ktv_read_struct(mavl_t ktv,const cw_ValStruct_t * stru, const char *pkey, 
 | 
			
		||||
	uint8_t * data, int len);
 | 
			
		||||
int cw_ktv_write_struct(mavl_t ktv, mavl_t def, const cw_ValStruct_t * stru, const char *pkey, 
 | 
			
		||||
	uint8_t * dst);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern const struct cw_Type cw_type_byte;
 | 
			
		||||
extern const struct cw_Type cw_type_word;
 | 
			
		||||
@ -178,24 +172,7 @@ extern const struct cw_Type cw_type_struct;
 | 
			
		||||
/*
 | 
			
		||||
void cw_kvstore_mavl_delete(const void *data);
 | 
			
		||||
 */
 | 
			
		||||
cw_Val_t *cw_ktv_add(mavl_t kvstore, const char *key, const struct cw_Type *type, 
 | 
			
		||||
			const void * valguard, 
 | 
			
		||||
			   const uint8_t * data, int len);
 | 
			
		||||
 | 
			
		||||
void cw_ktv_del_sub(mavl_t ktvstore, const char *basekey);
 | 
			
		||||
 | 
			
		||||
cw_Val_t * cw_ktv_replace(mavl_t kvtstore, const char *key, const struct cw_Type *type,
 | 
			
		||||
			const void * valguard,
 | 
			
		||||
			const uint8_t * data, int len);
 | 
			
		||||
 | 
			
		||||
const char * cw_ktv_add_from_str(mavl_t kvtstore, const char *key, const struct cw_Type *type, 
 | 
			
		||||
			const void * valguard,
 | 
			
		||||
			const char * str);
 | 
			
		||||
 | 
			
		||||
int cw_ktv_mavlcmp(const void *v1, const void *v2);
 | 
			
		||||
int cw_ktv_mavlcmp_type_by_name(const void *v1,const void *v2);
 | 
			
		||||
 | 
			
		||||
void cw_ktv_mavldel(void *data);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Create a KTV store 
 | 
			
		||||
 | 
			
		||||
@ -56,6 +56,12 @@ static cw_ValStruct_t radio_operational_state[] = {
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t image_identifier_stru[] = {
 | 
			
		||||
	{CW_TYPE_DWORD, "vendor-id", 4,-1},
 | 
			
		||||
	{CW_TYPE_BSTR16, "identifier", -1,-1},
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValValRange_t radio_admin_state_valguard[]={
 | 
			
		||||
	{0,0,"0 - reserved"},
 | 
			
		||||
@ -96,7 +102,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		1,1,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BYTE,				/* type */
 | 
			
		||||
		"discovery-type",			/* Key */
 | 
			
		||||
		"capwap/discovery-type",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
@ -111,7 +117,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		1,1,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BYTE,				/* type */
 | 
			
		||||
		"wtp-mac-type",				/* Key */
 | 
			
		||||
		"capwap/wtp-mac-type",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
@ -125,18 +131,18 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		14,1024,				/* min/max length */
 | 
			
		||||
		NULL,					/* type */
 | 
			
		||||
		CW_KEY_WTP_BOARD_DATA,			/* Key */
 | 
			
		||||
		"capwap/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 */
 | 
			
		||||
		CAPWAP_ELEM_WTP_DESCRIPTOR,		/* #Element ID */
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		33,1024,				/* min/max length */
 | 
			
		||||
		NULL,					/* type */
 | 
			
		||||
		CW_KEY_WTP_DESCRIPTOR,			/* Key */
 | 
			
		||||
		"capwap/wtp-descriptor",		/* Key */
 | 
			
		||||
		capwap_in_wtp_descriptor,		/* get */
 | 
			
		||||
		capwap_out_wtp_descriptor,		/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -147,7 +153,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		1,1,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BYTE,				/* type */
 | 
			
		||||
		CW_KEY_WTP_FRAME_TUNNEL_MODE,		/* Key */
 | 
			
		||||
		"capwap/wtp-frame-tunnel-mode",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -160,7 +166,13 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		NULL,					/* type */
 | 
			
		||||
		"vendor_specific_payload",		/* Key */
 | 
			
		||||
		capwap_in_vendor_specific_payload,	/* get */
 | 
			
		||||
		NULL					/* put */
 | 
			
		||||
		NULL,					/* put */
 | 
			
		||||
		NULL,					/* mkkey*/
 | 
			
		||||
		NULL,					/* patch*/
 | 
			
		||||
		NULL,					/* param */
 | 
			
		||||
		1					/* flags */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{ 
 | 
			
		||||
@ -181,7 +193,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		0,0,					/* min/max length */
 | 
			
		||||
		NULL,					/* type */
 | 
			
		||||
		CW_KEY_AC_DESCRIPTOR,			/* Key */
 | 
			
		||||
		"capwap/ac-descriptor",			/* Key */
 | 
			
		||||
		capwap_in_ac_descriptor,		/* get */
 | 
			
		||||
		capwap_out_ac_descriptor		/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -193,7 +205,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		1,CAPWAP_MAX_AC_NAME_LEN,		/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"ac-name",				/* Key */
 | 
			
		||||
		"capwap/ac-name",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -205,7 +217,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		6,6,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"capwap-control-ip-address",		/* Key */
 | 
			
		||||
		"capwap/control-ip-address",		/* Key */
 | 
			
		||||
		capwap_in_capwap_control_ip_address,	/* get */
 | 
			
		||||
		capwap_out_capwap_control_ip_address	/* put */
 | 
			
		||||
	},
 | 
			
		||||
@ -216,7 +228,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		18,18,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"capwap-control-ip-address",		/* Key */
 | 
			
		||||
		"capwap/control-ip-address",		/* Key */
 | 
			
		||||
		capwap_in_capwap_control_ip_address,	/* get */
 | 
			
		||||
		capwap_out_capwap_control_ip_address	/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -229,7 +241,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		1,CAPWAP_MAX_LOCATION_DATA_LEN,		/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"location-data",			/* Key */
 | 
			
		||||
		"capwap/location-data",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -241,7 +253,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		1,CAPWAP_MAX_WTP_NAME_LEN,		/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"wtp-name",				/* Key */
 | 
			
		||||
		"capwap/wtp-name",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -252,7 +264,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		CAPWAP_SESSION_ID_LEN,CAPWAP_SESSION_ID_LEN,	/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"session-id",				/* Key */
 | 
			
		||||
		"capwap/session-id",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -264,7 +276,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		4,4,					/* min/max length */
 | 
			
		||||
		CW_TYPE_DWORD,				/* type */
 | 
			
		||||
		"result-code",				/* Key */
 | 
			
		||||
		"capwap/result-code",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -276,7 +288,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		1,1,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BYTE,				/* type */
 | 
			
		||||
		"ecn-support",				/* Key */
 | 
			
		||||
		"capwap/ecn-support",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -288,7 +300,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		2,2,					/* min/max length */
 | 
			
		||||
		CW_TYPE_WORD,				/* type */
 | 
			
		||||
		"maximum-message-length",		/* Key */
 | 
			
		||||
		"capwap/maximum-message-length",	/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -300,7 +312,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		4,4,					/* min/max length */
 | 
			
		||||
		CW_TYPE_IPADDRESS,			/* type */
 | 
			
		||||
		"capwap-local-ip-address",		/* Key */
 | 
			
		||||
		"capwap/local-ip-address",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		capwap_out_capwap_local_ip_address	/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -311,7 +323,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		16,16,					/* min/max length */
 | 
			
		||||
		CW_TYPE_IPADDRESS,			/* type */
 | 
			
		||||
		"capwap-local-ip-address",		/* Key */
 | 
			
		||||
		"capwap/local-ip-address",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		capwap_out_capwap_local_ip_address	/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -324,7 +336,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		2,2,					/* min/max length */
 | 
			
		||||
		CW_TYPE_WORD,				/* type */
 | 
			
		||||
		"statistics-timer",			/* Key */
 | 
			
		||||
		"capwap/statistics-timer",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -336,7 +348,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		15,15,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"wtp-reboot-statistics",		/* Key */
 | 
			
		||||
		"capwap/wtp-reboot-statistics",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* handler */
 | 
			
		||||
		cw_out_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
@ -352,7 +364,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0, 0,						/* Vendor / Proto */
 | 
			
		||||
		2, 2,						/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,					/* type */
 | 
			
		||||
		"admin-state",					/* Key */
 | 
			
		||||
		"capwap/admin-state",				/* Key */
 | 
			
		||||
		cw_in_radio_generic,				/* get */
 | 
			
		||||
		cw_out_radio_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
@ -368,7 +380,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0, 0,					/* Vendor / Proto */
 | 
			
		||||
		2, 2,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"capwap-timers",			/* Key */
 | 
			
		||||
		"capwap/timers",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
@ -383,7 +395,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0, 0,						/* Vendor / Proto */
 | 
			
		||||
		3, 3,						/* min/max length */
 | 
			
		||||
		CW_TYPE_WORD,					/* type */
 | 
			
		||||
		"decryption-error-report-period",		/* Key */
 | 
			
		||||
		"capwap/decryption-error-report-period",	/* Key */
 | 
			
		||||
		cw_in_radio_generic,				/* get */
 | 
			
		||||
		cw_out_radio_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -395,7 +407,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0, 0,						/* Vendor / Proto */
 | 
			
		||||
		4, 4,						/* min/max length */
 | 
			
		||||
		CW_TYPE_DWORD,					/* type */
 | 
			
		||||
		"idle-timeout",					/* Key */
 | 
			
		||||
		"capwap/idle-timeout",				/* Key */
 | 
			
		||||
		cw_in_generic,					/* get */
 | 
			
		||||
		cw_out_generic					/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -407,7 +419,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0, 0,						/* Vendor / Proto */
 | 
			
		||||
		1, 1,						/* min/max length */
 | 
			
		||||
		CW_TYPE_BYTE,					/* type */
 | 
			
		||||
		"wtp-fallback",					/* Key */
 | 
			
		||||
		"capwap/wtp-fallback",				/* Key */
 | 
			
		||||
		cw_in_generic,					/* get */
 | 
			
		||||
		cw_out_generic					/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -418,7 +430,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0, 0,						/* Vendor / Proto */
 | 
			
		||||
		3, 3,						/* min/max length */
 | 
			
		||||
		radio_operational_state,			/* type */
 | 
			
		||||
		"operational-state",				/* Key */
 | 
			
		||||
		"capwap/operational-state",			/* Key */
 | 
			
		||||
		cw_in_radio_generic_struct,			/* get */
 | 
			
		||||
		cw_out_radio_generic_struct			/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -430,11 +442,26 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		1,513,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"ac-name-with-index",			/* Key */
 | 
			
		||||
		"capwap/ac-name-with-priority",		/* Key */
 | 
			
		||||
		cw_in_generic_with_index,		/* get */
 | 
			
		||||
		cw_out_generic_with_index		/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Image Identifier",			/* name */
 | 
			
		||||
		CAPWAP_ELEM_IMAGE_IDENTIFIER,		/* Element ID */
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		5,1028,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"capwap/image-identifier",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,
 | 
			
		||||
		image_identifier_stru			/* param */
 | 
			
		||||
	}
 | 
			
		||||
	,		
 | 
			
		||||
	{0,0,0,0,0,0,0,0}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
@ -552,8 +579,8 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
 | 
			
		||||
 | 
			
		||||
	{0,0,CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE,	0, 0},
 | 
			
		||||
	{0,0,CAPWAP_ELEM_STATISTICS_TIMER,		0, 0},
 | 
			
		||||
	{0,0,CAPWAP_ELEM_IMAGE_IDENTIFIER,		0, 0},
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD,	0, CW_IGNORE},
 | 
			
		||||
	{0,0,0,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -9,15 +9,12 @@ int capwap_in_ac_descriptor(struct cw_ElemHandler *eh,
 | 
			
		||||
			struct cw_ElemHandlerParams *params, 
 | 
			
		||||
			uint8_t * data, int len)
 | 
			
		||||
{
 | 
			
		||||
	stop();
 | 
			
		||||
 | 
			
		||||
	static struct cw_DescriptorSubelemDef allowed[] = {
 | 
			
		||||
		{0,CAPWAP_SUBELEM_AC_HARDWARE_VERSION, "hardware", 1024,1},
 | 
			
		||||
		{0,CAPWAP_SUBELEM_AC_SOFTWARE_VERSION, "software", 1024,1},
 | 
			
		||||
		{0,0, NULL,0, 0}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	return cw_read_ac_descriptor(params->cfg,eh,params,data,len,allowed);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,9 @@ int capwap_in_vendor_specific_payload(struct cw_ElemHandler *handler,
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	if (!vhandler) {
 | 
			
		||||
		cw_dbg_elem(params->dbg_level, NULL, params->msgdata->type, handler,
 | 
			
		||||
                            data, len);
 | 
			
		||||
 | 
			
		||||
		cw_dbg(DBG_WARN,
 | 
			
		||||
		       "Can't handle Vendor Specific Payload %s/%d, in msg %d (%s) in %s state.",
 | 
			
		||||
		       cw_strvendor(vendor_id), elem_id, params->msgdata->type,
 | 
			
		||||
 | 
			
		||||
@ -30,8 +30,8 @@
 | 
			
		||||
#include "cw/keys.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void readsubelems_wtp_board_data(mavl_t cfg, uint8_t * msgelem,
 | 
			
		||||
					int len)
 | 
			
		||||
static void readsubelems_wtp_board_data(cw_Cfg_t * cfg, uint8_t * msgelem,
 | 
			
		||||
					int len,const char *pkey)
 | 
			
		||||
{
 | 
			
		||||
	int i = 0;
 | 
			
		||||
	uint32_t val;
 | 
			
		||||
@ -56,11 +56,7 @@ static void readsubelems_wtp_board_data(mavl_t cfg, uint8_t * msgelem,
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
/*		cw_dbg(DBG_SUBELEM, "WTP board data sub-element, type=%d, len=%d",
 | 
			
		||||
		       subtype, sublen);*/
 | 
			
		||||
 | 
			
		||||
		switch (subtype) {
 | 
			
		||||
 | 
			
		||||
			
 | 
			
		||||
			case CW_BOARDDATA_MODELNO:
 | 
			
		||||
				key = "model-no";
 | 
			
		||||
@ -83,7 +79,7 @@ static void readsubelems_wtp_board_data(mavl_t cfg, uint8_t * msgelem,
 | 
			
		||||
		}
 | 
			
		||||
		if (key != NULL){
 | 
			
		||||
			char add_key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
			sprintf(add_key,"wtp-board-data/%s",key);
 | 
			
		||||
			sprintf(add_key,"%s/%s",pkey,key);
 | 
			
		||||
			cw_cfg_set_val(cfg,add_key,CW_TYPE_BSTR16,NULL,msgelem+i,sublen);
 | 
			
		||||
			
 | 
			
		||||
		}
 | 
			
		||||
@ -107,7 +103,7 @@ int capwap_in_wtp_board_data(struct cw_ElemHandler *eh, struct cw_ElemHandlerPar
 | 
			
		||||
	sprintf(vendor_key,"%s/%s",eh->key,"vendor");
 | 
			
		||||
	cw_cfg_set_val(params->cfg,vendor_key,CW_TYPE_DWORD,NULL,data,len);
 | 
			
		||||
 | 
			
		||||
	readsubelems_wtp_board_data(params->cfg, data + 4, len - 4);
 | 
			
		||||
	readsubelems_wtp_board_data(params->cfg, data + 4, len - 4,eh->key);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,74 +3,27 @@
 | 
			
		||||
#include "cw/dbg.h"
 | 
			
		||||
#include "cw/conn.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "cw/capwap.h"
 | 
			
		||||
#include "cw/cw.h"
 | 
			
		||||
#include "cw/val.h"
 | 
			
		||||
#include "cw/keys.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char * parent_key){
 | 
			
		||||
 | 
			
		||||
	stop();
 | 
			
		||||
 | 
			
		||||
	uint8_t *d = dst;
 | 
			
		||||
	
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/stations",0));
 | 
			
		||||
	d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/station-limit",0));
 | 
			
		||||
	d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/active-wtps",0));
 | 
			
		||||
	d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/max-wtps",0));
 | 
			
		||||
	
 | 
			
		||||
	d += cw_put_byte(d,cw_ktv_get_byte(global,"ac-descriptor/security",0));
 | 
			
		||||
/*	
 | 
			
		||||
	security = 0;
 | 
			
		||||
	if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
 | 
			
		||||
		security |= CAPWAP_FLAG_AC_SECURITY_X;
 | 
			
		||||
		
 | 
			
		||||
	if (cw_ktv_get(local,"dtls-psk",CW_TYPE_BSTR16))
 | 
			
		||||
		security |= CAPWAP_FLAG_AC_SECURITY_S;
 | 
			
		||||
 | 
			
		||||
	if (security == 0){
 | 
			
		||||
		cw_log(LOG_WARNING,"No AC security selected");
 | 
			
		||||
	}
 | 
			
		||||
	d += cw_put_byte(dst,security);
 | 
			
		||||
*/	
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,CW_SKEY_RMAC_FIELD);
 | 
			
		||||
	d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
 | 
			
		||||
	
 | 
			
		||||
	d += cw_put_byte(d,0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
 | 
			
		||||
	d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
 | 
			
		||||
 | 
			
		||||
	return d - dst;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#include "mod_capwap.h"
 | 
			
		||||
 | 
			
		||||
int capwap_out_ac_descriptor(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst)
 | 
			
		||||
{
 | 
			
		||||
	stop();
 | 
			
		||||
/*	int len,l;
 | 
			
		||||
	int len,l;
 | 
			
		||||
	uint8_t *d = dst+4;
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
 | 
			
		||||
	d+=put_ac_status(params->cfg,
 | 
			
		||||
				params->global_cfg,
 | 
			
		||||
				d, eh->key);
 | 
			
		||||
	d+=cw_put_ac_status(d, params->cfg_list, eh->key);
 | 
			
		||||
 | 
			
		||||
	sprintf(key,"%s/%s",eh->key,CW_SKEY_HARDWARE);
 | 
			
		||||
	d+=cw_write_descriptor_subelem (d, params->cfg,
 | 
			
		||||
	d+=cw_put_descriptor_subelem (d, params->cfg_list,
 | 
			
		||||
                                 CAPWAP_SUBELEM_AC_HARDWARE_VERSION, key);
 | 
			
		||||
 
 | 
			
		||||
	sprintf(key,"%s/%s",eh->key,CW_SKEY_SOFTWARE);
 | 
			
		||||
	d+=cw_write_descriptor_subelem (d, params->cfg,
 | 
			
		||||
	d+=cw_put_descriptor_subelem (d, params->cfg_list,
 | 
			
		||||
                                 CAPWAP_SUBELEM_AC_SOFTWARE_VERSION, key);
 | 
			
		||||
 | 
			
		||||
	len = d-dst-4;
 | 
			
		||||
@ -78,6 +31,5 @@ int capwap_out_ac_descriptor(struct cw_ElemHandler * eh,
 | 
			
		||||
	l = len + cw_put_elem_hdr(dst,eh->id,len);
 | 
			
		||||
	cw_dbg_elem(DBG_ELEM_OUT,NULL,params->msgdata->type,eh,dst,l);
 | 
			
		||||
	return l;
 | 
			
		||||
*/
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -39,13 +39,12 @@ int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
 | 
			
		||||
	val = cw_cfg_get_byte_l(params->cfg_list,key, 0);
 | 
			
		||||
	d+=cw_put_byte(d,val);
 | 
			
		||||
	if (val<=0){
 | 
			
		||||
		cw_dbg(DBG_WARN,"Cannot value for %s, setting to 0", CW_SKEY_MAX_RADIOS);
 | 
			
		||||
		cw_dbg(DBG_WARN,"Cannot get value for %s, setting to 0", CW_SKEY_MAX_RADIOS);
 | 
			
		||||
		d+=cw_put_byte(d,0);
 | 
			
		||||
	}
 | 
			
		||||
		
 | 
			
		||||
	sprintf(key,"%s/%s",eh->key,CW_SKEY_RADIOS_IN_USE);
 | 
			
		||||
	val = cw_cfg_get_byte_l(params->cfg_list,key, 0);
 | 
			
		||||
cw_dbg("WTP-DESCRIPTOR: radios in use: %d",val);	
 | 
			
		||||
	d+=cw_put_byte(d,val);	/*radios in use*/
 | 
			
		||||
 | 
			
		||||
/* 	d+=cw_put_encryption_capabilities_7(d,1); */
 | 
			
		||||
 | 
			
		||||
@ -47,9 +47,10 @@ static int detect(struct cw_Conn *conn, const uint8_t * rawmsg, int rawlen, int
 | 
			
		||||
int static setup_cfg(struct cw_Conn  * conn)
 | 
			
		||||
{
 | 
			
		||||
	int security;
 | 
			
		||||
	
 | 
			
		||||
	security = cw_setup_dtls(conn,conn->local_cfg,"capwap",CAPWAP_CIPHER);
 | 
			
		||||
	stop();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//	stop();
 | 
			
		||||
//	cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
@ -15,14 +15,27 @@
 | 
			
		||||
			uint8_t * data,	 int len);
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
char x[] = {'a','b'};
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t capwap80211_antenna_stru[]={
 | 
			
		||||
	{CW_TYPE_BOOL,"diversity",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"combiner",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"antenna-count",1,-1},
 | 
			
		||||
	{NULL,"xxx",1,-1,x},
 | 
			
		||||
//	{NULL,"xxx",1,-1,"a",}
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
	{
 | 
			
		||||
		"IEEE 802.11 WTP Radio Information",			/* name */
 | 
			
		||||
		"IEEE 802.11 WTP Radio Information",		/* name */
 | 
			
		||||
		CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,		/* Element ID */
 | 
			
		||||
		0, 0,						/* Vendor / Proto */
 | 
			
		||||
		0, 0,						/* min/max length */
 | 
			
		||||
		CW_TYPE_DWORD,					/* type */
 | 
			
		||||
		"wtp-radio-information",			/* Key */
 | 
			
		||||
		"capwap80211/wtp-radio-information",		/* Key */
 | 
			
		||||
		cw_in_radio_generic,				/* get */
 | 
			
		||||
		cw_out_radio_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -33,39 +46,55 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		0, 0,						/* Vendor / Proto */
 | 
			
		||||
		3, 0,						/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,					/* type */
 | 
			
		||||
		"rate_set",					/* Key */
 | 
			
		||||
		"capwap80211/rate-set",				/* Key */
 | 
			
		||||
		cw_in_radio_generic,				/* get */
 | 
			
		||||
		cw_out_radio_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL}
 | 
			
		||||
	{
 | 
			
		||||
		"IEEE 802.11 Antenna",				/* name */
 | 
			
		||||
		CAPWAP80211_ELEM_ANTENNA,				/* Element ID */
 | 
			
		||||
		0, 0,						/* Vendor / Proto */
 | 
			
		||||
		3, 0,						/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,					/* type */
 | 
			
		||||
		"capwap80211/antenna",				/* Key */
 | 
			
		||||
		cw_in_radio_generic,				/* get */
 | 
			
		||||
		cw_out_radio_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,
 | 
			
		||||
		capwap80211_antenna_stru
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*static int discovery_request_states[] = { CAPWAP_STATE_DISCOVERY, 0 };*/
 | 
			
		||||
static struct cw_ElemDef discovery_request_elements[] = {
 | 
			
		||||
	{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
 | 
			
		||||
	{0, 0, 0, 0, 0}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static struct cw_ElemDef discovery_response_elements[] = {
 | 
			
		||||
	{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
 | 
			
		||||
	{0, 0, 0, 0, 0}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*static int join_request_states[] = { CAPWAP_STATE_JOIN, 0 };*/
 | 
			
		||||
static struct cw_ElemDef join_request_elements[] = {
 | 
			
		||||
	{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
 | 
			
		||||
	{0, 0, 0, 0, 0}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*static int join_response_states[] = { CAPWAP_STATE_JOIN, 0 };*/
 | 
			
		||||
static struct cw_ElemDef join_response_elements[] = {
 | 
			
		||||
	{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,	1, 0},
 | 
			
		||||
	{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
 | 
			
		||||
	{0, 0, 0, 0, 0}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*static int configuration_status_response_states[] = { CAPWAP_STATE_JOIN, 0 };*/
 | 
			
		||||
static struct cw_ElemDef configuration_status_response_elements[] = {
 | 
			
		||||
	{0, 0, CAPWAP80211_ELEM_RATE_SET		, 1, 0},
 | 
			
		||||
	{0, 0, 0, 0, 0}
 | 
			
		||||
@ -80,6 +109,14 @@ static struct cw_MsgDef messages[] = {
 | 
			
		||||
		discovery_request_elements
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{
 | 
			
		||||
		NULL,
 | 
			
		||||
		CAPWAP_MSG_DISCOVERY_RESPONSE,
 | 
			
		||||
		CW_ROLE_WTP,
 | 
			
		||||
		NULL,				/* states */
 | 
			
		||||
		discovery_response_elements
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{
 | 
			
		||||
		NULL,				/* name */
 | 
			
		||||
		CAPWAP_MSG_JOIN_REQUEST,	/* type */
 | 
			
		||||
 | 
			
		||||
@ -50,6 +50,7 @@
 | 
			
		||||
#define CW_CISCO_SUPPORTED_RATES		LW_ELEM_80211_RATE_SET			/* 16 */
 | 
			
		||||
 | 
			
		||||
#define CISCO_ELEM_15				15					/* 15 */
 | 
			
		||||
#define CISCO_ELEM_16				16					/* 16 */
 | 
			
		||||
#define CISCO_ELEM_19				19					/* 19 */
 | 
			
		||||
#define CISCO_ELEM_22				22					/* 22 */
 | 
			
		||||
#define CISCO_ELEM_24				24					/* 24 */
 | 
			
		||||
 | 
			
		||||
@ -1,117 +0,0 @@
 | 
			
		||||
 | 
			
		||||
#include "cw/mbag.h"
 | 
			
		||||
#include "cw/action.h"
 | 
			
		||||
#include "cw/dbg.h"
 | 
			
		||||
#include "cw/cw.h"
 | 
			
		||||
 | 
			
		||||
#include "cisco_items.h"
 | 
			
		||||
#include "include/cipwap_items.h"
 | 
			
		||||
#include "cw/capwap80211_items.h"
 | 
			
		||||
 | 
			
		||||
//int mbag_get_upd(mbag_t b, mbag_t b_upd, const char *id,
 | 
			
		||||
//		 uint8_t * dst, struct mbag_typedef * deftype, uint8_t * def, int deflen);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int mbag_get_upd(mbag_t b, mbag_t b_upd, const char *id, uint8_t *dst, int *found);
 | 
			
		||||
 | 
			
		||||
int cisco80211_out_wtp_radio_configuration(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
cw_dbg(DBG_X,"The update beginns ***************************************************************");
 | 
			
		||||
	int count=0;
 | 
			
		||||
	int n;
 | 
			
		||||
	uint8_t *d = dst+10;
 | 
			
		||||
 | 
			
		||||
	MAVLITER_DEFINE(it,conn->radios_upd);
 | 
			
		||||
	mavliter_foreach(&it){
 | 
			
		||||
		struct mbag_item *r = mavliter_get(&it);
 | 
			
		||||
		mbag_t radio_upd = r->u2.data;
 | 
			
		||||
		mbag_t radio = mbag_i_get_mbag(conn->radios,r->u1.iid,NULL);
 | 
			
		||||
 | 
			
		||||
		radio = radio_upd;
 | 
			
		||||
 | 
			
		||||
		d+=cw_put_byte(d,r->u1.iid);
 | 
			
		||||
 | 
			
		||||
//		mbag_t radio = mbag_i_get(conn->radios,radio_upd->data->iid);
 | 
			
		||||
 | 
			
		||||
		n  = mbag_get_upd(radio,radio_upd,CISCO_RADIOITEM80211_CFG_TYPE,d,&count);
 | 
			
		||||
		d += n==-1 ? cw_put_byte(dst,0) : n;
 | 
			
		||||
		n  = mbag_get_upd(radio,radio_upd,CIPWAP_RADIOITEM80211_OCCUPANCY_LIMIT,d,&count);
 | 
			
		||||
		d += n==-1 ? cw_put_word(dst,100) : n;
 | 
			
		||||
		n  = mbag_get_upd(radio,radio_upd,CIPWAP_RADIOITEM80211_CFP_PERIOD,d,&count);
 | 
			
		||||
		d += n==-1 ? cw_put_byte(dst,4) : n;
 | 
			
		||||
		n  = mbag_get_upd(radio,radio_upd,CIPWAP_RADIOITEM80211_CFP_MAXIMUM_DURATION,d,&count);
 | 
			
		||||
		d += n==-1 ? cw_put_word(dst,60) : n;
 | 
			
		||||
		
 | 
			
		||||
		n  = mbag_get_upd(radio,radio_upd,CW_RADIOITEM80211_BSSID,d,&count);
 | 
			
		||||
		if (n==-1){
 | 
			
		||||
			char defbssid[6]={1,2,3,4,5,6};
 | 
			
		||||
			memcpy(d,defbssid,6);
 | 
			
		||||
			d+=6;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			d+=n;
 | 
			
		||||
 | 
			
		||||
		n  = mbag_get_upd(radio,radio_upd,CW_RADIOITEM80211_BEACON_PERIOD,d,&count);
 | 
			
		||||
		d += n==-1 ? cw_put_word(dst,100) : n;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		int dcount = 0;
 | 
			
		||||
		n  = mbag_get_upd(radio,radio_upd,CISCO_RADIOITEM80211_COUNTRY_STR1,d,&dcount);
 | 
			
		||||
		if (!dcount){
 | 
			
		||||
			n  = mbag_get_upd(radio,radio_upd,CW_RADIOITEM80211_COUNTRY_STRING,d,&count);
 | 
			
		||||
			d += n==-1 ? cw_put_data(d,(uint8_t*)"DE ",3) : n;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			d+=n;
 | 
			
		||||
 | 
			
		||||
		dcount=0;
 | 
			
		||||
		n  = mbag_get_upd(radio,radio_upd,CISCO_RADIOITEM80211_COUNTRY_STR2,d,&dcount);
 | 
			
		||||
		if (!dcount){
 | 
			
		||||
			n  = mbag_get_upd(radio,radio_upd,CW_RADIOITEM80211_COUNTRY_STRING,d,&count);
 | 
			
		||||
			d += n==-1 ? cw_put_data(d,(uint8_t*)"DE ",3) : n;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			d+=n;
 | 
			
		||||
 | 
			
		||||
		count +=dcount;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		d+=cw_put_byte(d,10);
 | 
			
		||||
		d+=cw_put_word(d,1);
 | 
			
		||||
		d+=cw_put_word(d,0);
 | 
			
		||||
		d+=cw_put_word(d,177<<8);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!count){
 | 
			
		||||
		cw_dbg(DBG_X,"Return 0, because no item was in radio");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cw_dbg(DBG_X,"Yupp we do!");
 | 
			
		||||
	int l = d-dst-10;
 | 
			
		||||
	return l + cw_put_elem_vendor_hdr(dst, a->vendor_id, a->elem_id, l);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	mbag_set_word(r,CW_RADIOITEM80211_BEACON_PERIOD,cw_get_word(data+13));
 | 
			
		||||
	mbag_set_bstr16n(r,CW_RADIOITEM80211_COUNTRY_STRING,data+15,3);
 | 
			
		||||
	mbag_set_bstr16n(r,CISCO_RADIOITEM80211_COUNTRY_STR1,data+15,3);
 | 
			
		||||
	mbag_set_bstr16n(r,CISCO_RADIOITEM80211_COUNTRY_STR2,data+18,3);
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
//	mbag_set_byte(r,CISCO_RADIOITEM80211_CFG_TYPE,cw_get_byte(data+1));
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -34,6 +34,16 @@ static int postprocess_discovery();
 | 
			
		||||
static int preprocess_join_request();
 | 
			
		||||
static int postprocess_join_request();
 | 
			
		||||
 | 
			
		||||
int cisco_out_radio_info(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
 | 
			
		||||
			, uint8_t * dst);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValValRange_t cfg_type[]={
 | 
			
		||||
	{1,1,"1 - global"},
 | 
			
		||||
	{2,2,"2 - custom"},
 | 
			
		||||
	{0,0,NULL}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t ap_time_sync[] = {
 | 
			
		||||
	{CW_TYPE_DWORD, "timestamp", 4,-1},
 | 
			
		||||
@ -76,6 +86,19 @@ static cw_ValStruct_t cisco_8021xlogin[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t cisco_elem_15[] = {
 | 
			
		||||
	{CW_TYPE_BYTE, "cfg-type", 1, -1, cfg_type},
 | 
			
		||||
	{CW_TYPE_BYTE, "channel", 1,-1},
 | 
			
		||||
	{CW_TYPE_BSTR16, "rest",-1,-1},
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValEnum_t cisco_ap_username_and_password_enum[] ={
 | 
			
		||||
	{2,	"802.1x-credentials",	CW_TYPE_STRUCT, cw_in_generic, cw_out_generic, cisco_8021xlogin },
 | 
			
		||||
 | 
			
		||||
@ -264,7 +287,7 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	char testkey[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
//	char testkey[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	int idx;
 | 
			
		||||
	void * type;
 | 
			
		||||
	cw_Val_t * result;
 | 
			
		||||
@ -278,7 +301,7 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	type = NULL;
 | 
			
		||||
	result = cw_cfg_get_val_l(params->cfg_list,"wtp-descriptor/software/version",CW_TYPE_BSTR16);
 | 
			
		||||
	result = cw_cfg_get_val_l(params->cfg_list,"capwap/wtp-descriptor/software/version",CW_TYPE_BSTR16);
 | 
			
		||||
	if (result!=NULL){
 | 
			
		||||
		if(result->type->len(result)==4){
 | 
			
		||||
			uint32_t rv;
 | 
			
		||||
@ -305,9 +328,9 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
 | 
			
		||||
			break;
 | 
			
		||||
	
 | 
			
		||||
		if(type == NULL){
 | 
			
		||||
			sprintf(testkey,"%s/%s",key,"band-id");
 | 
			
		||||
//			sprintf(testkey,"%s/%s",key,"band-id");
 | 
			
		||||
			stop();
 | 
			
		||||
			result = cw_ktv_get_val_l(params->cfg_list,key,CW_TYPE_BYTE);
 | 
			
		||||
//			result = cw_ktv_get_val_l(params->cfg_list,key,CW_TYPE_BYTE);
 | 
			
		||||
			if (result==NULL){
 | 
			
		||||
				type = cisco_ap_regulatory_domain4;
 | 
			
		||||
			}
 | 
			
		||||
@ -340,7 +363,7 @@ static cw_ValStruct_t cisco_ap_model[]={
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t cisco_direct_sequence_control70[]={
 | 
			
		||||
	{CW_TYPE_BYTE,"cfg-type",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"cfg-type",1,-1,cfg_type},
 | 
			
		||||
	{CW_TYPE_BYTE,"current-channel",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"current-cca-mode",1,-1},
 | 
			
		||||
	{CW_TYPE_DWORD,"energy-detect-threshold",4,-1},
 | 
			
		||||
@ -352,9 +375,10 @@ static cw_ValStruct_t cisco_antenna_payload70[]={
 | 
			
		||||
	{CW_TYPE_BYTE,"diversity-selection",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"antenna-mode",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"number-of-antennas",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"unknown",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"802-11n-tx-antennas",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"802-11n-rx-antennas",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"unknown",1,-1},
 | 
			
		||||
//	{CW_TYPE_BYTE,"unknown",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"antenna-1",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"antenna-2",1,-1},
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
@ -413,11 +437,22 @@ static cw_ValStruct_t cisco_wtp_radio_config75[]={
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t cisco_tx_power[]={
 | 
			
		||||
	{CW_TYPE_BYTE,"reserved",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"@cisco/cfg-type",1,-1,cfg_type},
 | 
			
		||||
	{CW_TYPE_WORD,"current-tx-power",2,-1},
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t cisco_lw_radio_module_info_stru[]={
 | 
			
		||||
	{CW_TYPE_STR,"name",21,-1},
 | 
			
		||||
	{CW_TYPE_STR,"serial",11,-1},
 | 
			
		||||
	{CW_TYPE_STR,"type",25,-1},
 | 
			
		||||
	{CW_TYPE_STR,"descr",126,-1},
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t cisco_ap_qos[]={
 | 
			
		||||
	{CW_TYPE_BYTE,"tag-packets",1,-1},
 | 
			
		||||
	{CW_TYPE_BYTE,"uranium-queue-depth",1,-1},
 | 
			
		||||
@ -512,6 +547,17 @@ static cw_ValStruct_t cisco_ap_mode_and_type[]={
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t dtls_data_cfg[]={
 | 
			
		||||
	{CW_TYPE_BOOL,"cabable",1,-1},
 | 
			
		||||
	{CW_TYPE_BOOL,"enabled",1,-1},
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
static cw_ValStruct_t cisco_add_wlan[]={
 | 
			
		||||
	{CW_TYPE_BYTE,"radio-id",1,-1},
 | 
			
		||||
	{CW_TYPE_WORD,"wlan-capability",2,-1},
 | 
			
		||||
@ -530,7 +576,7 @@ static cw_ValStruct_t cisco_add_wlan[]={
 | 
			
		||||
	
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t cisco_add_wlan70[]={
 | 
			
		||||
	{CW_TYPE_BYTE,"radio-id",1,-1},
 | 
			
		||||
@ -567,7 +613,7 @@ static int cisco_in_lw_del_wlan(struct cw_ElemHandler *eh,
 | 
			
		||||
			uint8_t * data,	 int len)
 | 
			
		||||
{
 | 
			
		||||
	stop();
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
	int wlan_id, radio_id;
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	
 | 
			
		||||
@ -576,18 +622,18 @@ static int cisco_in_lw_del_wlan(struct cw_ElemHandler *eh,
 | 
			
		||||
	sprintf(key,"radio.%d/wlan.%d",radio_id,wlan_id);
 | 
			
		||||
	cw_ktv_del_sub(params->cfg,key);
 | 
			
		||||
	cw_dbg(DBG_INFO,"Del WLAN rid=%d, id=%d",wlan_id);
 | 
			
		||||
	return 0;
 | 
			
		||||
	return 0;*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
static int cw_mkradiokey(const char *pkey, uint8_t*data, int len, char *dst)
 | 
			
		||||
{
 | 
			
		||||
	int radio_id;
 | 
			
		||||
	radio_id = cw_get_byte(data);
 | 
			
		||||
	sprintf(dst,"radio.%d/%s",radio_id,pkey);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
}*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
static int cisoc_add_wlan_mkkey(const char *pkey, uint8_t*data, int len, char *dst)
 | 
			
		||||
@ -601,16 +647,18 @@ static int cisoc_add_wlan_mkkey(const char *pkey, uint8_t*data, int len, char *d
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
static int cisoc_add_wlan_mkkey70(const char *pkey, uint8_t*data, int len, char *dst)
 | 
			
		||||
 | 
			
		||||
static int cisco_add_wlan_mkkey70(const char *pkey, uint8_t*data, int len, char *dst)
 | 
			
		||||
{
 | 
			
		||||
        int wlan_id,radio_id;
 | 
			
		||||
	stop();
 | 
			
		||||
        radio_id = cw_get_byte(data);
 | 
			
		||||
        wlan_id = cw_get_byte(data+4);
 | 
			
		||||
        sprintf(dst,"radio.%d/wlan.%d/add-wlan",radio_id,wlan_id);
 | 
			
		||||
        return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
static int cisco_patch_add_wlan70(uint8_t * data, void * st)
 | 
			
		||||
{
 | 
			
		||||
	stop();
 | 
			
		||||
@ -620,7 +668,7 @@ static int cisco_patch_add_wlan70(uint8_t * data, void * st)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
static cw_ValStruct_t cisco_add_lwwlan[]={
 | 
			
		||||
	{CW_TYPE_BSTR16, "misc", 8, 2},
 | 
			
		||||
@ -767,7 +815,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		0,0,				/* Vendor / Proto */
 | 
			
		||||
		4,128,				/* min/max length */
 | 
			
		||||
		NULL,				/* type */
 | 
			
		||||
		CW_KEY_WTP_DESCRIPTOR,		/* Key */
 | 
			
		||||
		"capwap/wtp-descriptor",	/* Key */
 | 
			
		||||
		cisco_in_wtp_descriptor, 	/* get */
 | 
			
		||||
		cisco_out_wtp_descriptor	/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -778,7 +826,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		0,0,				/* Vendor / Proto */
 | 
			
		||||
		4,128,				/* min/max length */
 | 
			
		||||
		NULL,				/* type */
 | 
			
		||||
		"ac-descriptor",		/* Key */
 | 
			
		||||
		"capwap/ac-descriptor",		/* Key */
 | 
			
		||||
		cisco_in_ac_descriptor, 	/* get */
 | 
			
		||||
		cisco_out_ac_descriptor		/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -789,7 +837,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,		/* Vendor / Proto */
 | 
			
		||||
		1,512,				/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,			/* type */
 | 
			
		||||
		CW_KEY_WTP_NAME,		/* Key */
 | 
			
		||||
		"capwap/wtp-name",		/* Key */
 | 
			
		||||
		cw_in_generic,			/* get */
 | 
			
		||||
		cw_out_generic			/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -841,9 +889,9 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		0, 0,						/* Vendor / Proto */
 | 
			
		||||
		0, 0,						/* min/max length */
 | 
			
		||||
		CW_TYPE_DWORD,					/* type */
 | 
			
		||||
		"wtp-radio-information",			/* Key */
 | 
			
		||||
		"capwap80211/wtp-radio-information",		/* Key */
 | 
			
		||||
		cw_in_radio_generic,				/* get */
 | 
			
		||||
		cw_out_radio_generic				/* put */
 | 
			
		||||
		cisco_out_radio_info				/* put */ 
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{ 
 | 
			
		||||
@ -852,7 +900,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		4,CAPWAP_SESSION_ID_LEN,		/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"session-id",				/* Key */
 | 
			
		||||
		"capwap/session-id",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -877,8 +925,8 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		7,7,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"cisco/mwar-addr",			/* Key */
 | 
			
		||||
		cw_in_generic,			/* get */
 | 
			
		||||
		cw_out_generic,			/* put */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,
 | 
			
		||||
		mwar_addr
 | 
			
		||||
@ -890,7 +938,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		4,4,					/* min/max length */
 | 
			
		||||
		CW_TYPE_IPADDRESS,			/* type */
 | 
			
		||||
		"capwap-local-ip-address",		/* Key */
 | 
			
		||||
		"capwap/local-ip-address",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cisco_out_capwap_local_ip_address	/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -902,7 +950,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		16,16,					/* min/max length */
 | 
			
		||||
		CW_TYPE_IPADDRESS,			/* type */
 | 
			
		||||
		"capwap-local-ip-address",		/* Key */
 | 
			
		||||
		"capwap/local-ip-address",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cisco_out_capwap_local_ip_address	/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -915,11 +963,15 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		NULL,					/* type */
 | 
			
		||||
		"cisco_spam_vendor_specific",		/* Key */
 | 
			
		||||
		cisco_in_spam_vendor_specific,		/* get */
 | 
			
		||||
		NULL		/* put */
 | 
			
		||||
		NULL,					/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,					/* param */
 | 
			
		||||
		1
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{ 
 | 
			
		||||
		"Path MTU",				/* name */
 | 
			
		||||
		"Cisco LWAPP Path MTU",			/* name */
 | 
			
		||||
		CISCO_LWELEM_PATH_MTU,			/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		0,0,					/* min/max length */
 | 
			
		||||
@ -1310,7 +1362,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		4,4,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"cisco/tx-power",			/* Key */
 | 
			
		||||
		"capwap80211/tx-power",			/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic,			/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
@ -1381,16 +1433,37 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco Elem 15",			/* name */
 | 
			
		||||
		"Cisco Elem 15 - Channel Setting (?)",	/* name */
 | 
			
		||||
		CISCO_ELEM_15,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		1,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"cisco/elem15",				/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic			/* put */
 | 
			
		||||
		cw_out_radio_generic,			/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,
 | 
			
		||||
		cisco_elem_15
 | 
			
		||||
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco Elem 16 ",		/* name */
 | 
			
		||||
		CISCO_ELEM_16,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		1,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"cisco/elem16",				/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic,			/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,
 | 
			
		||||
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco Elem 39",			/* name */
 | 
			
		||||
		CISCO_ELEM_39,				/* Element ID */
 | 
			
		||||
@ -1461,7 +1534,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAP Elem 9",			/* name */
 | 
			
		||||
		"Cisco LWAPP Elem 9",			/* name */
 | 
			
		||||
 | 
			
		||||
		CISCO_LWELEM_9,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
@ -1473,6 +1546,75 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		cw_out_radio_generic			/* put */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAPP Elem 11",			/* name */
 | 
			
		||||
 | 
			
		||||
		CISCO_LWELEM_11,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		
 | 
			
		||||
		1,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"cisco/lwelem11",			/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic			/* put */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAP Elem 14",			/* name */
 | 
			
		||||
		CISCO_LWELEM_14,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		
 | 
			
		||||
		1,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"cisco/lwelem14",			/* Key */
 | 
			
		||||
		cw_in_generic,			/* get */
 | 
			
		||||
		cw_out_generic			/* put */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAP Elem 27",			/* name */
 | 
			
		||||
 | 
			
		||||
		CISCO_LWELEM_27,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		
 | 
			
		||||
		1,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"cisco/lwelem27",			/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic			/* put */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAP Elem 28",			/* name */
 | 
			
		||||
 | 
			
		||||
		CISCO_LWELEM_28,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		
 | 
			
		||||
		1,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"cisco/lwelem28",			/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic			/* put */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAPP Elem 29",			/* name */
 | 
			
		||||
 | 
			
		||||
		CISCO_LWELEM_29,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		
 | 
			
		||||
		1,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"cisco/lwelem29",			/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic			/* put */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAP Elem 33",			/* name */
 | 
			
		||||
 | 
			
		||||
@ -1499,6 +1641,50 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		cw_out_radio_generic			/* put */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAP Elem 55",			/* name */
 | 
			
		||||
 | 
			
		||||
		CISCO_LWELEM_55,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		
 | 
			
		||||
		1,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"cisco/lwelem55",			/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic			/* put */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAPP Radio Module Info",	/* name */
 | 
			
		||||
		CISCO_LWELEM_RADIO_MODULE_INFO,		/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		183,183,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"cisco/radio-module-info",		/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic,			/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,
 | 
			
		||||
		cisco_lw_radio_module_info_stru	/* param */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"Cisco LWAPP Elem 105",			/* name */
 | 
			
		||||
 | 
			
		||||
		CISCO_LWELEM_105,				/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		
 | 
			
		||||
		1,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"cisco/lwelem105",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1600,7 +1786,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		0,1024,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"location-data",			/* Key */
 | 
			
		||||
		"capwap/location-data",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	},
 | 
			
		||||
@ -1626,7 +1812,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		2,2,					/* min/max length */
 | 
			
		||||
		CW_TYPE_WORD,				/* type */
 | 
			
		||||
		"statistics-timer",			/* Key */
 | 
			
		||||
		"capwap/statistics-timer",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -1638,7 +1824,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		1,513,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"ac-name-with-index",			/* Key */
 | 
			
		||||
		"capwap/ac-name-with-priority",		/* Key */
 | 
			
		||||
		cw_in_generic_with_index,		/* get */
 | 
			
		||||
		cw_out_generic_with_index		/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -1714,19 +1900,20 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
 | 
			
		||||
//	{ 
 | 
			
		||||
//		"Add Cisco WLAN",			/* name */
 | 
			
		||||
///		CISCO_ELEM_ADD_WLAN,			/* Element ID */
 | 
			
		||||
///		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
///		7,1117,					/* min/max length */
 | 
			
		||||
//		cisco_add_wlan70,			/* type */
 | 
			
		||||
//		"radio/wlan/add-wlan",			/* Key */
 | 
			
		||||
///		cw_in_generic_struct,			/* get */
 | 
			
		||||
//		cw_out_traverse,			/* put */
 | 
			
		||||
//		cisoc_add_wlan_mkkey70,
 | 
			
		||||
//		cisco_patch_add_wlan70
 | 
			
		||||
//	}
 | 
			
		||||
//	,
 | 
			
		||||
	{ 
 | 
			
		||||
		"Add Cisco WLAN",			/* name */
 | 
			
		||||
		CISCO_ELEM_ADD_WLAN,			/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		7,1117,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"radio/wlan/add-wlan",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_traverse,			/* put */
 | 
			
		||||
		cisco_add_wlan_mkkey70,
 | 
			
		||||
		NULL, //		cisco_patch_add_wlan70
 | 
			
		||||
		cisco_add_wlan70
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	
 | 
			
		||||
	{ 
 | 
			
		||||
		"Add Cisco WLAN (LWAPP)",		/* name */
 | 
			
		||||
@ -1756,12 +1943,12 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
	,
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"SSC Hash",					/* name */
 | 
			
		||||
		"SSC Hash",				/* name */
 | 
			
		||||
		CISCO_LWELEM_SSC_HASH,			/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		1,331,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"cisco/hash",				/* Key */
 | 
			
		||||
		"cisco/ssc-hash",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
@ -1789,7 +1976,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		3,3,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"operational-state",			/* Key */
 | 
			
		||||
		"capwap/operational-state",		/* Key */
 | 
			
		||||
		cw_in_radio_generic,			/* get */
 | 
			
		||||
		cw_out_radio_generic,			/* put */
 | 
			
		||||
		NULL,					/* mkkey */
 | 
			
		||||
@ -1847,7 +2034,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		CW_VENDOR_ID_CISCO, 0,			/* Vendor / Proto */
 | 
			
		||||
		2, 2,					/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"capwap-timers",			/* Key */
 | 
			
		||||
		"capwap/timers",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic,				/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
@ -1862,7 +2049,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		CW_VENDOR_ID_CISCO, 0,						/* Vendor / Proto */
 | 
			
		||||
		4, 4,						/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,				/* type */
 | 
			
		||||
		"cisco-8011-assoc-limit",			/* Key */
 | 
			
		||||
		"cisco/8011-assoc-limit",			/* Key */
 | 
			
		||||
		cw_in_generic,					/* get */
 | 
			
		||||
		cw_out_generic,					/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
@ -1877,7 +2064,7 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		CW_VENDOR_ID_CISCO, 0,				/* Vendor / Proto */
 | 
			
		||||
		1, 1,						/* min/max length */
 | 
			
		||||
		CW_TYPE_BOOL,					/* type */
 | 
			
		||||
		"cisco/sig-toogle",				/* Key */
 | 
			
		||||
		"cisco/sig-toggle",				/* Key */
 | 
			
		||||
		cw_in_generic,					/* get */
 | 
			
		||||
		cw_out_generic					/* put */
 | 
			
		||||
	}
 | 
			
		||||
@ -1902,11 +2089,14 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
		"AP DTLS Data CFG",				/* name */
 | 
			
		||||
		CISCO_LWELEM_AP_DTLS_DATA_CFG,			/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO, CW_PROTO_LWAPP,		/* Vendor / Proto */
 | 
			
		||||
		3, 3,						/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,					/* type */
 | 
			
		||||
		2, 2,						/* min/max length */
 | 
			
		||||
		CW_TYPE_STRUCT,					/* type */
 | 
			
		||||
		"cisco/ap-dtls-data-cfg",			/* Key */
 | 
			
		||||
		cw_in_generic,					/* get */
 | 
			
		||||
		cw_out_generic					/* put */
 | 
			
		||||
		cw_out_generic,					/* put */
 | 
			
		||||
		NULL,
 | 
			
		||||
		NULL,
 | 
			
		||||
		dtls_data_cfg
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{
 | 
			
		||||
@ -1937,13 +2127,12 @@ static struct cw_ElemHandler handlers70[] = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*static uint16_t discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};*/
 | 
			
		||||
static struct cw_ElemDef discovery_request_elements[] ={
 | 
			
		||||
/*	{0,0,			CAPWAP_ELEM_WTP_DESCRIPTOR,	1, 0},*/
 | 
			
		||||
	{0,0,			CAPWAP_ELEM_WTP_BOARD_DATA,	0, 0},
 | 
			
		||||
	{0,CW_VENDOR_ID_CISCO,	CISCO_ELEM_RAD_NAME,		1, 0},
 | 
			
		||||
	{0,CW_VENDOR_ID_CISCO,	CW_CISCO_BOARD_DATA_OPTIONS,	0, 0},
 | 
			
		||||
	{0,0,			CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,	0, 0},
 | 
			
		||||
	{0,0,			CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,	1, 0},
 | 
			
		||||
	{0,0,0,00}
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
@ -1952,7 +2141,7 @@ static struct cw_ElemDef discovery_request_elements[] ={
 | 
			
		||||
static struct cw_ElemDef discovery_response_elements[] ={
 | 
			
		||||
	{0,CW_VENDOR_ID_CISCO,	CISCO_ELEM_AP_TIMESYNC,			1, 0},
 | 
			
		||||
	{0,CW_VENDOR_ID_CISCO,	CISCO_ELEM_MWAR_TYPE,			0, 0},
 | 
			
		||||
	{0,0,			CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,	0, 0},
 | 
			
		||||
	{0,0,			CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,	1, 0},
 | 
			
		||||
	{0,0,0,00}
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
@ -1981,10 +2170,9 @@ static struct cw_ElemDef join_request_elements[] ={
 | 
			
		||||
static struct cw_ElemDef join_response_elements[] ={
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
 | 
			
		||||
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_PATH_MTU,	0, 0},
 | 
			
		||||
 | 
			
		||||
	{0,0,			CAPWAP_ELEM_ECN_SUPPORT,	0, CW_DELETE},
 | 
			
		||||
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_PATH_MTU,	1, 0},
 | 
			
		||||
	{0,0,0,00}
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
@ -2002,6 +2190,7 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
 | 
			
		||||
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_15,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_16,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_19,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_22,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_24,				0, 0},	
 | 
			
		||||
@ -2016,8 +2205,15 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_153,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_156,				0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_9,		0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_11,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_14,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_27,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_28,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_29,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_33,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_48,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_55,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_105,	0, 0},	
 | 
			
		||||
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_CAPWAP_TIMERS,		0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_DIRECT_SEQUENCE_CONTROL,	0, 0},
 | 
			
		||||
@ -2062,10 +2258,11 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE,	1, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_AC_IP_ADDR_WITH_INDEX,	0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_VLAN,			0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_TCP_ADJUST_MSS,			0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_HARDWARE_INFO,			0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_ROUGE_DETECTION,			0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_AP_DTLS_DATA_CFG,			0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_TCP_ADJUST_MSS,		0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_HARDWARE_INFO,		0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_ROUGE_DETECTION,		0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_AP_DTLS_DATA_CFG,		0, 0},
 | 
			
		||||
//	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_PATH_MTU,			0, 0},
 | 
			
		||||
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_DISCOVERY_PROTOCOL,	1, 0},
 | 
			
		||||
	{0,0,0,00}
 | 
			
		||||
@ -2077,6 +2274,7 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_15,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_16,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_19,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_22,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_24,				0, 0},	
 | 
			
		||||
@ -2092,8 +2290,15 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_156,				0, 0},	
 | 
			
		||||
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_9,		0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_11,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_14,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_27,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_28,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_29,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_33,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_48,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_55,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_105,	0, 0},	
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_CAPWAP_TIMERS,		0, 0},	
 | 
			
		||||
@ -2132,6 +2337,7 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
 | 
			
		||||
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_15,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_16,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_19,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_22,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_24,				0, 0},	
 | 
			
		||||
@ -2146,8 +2352,15 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_153,				0, 0},	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_156,				0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_9,		0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_11,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_14,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_27,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_28,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_29,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_33,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_48,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_55,	0, 0},	
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_105,	0, 0},	
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_CAPWAP_TIMERS,		0, 0},	
 | 
			
		||||
@ -2155,6 +2368,7 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{0,0,			CAPWAP_ELEM_RADIO_OPERATIONAL_STATE,	0,0},
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CW_CISCO_ANTENNA_PAYLOAD,		0,0},
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_AP_UPTIME,			0, 0},
 | 
			
		||||
@ -2226,6 +2440,8 @@ static struct cw_ElemDef wtp_event_request_elements[] ={
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_ADD_WLAN,			0, CW_IGNORE},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_ADD_WLAN,			0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_HARDWARE_INFO,			0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_RADIO_MODULE_INFO,	0, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_29,	0, 0},	
 | 
			
		||||
 | 
			
		||||
	{0,0,0,0,0}
 | 
			
		||||
};
 | 
			
		||||
@ -2244,10 +2460,12 @@ static struct cw_ElemDef change_state_event_request_elements[] ={
 | 
			
		||||
	
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_ADD_WLAN,			1, CW_IGNORE},
 | 
			
		||||
	{0, CW_VENDOR_ID_CISCO,	CISCO_ELEM_OPER_STATE_DETAIL_CAUSE,	1, CW_IGNORE},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_105,	0, 0},	
 | 
			
		||||
 | 
			
		||||
	{0, 0,			CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE,	1, 0},
 | 
			
		||||
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_HARDWARE_INFO,			1, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_HARDWARE_INFO,	1, 0},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_RADIO_MODULE_INFO,	1, 0},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{0,0,0,0,0}
 | 
			
		||||
@ -2544,15 +2762,15 @@ static void set_ac_version(struct cw_ElemHandlerParams * params)
 | 
			
		||||
{
 | 
			
		||||
	bstr16_t wtpver;
 | 
			
		||||
	char verstr[512];
 | 
			
		||||
	wtpver = cw_cfg_get_bstr16(params->cfg,"wtp-descriptor/software/version",NULL);
 | 
			
		||||
	wtpver = cw_cfg_get_bstr16(params->cfg,"capwap/wtp-descriptor/software/version",NULL);
 | 
			
		||||
	if (wtpver==NULL)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	cw_format_version(verstr,bstr16_data(wtpver),bstr16_len(wtpver));
 | 
			
		||||
	cw_dbg(DBG_INFO, "Cisco - Setting AC software version to: %s", verstr);
 | 
			
		||||
	
 | 
			
		||||
	cw_cfg_set_bstr16(params->conn->local_cfg,"ac-descriptor/software/version",wtpver);
 | 
			
		||||
	cw_cfg_set_int(params->conn->local_cfg,"ac-descriptor/software/vendor",CW_VENDOR_ID_CISCO);
 | 
			
		||||
	cw_cfg_set_bstr16(params->conn->local_cfg,"capwap/ac-descriptor/software/version",wtpver);
 | 
			
		||||
	cw_cfg_set_int(params->conn->local_cfg,"capwap/ac-descriptor/software/vendor",CW_VENDOR_ID_CISCO);
 | 
			
		||||
 | 
			
		||||
	if(bstr16_len(wtpver)==4){
 | 
			
		||||
		uint32_t rv;
 | 
			
		||||
@ -2600,9 +2818,9 @@ static int preprocess_join_request(struct cw_Conn *conn)
 | 
			
		||||
 | 
			
		||||
	use_ac_version = cw_cfg_get_bool(conn->global_cfg,"cisco/wtp-use-ac-version",0);
 | 
			
		||||
	if (use_ac_version){
 | 
			
		||||
		ver = cw_cfg_get_bstr16(conn->remote_cfg,"ac-descriptor/software/version",NULL );
 | 
			
		||||
		ver = cw_cfg_get_bstr16(conn->remote_cfg,"capwap/ac-descriptor/software/version",NULL );
 | 
			
		||||
		if (ver != NULL){
 | 
			
		||||
			cw_cfg_set_bstr16(conn->local_cfg,"wtp-descriptor/software/version",ver);
 | 
			
		||||
			cw_cfg_set_bstr16(conn->local_cfg,"capwap/wtp-descriptor/software/version",ver);
 | 
			
		||||
			cw_format_version(verstr,bstr16_data(ver),bstr16_len(ver));
 | 
			
		||||
			cw_dbg(DBG_INFO, "Cisco WTP - Using AC's software version: %s", verstr);
 | 
			
		||||
			free(ver);
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,9 @@ int cisco_in_spam_vendor_specific(struct cw_ElemHandler *eh,
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	if (!vhandler) {
 | 
			
		||||
		cw_dbg_elem(params->dbg_level, NULL, params->msgdata->type, eh,
 | 
			
		||||
                            data, len);
 | 
			
		||||
 | 
			
		||||
                cw_dbg(DBG_WARN,
 | 
			
		||||
                       "Can't handle Vendor Specific LWAPP Payload %s/%d, in msg %d (%s) in %s state.",
 | 
			
		||||
                       cw_strvendor(vendor_id), elem_id, params->msgdata->type,
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,7 @@
 | 
			
		||||
static int put_ac_status(cw_Cfg_t * cfg1, cw_Cfg_t * cfg2, uint8_t *dst, const char * parent_key){
 | 
			
		||||
 | 
			
		||||
	uint8_t *d = dst;
 | 
			
		||||
	uint8_t security;
 | 
			
		||||
//	uint8_t security;
 | 
			
		||||
	
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	
 | 
			
		||||
@ -55,7 +55,7 @@ static int put_ac_status(cw_Cfg_t * cfg1, cw_Cfg_t * cfg2, uint8_t *dst, const c
 | 
			
		||||
int cisco_out_ac_descriptor(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst)
 | 
			
		||||
{
 | 
			
		||||
	int len,l;
 | 
			
		||||
	int len;
 | 
			
		||||
	uint8_t *d = dst+4;
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
 | 
			
		||||
@ -77,9 +77,9 @@ int cisco_out_ac_descriptor(struct cw_ElemHandler * eh,
 | 
			
		||||
 | 
			
		||||
	len = d-dst-4;
 | 
			
		||||
 | 
			
		||||
	l = len + cw_put_elem_hdr(dst,eh->id,len);
 | 
			
		||||
	cw_dbg_elem(DBG_ELEM_OUT,NULL,params->msgdata->type,eh,dst,l);
 | 
			
		||||
	return  len + cw_put_elem_hdr(dst,eh->id,len);
 | 
			
		||||
//	cw_dbg_elem(DBG_ELEM_OUT,NULL,params->msgdata->type,eh,dst,l);
 | 
			
		||||
 | 
			
		||||
	return l;
 | 
			
		||||
//	return l;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -14,21 +14,26 @@ int cisco_out_lw_path_mtu(struct cw_ElemHandler * eh,
 | 
			
		||||
 | 
			
		||||
	char key[CW_CFG_MAX_KEY_LEN];
 | 
			
		||||
	int len,max;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
	int hl = params->msgset->header_len(eh);
 | 
			
		||||
	int cl = dst-params->rawmsg;
 | 
			
		||||
	int wl = 1400-cl-hl;
 | 
			
		||||
 | 
			
		||||
printf("HL:%d CL:%d WL: %d\n",hl,cl,wl);
 | 
			
		||||
 | 
			
		||||
	sprintf(key,"%s/%s",eh->key,"len");
 | 
			
		||||
	len = cw_cfg_get_word(params->cfg,key,0);
 | 
			
		||||
	len = cw_cfg_get_word_l(params->cfg_list,key,0);
 | 
			
		||||
	if (len == 0)
 | 
			
		||||
		return 0;
 | 
			
		||||
	sprintf(key,"%s/%s",eh->key,"max");
 | 
			
		||||
	max = cw_cfg_get_word(params->cfg,key,0);
 | 
			
		||||
	max = cw_cfg_get_word_l(params->cfg_list,key,0);
 | 
			
		||||
	
 | 
			
		||||
	lw_set_word(dst+16,max);
 | 
			
		||||
	lw_set_word(dst+16+2,len);
 | 
			
		||||
	memset(dst+16+4,0,len-4);
 | 
			
		||||
	
 | 
			
		||||
	/* put the lwap elem header */
 | 
			
		||||
	lw_set_dword(dst + 10, eh->vendor);
 | 
			
		||||
	lw_set_word(dst + 14, eh->id);
 | 
			
		||||
	lw_set_word(dst+hl,max);
 | 
			
		||||
	lw_set_word(dst+hl+2,wl);
 | 
			
		||||
	memset(dst+hl+4,0,wl-4);
 | 
			
		||||
 | 
			
		||||
	return len + 6 + cw_put_elem_vendor_hdr(dst, eh->vendor, CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6);
 | 
			
		||||
	len = wl;	
 | 
			
		||||
	
 | 
			
		||||
	return params->msgset->write_header(eh,dst,len);
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -25,3 +25,20 @@ cw_dbg(DBG_X,"NUM RADIOS: %d",radios);
 | 
			
		||||
	return len;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cisco_out_radio_info(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
 | 
			
		||||
			, uint8_t * dst)
 | 
			
		||||
{
 | 
			
		||||
	if (! (params->msgdata->type & 1) ){
 | 
			
		||||
		int start = params->msgset->header_len(handler);
 | 
			
		||||
		cw_put_byte(dst+start,0);
 | 
			
		||||
		cw_put_dword(dst+start+1,7);
 | 
			
		||||
		return params->msgset->write_header(handler,dst,5);
 | 
			
		||||
	}
 | 
			
		||||
	return cw_out_radio_generic(handler,params,dst);	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -29,10 +29,15 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define CISCO_LWELEM_9				9
 | 
			
		||||
#define CISCO_LWELEM_11				11
 | 
			
		||||
#define CISCO_LWELEM_14				14
 | 
			
		||||
#define CISCO_LWELEM_AP_USERNAME_PASSWORD	18
 | 
			
		||||
#define LW_CISCO_MANAGER_IP_ADDR		19
 | 
			
		||||
#define CISCO_LWELEM_DISCOVERY_PROTOCOL		20
 | 
			
		||||
#define CISCO_LWELEM_RADIO_MODULE_INFO		21
 | 
			
		||||
#define CISCO_LWELEM_27				27
 | 
			
		||||
#define CISCO_LWELEM_28				28
 | 
			
		||||
#define CISCO_LWELEM_29				29
 | 
			
		||||
#define CISCO_LWELEM_AC_IP_ADDR_WITH_INDEX	32
 | 
			
		||||
#define CISCO_LWELEM_33				33
 | 
			
		||||
#define CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE	34
 | 
			
		||||
@ -41,6 +46,7 @@
 | 
			
		||||
 | 
			
		||||
#define CISCO_LWELEM_AP_TELNET_SSH		44
 | 
			
		||||
#define CISCO_LWELEM_48				48
 | 
			
		||||
#define CISCO_LWELEM_55				55
 | 
			
		||||
#define CISCO_LWELEM_AP_SUBMODE			67
 | 
			
		||||
#define LW_CISCO_AP_HEARTBEAT_TIMEOUT		68
 | 
			
		||||
 | 
			
		||||
@ -54,6 +60,8 @@
 | 
			
		||||
#define LW_CISCO_PRIMED_JOIN_TIMEOUT		85
 | 
			
		||||
#define CISCO_LWELEM_AP_DTLS_DATA_CFG		74
 | 
			
		||||
 | 
			
		||||
#define CISCO_LWELEM_105			105
 | 
			
		||||
 | 
			
		||||
#define CISCO_LWELEM_RAD_EXTENDED_CONFIG	111
 | 
			
		||||
#define CISCO_LWELEM_ADD_WLAN			128
 | 
			
		||||
#define CISCO_LWELEM_AP_DNS_SERV_IP_ADD		121
 | 
			
		||||
 | 
			
		||||
@ -97,7 +97,7 @@ static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
static int init(struct cw_Mod *mod, mavl_t global_cfg, int role)
 | 
			
		||||
static int init(struct cw_Mod *mod, cw_Cfg_t * global_cfg, int role)
 | 
			
		||||
{
 | 
			
		||||
/*	uint8_t * str;*/
 | 
			
		||||
	static char * hardware_version; /*strdup(".x01000001");*/
 | 
			
		||||
@ -232,7 +232,7 @@ int static setup_cfg(struct cw_Conn  * conn)
 | 
			
		||||
	security = cw_setup_dtls(conn,conn->global_cfg,"cisco",CAPWAP_CIPHER);
 | 
			
		||||
 | 
			
		||||
	if (conn->role == CW_ROLE_AC){
 | 
			
		||||
		cw_cfg_set_int(conn->local_cfg,"ac-descriptor/security",security);
 | 
			
		||||
		cw_cfg_set_int(conn->local_cfg,"capwap/ac-descriptor/security",security);
 | 
			
		||||
	
 | 
			
		||||
//		if (conn->default_cfg==NULL){
 | 
			
		||||
//			conn->default_cfg=cw_cfg_create();
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										201
									
								
								src/wtp/1142-factroy-70.ckv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										201
									
								
								src/wtp/1142-factroy-70.ckv
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,201 @@
 | 
			
		||||
#
 | 
			
		||||
# Join Request
 | 
			
		||||
#
 | 
			
		||||
capwap-local-ip-address: 192.168.0.13
 | 
			
		||||
cisco/ap-group-name: default-group
 | 
			
		||||
cisco/lw-path-mtu/len: 1095
 | 
			
		||||
cisco/lw-path-mtu/max: 1485
 | 
			
		||||
cisco/mwar-addr/address: 192.168.0.14
 | 
			
		||||
cisco/mwar-addr/mwar-type: 0
 | 
			
		||||
cisco/mwar-addr/unknown: 0
 | 
			
		||||
cisco/wtp-board-data/options/ant-type: 1
 | 
			
		||||
cisco/wtp-board-data/options/ap-type: 0
 | 
			
		||||
cisco/wtp-board-data/options/failover-priority: 1
 | 
			
		||||
cisco/wtp-board-data/options/flex-connect: 0
 | 
			
		||||
location-data: default location
 | 
			
		||||
maximum-message-length: 14000
 | 
			
		||||
radio.0/wtp-radio-information: 1
 | 
			
		||||
radio.1/wtp-radio-information: 2
 | 
			
		||||
session-id: .x4a230869
 | 
			
		||||
wtp-board-data/board-id: .x0000
 | 
			
		||||
wtp-board-data/mac-address: .xc47d4f3af8a6
 | 
			
		||||
wtp-board-data/model-no: "AIR-LAP1142N-E-K9   "
 | 
			
		||||
wtp-board-data/revision: A0
 | 
			
		||||
wtp-board-data/serial-no: FCZ1406W232
 | 
			
		||||
wtp-board-data/vendor: 4232704
 | 
			
		||||
wtp-descriptor/bootloader/vendor: 4232704
 | 
			
		||||
wtp-descriptor/bootloader/version: .x0c041200
 | 
			
		||||
wtp-descriptor/hardware/vendor: 4232704
 | 
			
		||||
wtp-descriptor/hardware/version: .x01000000
 | 
			
		||||
wtp-descriptor/max-radios: 2
 | 
			
		||||
wtp-descriptor/radios-in-use: 2
 | 
			
		||||
wtp-descriptor/software/vendor: 4232704
 | 
			
		||||
wtp-descriptor/software/version: .x07007400
 | 
			
		||||
wtp-frame-tunnel-mode: 4
 | 
			
		||||
wtp-mac-type: 1 - Split MAC
 | 
			
		||||
wtp-name: APc47d.4f3a.f8a6
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Configuration Status Request
 | 
			
		||||
#
 | 
			
		||||
capwap/ac-name: 
 | 
			
		||||
cisco/ap-backup-software-version: .x00000000
 | 
			
		||||
cisco/ap-dtls-data-cfg/cabable: true
 | 
			
		||||
cisco/ap-dtls-data-cfg/enabled: false
 | 
			
		||||
cisco/ap-ethernet-port-type: .x000000
 | 
			
		||||
cisco/ap-led-state-config/led-state: 1
 | 
			
		||||
cisco/ap-log-facility: 0
 | 
			
		||||
cisco/ap-min-ios-version: .x08036f00
 | 
			
		||||
cisco/ap-mode-and-type/mode: 0
 | 
			
		||||
cisco/ap-mode-and-type/type: 15
 | 
			
		||||
cisco/ap-model/image: 12.4(23c)JA2
 | 
			
		||||
cisco/ap-model/model: "AIR-LAP1142N-E-K9   "
 | 
			
		||||
cisco/ap-power-injector-config/selection: 0
 | 
			
		||||
cisco/ap-power-injector-config/state: 17
 | 
			
		||||
cisco/ap-power-injector-config/switch-mac-address: .x000000000000
 | 
			
		||||
cisco/ap-pre-std-switch-config: 0
 | 
			
		||||
cisco/ap-regulatory-domain.0/code0: 0
 | 
			
		||||
cisco/ap-regulatory-domain.0/code1: 1
 | 
			
		||||
cisco/ap-regulatory-domain.0/set: true
 | 
			
		||||
cisco/ap-regulatory-domain.0/slot: 0
 | 
			
		||||
cisco/ap-regulatory-domain.1/code0: 0
 | 
			
		||||
cisco/ap-regulatory-domain.1/code1: 1
 | 
			
		||||
cisco/ap-regulatory-domain.1/set: true
 | 
			
		||||
cisco/ap-regulatory-domain.1/slot: 1
 | 
			
		||||
cisco/ap-static-ip-addr/address: 192.168.0.13
 | 
			
		||||
cisco/ap-static-ip-addr/enabled: false
 | 
			
		||||
cisco/ap-static-ip-addr/gateway: 192.168.0.1
 | 
			
		||||
cisco/ap-static-ip-addr/netmask: 255.255.255.0
 | 
			
		||||
cisco/ap-static-ip-addr/unknown: 0.0.0.0
 | 
			
		||||
cisco/ap-sub-mode: 0
 | 
			
		||||
cisco/ap-telnet-ssh/ssh: false
 | 
			
		||||
cisco/ap-telnet-ssh/telnet: false
 | 
			
		||||
cisco/ap-uptime/current-uptime: 84
 | 
			
		||||
cisco/ap-uptime/last-uptime: 1
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/enable-password: $1$.q2F$Fkcs06gZJpIE3LnX8oxmN.
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/option: 1
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/password: $1$ZFkU$zIX6UG1NozXk2.V1lZNIV.
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/username: Cisco
 | 
			
		||||
cisco/cisco-discovery-protocol/data: 513
 | 
			
		||||
cisco/cisco-discovery-protocol/enabled: false
 | 
			
		||||
cisco/loghost-config/last-joined-ap: None
 | 
			
		||||
cisco/loghost-config/loghost: 255.255.255.255
 | 
			
		||||
cisco/lwelem105: .x0000
 | 
			
		||||
cisco/lwelem14: .x000100000000000000000000000000000000
 | 
			
		||||
cisco/reset-button-state: true
 | 
			
		||||
cisco/rouge-and-mss/enable: false
 | 
			
		||||
cisco/rouge-and-mss/tcp-adjust-mss: 0
 | 
			
		||||
cisco/rouge-detection/rest: .x0000000a
 | 
			
		||||
cisco/rouge-detection/rouge-detection: true
 | 
			
		||||
cisco/wtp-board-data/card-id: 0
 | 
			
		||||
cisco/wtp-board-data/card-revision: 0
 | 
			
		||||
cisco/wtp-board-data/ethernet-mac-address: .xc47d4f3af8a6
 | 
			
		||||
cisco/wtp-board-data/options/ant-type: 1
 | 
			
		||||
cisco/wtp-board-data/options/ap-type: 1
 | 
			
		||||
cisco/wtp-board-data/options/failover-priority: 0
 | 
			
		||||
cisco/wtp-board-data/options/flex-connect: 1
 | 
			
		||||
cisco/wtp-board-data/wtp-model-hi: 0
 | 
			
		||||
cisco/wtp-board-data/wtp-model-lo: 0
 | 
			
		||||
cisco/wtp-board-data/wtp-serial-number: FCZ1406W232
 | 
			
		||||
radio.0/admin-state: 1 - enabled
 | 
			
		||||
radio.0/cisco/antenna-payload/802-11n-rx-antennas: 0
 | 
			
		||||
radio.0/cisco/antenna-payload/802-11n-tx-antennas: 0
 | 
			
		||||
radio.0/cisco/antenna-payload/antenna-1: 1
 | 
			
		||||
radio.0/cisco/antenna-payload/antenna-2: 1
 | 
			
		||||
radio.0/cisco/antenna-payload/antenna-mode: 3
 | 
			
		||||
radio.0/cisco/antenna-payload/diversity-selection: 255
 | 
			
		||||
radio.0/cisco/antenna-payload/number-of-antennas: 2
 | 
			
		||||
radio.0/cisco/antenna-payload/unknown: 0
 | 
			
		||||
radio.0/cisco/channel-power: .x08080d0108221c16100a04fefe0208221c16100a04fefe0308221c16100a04fefe0408221c16100a04fefe0508221c16100a04fefe0608221c16100a04fefe0708221c16100a04fefe0808221c16100a04fefe0908221c16100a04fefe0a08221c16100a04fefe0b08221c16100a04fefe0c08221c16100a04fefe0d08221c16100a04fefe
 | 
			
		||||
radio.0/cisco/elem16: .x02040b0c
 | 
			
		||||
radio.0/cisco/elem47: .x0100000000000000000000000000000000
 | 
			
		||||
radio.0/cisco/elem48: .x00
 | 
			
		||||
radio.0/cisco/lwelem11: .x00000203
 | 
			
		||||
radio.0/cisco/lwelem27: .x00000000000000000000000000000000000000000000000000
 | 
			
		||||
radio.0/cisco/lwelem28: .x0303020202000000000000000000000000000000000000000000313f01
 | 
			
		||||
radio.0/cisco/lwelem29: .x00010000000000000200001400
 | 
			
		||||
radio.0/cisco/mac-operation/fragmentation-threshold: 0
 | 
			
		||||
radio.0/cisco/mac-operation/long-retry: 0
 | 
			
		||||
radio.0/cisco/mac-operation/reserved: 1
 | 
			
		||||
radio.0/cisco/mac-operation/rts-threshold: 2347
 | 
			
		||||
radio.0/cisco/mac-operation/rx-msdu-lifetime: 1000
 | 
			
		||||
radio.0/cisco/mac-operation/short-retry: 0
 | 
			
		||||
radio.0/cisco/mac-operation/tx-msdu-lifetime: 5000
 | 
			
		||||
radio.0/cisco/multi-domain-capability/first-channel: 1
 | 
			
		||||
radio.0/cisco/multi-domain-capability/max-tx-power-level: 65535
 | 
			
		||||
radio.0/cisco/multi-domain-capability/number-of-channels: 13
 | 
			
		||||
radio.0/cisco/multi-domain-capability/reserved: 1
 | 
			
		||||
radio.0/cisco/tx-power-levels: .x070011000e000b000800050002ffff0000
 | 
			
		||||
radio.0/cisco/tx-power/cfg-type: 1 - global
 | 
			
		||||
radio.0/cisco/tx-power/current-tx-power: 0
 | 
			
		||||
radio.0/cisco/wtp-radio-config/beacon-period: 0
 | 
			
		||||
radio.0/cisco/wtp-radio-config/bss-id: .x04fe7f499b90
 | 
			
		||||
radio.0/cisco/wtp-radio-config/cfg-period: 0
 | 
			
		||||
radio.0/cisco/wtp-radio-config/cfg-type: 1
 | 
			
		||||
radio.0/cisco/wtp-radio-config/cfp-maximum-duration: 0
 | 
			
		||||
radio.0/cisco/wtp-radio-config/country-str1: 
 | 
			
		||||
radio.0/cisco/wtp-radio-config/country-str2: 
 | 
			
		||||
radio.0/cisco/wtp-radio-config/occupancy-limit: 0
 | 
			
		||||
radio.0/cisco/wtp-radio-config/reg: 256
 | 
			
		||||
radio.1/admin-state: 1 - enabled
 | 
			
		||||
radio.1/cisco/antenna-payload/802-11n-rx-antennas: 0
 | 
			
		||||
radio.1/cisco/antenna-payload/802-11n-tx-antennas: 0
 | 
			
		||||
radio.1/cisco/antenna-payload/antenna-1: 1
 | 
			
		||||
radio.1/cisco/antenna-payload/antenna-2: 1
 | 
			
		||||
radio.1/cisco/antenna-payload/antenna-mode: 3
 | 
			
		||||
radio.1/cisco/antenna-payload/diversity-selection: 255
 | 
			
		||||
radio.1/cisco/antenna-payload/number-of-antennas: 2
 | 
			
		||||
radio.1/cisco/antenna-payload/unknown: 0
 | 
			
		||||
radio.1/cisco/channel-power: .x0808102408221c16100a04fefe2808221c16100a04fefe2c08221c16100a04fefe3008221c16100a04fefe3408221c16100a04fefe3808221c16100a04fefe3c08221c16100a04fefe4008221c16100a04fefe6408221c16100a04fefe6808221c16100a04fefe6c08221c16100a04fefe7008221c16100a04fefe7408221c16100a04fefe8408221c16100a04fefe8808221c16100a04fefe8c08221c16100a04fefe
 | 
			
		||||
radio.1/cisco/elem16: .x0c121824
 | 
			
		||||
radio.1/cisco/elem47: .x0100000000000000000000000000000000
 | 
			
		||||
radio.1/cisco/elem48: .x00
 | 
			
		||||
radio.1/cisco/lwelem11: .x00010203
 | 
			
		||||
radio.1/cisco/lwelem27: .x00000000000000000000000000000000000000000000000000
 | 
			
		||||
radio.1/cisco/lwelem28: .x0303020202000000000000000000000000000000000000000000313f01
 | 
			
		||||
radio.1/cisco/lwelem29: .x00010003000000000200001400
 | 
			
		||||
radio.1/cisco/mac-operation/fragmentation-threshold: 0
 | 
			
		||||
radio.1/cisco/mac-operation/long-retry: 0
 | 
			
		||||
radio.1/cisco/mac-operation/reserved: 1
 | 
			
		||||
radio.1/cisco/mac-operation/rts-threshold: 2347
 | 
			
		||||
radio.1/cisco/mac-operation/rx-msdu-lifetime: 1000
 | 
			
		||||
radio.1/cisco/mac-operation/short-retry: 0
 | 
			
		||||
radio.1/cisco/mac-operation/tx-msdu-lifetime: 5000
 | 
			
		||||
radio.1/cisco/multi-domain-capability/first-channel: 36
 | 
			
		||||
radio.1/cisco/multi-domain-capability/max-tx-power-level: 65535
 | 
			
		||||
radio.1/cisco/multi-domain-capability/number-of-channels: 16
 | 
			
		||||
radio.1/cisco/multi-domain-capability/reserved: 1
 | 
			
		||||
radio.1/cisco/tx-power-levels: .x070011000e000b000800050002ffff0000
 | 
			
		||||
radio.1/cisco/tx-power/cfg-type: 1 - global
 | 
			
		||||
radio.1/cisco/tx-power/current-tx-power: 0
 | 
			
		||||
radio.1/cisco/wtp-radio-config/beacon-period: 0
 | 
			
		||||
radio.1/cisco/wtp-radio-config/bss-id: .x04fe7f499b90
 | 
			
		||||
radio.1/cisco/wtp-radio-config/cfg-period: 0
 | 
			
		||||
radio.1/cisco/wtp-radio-config/cfg-type: 1
 | 
			
		||||
radio.1/cisco/wtp-radio-config/cfp-maximum-duration: 0
 | 
			
		||||
radio.1/cisco/wtp-radio-config/country-str1: 
 | 
			
		||||
radio.1/cisco/wtp-radio-config/country-str2: 
 | 
			
		||||
radio.1/cisco/wtp-radio-config/occupancy-limit: 0
 | 
			
		||||
radio.1/cisco/wtp-radio-config/reg: 256
 | 
			
		||||
radio.255/admin-state: 1 - enabled
 | 
			
		||||
statistics-timer: 180
 | 
			
		||||
wtp-reboot-statistics/ac-initiated-count: 1
 | 
			
		||||
wtp-reboot-statistics/hw-failure-count: 0
 | 
			
		||||
wtp-reboot-statistics/last-failure-type: 1
 | 
			
		||||
wtp-reboot-statistics/link-failure-count: 0
 | 
			
		||||
wtp-reboot-statistics/other-failure-count: 15
 | 
			
		||||
wtp-reboot-statistics/reboot-count: 0
 | 
			
		||||
wtp-reboot-statistics/sw-failure-count: 0
 | 
			
		||||
wtp-reboot-statistics/unknown-failure-count: 0
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Local
 | 
			
		||||
#
 | 
			
		||||
wtp-name: Soft-WTP
 | 
			
		||||
cisco/ssl-certfile: ../../ssl/certs/wtpc.crt
 | 
			
		||||
cisco/ssl-cipher: SHA1
 | 
			
		||||
cisco/ssl-keyfile: ../../ssl/certs/wtpc.key
 | 
			
		||||
cisco/wtp-use-ac-version: true
 | 
			
		||||
wtp-board-data/mac-address: .x0800276edf58
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@ LIBDIR		:= ../../lib
 | 
			
		||||
LIBARCHDIR	:= $(LIBDIR)/$(KERNEL)/$(ARCH)
 | 
			
		||||
 | 
			
		||||
CFLAGS+=-I../ -DUSE_OPENSSL -I../../include
 | 
			
		||||
LDFLAGS+=-L$(LIBARCHDIR) 
 | 
			
		||||
LDFLAGS+=-L$(LIBARCHDIR) -L/usr/local/lib
 | 
			
		||||
LIBS+=-lcw -lnettle -lssl -lcrypto -ldl -lpthread -lmavl
 | 
			
		||||
 | 
			
		||||
SOURCES=\
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@
 | 
			
		||||
#include "wtp_interface.h"
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
int changestate(struct conn * conn)
 | 
			
		||||
int changestate(struct cw_Conn * conn)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -2,14 +2,47 @@
 | 
			
		||||
# This file is igenerated  by WAT
 | 
			
		||||
# If you edit this, your cahnges might be overwritten
 | 
			
		||||
#
 | 
			
		||||
capwap-local-ip-address: 192.168.0.14
 | 
			
		||||
capwap-timers/echo-interval: 30
 | 
			
		||||
capwap-timers/max-discovery-interval: 10
 | 
			
		||||
capwap/ac-name: 
 | 
			
		||||
cisco-8011-assoc-limit/enable: false
 | 
			
		||||
cisco-8011-assoc-limit/interval: 500
 | 
			
		||||
cisco-8011-assoc-limit/limit: 25
 | 
			
		||||
capwap/idle-timeout: 300
 | 
			
		||||
capwap/local-ip-address: 192.168.0.24
 | 
			
		||||
capwap/location-data: default location
 | 
			
		||||
capwap/maximum-message-length: 14000
 | 
			
		||||
capwap/session-id: .x14c4c46b
 | 
			
		||||
capwap/statistics-timer: 180
 | 
			
		||||
capwap/timers/echo-interval: 30
 | 
			
		||||
capwap/timers/max-discovery-interval: 10
 | 
			
		||||
capwap/wtp-board-data/board-id: .x0000
 | 
			
		||||
capwap/wtp-board-data/mac-address: .x0800276edf58
 | 
			
		||||
capwap/wtp-board-data/model-no: "AIR-LAP1142N-E-K9   "
 | 
			
		||||
capwap/wtp-board-data/revision: A0
 | 
			
		||||
capwap/wtp-board-data/serial-no: FCZ1406W232
 | 
			
		||||
capwap/wtp-board-data/vendor: 4232704
 | 
			
		||||
capwap/wtp-descriptor/bootloader/vendor: 4232704
 | 
			
		||||
capwap/wtp-descriptor/bootloader/version: .x0c041200
 | 
			
		||||
capwap/wtp-descriptor/hardware/vendor: 4232704
 | 
			
		||||
capwap/wtp-descriptor/hardware/version: .x01000000
 | 
			
		||||
capwap/wtp-descriptor/max-radios: 2
 | 
			
		||||
capwap/wtp-descriptor/radios-in-use: 2
 | 
			
		||||
capwap/wtp-descriptor/software/vendor: 4232704
 | 
			
		||||
capwap/wtp-descriptor/software/version: .x07007400
 | 
			
		||||
capwap/wtp-fallback: 1
 | 
			
		||||
capwap/wtp-frame-tunnel-mode: 4
 | 
			
		||||
capwap/wtp-mac-type: 1 - Split MAC
 | 
			
		||||
capwap/wtp-name: Soft-WTP
 | 
			
		||||
capwap/wtp-reboot-statistics/ac-initiated-count: 113
 | 
			
		||||
capwap/wtp-reboot-statistics/hw-failure-count: 0
 | 
			
		||||
capwap/wtp-reboot-statistics/last-failure-type: 1
 | 
			
		||||
capwap/wtp-reboot-statistics/link-failure-count: 0
 | 
			
		||||
capwap/wtp-reboot-statistics/other-failure-count: 1
 | 
			
		||||
capwap/wtp-reboot-statistics/reboot-count: 0
 | 
			
		||||
capwap/wtp-reboot-statistics/sw-failure-count: 0
 | 
			
		||||
capwap/wtp-reboot-statistics/unknown-failure-count: 0
 | 
			
		||||
cisco/8011-assoc-limit/enable: false
 | 
			
		||||
cisco/8011-assoc-limit/interval: 500
 | 
			
		||||
cisco/8011-assoc-limit/limit: 25
 | 
			
		||||
cisco/ap-backup-software-version: .x00000000
 | 
			
		||||
cisco/ap-dtls-data-cfg/cabable: true
 | 
			
		||||
cisco/ap-dtls-data-cfg/enabled: false
 | 
			
		||||
cisco/ap-ethernet-port-type: .x000000
 | 
			
		||||
cisco/ap-group-name: default-group
 | 
			
		||||
cisco/ap-led-state-config/led-state: 1
 | 
			
		||||
@ -31,7 +64,7 @@ cisco/ap-regulatory-domain.1/code0: 0
 | 
			
		||||
cisco/ap-regulatory-domain.1/code1: 1
 | 
			
		||||
cisco/ap-regulatory-domain.1/set: true
 | 
			
		||||
cisco/ap-regulatory-domain.1/slot: 1
 | 
			
		||||
cisco/ap-static-ip-addr/address: 192.168.0.14
 | 
			
		||||
cisco/ap-static-ip-addr/address: 192.168.0.13
 | 
			
		||||
cisco/ap-static-ip-addr/enabled: false
 | 
			
		||||
cisco/ap-static-ip-addr/gateway: 192.168.0.1
 | 
			
		||||
cisco/ap-static-ip-addr/netmask: 255.255.255.0
 | 
			
		||||
@ -39,19 +72,23 @@ cisco/ap-static-ip-addr/unknown: 0.0.0.0
 | 
			
		||||
cisco/ap-sub-mode: 0
 | 
			
		||||
cisco/ap-telnet-ssh/ssh: false
 | 
			
		||||
cisco/ap-telnet-ssh/telnet: false
 | 
			
		||||
cisco/ap-uptime/current-uptime: 120
 | 
			
		||||
cisco/ap-uptime/last-uptime: 1
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/enable-password: $1$IMuO$BHTjaFsUF.X3g3Q9YDmcS0
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/option: 1
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/password: $1$SL3y$sc6giltX5bNe5mzHT8Gwy1
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/username: Cisco
 | 
			
		||||
cisco/ap-uptime/current-uptime: 36527
 | 
			
		||||
cisco/ap-uptime/last-uptime: 36513
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/enable-password: $1$qve.$obrsuC2vFk5/TepRMiMxa.
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/option: 1025
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/password: $1$MX4t$F19wCuY8yN5jBD7g2Qutr/
 | 
			
		||||
cisco/ap-username-and-password/login-credentials/username: admin
 | 
			
		||||
cisco/cisco-discovery-protocol/data: 513
 | 
			
		||||
cisco/cisco-discovery-protocol/enabled: false
 | 
			
		||||
cisco/elem132: .x0100000000
 | 
			
		||||
cisco/loghost-config/last-joined-ap: None
 | 
			
		||||
cisco/loghost-config/last-joined-ap: actube_X
 | 
			
		||||
cisco/loghost-config/loghost: 255.255.255.255
 | 
			
		||||
cisco/lw-path-mtu/len: 1095
 | 
			
		||||
cisco/lw-path-mtu/max: 1485
 | 
			
		||||
cisco/lwelem105: .x000b
 | 
			
		||||
cisco/lwelem14: .x000000000000000000000000000000000000
 | 
			
		||||
cisco/mcast-mgid-info: .x0000000d0000000000000000000000000000000101000000
 | 
			
		||||
cisco/mwar-addr/address: 192.168.0.162
 | 
			
		||||
cisco/mwar-addr/address: 192.168.0.24
 | 
			
		||||
cisco/mwar-addr/mwar-type: 0
 | 
			
		||||
cisco/mwar-addr/unknown: 0
 | 
			
		||||
cisco/reset-button-state: true
 | 
			
		||||
@ -59,7 +96,7 @@ cisco/rouge-and-mss/enable: false
 | 
			
		||||
cisco/rouge-and-mss/tcp-adjust-mss: 0
 | 
			
		||||
cisco/rouge-detection/rest: .x0000000a
 | 
			
		||||
cisco/rouge-detection/rouge-detection: true
 | 
			
		||||
cisco/sig-toogle: true
 | 
			
		||||
cisco/sig-toggle: true
 | 
			
		||||
cisco/spam-domain-secret: .xe1ffd18a8f15b3b59c0a47a7f17a96e7cb36174f00
 | 
			
		||||
cisco/ssl-certfile: ../../ssl/certs/wtpc.crt
 | 
			
		||||
cisco/ssl-cipher: SHA1
 | 
			
		||||
@ -68,28 +105,32 @@ cisco/wtp-board-data/card-id: 0
 | 
			
		||||
cisco/wtp-board-data/card-revision: 0
 | 
			
		||||
cisco/wtp-board-data/ethernet-mac-address: .xc47d4f3af8a6
 | 
			
		||||
cisco/wtp-board-data/options/ant-type: 1
 | 
			
		||||
cisco/wtp-board-data/options/ap-type: 0
 | 
			
		||||
cisco/wtp-board-data/options/failover-priority: 1
 | 
			
		||||
cisco/wtp-board-data/options/flex-connect: 0
 | 
			
		||||
cisco/wtp-board-data/options/ap-type: 1
 | 
			
		||||
cisco/wtp-board-data/options/failover-priority: 0
 | 
			
		||||
cisco/wtp-board-data/options/flex-connect: 1
 | 
			
		||||
cisco/wtp-board-data/wtp-model-hi: 0
 | 
			
		||||
cisco/wtp-board-data/wtp-model-lo: 0
 | 
			
		||||
cisco/wtp-board-data/wtp-serial-number: FCZ1406W232
 | 
			
		||||
cisco/wtp-use-ac-version: true
 | 
			
		||||
idle-timeout: 300
 | 
			
		||||
location-data: default location
 | 
			
		||||
maximum-message-length: 14000
 | 
			
		||||
radio.0/admin-state: 1 - enabled
 | 
			
		||||
radio.0/capwap/admin-state: 1 - enabled
 | 
			
		||||
radio.0/capwap/decryption-error-report-period: 120
 | 
			
		||||
radio.0/capwap/operational-state/cause: Normal
 | 
			
		||||
radio.0/capwap/operational-state/state: enabled
 | 
			
		||||
radio.0/capwap80211/rate-set: .x82848b960c1218243048606c
 | 
			
		||||
radio.0/capwap80211/tx-power/@cisco/cfg-type: 1 - global
 | 
			
		||||
radio.0/capwap80211/tx-power/current-tx-power: 1
 | 
			
		||||
radio.0/capwap80211/wtp-radio-information: 1
 | 
			
		||||
radio.0/cisco/air-space-capability: 0
 | 
			
		||||
radio.0/cisco/antenna-payload/802-11n-rx-antennas: 7
 | 
			
		||||
radio.0/cisco/antenna-payload/802-11n-tx-antennas: 0
 | 
			
		||||
radio.0/cisco/antenna-payload/802-11n-rx-antennas: 3
 | 
			
		||||
radio.0/cisco/antenna-payload/802-11n-tx-antennas: 7
 | 
			
		||||
radio.0/cisco/antenna-payload/antenna-1: 1
 | 
			
		||||
radio.0/cisco/antenna-payload/antenna-2: 1
 | 
			
		||||
radio.0/cisco/antenna-payload/antenna-mode: 3
 | 
			
		||||
radio.0/cisco/antenna-payload/diversity-selection: 255
 | 
			
		||||
radio.0/cisco/antenna-payload/number-of-antennas: 2
 | 
			
		||||
radio.0/cisco/antenna-payload/unknown: 3
 | 
			
		||||
radio.0/cisco/antenna-payload/unknown: 0
 | 
			
		||||
radio.0/cisco/channel-power: .x08080d0108221c16100a04fefe0208221c16100a04fefe0308221c16100a04fefe0408221c16100a04fefe0508221c16100a04fefe0608221c16100a04fefe0708221c16100a04fefe0808221c16100a04fefe0908221c16100a04fefe0a08221c16100a04fefe0b08221c16100a04fefe0c08221c16100a04fefe0d08221c16100a04fefe
 | 
			
		||||
radio.0/cisco/direct-sequence-control/cfg-type: 1
 | 
			
		||||
radio.0/cisco/direct-sequence-control/cfg-type: 1 - global
 | 
			
		||||
radio.0/cisco/direct-sequence-control/current-cca-mode: 0
 | 
			
		||||
radio.0/cisco/direct-sequence-control/current-channel: 1
 | 
			
		||||
radio.0/cisco/direct-sequence-control/energy-detect-threshold: -50
 | 
			
		||||
@ -98,12 +139,17 @@ radio.0/cisco/elem145: .x01
 | 
			
		||||
radio.0/cisco/elem146: .x690f
 | 
			
		||||
radio.0/cisco/elem153: .x00
 | 
			
		||||
radio.0/cisco/elem156: .x020100
 | 
			
		||||
radio.0/cisco/elem19: .xc0a800a10001000cc0a800a103000101003ccd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000001060b010101
 | 
			
		||||
radio.0/cisco/elem16: .x02040b0c
 | 
			
		||||
radio.0/cisco/elem19: .xc0a800a10001000cc0a800a103000101001ecd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000001060b010101
 | 
			
		||||
radio.0/cisco/elem22: .x0d00b400320102030405060708090a0b0c0d
 | 
			
		||||
radio.0/cisco/elem24: .x003c000c
 | 
			
		||||
radio.0/cisco/elem47: .x0100000000000000000000000000000000
 | 
			
		||||
radio.0/cisco/elem48: .x00
 | 
			
		||||
radio.0/cisco/elem81: .x00000000010101010a001e0a02051cbfffbfff0a00
 | 
			
		||||
radio.0/cisco/lwelem11: .x00000203
 | 
			
		||||
radio.0/cisco/lwelem27: .x182c0000000000000000000000000000ffff00000000000000
 | 
			
		||||
radio.0/cisco/lwelem28: .x0303020202000000000000000000000000000000000000000000313f01
 | 
			
		||||
radio.0/cisco/lwelem29: .x00010100000000000200001400
 | 
			
		||||
radio.0/cisco/lwelem48: .x01055a0101a6c405b06432b03232
 | 
			
		||||
radio.0/cisco/lwelem9: .x0100000000000000000000000000000000
 | 
			
		||||
radio.0/cisco/mac-operation/fragmentation-threshold: 2346
 | 
			
		||||
@ -117,9 +163,11 @@ radio.0/cisco/multi-domain-capability/first-channel: 1
 | 
			
		||||
radio.0/cisco/multi-domain-capability/max-tx-power-level: 20
 | 
			
		||||
radio.0/cisco/multi-domain-capability/number-of-channels: 13
 | 
			
		||||
radio.0/cisco/multi-domain-capability/reserved: 1
 | 
			
		||||
radio.0/cisco/radio-module-info/descr: 802.11N 2.4GHz Radio
 | 
			
		||||
radio.0/cisco/radio-module-info/name: UNKNOWN
 | 
			
		||||
radio.0/cisco/radio-module-info/serial: FOC14053DBQ
 | 
			
		||||
radio.0/cisco/radio-module-info/type: Dot11Radio0
 | 
			
		||||
radio.0/cisco/tx-power-levels: .x070011000e000b000800050002ffff0000
 | 
			
		||||
radio.0/cisco/tx-power/current-tx-power: 1
 | 
			
		||||
radio.0/cisco/tx-power/reserved: 1
 | 
			
		||||
radio.0/cisco/wtp-radio-config/beacon-period: 100
 | 
			
		||||
radio.0/cisco/wtp-radio-config/bss-id: .x04fe7f499b90
 | 
			
		||||
radio.0/cisco/wtp-radio-config/cfg-period: 4
 | 
			
		||||
@ -129,32 +177,75 @@ radio.0/cisco/wtp-radio-config/country-str1: "DE "
 | 
			
		||||
radio.0/cisco/wtp-radio-config/country-str2: "DE "
 | 
			
		||||
radio.0/cisco/wtp-radio-config/occupancy-limit: 100
 | 
			
		||||
radio.0/cisco/wtp-radio-config/reg: 167772416
 | 
			
		||||
radio.0/decryption-error-report-period: 120
 | 
			
		||||
radio.0/operational-state/cause: Normal
 | 
			
		||||
radio.0/operational-state/state: enabled
 | 
			
		||||
radio.0/rate_set: .x82848b960c1218243048606c
 | 
			
		||||
radio.0/wtp-radio-information: 1
 | 
			
		||||
radio.1/admin-state: 1 - enabled
 | 
			
		||||
radio.0/wlan.1/add-wlan/aironet-ie: true
 | 
			
		||||
radio.0/wlan.1/add-wlan/broadcast-ssid: true
 | 
			
		||||
radio.0/wlan.1/add-wlan/dtim-period: 1
 | 
			
		||||
radio.0/wlan.1/add-wlan/encryption-policy: 4
 | 
			
		||||
radio.0/wlan.1/add-wlan/hreap-local-switch: 0
 | 
			
		||||
radio.0/wlan.1/add-wlan/profile-name: tubeC
 | 
			
		||||
radio.0/wlan.1/add-wlan/qos: 0
 | 
			
		||||
radio.0/wlan.1/add-wlan/radio-id: 0
 | 
			
		||||
radio.0/wlan.1/add-wlan/scan-defer-period: 28784
 | 
			
		||||
radio.0/wlan.1/add-wlan/scan-defer-time: 100
 | 
			
		||||
radio.0/wlan.1/add-wlan/session-timout: 1800
 | 
			
		||||
radio.0/wlan.1/add-wlan/ssid: tubeC
 | 
			
		||||
radio.0/wlan.1/add-wlan/wep-encryption: false
 | 
			
		||||
radio.0/wlan.1/add-wlan/wep-key: .x1978b2c072f90ff26e4e24c806
 | 
			
		||||
radio.0/wlan.1/add-wlan/wep-key-index: 1
 | 
			
		||||
radio.0/wlan.1/add-wlan/wlan-capability: 1073
 | 
			
		||||
radio.0/wlan.1/add-wlan/wlan-id: 1
 | 
			
		||||
radio.0/wlan.13/add-wlan/aironet-ie: true
 | 
			
		||||
radio.0/wlan.13/add-wlan/broadcast-ssid: true
 | 
			
		||||
radio.0/wlan.13/add-wlan/dtim-period: 19
 | 
			
		||||
radio.0/wlan.13/add-wlan/encryption-policy: 1
 | 
			
		||||
radio.0/wlan.13/add-wlan/hreap-local-switch: 16
 | 
			
		||||
radio.0/wlan.13/add-wlan/profile-name: SuerWLAN
 | 
			
		||||
radio.0/wlan.13/add-wlan/qos: 0
 | 
			
		||||
radio.0/wlan.13/add-wlan/radio-id: 0
 | 
			
		||||
radio.0/wlan.13/add-wlan/scan-defer-period: 15420
 | 
			
		||||
radio.0/wlan.13/add-wlan/scan-defer-time: 100
 | 
			
		||||
radio.0/wlan.13/add-wlan/session-timout: 1800
 | 
			
		||||
radio.0/wlan.13/add-wlan/ssid: SuperSSID
 | 
			
		||||
radio.0/wlan.13/add-wlan/wep-encryption: false
 | 
			
		||||
radio.0/wlan.13/add-wlan/wep-key: .x1978b2c072f90ff26e4e24c806
 | 
			
		||||
radio.0/wlan.13/add-wlan/wep-key-index: 1
 | 
			
		||||
radio.0/wlan.13/add-wlan/wlan-capability: 1057
 | 
			
		||||
radio.0/wlan.13/add-wlan/wlan-id: 13
 | 
			
		||||
radio.1/capwap/admin-state: 1 - enabled
 | 
			
		||||
radio.1/capwap/decryption-error-report-period: 120
 | 
			
		||||
radio.1/capwap/operational-state/cause: Normal
 | 
			
		||||
radio.1/capwap/operational-state/state: enabled
 | 
			
		||||
radio.1/capwap80211/rate-set: .x8c129824b048606c
 | 
			
		||||
radio.1/capwap80211/tx-power/@cisco/cfg-type: 1 - global
 | 
			
		||||
radio.1/capwap80211/tx-power/current-tx-power: 6
 | 
			
		||||
radio.1/capwap80211/wtp-radio-information: 2
 | 
			
		||||
radio.1/cisco/air-space-capability: 0
 | 
			
		||||
radio.1/cisco/antenna-payload/802-11n-rx-antennas: 7
 | 
			
		||||
radio.1/cisco/antenna-payload/802-11n-tx-antennas: 0
 | 
			
		||||
radio.1/cisco/antenna-payload/802-11n-rx-antennas: 3
 | 
			
		||||
radio.1/cisco/antenna-payload/802-11n-tx-antennas: 7
 | 
			
		||||
radio.1/cisco/antenna-payload/antenna-1: 1
 | 
			
		||||
radio.1/cisco/antenna-payload/antenna-2: 1
 | 
			
		||||
radio.1/cisco/antenna-payload/antenna-mode: 3
 | 
			
		||||
radio.1/cisco/antenna-payload/diversity-selection: 255
 | 
			
		||||
radio.1/cisco/antenna-payload/number-of-antennas: 2
 | 
			
		||||
radio.1/cisco/antenna-payload/unknown: 3
 | 
			
		||||
radio.1/cisco/antenna-payload/unknown: 0
 | 
			
		||||
radio.1/cisco/channel-power: .x0808102408221c16100a04fefe2808221c16100a04fefe2c08221c16100a04fefe3008221c16100a04fefe3408221c16100a04fefe3808221c16100a04fefe3c08221c16100a04fefe4008221c16100a04fefe6408221c16100a04fefe6808221c16100a04fefe6c08221c16100a04fefe7008221c16100a04fefe7408221c16100a04fefe8408221c16100a04fefe8808221c16100a04fefe8c08221c16100a04fefe
 | 
			
		||||
radio.1/cisco/elem145: .x01
 | 
			
		||||
radio.1/cisco/elem15: .x012407ffffffce000000
 | 
			
		||||
radio.1/cisco/elem15/cfg-type: 1 - global
 | 
			
		||||
radio.1/cisco/elem15/channel: 56
 | 
			
		||||
radio.1/cisco/elem15/rest: .x07ffffffce010001
 | 
			
		||||
radio.1/cisco/elem153: .x00
 | 
			
		||||
radio.1/cisco/elem156: .x020100
 | 
			
		||||
radio.1/cisco/elem19: .xc0a800a10001000bc0a800a110000101003ccd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000024282c3034383c4064686c707484888c01010101010101010101010101010101
 | 
			
		||||
radio.1/cisco/elem16: .x0c121824
 | 
			
		||||
radio.1/cisco/elem19: .xc0a800a10001000bc0a800a110000101001ecd774fc43bd27db633509934957d3acb000000000000000052464d000000000000000000000000000000000000000000000000000000000024282c3034383c4064686c707484888c01010101010101010101010101010101
 | 
			
		||||
radio.1/cisco/elem22: .x1000b4003224282c3034383c4064686c707484888c
 | 
			
		||||
radio.1/cisco/elem24: .x003c000c
 | 
			
		||||
radio.1/cisco/elem47: .x0100000000000000000000000000000000
 | 
			
		||||
radio.1/cisco/elem48: .x00
 | 
			
		||||
radio.1/cisco/elem81: .x00000000010101010a001e0a02050fbfffbfff0a00
 | 
			
		||||
radio.1/cisco/lwelem11: .x00010203
 | 
			
		||||
radio.1/cisco/lwelem27: .x186e0000000000000000000000000000ffff00000000000000
 | 
			
		||||
radio.1/cisco/lwelem28: .x0303020202000000000000000000000000000000000000000000313f01
 | 
			
		||||
radio.1/cisco/lwelem29: .x00018803000000000200002803
 | 
			
		||||
radio.1/cisco/lwelem33: .x00
 | 
			
		||||
radio.1/cisco/lwelem48: .x01055a0101a6c405b06432b03232
 | 
			
		||||
radio.1/cisco/lwelem9: .x0100000000000000000000000000000000
 | 
			
		||||
@ -169,9 +260,11 @@ radio.1/cisco/multi-domain-capability/first-channel: 36
 | 
			
		||||
radio.1/cisco/multi-domain-capability/max-tx-power-level: 20
 | 
			
		||||
radio.1/cisco/multi-domain-capability/number-of-channels: 4
 | 
			
		||||
radio.1/cisco/multi-domain-capability/reserved: 1
 | 
			
		||||
radio.1/cisco/radio-module-info/descr: 802.11N 5GHz Radio
 | 
			
		||||
radio.1/cisco/radio-module-info/name: UNKNOWN
 | 
			
		||||
radio.1/cisco/radio-module-info/serial: FOC14053DBQ
 | 
			
		||||
radio.1/cisco/radio-module-info/type: Dot11Radio1
 | 
			
		||||
radio.1/cisco/tx-power-levels: .x070011000e000b000800050002ffff0000
 | 
			
		||||
radio.1/cisco/tx-power/current-tx-power: 1
 | 
			
		||||
radio.1/cisco/tx-power/reserved: 1
 | 
			
		||||
radio.1/cisco/wtp-radio-config/beacon-period: 100
 | 
			
		||||
radio.1/cisco/wtp-radio-config/bss-id: .x04fe7f499b90
 | 
			
		||||
radio.1/cisco/wtp-radio-config/cfg-period: 4
 | 
			
		||||
@ -181,40 +274,47 @@ radio.1/cisco/wtp-radio-config/country-str1: "DE "
 | 
			
		||||
radio.1/cisco/wtp-radio-config/country-str2: "DE "
 | 
			
		||||
radio.1/cisco/wtp-radio-config/occupancy-limit: 100
 | 
			
		||||
radio.1/cisco/wtp-radio-config/reg: 167772416
 | 
			
		||||
radio.1/decryption-error-report-period: 120
 | 
			
		||||
radio.1/operational-state/cause: Normal
 | 
			
		||||
radio.1/operational-state/state: enabled
 | 
			
		||||
radio.1/rate_set: .x8c129824b048606c
 | 
			
		||||
radio.1/wtp-radio-information: 2
 | 
			
		||||
radio.1/wlan.1/add-wlan/aironet-ie: true
 | 
			
		||||
radio.1/wlan.1/add-wlan/broadcast-ssid: true
 | 
			
		||||
radio.1/wlan.1/add-wlan/dtim-period: 1
 | 
			
		||||
radio.1/wlan.1/add-wlan/encryption-policy: 4
 | 
			
		||||
radio.1/wlan.1/add-wlan/hreap-local-switch: 0
 | 
			
		||||
radio.1/wlan.1/add-wlan/profile-name: tubeC
 | 
			
		||||
radio.1/wlan.1/add-wlan/qos: 0
 | 
			
		||||
radio.1/wlan.1/add-wlan/radio-id: 1
 | 
			
		||||
radio.1/wlan.1/add-wlan/scan-defer-period: 28784
 | 
			
		||||
radio.1/wlan.1/add-wlan/scan-defer-time: 100
 | 
			
		||||
radio.1/wlan.1/add-wlan/session-timout: 1800
 | 
			
		||||
radio.1/wlan.1/add-wlan/ssid: tubeC
 | 
			
		||||
radio.1/wlan.1/add-wlan/wep-encryption: false
 | 
			
		||||
radio.1/wlan.1/add-wlan/wep-key: .x166ad266a0adea9f140cadf37f
 | 
			
		||||
radio.1/wlan.1/add-wlan/wep-key-index: 1
 | 
			
		||||
radio.1/wlan.1/add-wlan/wlan-capability: 17
 | 
			
		||||
radio.1/wlan.1/add-wlan/wlan-id: 1
 | 
			
		||||
radio.1/wlan.13/add-wlan/aironet-ie: true
 | 
			
		||||
radio.1/wlan.13/add-wlan/broadcast-ssid: true
 | 
			
		||||
radio.1/wlan.13/add-wlan/dtim-period: 19
 | 
			
		||||
radio.1/wlan.13/add-wlan/encryption-policy: 1
 | 
			
		||||
radio.1/wlan.13/add-wlan/hreap-local-switch: 16
 | 
			
		||||
radio.1/wlan.13/add-wlan/profile-name: SuerWLAN
 | 
			
		||||
radio.1/wlan.13/add-wlan/qos: 0
 | 
			
		||||
radio.1/wlan.13/add-wlan/radio-id: 1
 | 
			
		||||
radio.1/wlan.13/add-wlan/scan-defer-period: 15420
 | 
			
		||||
radio.1/wlan.13/add-wlan/scan-defer-time: 100
 | 
			
		||||
radio.1/wlan.13/add-wlan/session-timout: 1800
 | 
			
		||||
radio.1/wlan.13/add-wlan/ssid: SuperSSID
 | 
			
		||||
radio.1/wlan.13/add-wlan/wep-encryption: false
 | 
			
		||||
radio.1/wlan.13/add-wlan/wep-key: .x166ad266a0adea9f140cadf37f
 | 
			
		||||
radio.1/wlan.13/add-wlan/wep-key-index: 1
 | 
			
		||||
radio.1/wlan.13/add-wlan/wlan-capability: 1
 | 
			
		||||
radio.1/wlan.13/add-wlan/wlan-id: 13
 | 
			
		||||
radio.2/cisco/lwelem33: .x00
 | 
			
		||||
radio.255/admin-state: 1 - enabled
 | 
			
		||||
radio.255/operational-state/cause: Normal
 | 
			
		||||
radio.255/operational-state/state: enabled
 | 
			
		||||
session-id: .xd328ad6c
 | 
			
		||||
statistics-timer: 180
 | 
			
		||||
wtp-board-data/board-id: .x0000
 | 
			
		||||
wtp-board-data/mac-address: .x0800276edf58
 | 
			
		||||
wtp-board-data/model-no: "AIR-LAP1142N-E-K9   "
 | 
			
		||||
wtp-board-data/revision: A0
 | 
			
		||||
wtp-board-data/serial-no: FCZ1406W232
 | 
			
		||||
wtp-board-data/vendor: 4232704
 | 
			
		||||
wtp-descriptor/bootloader/vendor: 4232704
 | 
			
		||||
wtp-descriptor/bootloader/version: .x0c041200
 | 
			
		||||
wtp-descriptor/hardware/vendor: 4232704
 | 
			
		||||
wtp-descriptor/hardware/version: .x01000000
 | 
			
		||||
wtp-descriptor/max-radios: 2
 | 
			
		||||
wtp-descriptor/radios-in-use: 2
 | 
			
		||||
wtp-descriptor/software/vendor: 4232704
 | 
			
		||||
wtp-descriptor/software/version: .x07007400
 | 
			
		||||
wtp-fallback: 1
 | 
			
		||||
wtp-frame-tunnel-mode: 4
 | 
			
		||||
wtp-mac-type: 1 - Split MAC
 | 
			
		||||
wtp-name: SoftWTP-Tube
 | 
			
		||||
wtp-reboot-statistics/ac-initiated-count: 1
 | 
			
		||||
wtp-reboot-statistics/hw-failure-count: 0
 | 
			
		||||
wtp-reboot-statistics/last-failure-type: 1
 | 
			
		||||
wtp-reboot-statistics/link-failure-count: 0
 | 
			
		||||
wtp-reboot-statistics/other-failure-count: 17
 | 
			
		||||
wtp-reboot-statistics/reboot-count: 0
 | 
			
		||||
wtp-reboot-statistics/sw-failure-count: 0
 | 
			
		||||
wtp-reboot-statistics/unknown-failure-count: 0
 | 
			
		||||
radio.255/capwap/admin-state: 1 - enabled
 | 
			
		||||
radio.255/capwap/operational-state/cause: Normal
 | 
			
		||||
radio.255/capwap/operational-state/state: enabled
 | 
			
		||||
radio.255/cisco/radio-module-info/descr: Cisco Aironet 1140 Series (IEEE 802.11n) Access Point
 | 
			
		||||
radio.255/cisco/radio-module-info/name: AIR-LAP1142N-E-K9 A0
 | 
			
		||||
radio.255/cisco/radio-module-info/serial: FCZ1406W232
 | 
			
		||||
radio.255/cisco/radio-module-info/type: AP1140
 | 
			
		||||
wfat-rem/bind-addr: 0.0.0.0
 | 
			
		||||
wfat-rem/discovery-addr: 255.255.255.255
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,7 @@
 | 
			
		||||
static int config_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
 | 
			
		||||
{
 | 
			
		||||
	cw_dbg(DBG_X,"*** Configurations Status Response received ****");
 | 
			
		||||
	cw_cfg_copy(params->cfg, params->conn->global_cfg);
 | 
			
		||||
	cw_cfg_copy(params->cfg, params->conn->global_cfg,DBG_CFG_UPDATES,"GlbalCfg");
 | 
			
		||||
	cw_cfg_save(bootcfg.cfgfilename, params->conn->global_cfg,
 | 
			
		||||
			"#\n# This file is igenerated  by WAT\n# If you edit this, your cahnges might be overwritten\n#\n");  
 | 
			
		||||
	cw_dbg(DBG_X,"*** Cnofig Saved ***");
 | 
			
		||||
@ -31,7 +31,9 @@ int configure(struct cw_Conn * conn)
 | 
			
		||||
	cw_conn_set_msg_cb(conn,CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,config_cb);
 | 
			
		||||
	
 | 
			
		||||
	int rc;
 | 
			
		||||
	cw_cfg_copy(conn->global_cfg,conn->update_cfg);
 | 
			
		||||
	cw_cfg_copy(conn->global_cfg,conn->update_cfg,0,"");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST);
 | 
			
		||||
	cw_cfg_clear(conn->update_cfg);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -45,9 +45,9 @@ static struct cw_DiscoveryResults * run_discovery(struct cw_Conn *conn)
 | 
			
		||||
	results = cw_discovery_results_create();
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	min = cw_cfg_get_byte(conn->global_cfg,"capwap-timers/min-discovery-interval",
 | 
			
		||||
	min = cw_cfg_get_byte(conn->global_cfg,"capwap/timers/min-discovery-interval",
 | 
			
		||||
					CAPWAP_MIN_DISCOVERY_INTERVAL);
 | 
			
		||||
	max = cw_cfg_get_byte(conn->global_cfg,"capwap-timers/max-discovery-interval",
 | 
			
		||||
	max = cw_cfg_get_byte(conn->global_cfg,"capwap/timers/max-discovery-interval",
 | 
			
		||||
					CAPWAP_MAX_DISCOVERY_INTERVAL);
 | 
			
		||||
 | 
			
		||||
	delay = cw_randint(min,max);
 | 
			
		||||
@ -214,7 +214,8 @@ struct cw_DiscoveryResults * cw_run_discovery(struct cw_Conn *conn, const char *
 | 
			
		||||
			if (brc < 0) {
 | 
			
		||||
				cw_log(LOG_ERR, "Can't bind to %s",
 | 
			
		||||
				       sock_addr2str(&bind_address, sock_buf));
 | 
			
		||||
				return 0;
 | 
			
		||||
				results = 0;
 | 
			
		||||
				goto errX;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -233,6 +234,7 @@ struct cw_DiscoveryResults * cw_run_discovery(struct cw_Conn *conn, const char *
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
errX:
 | 
			
		||||
 | 
			
		||||
	freeaddrinfo(res0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,9 @@
 | 
			
		||||
#include "wtp.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int run_join(struct cw_Conn *conn);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
#define acinfo_log acinfo_log_
 | 
			
		||||
 | 
			
		||||
@ -107,8 +110,8 @@ static int run_join_d(struct cw_Conn * conn, struct sockaddr *sa,cw_Cfg_t * cfg)
 | 
			
		||||
	int rc;
 | 
			
		||||
 | 
			
		||||
	/* Check if we support the same auth methods as the AC */
 | 
			
		||||
	lsec = cw_cfg_get_byte(conn->global_cfg,"ac-descriptor/security",255);
 | 
			
		||||
	rsec = cw_cfg_get_byte(cfg,"ac-descriptor/security",0);
 | 
			
		||||
	lsec = cw_cfg_get_byte(conn->global_cfg,"capwap/ac-descriptor/security",255);
 | 
			
		||||
	rsec = cw_cfg_get_byte(cfg,"capwap/ac-descriptor/security",0);
 | 
			
		||||
	if ((lsec & rsec) == 0){
 | 
			
		||||
		cw_log(LOG_ERR, "Can't establish DTLS with AC, my sec: %d, remote sec %d",lsec,rsec);
 | 
			
		||||
		return 0;
 | 
			
		||||
@ -213,7 +216,7 @@ int join(struct cw_Conn * conn, struct cw_DiscoveryResults * results)
 | 
			
		||||
		sock_setport((struct sockaddr*)&sockaddr,5246);
 | 
			
		||||
 | 
			
		||||
		cw_cfg_clear(conn->remote_cfg);
 | 
			
		||||
		cw_cfg_copy(e->cfg,conn->remote_cfg);
 | 
			
		||||
		cw_cfg_copy(e->cfg,conn->remote_cfg,0,"");
 | 
			
		||||
		rc = run_join_d(conn,(struct sockaddr*)(&sockaddr),e->cfg);
 | 
			
		||||
		if (rc)
 | 
			
		||||
			return 1;
 | 
			
		||||
 | 
			
		||||
@ -26,7 +26,6 @@
 | 
			
		||||
#include "wtp_interface.h"
 | 
			
		||||
 | 
			
		||||
#include "cw/dbg.h"
 | 
			
		||||
#include "cfg.h"
 | 
			
		||||
 | 
			
		||||
int update =1;
 | 
			
		||||
 | 
			
		||||
@ -34,12 +33,12 @@ int update =1;
 | 
			
		||||
 | 
			
		||||
static int update_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
 | 
			
		||||
{
 | 
			
		||||
	cw_dbg(DBG_X," **** Configuration Update Request Received ***");
 | 
			
		||||
//	cw_dbg(DBG_X," **** Configuration Update Request Received ***");
 | 
			
		||||
//	cw_cfg_dump(params->conn->global_cfg);
 | 
			
		||||
	cw_cfg_copy(params->cfg, params->conn->global_cfg);
 | 
			
		||||
	cw_cfg_copy(params->cfg, params->conn->global_cfg,DBG_CFG_UPDATES,"GlobalCfg");
 | 
			
		||||
	cw_cfg_save(bootcfg.cfgfilename, params->conn->global_cfg,
 | 
			
		||||
			"#\n# This file is igenerated  by WAT\n# If you edit this, your cahnges might be overwritten\n#\n");  
 | 
			
		||||
	cw_dbg(DBG_X," **** Configuration Update Request Received Saved ***");
 | 
			
		||||
//	cw_dbg(DBG_X," **** Configuration Update Request Received Saved ***");
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -98,7 +97,7 @@ int run(struct cw_Conn * conn)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		while (!cw_timer_timeout(timer) && conn->capwap_state == CAPWAP_STATE_RUN) {
 | 
			
		||||
			mavl_del_all(conn->remote_cfg);
 | 
			
		||||
			cw_cfg_clear(conn->remote_cfg);
 | 
			
		||||
			rc = cw_read_messages(conn);
 | 
			
		||||
			if (rc < 0 && errno == EAGAIN) {
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
@ -84,11 +84,13 @@ int main (int argc, char **argv)
 | 
			
		||||
	struct cw_Mod * mod;
 | 
			
		||||
	struct cw_MsgSet * msgset=NULL;
 | 
			
		||||
	struct cw_Conn * conn=NULL;
 | 
			
		||||
	FILE * file;
 | 
			
		||||
	//FILE * file;
 | 
			
		||||
	cw_Cfg_t * global_cfg =NULL;
 | 
			
		||||
	const cw_Type_t ** ti;
 | 
			
		||||
	//const cw_Type_t ** ti;
 | 
			
		||||
	int i;
 | 
			
		||||
	int rc;	
 | 
			
		||||
	int rc=EXIT_FAILURE;	
 | 
			
		||||
	struct cw_DiscoveryResults * results;
 | 
			
		||||
	const char *bind_addr, *disc_addr;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	bootcfg.nmods=0;
 | 
			
		||||
@ -101,6 +103,8 @@ int main (int argc, char **argv)
 | 
			
		||||
		bootcfg.modnames[1]="capwap80211";
 | 
			
		||||
		bootcfg.nmods=2;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cw_dbg_set_level(DBG_X,0);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	/* create an empty message set */
 | 
			
		||||
@ -140,6 +144,11 @@ int main (int argc, char **argv)
 | 
			
		||||
	conn->dtls_mtu = 1200;
 | 
			
		||||
	conn->msgset=msgset;
 | 
			
		||||
	conn->global_cfg = global_cfg;
 | 
			
		||||
 | 
			
		||||
	conn->cfg_list[0]=conn->update_cfg;
 | 
			
		||||
	conn->cfg_list[1]=conn->local_cfg;
 | 
			
		||||
	conn->cfg_list[2]=conn->global_cfg;
 | 
			
		||||
	conn->cfg_list[3]=NULL;
 | 
			
		||||
	
 | 
			
		||||
	conn->role = CW_ROLE_WTP;
 | 
			
		||||
	conn->wbid=1;
 | 
			
		||||
@ -166,14 +175,16 @@ int main (int argc, char **argv)
 | 
			
		||||
	conn->base_rmac = get_base_rmac();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*cw_run_discovery(conn, "255.255.255.255","192.168.56.1", &dis);*/
 | 
			
		||||
/*	cw_run_discovery(conn, "255.255.255.255",NULL, &dis);*/
 | 
			
		||||
	bind_addr = cw_cfg_get(global_cfg,"wfat/bind-addr","0.0.0.0");
 | 
			
		||||
	disc_addr = cw_cfg_get(global_cfg,"wfat/discovery-addr","255.255.255.255");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	results = cw_run_discovery(conn,disc_addr,bind_addr);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (!results)
 | 
			
		||||
		goto errX;
 | 
			
		||||
 | 
			
		||||
	struct cw_DiscoveryResulsts * results;
 | 
			
		||||
//	cw_run_discovery(conn, "192.168.0.162","192.168.0.14", &dis);
 | 
			
		||||
	//cw_run_discovery(conn, "255.255.255.255","192.168.0.14", &dis);
 | 
			
		||||
//	cw_run_discovery(conn, "192.168.0.255","192.168.0.14", &dis);
 | 
			
		||||
	results = cw_run_discovery(conn, "255.255.255.255","192.168.0.14");
 | 
			
		||||
 | 
			
		||||
	if (!join(conn,results)){
 | 
			
		||||
		cw_discovery_results_destroy(results); 
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user