Verified Commit 88d1e86c authored by Sven enniK's avatar Sven enniK
Browse files

add v0.4_server

parent d872e0d6
......@@ -17,7 +17,7 @@
#
ct_bmxd = '/srv/ffdd-server/salt/freifunk/base/bmxd/compiled-tools/bmxd'
REVISION = $(shell cd $(ct_bmxd); { export LC_ALL=C; find . -type f ! -iname "Makefile" -exec wc -c {} \; | sort; echo; find . -type f ! -iname "Makefile" -exec md5sum {} + | sort; echo; find . -type d | sort; find . -type d | sort | md5sum; } | md5sum | sed -e 's/^\(.\{10\}\).*/\1/')
REVISION = $(shell cd $(ct_bmxd); { export LC_ALL=C; find -type f ! -iname "Makefile" -exec wc -c {} \; | sort; echo; find -type f ! -iname "Makefile" -exec md5sum {} + | sort; echo; find . -type d | sort; find . -type d | sort | md5sum; } | md5sum | sed -e 's/^\(.\{10\}\).*/\1/')
REVISION_VERSION =\"-src:[$(REVISION)]\"
......@@ -88,6 +88,7 @@ LOG_BRANCH= trunk/batman-experimental
SRC_FILES= "\(\.c\)\|\(\.h\)\|\(Makefile\)\|\(INSTALL\)\|\(LIESMICH\)\|\(README\)\|\(THANKS\)\|\(./posix\)\|\(./linux\)\|\(./man\)\|\(./doc\)"
#SRC_C= batman.c originator.c hna.c schedule.c plugin.c list-batman.c allocate.c avl.c profile.c control.c metrics.c $(OS_C) posix/posix.c posix/tunnel.c linux/route.c
SRC_C= batman.c originator.c hna.c schedule.c plugin.c list-batman.c allocate.c avl.c profile.c control.c metrics.c $(OS_C)
SRC_H= batman.h originator.h hna.h schedule.h plugin.h list-batman.h allocate.h avl.h profile.h control.h metrics.h vis-types.h os.h
OBJS= $(SRC_C:.c=.o)
......
......@@ -17,6 +17,7 @@
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -31,6 +32,7 @@
#if defined DEBUG_MALLOC
struct chunkHeader *chunkList = NULL;
struct chunkHeader
......@@ -45,6 +47,7 @@ typedef unsigned char magicNumberTrailor;
#if defined MEMORY_USAGE
struct memoryUsage *memoryList = NULL;
......
......@@ -17,10 +17,13 @@
*
*/
#ifndef _ALLOCATE_H
#define _ALLOCATE_H 1
#include <stdint.h>
void checkIntegrity(void);
void checkLeak(void);
void *debugMalloc(uint32_t length, int32_t tag);
......@@ -28,4 +31,5 @@ void *debugRealloc(void *memory, uint32_t length, int32_t tag);
void debugFree(void *memoryParameter, int32_t tag);
void debugMemory( struct ctrl_node *cn );
#endif
......@@ -26,6 +26,8 @@
* for any damages from improper use. ;-)
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
......@@ -37,6 +39,7 @@
#include "avl.h"
struct avl_node *avl_find( struct avl_tree *tree, void *key )
{
struct avl_node *an = tree->root;
......@@ -98,6 +101,8 @@ struct avl_node *avl_iterate(struct avl_tree *tree, struct avl_node *an )
}
static struct avl_node *avl_create_node(void *key)
{
struct avl_node *an = debugMalloc(sizeof (struct avl_node), 327);
......@@ -229,6 +234,7 @@ void avl_insert(struct avl_tree *tree, void *key) {
}
void *avl_remove(struct avl_tree *tree, void *key)
{
struct avl_node *it = tree->root;
......@@ -560,6 +566,10 @@ static void avl_test()
/* for (i = 20; i >= 0; i--) {
p = debugMalloc(sizeof ( struct p), 999);
......
......@@ -19,6 +19,8 @@
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
......@@ -34,6 +36,10 @@
//#include "avl.h"
uint32_t My_pid = 0;
......@@ -751,3 +757,4 @@ struct plugin_v1 *srv_get_plugin_v1( void ) {
#endif /*NOSRV*/
......@@ -17,6 +17,8 @@
*
*/
#ifndef _BATMAN_BATMAN_H
#define _BATMAN_BATMAN_H
......@@ -59,7 +61,7 @@
* Global Variables and definitions
*/
#define SOURCE_VERSION "0.5-freifunk-dresden" //put exactly one distinct word inside the string like "0.3-pre-alpha" or "0.3-rc1" or "0.3"
#define SOURCE_VERSION "0.4-freifunk-dresden" //put exactly one distinct word inside the string like "0.3-pre-alpha" or "0.3-rc1" or "0.3"
#define COMPAT_VERSION 10
......@@ -194,6 +196,8 @@ extern uint32_t My_pid;
#define ARG_HELP "help"
#define ARG_VERBOSE_HELP "verbose_help"
#define ARG_EXP "exp_help"
......@@ -791,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>
......@@ -339,6 +340,7 @@ void accept_ctrl_node( void ) {
}
void handle_ctrl_node( struct ctrl_node *cn ) {
char buff[MAX_UNIX_MSG_SIZE+1];
......@@ -683,6 +685,9 @@ uint8_t __dbgf_all( void ) {
int (*load_config_cb) ( uint8_t test, struct opt_type *opt, struct ctrl_node *cn ) = NULL;
int (*save_config_cb) ( uint8_t del, struct opt_type *opt, char *parent, char *val, struct ctrl_node *cn ) = NULL;
......@@ -731,6 +736,8 @@ static int32_t opt_deprecated ( uint8_t cmd, uint8_t _save, struct opt_type *opt
int32_t get_tracked_network( struct opt_type *opt, struct opt_parent *patch, char *out, uint32_t *ip, int32_t *mask, struct ctrl_node *cn ) {
struct opt_child *nc, *mc;
......@@ -871,6 +878,8 @@ static char *debugWordDup( char* word, int32_t tag ) {
}
static void strchange( char *s, char i, char o ) {
char *p;
......@@ -1434,6 +1443,7 @@ static struct opt_child *add_opt_child( struct opt_type *opt, struct opt_parent
void set_opt_parent_val( struct opt_parent *p, char *val ) {
if ( val && p->p_val && wordsEqual( p->p_val, val ) )
......@@ -1574,6 +1584,7 @@ static struct opt_parent *dup_opt_parent ( struct opt_type *opt, struct opt_par
char *opt_cmd2str[] = {
"OPT_REGISTER",
"OPT_PATCH",
......@@ -2775,6 +2786,11 @@ void apply_init_args( int argc, char *argv[] ) {
char *ipStr( uint32_t addr ) {
#define IP2S_ARRAY_LEN 10
static uint8_t c=0;
......@@ -2934,6 +2950,7 @@ int32_t check_dir( char *path, uint8_t create, uint8_t write ) {
uint32_t wordlen ( char *s ) {
uint32_t i = 0;
......@@ -2980,6 +2997,11 @@ void wordCopy( char *out, char *in ) {
#ifndef NODEPRECATED
static int32_t opt_uptime ( uint8_t cmd, uint8_t _save, struct opt_type *opt, struct opt_parent *patch, struct ctrl_node *cn ) {
......@@ -3035,6 +3057,7 @@ static int32_t opt_show_info ( uint8_t cmd, uint8_t _save, struct opt_type *opt,
}
static int32_t opt_no_fork ( uint8_t cmd, uint8_t _save, struct opt_type *opt, struct opt_parent *patch, struct ctrl_node *cn ) {
if ( cmd == OPT_APPLY ) {
......@@ -3201,6 +3224,12 @@ static int32_t opt_run_dir ( uint8_t cmd, uint8_t _save, struct opt_type *opt, s
static struct opt_type control_options[]=
{
// ord parent long_name shrt Attributes *ival min max default *func,*syntax,*help
......@@ -3315,7 +3344,6 @@ void init_control( void ) {
}
void cleanup_config( void ) {
del_opt_parent( &Patch_opt, NULL );
......@@ -3328,6 +3356,7 @@ void cleanup_config( void ) {
}
void cleanup_control( void ) {
int8_t i;
......@@ -3350,3 +3379,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
......@@ -161,6 +162,7 @@ struct ctrl_node *create_ctrl_node( int fd, void (*cn_fd_handler) (struct ctrl_n
#define REFERENCE_KEY_WORD "ref:"
#define EOS_DELIMITER '#'
......
......@@ -17,6 +17,7 @@
*
*/
#include <stdio.h> /* NULL */
#include <string.h>
......@@ -31,6 +32,7 @@ int compare_key( void *data1, void *data2, size_t key_size ) {
}
/* hashfunction to choose an entry in a hash table of given size */
/* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */
int choose_key( void *data, int size, size_t key_size ) {
......@@ -90,6 +92,7 @@ void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb) {
}
/* free only the hashtable and the hash itself. */
void hash_destroy(struct hashtable_t *hash) {
......@@ -103,6 +106,8 @@ void hash_destroy(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 @@
*
*/
typedef int (*hashdata_compare_cb)(void *, void *, size_t);
typedef int (*hashdata_choose_cb)(void *, int, size_t);
typedef void (*hashdata_free_cb)(void *);
......
......@@ -724,3 +724,4 @@ struct plugin_v1 *hna_get_plugin_v1( void ) {
#endif //NOHNA
......@@ -17,6 +17,7 @@
*
*/
#ifndef NOHNA
#define ARG_UHNA "unicast_hna"
......@@ -31,6 +32,7 @@
#define A_TYPE_MAX 0x01
struct hna_netmask_type
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
......@@ -45,6 +47,7 @@ struct hna_netmask_type
} __attribute__((packed));
#define EXT_HNA_FIELD_TYPE nt.atype
#define EXT_HNA_FIELD_NETMASK nt.anetmask
#define EXT_HNA_FIELD_ADDR addr
......
......@@ -2236,3 +2236,5 @@ void cleanup_route( void ) {
rt_sock = 0;
}
......@@ -17,9 +17,12 @@
*
*/
#include "list-batman.h"
/*
* Insert a new entry between two known consecutive entries.
*
......@@ -81,6 +84,7 @@ void list_add_before( struct list_head *prev_node, struct list_head *next_node,
}
/*
* Delete a list entry by making the next entries
* point to each other.
......@@ -115,6 +119,7 @@ void list_del( struct list_head *prev_entry, struct list_head *entry, struct lis
}
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
......
......@@ -17,6 +17,8 @@
*
*/
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
......
......@@ -17,6 +17,7 @@
*
*/
#include <stdio.h>
#include <string.h>
......@@ -34,6 +35,7 @@ void flush_sq_record( struct sq_record *sqr ) {
}
void update_lounged_metric(uint8_t probe, uint8_t lounge_size, SQ_TYPE sqn_incm, SQ_TYPE sqn_max, struct sq_record *sqr, uint8_t ws)
{
SQ_TYPE sq_upd;
......@@ -95,6 +97,8 @@ void update_lounged_metric(uint8_t probe, uint8_t lounge_size, SQ_TYPE sqn_incm,
}
uint32_t upd_wavg( uint32_t *wavg, uint32_t probe, uint8_t weight_exp ) {
#ifndef NOPARANOIA
......
......@@ -91,6 +91,8 @@ SIMPEL_LIST( if_list );
static void update_routes( struct orig_node *orig_node, struct neigh_node *new_router ) {
prof_start( PROF_update_routes );
......@@ -284,6 +286,7 @@ struct neigh_node *update_orig(struct orig_node *on, uint16_t *oCtx, struct msg_
}
paranoia( -500001, !incm_rt );
/*
......@@ -2152,3 +2155,4 @@ void init_originator( void ) {
register_options_array( originator_options, sizeof( originator_options ) );
}
......@@ -21,7 +21,7 @@
#define _BATMAN_OS_H
#define timercpy(d, a) do { (d)->tv_sec = (a)->tv_sec; (d)->tv_usec = (a)->tv_usec; } while(0)
# define timercpy(d, a) (d)->tv_sec = (a)->tv_sec; (d)->tv_usec = (a)->tv_usec;
/* posix.c */
......@@ -52,7 +52,7 @@ void cleanup_all( int status );
#ifdef NOPARANOIA
#define paranoia( ... )
#else
#define paranoia( code , problem ) do { if ( problem ) { cleanup_all( code ); } } while(0)
#define paranoia( code , problem ); do { if ( problem ) { cleanup_all( code ); } }while(0)
#endif
......@@ -76,6 +76,8 @@ int8_t is_aborted();
uint8_t get_set_bits( uint32_t v );
/* route.c */
#define DEV_LO "lo"
......@@ -94,6 +96,7 @@ extern int32_t base_port;
/***
*
* Things you should leave as is unless your know what you are doing !
......@@ -112,6 +115,7 @@ extern int32_t base_port;
#define RT_TABLE_TUNNEL -3
extern uint8_t if_conf_soft_changed; // temporary enabled to trigger changed interface configuration
extern uint8_t if_conf_hard_changed; // temporary enabled to trigger changed interface configuration
......
......@@ -252,6 +252,8 @@ int32_t cb_snd_ext_hook( uint16_t ext_type, unsigned char* ext_buff ) {
int32_t reg_plugin_data( uint8_t data_type ) {
static int initialized = NO;
......
......@@ -25,6 +25,7 @@
extern struct list_head_first cb_fd_list;
enum {
PLUGIN_CB_CONF,
PLUGIN_CB_ORIG_CREATE,
......@@ -49,6 +50,7 @@ struct plugin_v1 {
};
struct plugin_node {
struct list_head list;
int32_t version;
......@@ -134,6 +136,7 @@ void **get_plugin_data( void *data, uint8_t data_type, int32_t registry );
/**************************************
*to be used by batman sceleton...
*/
......@@ -154,3 +157,4 @@ int32_t cb_snd_ext_hook( uint16_t ext_type, unsigned char* ext_buff );
// use void change_selects( void ) to trigger cb_fd_handler()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment