Verified Commit e6b3c0f2 authored by Sven enniK's avatar Sven enniK
Browse files

change to current server version

parent 1faa6cf4
......@@ -160,3 +160,4 @@ help:
# strip / strip_libs / strip_all strip bmxd / plugins / all
# install / install_libs / install_all install bmxd / plugins / all
# clean / clean_libs / clean_all clean bmxd / libs / all
We would like to thank all people that donated their
time and skills to the B.A.T.M.A.N. mesh routing protocol!
Marek Lindner (lindner_marek-at-yahoo.de)
Stefan Sperling (stsp-at-stsp.in-berlin.de
Axel Neumann (axel-at-open-mesh.net)
......
......@@ -17,6 +17,7 @@
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......
......@@ -17,11 +17,11 @@
*
*/
#ifndef _ALLOCATE_H
#define _ALLOCATE_H 1
#include <stdint.h>
void checkIntegrity(void);
void checkLeak(void);
void *debugMalloc(uint32_t length, int32_t tag);
......
......@@ -26,6 +26,8 @@
* for any damages from improper use. ;-)
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
......
......@@ -20,6 +20,7 @@
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
......@@ -36,6 +37,9 @@
uint32_t My_pid = 0;
......@@ -750,3 +754,4 @@ struct plugin_v1 *srv_get_plugin_v1( void ) {
#endif /*NOSRV*/
......@@ -17,6 +17,8 @@
*
*/
#ifndef _BATMAN_BATMAN_H
#define _BATMAN_BATMAN_H
......@@ -793,4 +795,7 @@ struct plugin_v1 *srv_get_plugin_v1( void );
#endif /*NOSRV*/
#endif /* _BATMAN_BATMAN_H */
......@@ -17,6 +17,7 @@
*
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdarg.h>
......@@ -3375,3 +3376,4 @@ void cleanup_control( void ) {
}
}
......@@ -17,6 +17,7 @@
*
*/
#define MIN_UPTIME 0
#define MAX_UPTIME 2147383 /*(((TP32/1000)/2)-100) /1000 to talk about seconds and not ms, /2 to not render scheduled events outdated, -100 to be save */
#define DEF_UPTIME 0
......@@ -114,17 +115,17 @@ struct dbg_histogram {
#ifdef NODEBUGALL
#define dbgf_all(...) {;}
#else
#define dbgf_all( dbgt, ... ); do { if ( __dbgf_all() ) { _dbgf_all( dbgt, __FUNCTION__, __VA_ARGS__ ); } } while (0)
#define dbgf_all( dbgt, ... ); do { if ( __dbgf_all() ) { _dbgf_all( dbgt, __func__, __VA_ARGS__ ); } } while (0)
#endif
#ifdef EXTDEBUG
#define dbgf_ext( dbgt, ... ); do { if ( __dbgf_all() ) { _dbgf_all( dbgt, __FUNCTION__, __VA_ARGS__ ); } } while (0)
#define dbgf_ext( dbgt, ... ); do { if ( __dbgf_all() ) { _dbgf_all( dbgt, __func__, __VA_ARGS__ ); } } while (0)
#else
#define dbgf_ext(...) {;}
#endif
#define dbgf( dbgl, dbgt, ...); _dbgf( dbgl, dbgt, __FUNCTION__, __VA_ARGS__ );
#define dbgf_cn( cn, dbgl, dbgt, ...); _dbgf_cn( cn, dbgl, dbgt, __FUNCTION__, __VA_ARGS__ );
#define dbgf( dbgl, dbgt, ...); _dbgf( dbgl, dbgt, __func__, __VA_ARGS__ );
#define dbgf_cn( cn, dbgl, dbgt, ...); _dbgf_cn( cn, dbgl, dbgt, __func__, __VA_ARGS__ );
void dbg ( int8_t dbgl, int8_t dbgt, char *last, ... );
void _dbgf ( int8_t dbgl, int8_t dbgt, char const *f, char *last, ... );
......
......@@ -7,8 +7,8 @@ doc: Makefile
pdflatex bmx.tex
pdflatex bmx.tex
rm -rv *.toc *.log *.aux
clean:
rm -rfv *.toc *.pdf *.log *.aux
rm -rfv *.toc *.pdf *.log *.aux
#$$(find -type d | grep "./")
\ No newline at end of file
This diff is collapsed.
......@@ -17,6 +17,7 @@
*
*/
#include <stdio.h> /* NULL */
#include <string.h>
......
......@@ -17,6 +17,7 @@
*
*/
typedef int (*hashdata_compare_cb)(void *, void *, size_t);
typedef int (*hashdata_choose_cb)(void *, int, size_t);
typedef void (*hashdata_free_cb)(void *);
......@@ -92,3 +93,4 @@ void hash_debug( struct hashtable_t *hash);
/* iterate though the hash. first element is selected with iter_in NULL.
* use the returned iterator to access the elements until hash_it_t returns NULL. */
struct hash_it_t *hash_iterate(struct hashtable_t *hash, struct hash_it_t *iter_in);
......@@ -17,6 +17,7 @@
*
*/
#ifndef NOHNA
#include <arpa/inet.h>
#include <string.h>
......@@ -721,3 +722,4 @@ struct plugin_v1 *hna_get_plugin_v1( void ) {
#endif //NOHNA
......@@ -17,6 +17,7 @@
*
*/
#ifndef NOHNA
#define ARG_UHNA "unicast_hna"
......
CFLAGS += -fpic -pedantic -Wall -W -Wno-unused-parameter -Os -g3 -std=gnu99 -I../../
LDFLAGS += -shared
#-Wl,-soname,bmxd_config
#-Wl,-soname,bmxd_config
PLUGIN_NAME = bmx_gsf_map
PLUGIN_VER = 1
......@@ -19,7 +19,7 @@ all: $(PLUGIN_FULLNAME) Makefile
$(PLUGIN_FULLNAME): $(OBJS) Makefile
$(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(OBJS) -o $(PLUGIN_FULLNAME)
$(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(OBJS) -o $(PLUGIN_FULLNAME)
%.o: %.c %.h Makefile
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
......@@ -27,7 +27,7 @@ $(PLUGIN_FULLNAME): $(OBJS) Makefile
clean:
rm -f *.o *.so.$(PLUGIN_VER)
install: all
mkdir -p $(LIBDIR)
......
......@@ -57,19 +57,19 @@
#define GSF_HELP_WORD "<WORD>"
static int32_t opt_gsf_map_local ( uint8_t cmd, uint8_t _save, struct opt_type *opt, struct opt_parent *patch, struct ctrl_node *cn ) {
if ( cmd == OPT_APPLY && cn ) {
struct list_head *lndev_pos;
struct orig_node *orig_node;
int rq, tq, rtq;
int count=0;
int count_neigh=0;
struct link_node *ln;
struct list_head *link_pos;
struct opt_parent *p;
char *gsf_map_name = (p=get_opt_parent_val( get_option( 0,0,GSF_MAP_MYNAME), 0)) ? p->p_val : DEF_GSF_MAP_MYNAME;
char *gsf_map_longitude = (p=get_opt_parent_val( get_option( 0,0,GSF_MAP_LONGITUDE), 0)) ? p->p_val : DEF_GSF_MAP_LONGITUDE;
......@@ -77,40 +77,40 @@ static int32_t opt_gsf_map_local ( uint8_t cmd, uint8_t _save, struct opt_type *
char *gsf_map_hw = (p=get_opt_parent_val( get_option( 0,0,GSF_MAP_HW), 0)) ? p->p_val : DEF_GSF_MAP_HW;
char *gsf_map_email = (p=get_opt_parent_val( get_option( 0,0,GSF_MAP_EMAIL), 0)) ? p->p_val : DEF_GSF_MAP_EMAIL;
//char *gsf_map_comment = (p=get_opt_parent_val( get_option( 0,0,GSF_MAP_COMMENT), 0)) ? p->p_val : DEF_GSF_MAP_COMMENT;
dbg_printf( cn,
dbg_printf( cn,
//uncomment following line to get the node back
//"\nnode = {\n"
"'%s' : {\n"
" 'name' : '%s', 'long' : %s, 'lat' : %s, 'hw' : '%s', 'email' : '%s' , 'links' : {\n",
ipStr(primary_addr),
gsf_map_name, gsf_map_longitude, gsf_map_latitude, gsf_map_hw, gsf_map_email );
list_for_each( link_pos, &link_list ) {
ln = list_entry(link_pos, struct link_node, list);
orig_node = ln->orig_node;
if ( !orig_node->router || !orig_node->primary_orig_node )
continue;
struct orig_node *onn = get_orig_node( orig_node->router->nnkey_addr, NO/*create*/ );
if ( !onn || !onn->last_valid_time || !onn->router )
continue;
list_for_each( lndev_pos, &ln->lndev_list ) {
struct link_node_dev *lndev = list_entry( lndev_pos, struct link_node_dev, list );
if ( count++ )
dbg_printf( cn, ",\n");
rq = lndev->rq_sqr.wa_val;
tq = tq_rate( orig_node, lndev->bif, PROBE_RANGE );
rtq = lndev->rtq_sqr.wa_val;
dbg_printf( cn, " '%i' : {\n"
" 'ip' : '%s', 'pq' : %3i, 'lseq' : %5i, 'lvld' : %4i, "
"'outIP' : '%s', 'dev' : '%s', 'via' : '%s',"
......@@ -121,29 +121,29 @@ static int32_t opt_gsf_map_local ( uint8_t cmd, uint8_t _save, struct opt_type *
orig_node->last_valid_sqn,
( batman_time - orig_node->last_valid_time)/1000,
lndev->bif->if_ip_str,
lndev->bif->dev,
lndev->bif->dev,
orig_node->orig_str,
rtq/PROBE_TO100, rq/PROBE_TO100, tq/PROBE_TO100 );
rtq/PROBE_TO100, rq/PROBE_TO100, tq/PROBE_TO100 );
}
}
dbg_printf( cn,
//",\n '' : {}"
"\n }\n }\n\n"
//uncomment following line to get final closing bracket back
//"}\n\n"
//"}\n\n"
);
}
return SUCCESS;
}
static int32_t opt_gsf_map_global ( uint8_t cmd, uint8_t _save, struct opt_type *opt, struct opt_parent *patch, struct ctrl_node *cn ) {
if ( cmd == OPT_APPLY && cn ) {
struct orig_node *orig_node;
struct avl_node *an;
uint32_t count=0;
......@@ -174,7 +174,7 @@ static int32_t opt_gsf_map_global ( uint8_t cmd, uint8_t _save, struct opt_type
dbg_printf( cn, " '%s' : {\n", orig_node->orig_str );
dbg_printf( cn,
dbg_printf( cn,
" "
"'dev' : '%s', 'via' : '%s', 'viaPub' : '%s', 'pq' : %i, 'ut' : '%s', "
"'lseq' : %i, 'lvld' : %i, 'pwd' : %i, 'ogi' : %i, 'hop' : %i, 'chng' : %i }",
......@@ -189,7 +189,7 @@ static int32_t opt_gsf_map_global ( uint8_t cmd, uint8_t _save, struct opt_type
WAVG( orig_node->ogi_wavg, OGI_WAVG_EXP ),
(Ttl+1 - orig_node->last_path_ttl),
orig_node->rt_changes
);
);
}
dbg_printf( cn,
......@@ -203,41 +203,41 @@ static int32_t opt_gsf_map_global ( uint8_t cmd, uint8_t _save, struct opt_type
static int32_t opt_gsf_map_args ( uint8_t cmd, uint8_t _save, struct opt_type *opt, struct opt_parent *patch, struct ctrl_node *cn ) {
if ( cmd == OPT_CHECK || cmd == OPT_APPLY ) {
char tmp_arg[MAX_ARG_SIZE]="0";
if( wordlen( patch->p_val ) + 1 >= MAX_ARG_SIZE ) {
dbg_cn( cn, DBGL_SYS, DBGT_ERR, "opt_gsf_map_args(): arguments: %s to long", patch->p_val );
return FAILURE;
}
wordCopy( tmp_arg, patch->p_val );
if( strpbrk( tmp_arg, "*'\"#\\/~?^°,;|<>()[]{}$%&=`´" ) ) {
dbg_cn( cn, DBGL_SYS, DBGT_ERR,
dbg_cn( cn, DBGL_SYS, DBGT_ERR,
"opt_gsf_map_args(): argument: %s contains illegal symbols", tmp_arg );
return FAILURE;
}
if ( patch->p_diff == ADD ) {
if ( !strcmp( opt->long_name, GSF_MAP_LONGITUDE ) ||
!strcmp( opt->long_name, GSF_MAP_LATITUDE ) )
if ( !strcmp( opt->long_name, GSF_MAP_LONGITUDE ) ||
!strcmp( opt->long_name, GSF_MAP_LATITUDE ) )
{
char **endptr = NULL;
errno = 0;
if ( strtod( tmp_arg, endptr ) == 0 || errno )
return FAILURE;
}
}
}
return SUCCESS;
}
......@@ -245,64 +245,64 @@ static int32_t opt_gsf_map_args ( uint8_t cmd, uint8_t _save, struct opt_type *o
static struct opt_type gsf_map_options[]= {
// ord parent long_name shrt Attributes *ival min max default *func,*syntax,*help
{ODI,5,0,0, 0, 0,0,0,0,0, 0, 0, 0, 0, 0,
0, "\nGraciaSenseFils (GSF) Map options:"},
{ODI,5,0,GSF_MAP_MYNAME, 0, A_PS1,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_gsf_map_args,
GSF_HELP_WORD, "set gsf-map name"},
{ODI,5,0,GSF_MAP_LONGITUDE, 0, A_PS1,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_gsf_map_args,
GSF_HELP_WORD, "set gsf-map longitude" },
{ODI,5,0,GSF_MAP_LATITUDE, 0, A_PS1,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_gsf_map_args,
GSF_HELP_WORD, "set gsf-map latitude" },
{ODI,5,0,GSF_MAP_HW, 0, A_PS1,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_gsf_map_args,
GSF_HELP_WORD, "set gsf-map hw" },
{ODI,5,0,GSF_MAP_EMAIL, 0, A_PS1,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_gsf_map_args,
GSF_HELP_WORD, "set gsf-map email" },
{ODI,5,0,GSF_MAP_COMMENT, 0, A_PS1,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_gsf_map_args,
GSF_HELP_WORD, "set gsf-map comment (use _ between several words)" },
{ODI,5,0,GSF_MAP_LOCAL_JSON, 0, A_PS0,A_USR,A_DYI,A_ARG,A_ANY, 0, 0, 0, 0, opt_gsf_map_local,
0, "show myself and local neighborhood in JSON format" },
{ODI,5,0,GSF_MAP_WORLD_JSON, 0, A_PS0,A_USR,A_DYI,A_ARG,A_ANY, 0, 0, 0, 0, opt_gsf_map_global,
0, "show all my reachable nodes in JSON format" },
};
static void gsf_map_cleanup( void ) {
// remove_options_array( gsf_map_options );
}
static int32_t gsf_map_init( void ) {
register_options_array( gsf_map_options, sizeof( gsf_map_options ) );
return SUCCESS;
}
struct plugin_v1* get_plugin_v1( void ) {
static struct plugin_v1 gsf_map_plugin_v1;
memset( &gsf_map_plugin_v1, 0, sizeof ( struct plugin_v1 ) );
gsf_map_plugin_v1.plugin_version = PLUGIN_VERSION_01;
gsf_map_plugin_v1.plugin_size = sizeof ( struct plugin_v1 );
gsf_map_plugin_v1.plugin_name = "bmx_gsf_map_plugin";
gsf_map_plugin_v1.cb_init = gsf_map_init;
gsf_map_plugin_v1.cb_cleanup = gsf_map_cleanup;
return &gsf_map_plugin_v1;
}
CFLAGS += -fpic -pedantic -Wall -W -Wno-unused-parameter -Os -g3 -std=gnu99 -I../../
LDFLAGS += -shared
#-Wl,-soname,bmxd_config
#-Wl,-soname,bmxd_config
PLUGIN_NAME = bmx_howto_plugin
PLUGIN_VER = 1
......@@ -27,7 +27,7 @@ $(PLUGIN_FULLNAME): $(OBJS) Makefile
clean:
rm -f *.o *.so.$(PLUGIN_VER)
install: all
mkdir -p $(LIBDIR)
......
......@@ -34,116 +34,116 @@ static int32_t howto_var;
static int32_t opt_howto_do ( uint8_t cmd, uint8_t _save, struct opt_type *opt, struct opt_parent *patch, struct ctrl_node *cn ) {
static uint8_t call_counter;
struct opt_parent *p;
if ( cmd == OPT_REGISTER ) {
call_counter = 0;
} else if ( cmd == OPT_CHECK ) {
if( wordlen( patch->p_val )+1 >= MAX_ARG_SIZE )
return FAILURE;
} else if ( cmd == OPT_APPLY ) {
call_counter++;
dbgf_cn( cn, DBGL_CHANGES, DBGT_INFO,
"now called for the %d time: going to store: %s",
dbgf_cn( cn, DBGL_CHANGES, DBGT_INFO,
"now called for the %d time: going to store: %s",
call_counter, patch->p_val );
dbgf( DBGL_CHANGES, DBGT_INFO, "%s - but currently still stored: %s",
dbgf( DBGL_CHANGES, DBGT_INFO, "%s - but currently still stored: %s",
opt_cmd2str[cmd], (p=get_opt_parent_val( opt, 0 )) ? p->p_val : NULL );
} else if ( cmd == OPT_SET_POST ) {
// this block will always be executed
// this block will always be executed
// after all options with this order were set and
// before any option with a higher order is set
dbgf( DBGL_CHANGES, DBGT_INFO, "%s - now stored: %s",
dbgf( DBGL_CHANGES, DBGT_INFO, "%s - now stored: %s",
opt_cmd2str[cmd], (p=get_opt_parent_val( opt, 0 )) ? p->p_val : NULL );
} else if ( cmd == OPT_POST ) {
//this block will always be executed after all options were set
if ( !on_the_fly ) {
//due to NOT on_the_fly
//due to NOT on_the_fly
//this block will only be executed once during init after all options were set
}
} else if ( cmd == OPT_UNREGISTER ) {
}
return SUCCESS;
}
static int32_t opt_howto_get ( uint8_t cmd, uint8_t _save, struct opt_type *opt, struct opt_parent *patch, struct ctrl_node *cn ) {
if ( cmd == OPT_APPLY ) {
int i;
for ( i=0; i<howto_var; i++ ) {
dbgf_cn( cn, DBGL_ALL, DBGT_INFO, "printing line %10d", i );
}
}
return SUCCESS;
}
static struct opt_type howto_plugin_options[]= {
// ord parent long_name shrt Attributes *ival min max default *func,*syntax,*help
{ODI,5,0,0, 0, 0,0,0,0,0, 0, 0, 0, 0, 0,0,
"\nDemo-plugin options:"},
{ODI,5,0,ARG_HOWTO_VAR, 0, A_PS1,A_ADM,A_DYI,A_CFA,A_ANY, &howto_var, 0, 10000, 100, 0,
ARG_VALUE_FORM,"set val of howto_plugin plugin" },
{ODI,5,0,ARG_HOWTO_DO, 0, A_PS1,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_howto_do,
"<word>","set argument of howto_plugin plugin"},
{ODI,5,0,ARG_HOWTO_GET, 0, A_PS0,A_ADM,A_DYI,A_ARG,A_ANY, 0, 0, 0, 0, opt_howto_get,
"<word>","set argument of howto_plugin plugin"}
};
static void howto_plugin_cleanup( void ) {
dbgf( DBGL_CHANGES, DBGT_INFO, "cleanung up plugin %s", HOWTO_PLUGIN );
}
static int32_t howto_plugin_init( void ) {