Author: axel
Date: 2009-11-27 23:08:32 +0000 (Fri, 27 Nov 2009)
New Revision: 1485
Modified:
trunk/batman-experimental/batman.h
trunk/batman-experimental/control.h
trunk/batman-experimental/hna.c
trunk/batman-experimental/schedule.c
Log:
minor debug, and comments beautification
Modified: trunk/batman-experimental/batman.h
===================================================================
--- trunk/batman-experimental/batman.h 2009-11-27 14:42:32 UTC (rev 1484)
+++ trunk/batman-experimental/batman.h 2009-11-27 23:08:32 UTC (rev 1485)
@@ -149,7 +149,7 @@
#define WARNING_PERIOD 20000
#define MAX_PATH_SIZE 300
-#define MAX_ARG_SIZE 50
+#define MAX_ARG_SIZE 200
/* DEF_UDPD_SIZE should not be increased before all bmxds' of a mesh support this
option!
Modified: trunk/batman-experimental/control.h
===================================================================
--- trunk/batman-experimental/control.h 2009-11-27 14:42:32 UTC (rev 1484)
+++ trunk/batman-experimental/control.h 2009-11-27 23:08:32 UTC (rev 1485)
@@ -298,50 +298,57 @@
enum opt_cmd {
+ // option handlers are registered, configured, and unregistered using primitives.
+ // for registration and unregistration the primitives OPT_REGISTER and OPT_UNREGISTER
are used
+ // for configuration the primitives OPT_PATCH, OPT_ADJUST, OPT_CHECK, OPT_APPLY,
OPT_SET_POST, OPT_POST are used
+
+
// called once for each option after registration
// Returns FAILURE or SUCCESS
OPT_REGISTER,
- OPT_PATCH,
-/*
- if applied values need to be adjusted to unified format it must be during OPT_ADJUST
- this has the following advantages:
- tracked and applied values are equal
- -> track knows about already configured values
- -> can prevent/warn reconfiguration of already configured values
- -> can reject resetting of non-configured values
-*/
+ OPT_PATCH,
+ // opt values are configured by creating, extending, adjusting and finally testing and
applying a patch
+ // option handler usually dont care about the creation of the patch.
+ // they get a complete patch which includes
+ // the option type-value pair and optional child type-valued pairs.
+
+
OPT_ADJUST,
+ // patched type-values pairs can be adjusted to a unified format before being checked or
applied
+ // this has the following advantages:
+ // tracked and applied values are equal (different value notations can be adjusted to a
unified format)
+ // -> track knows about already configured values (even when given with different
notation)
+ // -> can prevent/warn reconfiguration of already configured values
+ // -> can reject resetting of non-configured values
+
-
- // to test opt value!
+ OPT_CHECK,
+ // to test a give patch (type-value pair) !
// Returns FAILURE or n>=0 of processed bytes-1
- OPT_CHECK,
- // to set opt value!
+
+ OPT_APPLY,
+ // to apply a previously created and adjusted patch
// Returns FAILURE or n>=0 of processed bytes-1
- OPT_APPLY,
- /*
- // end of A_N section (after last opt_arg )
- // Returns FAILURE or SUCCESS
- OPT_TEST_END,
- OPT_SET_END,
- */
-
+ OPT_SET_POST,
+ // called whenever any option is changed and
// called ordered for each option and before next higher-order option
// Returns FAILURE or SUCCESS
- OPT_SET_POST,
+
+ OPT_POST,
+ // called whenever any option is changed and
// called ordered for each option after all options were (re-)set
// Returns FAILURE or SUCCESS
- OPT_POST,
+
+ OPT_UNREGISTER
// called once before an option is unregistered
// Returns FAILURE or SUCCESS
- OPT_UNREGISTER
};
Modified: trunk/batman-experimental/hna.c
===================================================================
--- trunk/batman-experimental/hna.c 2009-11-27 14:42:32 UTC (rev 1484)
+++ trunk/batman-experimental/hna.c 2009-11-27 23:08:32 UTC (rev 1485)
@@ -466,13 +466,13 @@
0, "\nHost and Network Announcement (HNA) options:"},
{ODI,5,0,ARG_UHNA,
'a',A_PMN,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_hna,
- ARG_PREFIX_FORM, "perform host-network announcement (HNA) for defined ip
range"},
+ ARG_PREFIX_FORM,"perform host-network announcement (HNA) for defined ip
range"},
{ODI,5,ARG_UHNA,ARG_NETW, 'n',A_CS1,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_hna,
ARG_NETW_FORM, "specify network of announcement"},
{ODI,5,ARG_UHNA,ARG_MASK, 'm',A_CS1,A_ADM,A_DYI,A_CFA,A_ANY, 0, 0, 0, 0, opt_hna,
- ARG_MASK_FORM, "specify network of announcement"},
+ ARG_MASK_FORM, "specify network prefix of announcement"},
{ODI,5,0,ARG_HNAS, 0, A_PS0,A_USR,A_DYN,A_ARG,A_ANY, 0, 0, 0, 0, opt_show_hnas,
Modified: trunk/batman-experimental/schedule.c
===================================================================
--- trunk/batman-experimental/schedule.c 2009-11-27 14:42:32 UTC (rev 1484)
+++ trunk/batman-experimental/schedule.c 2009-11-27 23:08:32 UTC (rev 1485)
@@ -419,7 +419,6 @@
//uint16_t aggr_interval = (my_ogi/aggr_p_ogi > 3*MIN_OGI) ? 3*MIN_OGI :
(my_ogi/aggr_p_ogi);
register_task( (aggr_interval + rand_num( aggr_interval/2 )) - (aggr_interval/4),
send_outstanding_ogms, NULL );
-
if ( list_empty( &send_list ) ||
GREAT_U32( (list_entry( (&send_list)->next, struct send_node, list
))->send_time, batman_time ) ) {
@@ -438,8 +437,8 @@
list_for_each_safe( send_pos, send_temp, &send_list ) {
send_node = list_entry( send_pos, struct send_node, list );
+
-
if ( GREAT_U32( send_node->send_time, batman_time ) )
break; // for now we are done,
@@ -1400,9 +1399,9 @@
send_node_new = batman_if->own_send_node;
memset( send_node_new, 0, sizeof( struct send_node) );
+
INIT_LIST_HEAD( &send_node_new->list );
-
-
+
send_node_new->send_time = batman_if->if_seqno_schedule + my_ogi;
if ( LESS_U32( send_node_new->send_time, batman_time ) ||
@@ -1460,16 +1459,12 @@
send_node_new->ogm_buff_len = ogm_len;
-
-
batman_if->own_ogm_out->ogm_seqno = htons( batman_if->if_seqno );
batman_if->own_ogm_out->bat_size = ogm_len/4;
batman_if->own_ogm_out->flags = 0;
- //batman_if->own_ogm_out->ogm_path_lounge = Signal_lounge; done in
if_reconfigure_soft
batman_if->own_ogm_out->ogm_misc = MIN( s_curr_avg_cpu_load , 255 );
-
prev_list_head = (struct list_head *)&send_list;
list_for_each( list_pos, &send_list ) {
@@ -1503,6 +1498,7 @@
}
+
prof_stop( PROF_schedule_own_ogm );
}