changes for actubent - not compiling!
FossilOrigin-Name: adf99bdc2ee784a4acf4066b90c33fb1e6124e8c49c255d3fd5011bb33852d52
This commit is contained in:
parent
ca22c44590
commit
d2d1be3346
@ -4,8 +4,8 @@
|
||||
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
||||
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="Yes"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||
<BuildMatrix>
|
||||
|
@ -314,6 +314,11 @@
|
||||
<File Name="src/cw/cw_type_word.c"/>
|
||||
<File Name="src/cw/cw_types.h"/>
|
||||
<File Name="src/cw/cw_type_dword.c"/>
|
||||
<File Name="src/cw/mavl_cmp_dword.c"/>
|
||||
<File Name="src/cw/mavl_free_bin.c"/>
|
||||
<File Name="src/cw/debug.h"/>
|
||||
<File Name="src/cw/debug.c"/>
|
||||
<File Name="src/cw/mavl_get_ptr.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Description/>
|
||||
|
@ -98,7 +98,32 @@ extern void test_sets();
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
/* char data[100];
|
||||
mavl_t im;
|
||||
mavldata_t val,itt;
|
||||
mavliter_t myit;
|
||||
|
||||
im = mavl_create(mavl_cmp_dword,NULL);
|
||||
|
||||
for (itt.dword=100; itt.dword>0; itt.dword--){
|
||||
printf("Copunting: %d\n",itt.dword);
|
||||
mavl_add(im,&itt);
|
||||
}
|
||||
|
||||
mavliter_init(&myit,im);
|
||||
mavliter_foreach(&myit){
|
||||
union mavldata * result;
|
||||
result = mavliter_get(&myit);
|
||||
printf("Got Value %d\n",result->dword);
|
||||
}
|
||||
|
||||
mavl_destroy(im);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int rc = 0;
|
||||
|
||||
/* parse arguments */
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include "cw/mbag.h"
|
||||
#include "cw/log.h"
|
||||
#include "cw/dbg.h"
|
||||
#include "cw/capwap_items.h"
|
||||
|
@ -428,9 +428,9 @@ void radios_to_sql(struct conn *conn)
|
||||
MAVLITER_DEFINE(it, conn->radios);
|
||||
mavliter_foreach(&it) {
|
||||
struct mbag_item * i = mavliter_get(&it);
|
||||
int rid = i->iid;
|
||||
int rid = i->u1.iid;
|
||||
|
||||
radio_to_sql(conn,wtp_id,rid,i->data);
|
||||
radio_to_sql(conn,wtp_id,rid,i->u2.data);
|
||||
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* @brief Implementation of methods for actionlists.
|
||||
*/
|
||||
|
||||
|
||||
#include "mbag.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "mavl.h"
|
||||
#include "conn.h"
|
||||
#include "mbag.h"
|
||||
/*#include "mbag.h"*/
|
||||
#include "strheap.h"
|
||||
#include "intavltree.h"
|
||||
#include "item.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "mbag.h"
|
||||
#include <errno.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "item.h"
|
||||
#include "capwap80211_items.h"
|
||||
#include "capwap80211_types.h"
|
||||
|
@ -11,7 +11,7 @@ static int to_str(void *item,char *dst)
|
||||
{
|
||||
mbag_item_t *it= item;
|
||||
|
||||
uint8_t *data = (uint8_t*)it->data;
|
||||
uint8_t *data = (uint8_t*)it->u2.data;
|
||||
int n=*data;
|
||||
data++;
|
||||
|
||||
@ -83,7 +83,7 @@ static struct mbag_item * from_str(const char *src)
|
||||
*data=nrates;
|
||||
memcpy(data+1,rates,nrates);
|
||||
|
||||
item->data=data;
|
||||
item->u2.data=data;
|
||||
|
||||
|
||||
return item;
|
||||
@ -103,14 +103,14 @@ static struct mbag_item * get(const uint8_t *src,int len)
|
||||
}
|
||||
*data=len;
|
||||
memcpy(data+1,src,len);
|
||||
item->data=data;
|
||||
item->u2.data=data;
|
||||
return item;
|
||||
}
|
||||
|
||||
static int put(struct mbag_item *i,uint8_t *dst)
|
||||
{
|
||||
int l=*((uint8_t*)(i->data));
|
||||
memcpy(dst,i->data+1,l);
|
||||
int l=*((uint8_t*)(i->u2.data));
|
||||
memcpy(dst,i->u2.data+1,l);
|
||||
return l;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "capwap.h"
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "item.h"
|
||||
|
||||
#include "capwap_items.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
|
||||
struct capwap_msg * capwap_msg_new()
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
|
||||
struct cw_strlist_elem capwap_strings_board[] = {
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
|
||||
struct cw_strlist_elem capwap_strings_elem[] = {
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "capwap80211.h"
|
||||
#include "strlist.h"
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
* @file
|
||||
* @brief Definition of CAPWAP Message Strings
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
|
||||
/**
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
|
||||
struct cw_strlist_elem capwap_strings_state[] = {
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "vendors.h"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "cipwap.h"
|
||||
#include "capwap_cisco.h"
|
||||
|
@ -95,8 +95,8 @@ int cw_out_cisco_wtp_radio_cfg(struct conn *conn, struct cw_action_out *a, uint8
|
||||
continue;
|
||||
}
|
||||
// l+=cw_put_elem_radio_info(dst+l,i->id,i->data);
|
||||
l+=cw_put_elem_cisco_radio_cfg(dst+l,i->iid,i->data);
|
||||
l+=cw_put_elem_cisco_ap_regulatory_domain(dst+l,i->iid,i->data);
|
||||
l+=cw_put_elem_cisco_radio_cfg(dst+l,i->u1.iid,i->u2.data);
|
||||
l+=cw_put_elem_cisco_ap_regulatory_domain(dst+l,i->u1.iid,i->u2.data);
|
||||
|
||||
}
|
||||
return l;
|
||||
@ -147,7 +147,7 @@ int cw_radio_cisco_set_state(struct conn * conn, uint8_t *data, int len, int cau
|
||||
MAVLITER_DEFINE(it,conn->radios);
|
||||
mavliter_foreach(&it){
|
||||
mbag_item_t *i = mavliter_get(&it);
|
||||
cw_radio_set_admin_state(conn->radios,i->iid,state,cause);
|
||||
cw_radio_set_admin_state(conn->radios,i->u1.iid,state,cause);
|
||||
|
||||
}
|
||||
return 1;
|
||||
|
@ -32,12 +32,13 @@
|
||||
#include "fragman.h"
|
||||
#include "cwmsg.h"
|
||||
|
||||
#include "action.h"
|
||||
/*#include "action.h"*/
|
||||
|
||||
/*#include "mbag.h"*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include "intavltree.h"
|
||||
|
||||
#include "mbag.h"
|
||||
|
||||
#include "mod.h"
|
||||
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
#include "capwap.h"
|
||||
|
||||
#include "conn.h"
|
||||
|
||||
#include "mavl.h"
|
||||
@ -13,9 +15,9 @@ void conn_clear_upd(struct conn *conn, int merge)
|
||||
|
||||
mavliter_foreach(&it){
|
||||
struct mbag_item * ruitem = mavliter_get(&it);
|
||||
mavl_t radio_upd = ruitem->data;
|
||||
mavl_t radio_upd = ruitem->u2.data;
|
||||
|
||||
mbag_t radio = mbag_i_get_mbag(conn->radios,ruitem->iid,NULL);
|
||||
mbag_t radio = mbag_i_get_mbag(conn->radios,ruitem->u1.iid,NULL);
|
||||
if (radio){
|
||||
mavl_merge(radio,radio_upd);
|
||||
}
|
||||
|
@ -26,9 +26,10 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "capwap.h"
|
||||
#include "conn.h"
|
||||
#include "sock.h"
|
||||
#include "capwap.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
#include "sock.h"
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
#include "capwap.h"
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "lwapp.h"
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "dbg.h"
|
||||
#include "conn.h"
|
||||
#include "sock.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include <time.h>
|
||||
#include "conn.h"
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
|
||||
static int conn_q_recv_packet_(struct conn * conn, uint8_t * buffer,int len,int peek)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
|
||||
#include "sock.h"
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include "sock.h"
|
||||
#include "capwap.h"
|
||||
|
||||
#include "conn.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include "sock.h"
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
#include "connlist.h"
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "cwmsg.h"
|
||||
#include "conn.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "log.h"
|
||||
#include "mbag.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "intavltree.h"
|
||||
#include "dbg.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "capwap_items.h"
|
||||
#include "cw.h"
|
||||
|
@ -28,7 +28,7 @@ int cw_detect_capwap(struct conn *conn)
|
||||
|
||||
mbag_item_t * item = mbag_get(is,CW_ITEM_WTP_SOFTWARE_VERSION);
|
||||
if (item) {
|
||||
bstrv_t s = item->data;
|
||||
bstrv_t s = item->u2.data;
|
||||
uint32_t v = bstrv_get_vendor_id(s);
|
||||
|
||||
switch(v) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "capwap_items.h"
|
||||
#include "intavltree.h"
|
||||
|
@ -17,8 +17,8 @@ int cw_in_check_generic_resp(struct conn *conn, struct cw_action_in *a, uint8_t
|
||||
mbag_item_t * result = mbag_get(conn->incomming,CW_ITEM_RESULT_CODE);
|
||||
|
||||
if (result ) {
|
||||
if (!cw_rcok(result->dword)){
|
||||
return result->dword;
|
||||
if (!cw_rcok(result->u2.dword)){
|
||||
return result->u2.dword;
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ int cw_in_check_generic_resp(struct conn *conn, struct cw_action_in *a, uint8_t
|
||||
|
||||
/* if we hava a result code, return it */
|
||||
if ( result ) {
|
||||
return result->dword;
|
||||
return result->u2.dword;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
@ -22,16 +23,16 @@ int cw_in_check_img_data_req_ac(struct conn *conn, struct cw_action_in *a, uint8
|
||||
|
||||
struct mbag_item *i = mbag_get(conn->incomming,CW_ITEM_IMAGE_IDENTIFIER);
|
||||
if (i) {
|
||||
uint32_t vendor_id = bstrv_get_vendor_id(i->data);
|
||||
uint32_t vendor_id = bstrv_get_vendor_id(i->u2.data);
|
||||
|
||||
const char * image_dir;
|
||||
image_dir = mbag_get_str(conn->local,CW_ITEM_AC_IMAGE_DIR,"./img");
|
||||
|
||||
char * image_filename = malloc(6+bstrv_len(i->data)+1+strlen(image_dir));
|
||||
char * image_filename = malloc(6+bstrv_len(i->u2.data)+1+strlen(image_dir));
|
||||
if (!image_filename)
|
||||
return CAPWAP_RESULT_IMAGE_DATA_ERROR;
|
||||
|
||||
sprintf(image_filename,"%s%04X/%s",image_dir,vendor_id,bstrv_data(i->data));
|
||||
sprintf(image_filename,"%s%04X/%s",image_dir,vendor_id,bstrv_data(i->u2.data));
|
||||
|
||||
|
||||
FILE *infile = fopen(image_filename,"rb");
|
||||
|
@ -33,16 +33,16 @@ int cw_in_check_img_data_req_wtp(struct conn *conn, struct cw_action_in *a, uint
|
||||
|
||||
struct mbag_item *i = mbag_get(conn->incomming,CW_ITEM_IMAGE_IDENTIFIER);
|
||||
if (i) {
|
||||
uint32_t vendor_id = bstrv_get_vendor_id(i->data);
|
||||
uint32_t vendor_id = bstrv_get_vendor_id(i->u2.data);
|
||||
|
||||
const char * image_dir;
|
||||
image_dir = mbag_get_str(conn->local,CW_ITEM_AC_IMAGE_DIR,"./img");
|
||||
|
||||
char * image_filename = malloc(6+bstrv_len(i->data)+1+strlen(image_dir));
|
||||
char * image_filename = malloc(6+bstrv_len(i->u2.data)+1+strlen(image_dir));
|
||||
if (!image_filename)
|
||||
return CAPWAP_RESULT_IMAGE_DATA_ERROR;
|
||||
|
||||
sprintf(image_filename,"%s%04X/%s",image_dir,vendor_id,bstrv_data(i->data));
|
||||
sprintf(image_filename,"%s%04X/%s",image_dir,vendor_id,bstrv_data(i->u2.data));
|
||||
|
||||
|
||||
FILE *infile = fopen(image_filename,"rb");
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
@ -26,7 +27,7 @@ int cw_in_check_img_data_resp(struct conn *conn, struct cw_action_in *a, uint8_t
|
||||
mbag_item_t * iresult = mbag_get(conn->incomming, CW_ITEM_RESULT_CODE);
|
||||
|
||||
if ( iresult ) {
|
||||
return iresult->dword;
|
||||
return iresult->u2.dword;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -15,8 +15,8 @@ int cw_in_check_join_resp(struct conn *conn, struct cw_action_in *a, uint8_t * d
|
||||
|
||||
mbag_item_t * jresult = mbag_get(conn->incomming,CW_ITEM_RESULT_CODE);
|
||||
if (jresult ) {
|
||||
if (!cw_rcok(jresult->dword)){
|
||||
return jresult->dword;
|
||||
if (!cw_rcok(jresult->u2.dword)){
|
||||
return jresult->u2.dword;
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ int cw_in_check_join_resp(struct conn *conn, struct cw_action_in *a, uint8_t * d
|
||||
|
||||
|
||||
if ( jresult ) {
|
||||
return jresult->dword;
|
||||
return jresult->u2.dword;
|
||||
}
|
||||
|
||||
/* set result code to ok and change to configure state */
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "dbg.h"
|
||||
#include "mbag.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
|
@ -27,7 +27,7 @@ int cw_out_80211_supported_rates(struct conn *conn, struct cw_action_out *a, uin
|
||||
if ( i->type != MBAG_MBAG ) {
|
||||
continue;
|
||||
}
|
||||
l+=cw_put_elem_80211_supported_rates(dst+l,i->iid,i->data);
|
||||
l+=cw_put_elem_80211_supported_rates(dst+l,i->u1.iid,i->u2.data);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ int cw_out_image_data(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
FILE *infile = item->data;
|
||||
FILE *infile = item->u2.data;
|
||||
if (infile==NULL){
|
||||
cw_log(LOG_ERR,"Image Data Request infile = NULL");
|
||||
return 0;
|
||||
|
@ -15,7 +15,7 @@ int cw_out_radio_administrative_states(struct conn *conn, struct cw_action_out *
|
||||
if ( i->type != MBAG_MBAG ) {
|
||||
continue;
|
||||
}
|
||||
l+=cw_put_elem_radio_administrative_state(dst+l,i->iid,i->data);
|
||||
l+=cw_put_elem_radio_administrative_state(dst+l,i->u1.iid,i->u2.data);
|
||||
|
||||
}
|
||||
return l;
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
|
||||
#include "mbag.h"
|
||||
#include "action.h"
|
||||
#include "cw.h"
|
||||
#include "cw/dbg.h"
|
||||
@ -26,15 +26,15 @@ cw_dbg(DBG_X,"Radio Generic out %s",a->item_id);
|
||||
|
||||
|
||||
|
||||
struct mbag_item * item = mbag_get(radio->data,a->item_id);
|
||||
struct mbag_item * item = mbag_get(radio->u2.data,a->item_id);
|
||||
if (!item){
|
||||
cw_dbg(DBG_X,"Not found! %s for rid %d",a->item_id,radio->iid);
|
||||
cw_dbg(DBG_X,"Not found! %s for rid %d",a->item_id,radio->u1.iid);
|
||||
continue;
|
||||
}
|
||||
int len=0;
|
||||
len += cw_put_byte(d+start,radio->iid);
|
||||
len += cw_put_byte(d+start,radio->u1.iid);
|
||||
|
||||
cw_dbg(DBG_X, "Radio generic out '%s' fro rid %d",a->item_id,radio->iid);
|
||||
cw_dbg(DBG_X, "Radio generic out '%s' fro rid %d",a->item_id,radio->u1.iid);
|
||||
len += cw_put_mbag_item(d + start+1, item);
|
||||
|
||||
if (a->vendor_id)
|
||||
|
@ -32,7 +32,7 @@ int cw_out_radio_infos(struct conn *conn, struct cw_action_out *a, uint8_t * dst
|
||||
if ( i->type != MBAG_MBAG ) {
|
||||
continue;
|
||||
}
|
||||
l+=cw_put_elem_radio_info(dst+l,i->iid,i->data);
|
||||
l+=cw_put_elem_radio_info(dst+l,i->u1.iid,i->u2.data);
|
||||
|
||||
}
|
||||
return l;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "log.h"
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
|
||||
#include "mbag.h"
|
||||
@ -51,7 +52,7 @@ int cw_out_wtp_board_data(struct conn *conn, struct cw_action_out *a, uint8_t *
|
||||
}
|
||||
|
||||
uint8_t *d = dst + 4;
|
||||
d += cw_put_dword(d, i->dword);
|
||||
d += cw_put_dword(d, i->u2.dword);
|
||||
|
||||
char buf[90];
|
||||
|
||||
@ -59,14 +60,14 @@ char buf[90];
|
||||
if (i) {
|
||||
|
||||
printf("We have got an i %p\n",i);
|
||||
printf("len: %d\n",bstr16_len(i->data));
|
||||
memcpy(buf,bstr16_data(i->data),bstr16_len(i->data));
|
||||
buf[bstr16_len(i->data)]=0;
|
||||
printf("len: %d\n",bstr16_len(i->u2.data));
|
||||
memcpy(buf,bstr16_data(i->u2.data),bstr16_len(i->u2.data));
|
||||
buf[bstr16_len(i->u2.data)]=0;
|
||||
printf("Val: %s\n",buf);
|
||||
|
||||
d += cw_put_word(d, CW_BOARDDATA_MODELNO);
|
||||
d += cw_put_word(d, bstr16_len(i->data));
|
||||
d += cw_put_data(d, bstr16_data(i->data), bstr16_len(i->data));
|
||||
d += cw_put_word(d, bstr16_len(i->u2.data));
|
||||
d += cw_put_data(d, bstr16_data(i->u2.data), bstr16_len(i->u2.data));
|
||||
} else {
|
||||
cw_log(LOG_ERR,
|
||||
"Error: Can't set sub-element \"WTP Model Number\" in WTP Board Data.");
|
||||
@ -75,8 +76,8 @@ printf("Val: %s\n",buf);
|
||||
i = mbag_get(board_data, CW_ITEM_WTP_BOARD_SERIALNO);
|
||||
if (i) {
|
||||
d += cw_put_word(d, CW_BOARDDATA_SERIALNO);
|
||||
d += cw_put_word(d, bstr16_len(i->data));
|
||||
d += cw_put_data(d, bstr16_data(i->data), bstr16_len(i->data));
|
||||
d += cw_put_word(d, bstr16_len(i->u2.data));
|
||||
d += cw_put_data(d, bstr16_data(i->u2.data), bstr16_len(i->u2.data));
|
||||
}else {
|
||||
cw_log(LOG_ERR,
|
||||
"Error: Can't set sub-element \"WTP Serial Number\" in WTP Board Data.");
|
||||
@ -86,22 +87,22 @@ printf("Val: %s\n",buf);
|
||||
i = mbag_get(board_data, CW_ITEM_WTP_BOARD_ID);
|
||||
if (i) {
|
||||
d += cw_put_word(d, CW_BOARDDATA_BOARDID);
|
||||
d += cw_put_word(d, bstr16_len(i->data));
|
||||
d += cw_put_data(d, bstr16_data(i->data), bstr16_len(i->data));
|
||||
d += cw_put_word(d, bstr16_len(i->u2.data));
|
||||
d += cw_put_data(d, bstr16_data(i->u2.data), bstr16_len(i->u2.data));
|
||||
}
|
||||
|
||||
i = mbag_get(board_data, CW_ITEM_WTP_BOARD_REVISION);
|
||||
if (i) {
|
||||
d += cw_put_word(d, CW_BOARDDATA_REVISION);
|
||||
d += cw_put_word(d, bstr16_len(i->data));
|
||||
d += cw_put_data(d, bstr16_data(i->data), bstr16_len(i->data));
|
||||
d += cw_put_word(d, bstr16_len(i->u2.data));
|
||||
d += cw_put_data(d, bstr16_data(i->u2.data), bstr16_len(i->u2.data));
|
||||
}
|
||||
|
||||
i = mbag_get(board_data, CW_ITEM_WTP_BOARD_MACADDRESS);
|
||||
if (i) {
|
||||
d += cw_put_word(d, CW_BOARDDATA_MACADDRESS);
|
||||
d += cw_put_word(d, bstr_len(i->data));
|
||||
d += cw_put_data(d, bstr_data(i->data), bstr_len(i->data));
|
||||
d += cw_put_word(d, bstr_len(i->u2.data));
|
||||
d += cw_put_data(d, bstr_data(i->u2.data), bstr_len(i->u2.data));
|
||||
}
|
||||
|
||||
int l = d - dst-4;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "log.h"
|
||||
#include "capwap.h"
|
||||
#include "conn.h"
|
||||
|
||||
#include "capwap.h"
|
||||
//#include "itemstore.h"
|
||||
#include "capwap_items.h"
|
||||
#include "capwap.h"
|
||||
@ -47,7 +48,7 @@ int cw_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t *
|
||||
mbag_item_t * i;
|
||||
i = mbag_get(mbag,CW_ITEM_WTP_HARDWARE_VERSION);
|
||||
if ( i ) {
|
||||
d += cw_put_version(d,CW_SUBELEM_WTP_HARDWARE_VERSION,i->data);
|
||||
d += cw_put_version(d,CW_SUBELEM_WTP_HARDWARE_VERSION,i->u2.data);
|
||||
}
|
||||
else {
|
||||
cw_log(LOG_ERR, "Can't send Hardware Version in WTP Descriptor, not set.");
|
||||
@ -55,7 +56,7 @@ int cw_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t *
|
||||
|
||||
i = mbag_get(mbag,CW_ITEM_WTP_SOFTWARE_VERSION);
|
||||
if ( i ) {
|
||||
d += cw_put_version(d,CW_SUBELEM_WTP_SOFTWARE_VERSION,i->data);
|
||||
d += cw_put_version(d,CW_SUBELEM_WTP_SOFTWARE_VERSION,i->u2.data);
|
||||
}
|
||||
else {
|
||||
cw_log(LOG_ERR, "Can't send Software Version in WTP descriptor, not set.");
|
||||
@ -63,7 +64,7 @@ int cw_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t *
|
||||
|
||||
i = mbag_get(mbag,CW_ITEM_WTP_BOOT_VERSION);
|
||||
if ( i ) {
|
||||
d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->data);
|
||||
d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->u2.data);
|
||||
}
|
||||
else {
|
||||
cw_log(LOG_INFO, "Can't send Boot Version in WTP descriptor, not set.");
|
||||
@ -71,7 +72,7 @@ int cw_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t *
|
||||
|
||||
i = mbag_get(mbag,CW_ITEM_WTP_OTHER_VERSION);
|
||||
if ( i ) {
|
||||
d += cw_put_version(d,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION,i->data);
|
||||
d += cw_put_version(d,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION,i->u2.data);
|
||||
}
|
||||
else {
|
||||
cw_log(LOG_INFO, "Can't send Other Version in WTP descriptor, not set.");
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap_items.h"
|
||||
#include "action.h"
|
||||
|
||||
@ -46,7 +47,7 @@ int cw_out_wtp_reboot_statistics(struct conn *conn, struct cw_action_out *a,
|
||||
return 0;
|
||||
}
|
||||
|
||||
mbag_t rs = (mbag_t) i->data;
|
||||
mbag_t rs = (mbag_t) i->u2.data;
|
||||
|
||||
uint8_t *d = dst + 4;
|
||||
d += cw_put_word(d, mbag_get_word(rs, CW_ITEM_REBOOT_COUNT, 0));
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "log.h"
|
||||
#include "dbg.h"
|
||||
#include "cw.h"
|
||||
|
@ -33,40 +33,40 @@ int cw_put_mbag_item(uint8_t * dst, struct mbag_item *item)
|
||||
|
||||
|
||||
if (MBAG_STR == item->type ){
|
||||
return cw_put_data(dst, item->data, strlen((char *) item->data));
|
||||
return cw_put_data(dst, item->u2.data, strlen((char *) item->u2.data));
|
||||
}
|
||||
|
||||
if (MBAG_DATA == item->type){
|
||||
return cw_put_data(dst, item->data+1, *((uint8_t*)item->data));
|
||||
return cw_put_data(dst, item->u2.data+1, *((uint8_t*)item->u2.data));
|
||||
}
|
||||
|
||||
if (MBAG_BYTE == item->type){
|
||||
return cw_put_byte(dst, item->byte);
|
||||
return cw_put_byte(dst, item->u2.byte);
|
||||
}
|
||||
if (MBAG_WORD == item->type){
|
||||
return cw_put_word(dst, item->word);
|
||||
return cw_put_word(dst, item->u2.word);
|
||||
}
|
||||
if (MTYPE_DWORD == item->type){
|
||||
return cw_put_dword(dst, item->dword);
|
||||
return cw_put_dword(dst, item->u2.dword);
|
||||
}
|
||||
if (MBAG_BSTR == item->type) {
|
||||
return cw_put_bstr(dst, item->data);
|
||||
return cw_put_bstr(dst, item->u2.data);
|
||||
}
|
||||
|
||||
if ( MBAG_BSTR16 == item->type)
|
||||
return cw_put_bstr16(dst,item->data);
|
||||
return cw_put_bstr16(dst,item->u2.data);
|
||||
|
||||
if (MBAG_VENDORSTR == item->type)
|
||||
{
|
||||
int l=0;
|
||||
l+=cw_put_dword(dst, bstrv_get_vendor_id(item->data));
|
||||
l+=cw_put_data(dst+4, bstrv_data(item->data),bstrv_len(item->data));
|
||||
l+=cw_put_dword(dst, bstrv_get_vendor_id(item->u2.data));
|
||||
l+=cw_put_data(dst+4, bstrv_data(item->u2.data),bstrv_len(item->u2.data));
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
if (MBAG_MBAG == item->type){
|
||||
*((void**)dst)=item->data;
|
||||
*((void**)dst)=item->u2.data;
|
||||
return sizeof(void *);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ int xxcw_put_radio_operational_states(mbag_t radios, uint8_t * dst, int *nerror,
|
||||
mavliter_foreach(&it){
|
||||
|
||||
mbag_item_t * radioitem = mavliter_get(&it);
|
||||
mbag_item_t *ositem = mbag_get(radioitem->data,CW_RADIOITEM_OPER_STATE);
|
||||
mbag_item_t *ositem = mbag_get(radioitem->u2.data,CW_RADIOITEM_OPER_STATE);
|
||||
if (!ositem){
|
||||
(*nerror)++;
|
||||
continue;
|
||||
@ -54,10 +54,10 @@ int xxcw_put_radio_operational_states(mbag_t radios, uint8_t * dst, int *nerror,
|
||||
|
||||
|
||||
/* Put the radio ID */
|
||||
cw_put_byte(d+4,radioitem->iid);
|
||||
cw_put_byte(d+4,radioitem->u1.iid);
|
||||
|
||||
/* Get the operational state and cause */
|
||||
uint16_t os = ositem->word;
|
||||
uint16_t os = ositem->u2.word;
|
||||
|
||||
if ( d7mode ){
|
||||
/* Isolate Oper Sate from cause */
|
||||
@ -77,7 +77,7 @@ int xxcw_put_radio_operational_states(mbag_t radios, uint8_t * dst, int *nerror,
|
||||
/* delete the operational state item, so it won't be
|
||||
sent again, until it is set by a change through
|
||||
Set Radio Admin State */
|
||||
mbag_del(radioitem->data,CW_RADIOITEM_OPER_STATE);
|
||||
mbag_del(radioitem->u2.data,CW_RADIOITEM_OPER_STATE);
|
||||
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "conn.h"
|
||||
#include "cwmsg.h"
|
||||
|
25
src/cw/dbg.c
25
src/cw/dbg.c
@ -27,6 +27,7 @@
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "capwap.h"
|
||||
#include "dbg.h"
|
||||
#include "sock.h"
|
||||
@ -166,7 +167,6 @@ static const char *get_dbg_color_off(int level)
|
||||
static const char *get_dbg_prefix(int level)
|
||||
{
|
||||
return cw_strlist_get_str(prefix, level);
|
||||
|
||||
}
|
||||
|
||||
static const char *get_dbg_color_ontext(int level)
|
||||
@ -627,9 +627,9 @@ int cw_format_item(char *dst, mbag_item_t * item)
|
||||
{
|
||||
*dst = 0;
|
||||
if (item->type == MBAG_BSTR16) {
|
||||
strncpy(dst, (char *) bstr16_data(item->data), bstr16_len(item->data));
|
||||
*(dst + bstr16_len(item->data)) = 0;
|
||||
return bstr16_len(item->data);
|
||||
strncpy(dst, (char *) bstr16_data(item->u2.data), bstr16_len(item->u2.data));
|
||||
*(dst + bstr16_len(item->u2.data)) = 0;
|
||||
return bstr16_len(item->u2.data);
|
||||
|
||||
|
||||
}
|
||||
@ -693,6 +693,23 @@ void cw_dbg_version_subelem(int level, const char *context, int subtype, bstrv_t
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void dbg_istore_dmp(mbag_t s)
|
||||
{
|
||||
|
80
src/cw/dbg.h
80
src/cw/dbg.h
@ -51,15 +51,11 @@ void cw_dbg_packet(struct conn *conn, uint8_t * packet, int len);
|
||||
//#define DBGX(f,...) printf("hallo\n")
|
||||
|
||||
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
|
||||
|
||||
#define cw_dbg_elem(level,conn,msgtype,msgelemtype,msgbuf,msglen)\
|
||||
cw_dbg_elem_colored(level,conn,msgtype,msgelemtype,msgbuf,msglen)
|
||||
|
||||
#else
|
||||
|
||||
#define cw_dbg_elem(...)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -67,78 +63,9 @@ void cw_dbg_packet(struct conn *conn, uint8_t * packet, int len);
|
||||
* @defgroup DbgOptions Debug Options
|
||||
* @{
|
||||
*/
|
||||
#include "debug.h"
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
||||
/** 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,
|
||||
|
||||
/** Message errors */
|
||||
DBG_MSG_ERR,
|
||||
|
||||
/** Show message elements */
|
||||
DBG_ELEM,
|
||||
|
||||
/** Show message element details */
|
||||
DBG_ELEM_DETAIL,
|
||||
|
||||
/** Error in msg elements */
|
||||
DBG_ELEM_ERR,
|
||||
|
||||
/** Show subelements */
|
||||
DBG_SUBELEM,
|
||||
|
||||
/** Show dump of subelements */
|
||||
DBG_SUBELEM_DMP,
|
||||
|
||||
/** hex dump elements */
|
||||
DBG_ELEM_DMP,
|
||||
|
||||
/** General infos, like CAPWAP state */
|
||||
DBG_INFO,
|
||||
|
||||
/** Misc. warnings */
|
||||
DBG_WARN,
|
||||
|
||||
/** RFC related */
|
||||
DBG_RFC,
|
||||
|
||||
/** DTLS related messages */
|
||||
DBG_DTLS,
|
||||
|
||||
/** DTLS BIOs in/out */
|
||||
DBG_DTLS_BIO,
|
||||
|
||||
/** Dump DTLS BIO i/o */
|
||||
DBG_DTLS_BIO_DMP,
|
||||
|
||||
/** Show DTLS Details */
|
||||
DBG_DTLS_DETAIL,
|
||||
|
||||
/** Debug Mods */
|
||||
DBG_MOD,
|
||||
|
||||
DBG_X
|
||||
|
||||
|
||||
};
|
||||
#define DBG_LN(level) level,__FILE__,__LINE__
|
||||
|
||||
|
||||
/* driver specific debugs */
|
||||
@ -175,6 +102,7 @@ extern struct cw_strlist_elem cw_dbg_strings[];
|
||||
if (cw_dbg_is_level(type)) cw_dbg_colored(type,__FILE__,__LINE__,__VA_ARGS__)
|
||||
|
||||
|
||||
|
||||
#define cw_dbg_dmp(type,...) cw_dbg_dmp_(type,__FILE__,__LINE__,__VA_ARGS__)
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
//#include <string.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "dbg.h"
|
||||
|
||||
/**
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "log.h"
|
||||
#include "dbg.h"
|
||||
#include "dtls.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/dtls.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "dtls_common.h"
|
||||
#include "dtls_gnutls.h"
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <gnutls/dtls.h>
|
||||
|
||||
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
#include <gnutls/gnutls.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "dtls.h"
|
||||
#include "dtls_gnutls.h"
|
||||
#include "capwap.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "gnutls/dtls.h"
|
||||
|
||||
#include "mbag.h"
|
||||
#include "dtls.h"
|
||||
#include "dtls_gnutls.h"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "mbag.h"
|
||||
#include "dtls_common.h"
|
||||
#include "dtls_gnutls.h"
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
#include "dtls.h"
|
||||
#include "dtls_gnutls.h"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include "capwap.h"
|
||||
|
||||
#include "dtls_openssl.h"
|
||||
#include "capwap.h"
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <openssl/err.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
#include "sock.h"
|
||||
#include "dtls_openssl.h"
|
||||
|
@ -21,11 +21,13 @@
|
||||
* @brief Functions for OpenSSL BIO
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include <errno.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "dtls_openssl.h"
|
||||
#include "dtls.h"
|
||||
|
||||
#include "mbag.h"
|
||||
#include "conn.h"
|
||||
#include "log.h"
|
||||
#include "dbg.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <openssl/err.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "dtls_openssl.h"
|
||||
#include "log.h"
|
||||
#include "dbg.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include "dtls_openssl.h"
|
||||
|
||||
const char * dtls_openssl_get_cipher(struct conn * conn)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "mbag.h"
|
||||
#include "item.h"
|
||||
#include "log.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef __CW_ITEM_H
|
||||
#define __CW_ITEM_H
|
||||
|
||||
#include "mbag.h"
|
||||
/*#include "mbag.h"*/
|
||||
|
||||
extern const char CW_ITEM_NONE[];
|
||||
extern const char CW_ITEM_ANY[];
|
||||
|
11
src/cw/log.h
11
src/cw/log.h
@ -55,12 +55,15 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifdef WITH_CW_LOG
|
||||
#define cw_log(level,...) cw_log_colored(level,__VA_ARGS__)
|
||||
#else
|
||||
/*#ifdef WITH_CW_LOG*/
|
||||
/*#define cw_log(level,...) cw_log_colored(level,__VA_ARGS__)*/
|
||||
|
||||
#define cw_log cw_log_colored
|
||||
|
||||
/*#else
|
||||
#define cw_log(...)
|
||||
#endif
|
||||
|
||||
*/
|
||||
/*
|
||||
//#ifdef WITH_CW_LOG_DEBUG
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "lwapp.h"
|
||||
#include "lwapp_cisco.h"
|
||||
#include "mbag.h"
|
||||
#include "lw.h"
|
||||
#include "vendors.h"
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
*@{
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include "lw.h"
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "lw.h"
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "mbag.h"
|
||||
#include "lwapp.h"
|
||||
#include "lw.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* @file
|
||||
* @brief Implementation of lw_put_cisco_path_mtu
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include "lwapp_cisco.h"
|
||||
#include "lw.h"
|
||||
#include "vendors.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "mbag.h"
|
||||
#include "lwapp.h"
|
||||
#include "lw.h"
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include <string.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
|
||||
#include "mbag.h"
|
||||
#include "lw.h"
|
||||
|
||||
int lw_put_sockaddr(uint8_t * dst, struct sockaddr_storage *addr)
|
||||
|
@ -21,7 +21,7 @@
|
||||
* @brief Implent lw_readelem_wtp_name
|
||||
*/
|
||||
|
||||
|
||||
#include "mbag.h"
|
||||
#include "lwapp.h"
|
||||
|
||||
#include "cw_util.h"
|
||||
|
@ -53,14 +53,22 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
union mavldata {
|
||||
void *ptr;
|
||||
uint32_t dword;
|
||||
uint16_t word;
|
||||
uint8_t byte;
|
||||
const char *str;
|
||||
};
|
||||
typedef union mavldata mavldata_t;
|
||||
|
||||
/**
|
||||
* Defines the structure of an AVL Node.
|
||||
*/
|
||||
struct mavlnode {
|
||||
/** Pointer to data, thant belongs to the node */
|
||||
void *data;
|
||||
/* void *data; */
|
||||
union mavldata data;
|
||||
/** Pointer to left son*/
|
||||
struct mavlnode *left;
|
||||
/** Pointer to right son*/
|
||||
@ -76,9 +84,9 @@ struct mavl {
|
||||
/** Pointer to root node */
|
||||
struct mavlnode *root;
|
||||
/** Compare function */
|
||||
int (*cmp) (const void *, const void *);
|
||||
int (*cmp) (const union mavldata *, const union mavldata *);
|
||||
/** Delete element function */
|
||||
void (*del) (void *);
|
||||
void (*del) (union mavldata *);
|
||||
/** Number of elements currently stored in the tree */
|
||||
int count;
|
||||
};
|
||||
@ -93,16 +101,17 @@ typedef struct mavl * mavl_t;
|
||||
* @defgroup MAVL_FUNCTIONS Functions
|
||||
* @{
|
||||
*/
|
||||
struct mavl *mavl_create(int (*cmp) (const void *, const void *),
|
||||
void (*del) (void *));
|
||||
struct mavl *mavl_create(int (*cmp) (const union mavldata *, const union mavldata *),
|
||||
void (*del) (union mavldata *));
|
||||
|
||||
void mavlnode_destroy(struct mavl *t, struct mavlnode *n);
|
||||
|
||||
void mavl_del_all(struct mavl *t);
|
||||
void *mavl_del(struct mavl *t, void *data);
|
||||
void *mavl_add(struct mavl *t, void *data);
|
||||
void * mavl_get(struct mavl *t ,void *data);
|
||||
struct mavlnode *mavl_get_node(struct mavl *t, void *data);
|
||||
union mavldata *mavl_del(struct mavl *t, union mavldata *data);
|
||||
union mavldata *mavl_add(struct mavl *t, union mavldata *data);
|
||||
union mavldata * mavl_get(struct mavl *t ,union mavldata *data);
|
||||
struct mavlnode *mavl_get_node(struct mavl *t, union mavldata *data);
|
||||
void * mavl_get_ptr(mavl_t tree, void * search);
|
||||
void mavl_merge(mavl_t m, mavl_t t);
|
||||
|
||||
|
||||
@ -121,7 +130,7 @@ int mavl_foreach_from_lr(struct mavl *t, struct mavlnode *n, void *data,
|
||||
|
||||
void *mavl_replace_data(struct mavl *t, void *data, int len);
|
||||
|
||||
void *mavl_replace(struct mavl *t,void *data);
|
||||
union mavldata *mavl_replace(struct mavl *t,union mavldata *data);
|
||||
|
||||
|
||||
void mavl_destroy(struct mavl *t);
|
||||
@ -129,6 +138,7 @@ void mavl_destroy(struct mavl *t);
|
||||
|
||||
|
||||
#define mavl_find(t,d) mavl_get(t,d)
|
||||
#define mavl_find_ptr(tree,search_ptr) mavl_get_ptr(tree,search_ptr)
|
||||
#define mavl_insert(t,d) mavl_add(t,d)
|
||||
|
||||
|
||||
@ -144,22 +154,22 @@ struct mavliter{
|
||||
struct mavlnode *cur;
|
||||
int stack_ptr;
|
||||
struct mavlnode * root;
|
||||
int (*cmp) (const void *, const void *);
|
||||
int (*cmp) (const union mavldata *, const union mavldata *);
|
||||
|
||||
};
|
||||
typedef struct mavliter mavliter_t;
|
||||
|
||||
|
||||
void * mavliter_next(mavliter_t *i);
|
||||
union mavldata * mavliter_next(mavliter_t *i);
|
||||
|
||||
void * mavliter_seek_set(struct mavliter *i);
|
||||
union mavldata * mavliter_seek_set(struct mavliter *i);
|
||||
|
||||
void mavliter_init(mavliter_t *i, mavl_t t);
|
||||
|
||||
|
||||
void * mavliter_get(mavliter_t *i);
|
||||
union mavldata * mavliter_get(mavliter_t *i);
|
||||
|
||||
extern void * mavliter_seek(mavliter_t *i,void *d);
|
||||
extern union mavldata * mavliter_seek(mavliter_t *i,void *d);
|
||||
|
||||
/**
|
||||
* Define a AVL Iterator varialble and accociate it with
|
||||
@ -182,16 +192,16 @@ extern void * mavliter_seek(mavliter_t *i,void *d);
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
#define MAVLITER_DEFINE(i,t)\
|
||||
mavliter_t i; mavliter_init(&i,t)
|
||||
#define MAVLITER_DEFINE(iterator,mavl_obj)\
|
||||
mavliter_t iterator; mavliter_init(&iterator,mavl_obj)
|
||||
|
||||
|
||||
/**
|
||||
* Iterate through all elements of an MAVL Object using a MAVL Iterator.
|
||||
* @param i pointer to MAVL Interator object
|
||||
*/
|
||||
#define mavliter_foreach(i)\
|
||||
for (mavliter_seek_set(i); NULL != mavliter_get(i); mavliter_next(i))
|
||||
#define mavliter_foreach(iterator)\
|
||||
for (mavliter_seek_set(iterator); NULL != mavliter_get(iterator); mavliter_next(iterator))
|
||||
|
||||
#define mavliter_foreach_from(i,from)\
|
||||
for (mavliter_seek(i,from); NULL != mavliter_get(i); mavliter_next(i))
|
||||
@ -210,7 +220,8 @@ extern void * mavliter_seek(mavliter_t *i,void *d);
|
||||
typedef mavl_t mavl_conststr_t;
|
||||
extern mavl_conststr_t mavl_create_conststr();
|
||||
|
||||
|
||||
int mavl_cmp_dword(const union mavldata *e1, const union mavldata *e2);
|
||||
void mavl_free_bin(union mavldata *data);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "mavl.h"
|
||||
|
||||
static struct mavlnode *mavlnode_create(void *data)
|
||||
|
||||
static struct mavlnode *mavlnode_create(union mavldata *data)
|
||||
{
|
||||
struct mavlnode *n = malloc(sizeof(struct mavlnode));
|
||||
if (!n)
|
||||
@ -8,20 +9,19 @@ static struct mavlnode *mavlnode_create(void *data)
|
||||
|
||||
n->left = n->right = 0;
|
||||
n->bal = 0;
|
||||
n->data = data;
|
||||
n->data = *data;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int mavl_add0(struct mavl *t, struct mavlnode **parent, void **data)
|
||||
static int mavl_add0(struct mavl *t, struct mavlnode **parent, union mavldata * data)
|
||||
{
|
||||
// struct mavlnode * rn;
|
||||
struct mavlnode *tmp;
|
||||
|
||||
struct mavlnode *n = *parent;
|
||||
int rc = t->cmp(*data, n->data);
|
||||
int rc = t->cmp(data, &n->data);
|
||||
|
||||
int bal;
|
||||
if (rc == 0) {
|
||||
@ -71,8 +71,6 @@ static int mavl_add0(struct mavl *t, struct mavlnode **parent, void **data)
|
||||
return 0;
|
||||
|
||||
}
|
||||
//printf("!!!!left bal = %i\n",n->left->bal);
|
||||
//exit(0);
|
||||
|
||||
}
|
||||
return bal;
|
||||
@ -80,7 +78,7 @@ static int mavl_add0(struct mavl *t, struct mavlnode **parent, void **data)
|
||||
}
|
||||
|
||||
/* n->left is 0 */
|
||||
n->left = mavlnode_create(*data);
|
||||
n->left = mavlnode_create(data);
|
||||
if (!n->left)
|
||||
return 3;
|
||||
|
||||
@ -139,9 +137,6 @@ static int mavl_add0(struct mavl *t, struct mavlnode **parent, void **data)
|
||||
n->right = tmp;
|
||||
return 0;
|
||||
}
|
||||
//printf("!!!!iright bal = %i\n",n->left->bal);
|
||||
//exit(0);
|
||||
|
||||
|
||||
}
|
||||
return bal;
|
||||
@ -150,7 +145,7 @@ static int mavl_add0(struct mavl *t, struct mavlnode **parent, void **data)
|
||||
|
||||
/* n->right is 0 */
|
||||
|
||||
n->right = mavlnode_create(*data);
|
||||
n->right = mavlnode_create(data);
|
||||
if (!n->right)
|
||||
return 3;
|
||||
|
||||
@ -171,16 +166,21 @@ static int mavl_add0(struct mavl *t, struct mavlnode **parent, void **data)
|
||||
* @data pointer to element
|
||||
* @return added alement or NULL if error.
|
||||
*/
|
||||
void *mavl_add(struct mavl *t, void *data)
|
||||
union mavldata *mavl_add(struct mavl *t, union mavldata *data)
|
||||
{
|
||||
union mavldata * d;
|
||||
int rc;
|
||||
|
||||
if (t->root == 0) {
|
||||
t->root = mavlnode_create(data);
|
||||
if (t->root)
|
||||
t->count++;
|
||||
return t->root->data;
|
||||
return &t->root->data;
|
||||
}
|
||||
void *d = data;
|
||||
int rc = mavl_add0(t, &t->root, &d);
|
||||
|
||||
d = data;
|
||||
|
||||
rc = mavl_add0(t, &t->root, d);
|
||||
|
||||
if (rc > 3)
|
||||
return NULL;
|
||||
|
5
src/cw/mavl_cmp_dword.c
Normal file
5
src/cw/mavl_cmp_dword.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include "mavl.h"
|
||||
|
||||
int mavl_cmp_dword(const union mavldata *e1, const union mavldata *e2){
|
||||
return e1->dword - e2->dword;
|
||||
}
|
@ -30,8 +30,8 @@
|
||||
* @param del pointer to delete function which is called when an element will be deletet
|
||||
* @return pointer to an #mavl struct
|
||||
*/
|
||||
struct mavl *mavl_create(int (*cmp) (const void *, const void *),
|
||||
void (*del) (void *))
|
||||
struct mavl *mavl_create(int (*cmp) (const union mavldata *, const union mavldata *),
|
||||
void (*del) (union mavldata *))
|
||||
{
|
||||
struct mavl *t = malloc(sizeof(struct mavl));
|
||||
if (!t)
|
||||
|
@ -3,7 +3,7 @@
|
||||
void mavlnode_destroy(struct mavl *t, struct mavlnode *n)
|
||||
{
|
||||
if (t->del) {
|
||||
t->del(n->data);
|
||||
t->del(&n->data);
|
||||
}
|
||||
free(n);
|
||||
t->count--;
|
||||
@ -11,7 +11,6 @@ void mavlnode_destroy(struct mavl *t, struct mavlnode *n)
|
||||
|
||||
|
||||
|
||||
|
||||
static void rot_rl(struct mavlnode *n, struct mavlnode **parent)
|
||||
{
|
||||
struct mavlnode *tmp;
|
||||
@ -70,16 +69,12 @@ static int adj_bal_l(struct mavlnode *n, struct mavlnode **parent)
|
||||
rot_l(n, parent);
|
||||
return 0;
|
||||
} else if (n->right->bal == -1) {
|
||||
// int rb;
|
||||
n->bal = 0;
|
||||
n->right->bal = 0;
|
||||
// rb = n->right->left->bal;
|
||||
n->right->left->bal = 0;
|
||||
rot_rl(n, parent);
|
||||
return 1;
|
||||
}
|
||||
// printf("adj bal l not handled \n");
|
||||
// exit(0);
|
||||
|
||||
return -11; /* that should never happen */
|
||||
}
|
||||
@ -98,16 +93,12 @@ static int adj_bal_r(struct mavlnode *n, struct mavlnode **parent)
|
||||
rot_r(n, parent);
|
||||
return 0;
|
||||
} else if (n->left->bal == 1) {
|
||||
// int rb;
|
||||
n->bal = 0;
|
||||
n->left->bal = 0;
|
||||
// rb = n->left->right->bal;
|
||||
n->left->right->bal = 0;
|
||||
rot_lr(n, parent);
|
||||
return 1;
|
||||
}
|
||||
// printf("adj bal li left not handled \n");
|
||||
// exit(0);
|
||||
return -11; /* that should never happen */
|
||||
}
|
||||
|
||||
@ -116,7 +107,7 @@ static int adj_bal_r(struct mavlnode *n, struct mavlnode **parent)
|
||||
|
||||
|
||||
|
||||
static int mavl_del_lo(struct mavlnode **parent, void **data)
|
||||
static int mavl_del_lo(struct mavlnode **parent, union mavldata *data)
|
||||
{
|
||||
struct mavlnode *n = *parent;
|
||||
|
||||
@ -152,12 +143,12 @@ static int mavl_del_lo(struct mavlnode **parent, void **data)
|
||||
|
||||
|
||||
|
||||
int mavl_del0(struct mavl *t, struct mavlnode **parent, void **data)
|
||||
int mavl_del0(struct mavl *t, struct mavlnode **parent, union mavldata *data)
|
||||
{
|
||||
struct mavlnode *n = *parent;
|
||||
int rc;
|
||||
int bal;
|
||||
rc = t->cmp(*data, n->data);
|
||||
rc = t->cmp(data, &n->data);
|
||||
|
||||
if (rc == 0) {
|
||||
if (n->right == 0 && n->left == 0) {
|
||||
@ -183,7 +174,7 @@ int mavl_del0(struct mavl *t, struct mavlnode **parent, void **data)
|
||||
/* node has two childs */
|
||||
|
||||
if (t->del) {
|
||||
t->del(n->data);
|
||||
t->del(&n->data);
|
||||
}
|
||||
t->count--;
|
||||
bal = mavl_del_lo(&n->right, &n->data);
|
||||
@ -237,13 +228,16 @@ int mavl_del0(struct mavl *t, struct mavlnode **parent, void **data)
|
||||
|
||||
}
|
||||
|
||||
void *mavl_del(struct mavl *t, void *data)
|
||||
union mavldata *mavl_del(struct mavl *t, union mavldata *data)
|
||||
{
|
||||
union mavldata *d;
|
||||
int rc;
|
||||
|
||||
if (!t->root)
|
||||
return NULL;
|
||||
|
||||
void *d = data;
|
||||
int rc = mavl_del0(t, &t->root, &d);
|
||||
d = data;
|
||||
rc = mavl_del0(t, &t->root, d);
|
||||
if (rc == 2)
|
||||
return NULL;
|
||||
return data;
|
||||
|
@ -24,7 +24,7 @@ int mavl_foreach_rl(struct mavlnode *n, int (*callback)(void *,void *),void *cbp
|
||||
return 1;
|
||||
if (!mavl_foreach_rl(n->right,callback,cbpriv))
|
||||
return 0;
|
||||
if (!callback(cbpriv,n->data))
|
||||
if (!callback(cbpriv,&n->data))
|
||||
return 0;
|
||||
return mavl_foreach_rl(n->left,callback,cbpriv);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ int mavl_foreach_lr(struct mavlnode *n, int (*callback)(void *,void *),void *cbp
|
||||
return 1;
|
||||
if (!mavl_foreach_lr(n->left,callback,cbpriv))
|
||||
return 0;
|
||||
if (!callback(cbpriv,n->data))
|
||||
if (!callback(cbpriv,&n->data))
|
||||
return 0;
|
||||
return mavl_foreach_lr(n->right,callback,cbpriv);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user