summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/db/analyst.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/analysis/db/analyst.c')
-rw-r--r--plugins/pychrysalide/analysis/db/analyst.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/db/analyst.c b/plugins/pychrysalide/analysis/db/analyst.c
index 83e3878..bb9af30 100644
--- a/plugins/pychrysalide/analysis/db/analyst.c
+++ b/plugins/pychrysalide/analysis/db/analyst.c
@@ -36,6 +36,7 @@
#include "client.h"
#include "collection.h"
+#include "../content.h"
#include "../../access.h"
#include "../../helpers.h"
#include "../../struct.h"
@@ -45,6 +46,9 @@
/* Crée un nouvel objet Python de type 'AnalystClient'. */
static PyObject *py_analyst_client_new(PyTypeObject *, PyObject *, PyObject *);
+/* Envoie un contenu binaire pour conservation côté serveur. */
+static PyObject *py_analyst_client_send_content(PyObject *, PyObject *);
+
/* Effectue une demande de sauvegarde de l'état courant. */
static PyObject *py_analyst_client_save(PyObject *, PyObject *);
@@ -179,6 +183,50 @@ static PyObject *py_analyst_client_new(PyTypeObject *type, PyObject *args, PyObj
/******************************************************************************
* *
* Paramètres : self = client à manipuler. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Envoie un contenu binaire pour conservation côté serveur. *
+* *
+* Retour : True si la commande a bien été envoyée, False sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_analyst_client_send_content(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Bilan à retourner */
+ GBinContent *content; /* Contenu binaire à envoyer */
+ int ret; /* Bilan de lecture des args. */
+ GAnalystClient *client; /* Version native du serveur */
+ bool status; /* Bilan de l'opération */
+
+#define ANALYST_CLIENT_SEND_CONTENT_METHOD PYTHON_METHOD_DEF \
+( \
+ send_content, "$self, content, /", \
+ METH_VARARGS, py_analyst_client, \
+ "Ask the server for saving the current state of the analyzed binary" \
+ " and returns the status of the request transmission." \
+)
+
+ ret = PyArg_ParseTuple(args, "O&", convert_to_binary_content, &content);
+ if (!ret) return NULL;
+
+ client = G_ANALYST_CLIENT(pygobject_get(self));
+
+ status = g_analyst_client_send_content(client, content);
+
+ result = status ? Py_True : Py_False;
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = client à manipuler. *
* args = arguments d'appel non utilisés ici. *
* *
* Description : Effectue une demande de sauvegarde de l'état courant. *
@@ -773,6 +821,7 @@ static int py_analyst_client_set_current_snapshot(PyObject *self, PyObject *valu
PyTypeObject *get_python_analyst_client_type(void)
{
static PyMethodDef py_analyst_client_methods[] = {
+ ANALYST_CLIENT_SEND_CONTENT_METHOD,
ANALYST_CLIENT_SAVE_METHOD,
ANALYST_CLIENT_SET_LAST_ACTIVE_METHOD,
ANALYST_CLIENT_SET_SNAPSHOT_NAME_METHOD,