aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/gnunet-service-consensus.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/consensus/gnunet-service-consensus.cc')
-rw-r--r--src/consensus/gnunet-service-consensus.cc74
1 files changed, 69 insertions, 5 deletions
diff --git a/src/consensus/gnunet-service-consensus.cc b/src/consensus/gnunet-service-consensus.cc
index 82ea5ef79..9e8aba6bb 100644
--- a/src/consensus/gnunet-service-consensus.cc
+++ b/src/consensus/gnunet-service-consensus.cc
@@ -24,23 +24,87 @@
24#include <stdint.h> 24#include <stdint.h>
25 25
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_protocols.h"
27#include "gnunet_common.h" 28#include "gnunet_common.h"
28#include "gnunet_service_lib.h" 29#include "gnunet_service_lib.h"
30#include "gnunet_consensus_service.h"
31#include "consensus.h"
29 32
30using namespace std; 33using namespace std;
31 34
35
36
37struct ConsensusSession
38{
39
40};
41
42
43
44struct ConsensusClient
45{
46
47};
48
49
50
51/**
52 * Called when a client wants to join a consensus session.
53 */
54void
55client_join (void *cls,
56 struct GNUNET_SERVER_Client *client,
57 const struct GNUNET_MessageHeader *message)
58{
59 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "client joined");
60}
61
62
32/** 63/**
33 * Process statistics requests. 64 * Called when a client performs an insert operation.
65 */
66void
67client_insert (void *cls,
68 struct GNUNET_SERVER_Client *client,
69 const struct GNUNET_MessageHeader *message)
70{
71
72}
73
74
75
76/**
77 * Called when a client performs the conclude operation.
78 */
79void
80client_conclude (void *cls,
81 struct GNUNET_SERVER_Client *client,
82 const struct GNUNET_MessageHeader *message)
83{
84
85}
86
87
88
89/**
90 * Process consensus requests.
34 * 91 *
35 * @param cls closure 92 * @param cls closure
36 * @param server the initialized server 93 * @param server the initialized server
37 * @param c configuration to use 94 * @param c configuration to use
38 */ 95 */
39static void 96static void
40run (void *cls, struct GNUNET_SERVER_Handle *server, 97run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c)
41 const struct GNUNET_CONFIGURATION_Handle *c)
42{ 98{
43 /* TODO */ 99 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
100 {&client_join, NULL, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN, 0},
101 {&client_insert, NULL, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT, 0},
102 {&client_conclude, NULL, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE,
103 sizeof (struct GNUNET_CONSENSUS_ConcludeMessage)},
104 {NULL, NULL, 0, 0}
105 };
106
107 GNUNET_SERVER_add_handlers(server, handlers);
44} 108}
45 109
46 110
@@ -55,6 +119,6 @@ int
55main (int argc, char *const *argv) 119main (int argc, char *const *argv)
56{ 120{
57 return (GNUNET_OK == 121 return (GNUNET_OK ==
58 GNUNET_SERVICE_run (argc, argv, "statistics", GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1; 122 GNUNET_SERVICE_run (argc, argv, "consensus", GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1;
59} 123}
60 124