summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-02-16 20:15:33 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-02-16 20:15:33 (GMT)
commit5c6680287b4b6ba38cc04e6d7cb80c87cb9e256d (patch)
tree5539499ef393a94a841d4df9cb2db5c7399a235d
parent635640a32fecbb9b8a5ddf239b819c022c4b9977 (diff)
Connected each loaded binary as a client to a server.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@473 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog12
-rw-r--r--src/analysis/binary.c52
-rw-r--r--src/analysis/binary.h3
-rw-r--r--src/gui/menus/project.c1
-rw-r--r--src/gui/panels/symbols.c2
5 files changed, 70 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ace9d6e..3fe266f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
15-02-16 Cyrille Bagard <nocbos@gmail.com>
+ * src/analysis/binary.c:
+ * src/analysis/binary.h:
+ Connect each loaded binary as a client to a server.
+
+ * src/gui/menus/project.c:
+ Update code.
+
+ * src/gui/panels/symbols.c:
+ Avoid to crash when loading a new binary in an empty project.
+
+15-02-16 Cyrille Bagard <nocbos@gmail.com>
+
* configure.ac:
Add the new Makefile from the 'plugins/mobicore' directory.
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index d27e761..911e239 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -700,6 +700,58 @@ void g_loaded_binary_set_storage(GLoadedBinary *binary, DBFeatures feature, DBSt
}
+/******************************************************************************
+* *
+* Paramètres : binary = élément binaire à manipuler. *
+* *
+* Description : Etablit une connexion à un serveur en tant que client. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_loaded_binary_connect(GLoadedBinary *binary)
+{
+ bool result; /* Bilan à retourner */
+
+ char *host; /* Nom du serveur à contacter */
+ int port; /* Numéro du port associé */
+ char *author; /* Identification à diffuser */
+
+
+
+
+ /* Détermination de l'identifiant */
+
+ binary->checksum = g_checksum_new(G_CHECKSUM_SHA256);
+ g_checksum_update(binary->checksum, binary->bin_data, binary->bin_length);
+
+
+ binary->local = g_db_client_new(g_loaded_binary_get_name(binary, false),
+ g_loaded_binary_get_cheksum(binary),
+ binary->collections);
+
+
+ if (!g_generic_config_get_value(get_main_configuration(), MPK_LOCAL_HOST, &host))
+ /* ... */;
+
+ if (!g_generic_config_get_value(get_main_configuration(), MPK_LOCAL_PORT, &port))
+ /* ... */;
+
+ if (!g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &author))
+ /* ... */;
+
+
+ result = g_db_client_start(binary->local, host, port, author);
+
+ printf("DB status :: %d\n", result);
+
+ return result;
+
+}
+
/* ---------------------------------------------------------------------------------- */
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 26367c4..fe6185f 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -107,6 +107,9 @@ DBStorage g_loaded_binary_get_storage(const GLoadedBinary *, DBFeatures);
/* Définit la forme d'enregistrement d'une fonctionnalité. */
void g_loaded_binary_set_storage(GLoadedBinary *, DBFeatures, DBStorage);
+/* Etablit une connexion à un serveur en tant que client. */
+bool g_loaded_binary_connect(GLoadedBinary *);
+
/* ------------------------- INFORMATIONS D'ENREGISTREMENTS ------------------------- */
diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c
index caf3f64..5e86c0f 100644
--- a/src/gui/menus/project.c
+++ b/src/gui/menus/project.c
@@ -306,6 +306,7 @@ static void mcb_project_add_binary_file(GtkMenuItem *menuitem, GMenuBar *bar)
g_signal_connect(binary, "disassembly-done",
G_CALLBACK(g_study_project_add_loaded_binary), get_current_project());
g_loaded_binary_analyse(binary);
+ g_loaded_binary_connect(binary);
}
g_free(filename);
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index e5fd390..40f1f76 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -608,6 +608,8 @@ static void change_symbols_panel_current_binary(GSymbolsPanel *panel, GLoadedBin
reorganize_symbols_tree_view(NULL, G_OBJECT(G_EDITOR_ITEM(panel)->widget));
}
+ return; /* FIXME */
+
gtk_widget_get_preferred_size(GTK_WIDGET(panel->treeview), NULL, &req);
gtk_widget_set_size_request(GTK_WIDGET(panel->treeview), req.width, req.height);