summaryrefslogtreecommitdiff
path: root/src/analysis
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 /src/analysis
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
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c52
-rw-r--r--src/analysis/binary.h3
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 ------------------------- */