s3d (0.2.2-8) meshs3d_tt.patch

Summary

 apps/meshs3d/main.c     |    6 +++---
 apps/meshs3d/meshs3d.h  |    4 ++--
 apps/meshs3d/mixed.data |    4 ++--
 apps/meshs3d/process.c  |   24 ++++++++++++------------
 4 files changed, 19 insertions(+), 19 deletions(-)

    
download this patch

Patch contents

Description: Add support for TT instead of HNA
 batctl renamed HNA to TT (aka TranslationTable style) and meshs3d should
 at support for both versions.
Author: Sven Eckelmann <sven@narfation.org>

---
diff --git a/apps/meshs3d/main.c b/apps/meshs3d/main.c
index fe7957bd71a8551e80e385cd09e30f1067e81996..519922d92b7dbf67dabd31c20eed45d9db766b02 100644
--- a/apps/meshs3d/main.c
+++ b/apps/meshs3d/main.c
@@ -50,7 +50,7 @@ static struct timespec sleep_time = {
 static void init_globals(void)
 {
 	Global.debug = 1;
-	Global.obj_node_hna = 0;
+	Global.obj_node_tt = 0;
 	Global.obj_node_inet = 0;
 	Global.obj_node_normal = 0;
 	Global.obj_btn_close = 0;
@@ -129,7 +129,7 @@ static void handle_node(void)
 			if (node->node_type == 1)
 				node->obj_id = s3d_clone(Global.obj_node_inet);
 			else if (node->node_type == 2)
-				node->obj_id = s3d_clone(Global.obj_node_hna);
+				node->obj_id = s3d_clone(Global.obj_node_tt);
 			else
 				node->obj_id = s3d_clone(Global.obj_node_normal);
 
@@ -561,7 +561,7 @@ int main(int argc, char *argv[])
 
 			Global.obj_node_normal = s3d_import_model_file("objs/accesspoint.3ds");
 			Global.obj_node_inet = s3d_import_model_file("objs/accesspoint_inet.3ds");
-			Global.obj_node_hna = s3d_import_model_file("objs/internet.3ds");
+			Global.obj_node_tt = s3d_import_model_file("objs/internet.3ds");
 			Global.obj_btn_close = s3d_import_model_file("objs/btn_close.3ds");
 
 			Global.obj_s3d_url = s3d_import_model_file("objs/s3d_berlios_de.3ds");
diff --git a/apps/meshs3d/meshs3d.h b/apps/meshs3d/meshs3d.h
index 7fa5931321f09677e4e76eeb9e1ae67fcad77d83..9c08ac4e8c5fbf44616e02f9f3da8ba9fedd0f84 100644
--- a/apps/meshs3d/meshs3d.h
+++ b/apps/meshs3d/meshs3d.h
@@ -77,7 +77,7 @@ struct olsr_neigh_list {
 struct node {
 	struct node_id address;
 	char name_string[NAMEMAX];  /* host ip */
-	int node_type;     /* normal = 0, internet gateway = 1, via hna announced network = 2 */
+	int node_type;     /* normal = 0, internet gateway = 1, via tt announced network = 2 */
 	int node_type_modified;   /* node_type modified flag */
 	int last_seen;     /* last seen counter */
 	int visible;     /* is this node visible or vanished */
@@ -92,7 +92,7 @@ struct glob {
 	int debug;
 	int obj_node_normal;
 	int obj_node_inet;
-	int obj_node_hna;
+	int obj_node_tt;
 	int obj_btn_close;
 	int obj_s3d_url;
 	int obj_zero_point;
diff --git a/apps/meshs3d/mixed.data b/apps/meshs3d/mixed.data
index 898d2a4ee779c132352a95ce411e23eafafa14dc..d326db0d3a9685d13cd764c9eedc893613aff523 100644
--- a/apps/meshs3d/mixed.data
+++ b/apps/meshs3d/mixed.data
@@ -1,11 +1,11 @@
 digraph {
 	"104.131.131.1" -> "02:00:00:00:00:04"[label="0.00", style=dashed];
 	"104.131.131.1" -> "104.131.0.42"[label="58.29", style=solid];
-	"104.65.0.42" -> "0.0.0.0/0.0.0.0"[label="HNA"];
+	"104.65.0.42" -> "0.0.0.0/0.0.0.0"[label="TT"];
 	"master" -> "02:00:00:00:00:02" [label="1.7"]
 	"master" -> "2001:db8:beef::1" [label="1.0"]
 	"master" -> "2001:db8::1" [label="1.0"]
-	"master" -> "00:ff:1c:68:00:00" [label="HNA"]
+	"master" -> "00:ff:1c:68:00:00" [label="TT"]
 	"master" -> "104.131.131.1" [label="5.7"]
 	"2001:db8:beef::1" -> "3ffe:1900:4545:3:200:f8ff:fe21:67cf" [label="1.0"]
 	"2001:db8::1" -> "3ffe:1900:4545:3:200:f8ff:fe21:67cf" [label="12.0"]
diff --git a/apps/meshs3d/process.c b/apps/meshs3d/process.c
index d0e24a6442e6f57a0a4f950385b3b0534c426035..e3f421b9e6b09098cdbebd0f3470c08b4b065dc1 100644
--- a/apps/meshs3d/process.c
+++ b/apps/meshs3d/process.c
@@ -387,8 +387,8 @@ int process_main(void)
 	char *lbuf_ptr, *last_cr_ptr, *con_from, *con_from_end, *con_to, *con_to_end, *etx, *etx_end, *tmp_char;
 	struct hash_it_t *hashit;
 	struct node_con *con;
-	char hna_name[NAMEMAX];
-	char hna_node[NAMEMAX];
+	char tt_name[NAMEMAX];
+	char tt_node[NAMEMAX];
 
 	struct node *tmp_node;
 	struct node_id int_con_from, int_con_to;
@@ -451,8 +451,8 @@ int process_main(void)
 
 				/* if( Global.debug ) printf( "con_from: %s, con_to: %s, etx: %s\n", con_from, con_to, etx ); */
 
-				/* announced network via HNA */
-				if (strncmp(etx, "HNA", NAMEMAX) == 0) {
+				/* announced network via TT */
+				if (strncmp(etx, "HNA", NAMEMAX) == 0 || strncmp(etx, "TT", NAMEMAX) == 0) {
 
 					if (strncmp(con_to, "0.0.0.0/0.0.0.0", NAMEMAX) == 0) {
 
@@ -473,12 +473,12 @@ int process_main(void)
 
 					} else {
 
-						memmove(hna_node, con_to, NAMEMAX);
-						if ((tmp_char = strchr(hna_node, (int)'/'))) {
+						memmove(tt_node, con_to, NAMEMAX);
+						if ((tmp_char = strchr(tt_node, (int)'/'))) {
 							tmp_char++;
 							address = (int) - inet_network(tmp_char);
-							sprintf(hna_name, "%u", (unsigned int)(32 - ceil(log(address) / log(2))));
-							strcpy(tmp_char, hna_name);
+							sprintf(tt_name, "%u", (unsigned int)(32 - ceil(log(address) / log(2))));
+							strcpy(tmp_char, tt_name);
 							tmp_char--;
 						}
 
@@ -488,21 +488,21 @@ int process_main(void)
 							printf("%s is not a valid address\n", con_from);
 							continue;
 						}
-						if (parse_address(hna_node, &int_con_to) != 0) {
-							printf("%s is not a valid address\n", hna_node);
+						if (parse_address(tt_node, &int_con_to) != 0) {
+							printf("%s is not a valid address\n", tt_node);
 							continue;
 						}
 						if (tmp_char != NULL)
 							tmp_char[0] = '/';
 
 						handle_mesh_node(int_con_from, con_from);
-						tmp_node = handle_mesh_node(int_con_to, hna_node);
+						tmp_node = handle_mesh_node(int_con_to, tt_node);
 
 						if (tmp_node->node_type != 2) {
 
 							tmp_node->node_type = 2;
 							tmp_node->node_type_modified = 1;
-							if (Global.debug) printf("new hna network: %s\n", tmp_node->name_string);
+							if (Global.debug) printf("new tt network: %s\n", tmp_node->name_string);
 
 						}