scalarproduct client More...
#include "platform.h"
#include <gcrypt.h>
#include <inttypes.h>
#include "gnunet_util_lib.h"
#include "gnunet_scalarproduct_service.h"
#include "gnunet_protocols.h"
#include "scalarproduct.h"
Go to the source code of this file.
Macros | |
#define | GCRYPT_NO_DEPRECATED |
#define | LOG(kind, ...) |
Functions | |
static void | responder_callback (void *cls, enum GNUNET_SCALARPRODUCT_ResponseStatus status) |
Callback called if we are initiating a new computation session. More... | |
static void | requester_callback (void *cls, enum GNUNET_SCALARPRODUCT_ResponseStatus status, gcry_mpi_t result) |
Callback called if we are initiating a new computation session. More... | |
static void | shutdown_task (void *cls) |
Task run during shutdown. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be run by the scheduler. More... | |
int | main (int argc, char *const *argv) |
The main function to the scalarproduct client. More... | |
Variables | |
static struct GNUNET_HashCode | session_key |
the session key identifying this computation More... | |
static struct GNUNET_PeerIdentity | peer_id |
PeerID we want to compute a scalar product with. More... | |
static char * | input_peer_id |
Option -p: destination peer identity for checking message-ids with. More... | |
static char * | input_session_key |
Option -p: destination peer identity for checking message-ids with. More... | |
static char * | input_elements |
Option -e: vector to calculate a scalarproduct with. More... | |
static int | ret = -1 |
Global return value. More... | |
static struct GNUNET_SCALARPRODUCT_ComputationHandle * | computation |
our Scalarproduct Computation handle More... | |
scalarproduct client
Definition in file gnunet-scalarproduct.c.
#define GCRYPT_NO_DEPRECATED |
Definition at line 26 of file gnunet-scalarproduct.c.
#define LOG | ( | kind, | |
... | |||
) |
Definition at line 36 of file gnunet-scalarproduct.c.
|
static |
Callback called if we are initiating a new computation session.
cls | unused |
status | if our job was successfully processed |
Definition at line 83 of file gnunet-scalarproduct.c.
References computation, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_h2s(), GNUNET_SCALARPRODUCT_STATUS_DISCONNECTED, GNUNET_SCALARPRODUCT_STATUS_FAILURE, GNUNET_SCALARPRODUCT_STATUS_INVALID_RESPONSE, GNUNET_SCALARPRODUCT_STATUS_SUCCESS, GNUNET_SCHEDULER_shutdown(), LOG, ret, session_key, and status.
Referenced by run().
|
static |
Callback called if we are initiating a new computation session.
cls | unused |
status | if our job was successfully processed |
result | the result in gnu/gcry MPI format |
Definition at line 132 of file gnunet-scalarproduct.c.
References computation, GNUNET_ERROR_TYPE_ERROR, GNUNET_h2s(), GNUNET_i2s(), GNUNET_SCALARPRODUCT_STATUS_DISCONNECTED, GNUNET_SCALARPRODUCT_STATUS_FAILURE, GNUNET_SCALARPRODUCT_STATUS_INVALID_RESPONSE, GNUNET_SCALARPRODUCT_STATUS_SUCCESS, GNUNET_SCHEDULER_shutdown(), LOG, LOG_GCRY, peer_id, result, ret, session_key, and status.
Referenced by run().
|
static |
Task run during shutdown.
cls | unused |
Definition at line 195 of file gnunet-scalarproduct.c.
References computation, GNUNET_SCALARPRODUCT_cancel(), and ret.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 214 of file gnunet-scalarproduct.c.
References _, cfg, computation, end, GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_htonll(), GNUNET_malloc, GNUNET_OK, GNUNET_SCALARPRODUCT_accept_computation(), GNUNET_SCALARPRODUCT_start_computation(), GNUNET_SCHEDULER_add_shutdown(), input_elements, input_peer_id, input_session_key, GNUNET_SCALARPRODUCT_Element::key, LOG, peer_id, GNUNET_PeerIdentity::public_key, requester_callback(), responder_callback(), ret, session_key, shutdown_task(), and GNUNET_SCALARPRODUCT_Element::value.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function to the scalarproduct client.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 358 of file gnunet-scalarproduct.c.
References gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), input_elements, input_peer_id, input_session_key, options, ret, and run().
|
static |
the session key identifying this computation
Definition at line 43 of file gnunet-scalarproduct.c.
Referenced by GNUNET_SCALARPRODUCT_accept_computation(), GNUNET_SCALARPRODUCT_start_computation(), requester_callback(), responder_callback(), and run().
|
static |
PeerID we want to compute a scalar product with.
Definition at line 48 of file gnunet-scalarproduct.c.
Referenced by requester_callback(), and run().
|
static |
Option -p: destination peer identity for checking message-ids with.
Definition at line 53 of file gnunet-scalarproduct.c.
|
static |
Option -p: destination peer identity for checking message-ids with.
Definition at line 58 of file gnunet-scalarproduct.c.
|
static |
Option -e: vector to calculate a scalarproduct with.
Definition at line 63 of file gnunet-scalarproduct.c.
|
static |
Global return value.
Definition at line 68 of file gnunet-scalarproduct.c.
Referenced by main(), requester_callback(), responder_callback(), run(), and shutdown_task().
|
static |
our Scalarproduct Computation handle
Definition at line 73 of file gnunet-scalarproduct.c.
Referenced by requester_callback(), responder_callback(), run(), and shutdown_task().