From 5c6680287b4b6ba38cc04e6d7cb80c87cb9e256d Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 16 Feb 2015 20:15:33 +0000 Subject: 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 --- ChangeLog | 12 +++++++++++ src/analysis/binary.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ src/analysis/binary.h | 3 +++ src/gui/menus/project.c | 1 + src/gui/panels/symbols.c | 2 ++ 5 files changed, 70 insertions(+) diff --git a/ChangeLog b/ChangeLog index ace9d6e..3fe266f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 15-02-16 Cyrille Bagard + * 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 + * 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); -- cgit v0.11.2-87-g4458