diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 52 | ||||
-rw-r--r-- | src/analysis/binary.h | 3 |
2 files changed, 55 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 ------------------------- */ |