diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/analysis/binary.c | 52 | ||||
-rw-r--r-- | src/analysis/binary.h | 3 | ||||
-rw-r--r-- | src/gui/menus/project.c | 1 | ||||
-rw-r--r-- | src/gui/panels/symbols.c | 2 |
4 files changed, 58 insertions, 0 deletions
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); |