2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file set/gnunet-service-set.c
23 * @brief two-peer set operations
24 * @author Florian Dold
26 #include "gnunet-service-set.h"
27 #include "set_protocol.h"
31 * Peer that has connected to us, but is not yet evaluating a set operation.
32 * Once the peer has sent a request, and the client has
33 * accepted or rejected it, this information will be deleted.
38 * Incoming peers are held in a linked list
40 struct Incoming *next;
43 * Incoming peers are held in a linked list
45 struct Incoming *prev;
48 * Detail information about the operation.
50 struct OperationSpecification *spec;
53 * The identity of the requesting peer.
55 struct GNUNET_PeerIdentity peer;
60 struct GNUNET_MESH_Tunnel *tunnel;
63 * Unique request id for the request from
64 * a remote peer, sent to the client, which will
65 * accept or reject the request.
66 * Set to '0' iff the request has not been
72 * Timeout task, if the incoming peer has not been accepted
73 * after the timeout, it will be disconnected.
75 GNUNET_SCHEDULER_TaskIdentifier timeout_task;
80 * Configuration of our local peer.
81 * (Not declared 'static' as also needed in gnunet-service-set_union.c)
83 const struct GNUNET_CONFIGURATION_Handle *configuration;
86 * Handle to the mesh service, used
87 * to listen for and connect to remote peers.
88 * (Not declared 'static' as also needed in gnunet-service-set_union.c)
90 struct GNUNET_MESH_Handle *mesh;
93 * Sets are held in a doubly linked list.
95 static struct Set *sets_head;
98 * Sets are held in a doubly linked list.
100 static struct Set *sets_tail;
103 * Listeners are held in a doubly linked list.
105 static struct Listener *listeners_head;
108 * Listeners are held in a doubly linked list.
110 static struct Listener *listeners_tail;
113 * Incoming sockets from remote peers are
114 * held in a doubly linked list.
116 static struct Incoming *incoming_head;
119 * Incoming sockets from remote peers are
120 * held in a doubly linked list.
122 static struct Incoming *incoming_tail;
125 * Counter for allocating unique IDs for clients,
126 * used to identify incoming operation requests from remote peers,
127 * that the client can choose to accept or refuse.
129 static uint32_t suggest_id = 1;
133 * Get set that is owned by the given client, if any.
135 * @param client client to look for
136 * @return set that the client owns, NULL if the client
140 set_get (struct GNUNET_SERVER_Client *client)
144 for (set = sets_head; NULL != set; set = set->next)
145 if (set->client == client)
152 * Get the listener associated with the given client, if any.
154 * @param client the client
155 * @return listener associated with the client, NULL
158 static struct Listener *
159 listener_get (struct GNUNET_SERVER_Client *client)
161 struct Listener *listener;
163 for (listener = listeners_head; NULL != listener; listener = listener->next)
164 if (listener->client == client)
171 * Get the incoming socket associated with the given id.
173 * @param id id to look for
174 * @return the incoming socket associated with the id,
175 * or NULL if there is none
177 static struct Incoming *
178 get_incoming (uint32_t id)
180 struct Incoming *incoming;
182 for (incoming = incoming_head; NULL != incoming; incoming = incoming->next)
183 if (incoming->suggest_id == id)
190 * Destroy a listener, free all resources associated with it.
192 * @param listener listener to destroy
195 listener_destroy (struct Listener *listener)
197 /* If the client is not dead yet, destroy it.
198 * The client's destroy callback will destroy the listener again. */
199 if (NULL != listener->client)
201 GNUNET_SERVER_client_disconnect (listener->client);
202 listener->client = NULL;
205 if (NULL != listener->client_mq)
207 GNUNET_MQ_destroy (listener->client_mq);
208 listener->client_mq = NULL;
210 GNUNET_CONTAINER_DLL_remove (listeners_head, listeners_tail, listener);
211 GNUNET_free (listener);
216 * Destroy a set, and free all resources associated with it.
218 * @param set the set to destroy
221 set_destroy (struct Set *set)
223 /* If the client is not dead yet, destroy it.
224 * The client's destroy callback will destroy the set again. */
225 if (NULL != set->client)
227 GNUNET_SERVER_client_disconnect (set->client);
231 switch (set->operation)
233 case GNUNET_SET_OPERATION_INTERSECTION:
236 case GNUNET_SET_OPERATION_UNION:
237 _GSS_union_set_destroy (set);
243 GNUNET_CONTAINER_DLL_remove (sets_head, sets_tail, set);
249 * Clean up after a client after it is
250 * disconnected (either by us or by itself)
252 * @param cls closure, unused
253 * @param client the client to clean up after
256 handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
259 struct Listener *listener;
261 set = set_get (client);
267 listener = listener_get (client);
268 if (NULL != listener)
270 listener->client = NULL;
271 listener_destroy (listener);
277 * Destroy an incoming request from a remote peer
279 * @param incoming remote request to destroy
282 incoming_destroy (struct Incoming *incoming)
284 if (NULL != incoming->tunnel)
286 struct GNUNET_MESH_Tunnel *t = incoming->tunnel;
287 incoming->tunnel = NULL;
288 GNUNET_MESH_tunnel_destroy (t);
291 GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming);
292 GNUNET_free (incoming);
296 static struct Listener *
297 listener_get_by_target (enum GNUNET_SET_OperationType op,
298 const struct GNUNET_HashCode *app_id)
302 for (l = listeners_head; NULL != l; l = l->next)
304 if (l->operation != op)
306 if (0 != GNUNET_CRYPTO_hash_cmp (app_id, &l->app_id))
315 * Suggest the given request to the listener,
316 * who can accept or reject the request.
318 * @param incoming the incoming peer with the request to suggest
319 * @param listener the listener to suggest the request to
322 incoming_suggest (struct Incoming *incoming, struct Listener *listener)
324 struct GNUNET_MQ_Envelope *mqm;
325 struct GNUNET_SET_RequestMessage *cmsg;
327 GNUNET_assert (0 == incoming->suggest_id);
328 GNUNET_assert (NULL != incoming->spec);
329 incoming->suggest_id = suggest_id++;
331 GNUNET_SCHEDULER_cancel (incoming->timeout_task);
332 mqm = GNUNET_MQ_msg_nested_mh (cmsg, GNUNET_MESSAGE_TYPE_SET_REQUEST,
333 incoming->spec->context_msg);
334 GNUNET_assert (NULL != mqm);
335 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "suggesting request with accept id %u\n", incoming->suggest_id);
336 cmsg->accept_id = htonl (incoming->suggest_id);
337 cmsg->peer_id = incoming->spec->peer;
338 GNUNET_MQ_send (listener->client_mq, mqm);
344 * Handle a request for a set operation from
347 * @param cls the incoming socket
348 * @param tunnel the tunnel that sent the message
349 * @param tunnel_ctx the tunnel context
350 * @param mh the message
353 handle_p2p_operation_request (void *cls,
354 struct GNUNET_MESH_Tunnel *tunnel,
356 const struct GNUNET_MessageHeader *mh)
358 struct TunnelContext *tc = *tunnel_ctx;
359 struct Incoming *incoming;
360 const struct OperationRequestMessage *msg = (const struct OperationRequestMessage *) mh;
361 struct Listener *listener;
362 struct OperationSpecification *spec;
364 if (CONTEXT_INCOMING != tc->type)
366 /* unexpected request */
368 /* kill the tunnel, cleaner will be called */
369 return GNUNET_SYSERR;
372 incoming = tc->data.incoming;
374 if (NULL != incoming->spec)
376 /* double operation request */
378 return GNUNET_SYSERR;
381 spec = GNUNET_new (struct OperationSpecification);
383 GNUNET_copy_message (GNUNET_MQ_extract_nested_mh (msg));
384 spec->operation = ntohl (msg->operation);
385 spec->app_id = msg->app_id;
386 spec->salt = ntohl (msg->salt);
387 spec->peer = incoming->peer;
389 incoming->spec = spec;
391 if ( (NULL != spec->context_msg) &&
392 (ntohs (spec->context_msg->size) > GNUNET_SET_CONTEXT_MESSAGE_MAX_SIZE) )
395 return GNUNET_SYSERR;
398 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "received P2P operation request (op %u, app %s)\n",
399 ntohs (msg->operation), GNUNET_h2s (&msg->app_id));
400 listener = listener_get_by_target (ntohs (msg->operation), &msg->app_id);
401 if (NULL == listener)
403 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
404 "no listener matches incoming request, waiting with timeout\n");
407 incoming_suggest (incoming, listener);
413 * Called when a client wants to create a new set.
416 * @param client client that sent the message
417 * @param m message sent by the client
420 handle_client_create (void *cls,
421 struct GNUNET_SERVER_Client *client,
422 const struct GNUNET_MessageHeader *m)
424 struct GNUNET_SET_CreateMessage *msg = (struct GNUNET_SET_CreateMessage *) m;
427 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "client created new set (operation %u)\n",
428 ntohs (msg->operation));
430 if (NULL != set_get (client))
433 GNUNET_SERVER_client_disconnect (client);
439 switch (ntohs (msg->operation))
441 case GNUNET_SET_OPERATION_INTERSECTION:
442 //set = _GSS_intersection_set_create ();
444 case GNUNET_SET_OPERATION_UNION:
445 set = _GSS_union_set_create ();
449 GNUNET_SERVER_client_disconnect (client);
453 GNUNET_assert (NULL != set);
455 set->client = client;
456 set->client_mq = GNUNET_MQ_queue_for_server_client (client);
457 GNUNET_CONTAINER_DLL_insert (sets_head, sets_tail, set);
458 GNUNET_SERVER_receive_done (client, GNUNET_OK);
463 * Called when a client wants to create a new listener.
466 * @param client client that sent the message
467 * @param m message sent by the client
470 handle_client_listen (void *cls,
471 struct GNUNET_SERVER_Client *client,
472 const struct GNUNET_MessageHeader *m)
474 struct GNUNET_SET_ListenMessage *msg = (struct GNUNET_SET_ListenMessage *) m;
475 struct Listener *listener;
476 struct Incoming *incoming;
478 if (NULL != listener_get (client))
481 GNUNET_SERVER_client_disconnect (client);
484 listener = GNUNET_new (struct Listener);
485 listener->client = client;
486 listener->client_mq = GNUNET_MQ_queue_for_server_client (client);
487 listener->app_id = msg->app_id;
488 listener->operation = ntohs (msg->operation);
489 GNUNET_CONTAINER_DLL_insert_tail (listeners_head, listeners_tail, listener);
490 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "new listener created (op %u, app %s)\n",
491 listener->operation, GNUNET_h2s (&listener->app_id));
492 for (incoming = incoming_head; NULL != incoming; incoming = incoming->next)
494 if ( (NULL == incoming->spec) ||
495 (0 != incoming->suggest_id) )
497 if (listener->operation != incoming->spec->operation)
499 if (0 != GNUNET_CRYPTO_hash_cmp (&listener->app_id, &incoming->spec->app_id))
501 incoming_suggest (incoming, listener);
503 GNUNET_SERVER_receive_done (client, GNUNET_OK);
508 * Called when a client wants to remove an element
509 * from the set it inhabits.
512 * @param client client that sent the message
513 * @param m message sent by the client
516 handle_client_remove (void *cls,
517 struct GNUNET_SERVER_Client *client,
518 const struct GNUNET_MessageHeader *m)
522 set = set_get (client);
526 GNUNET_SERVER_client_disconnect (client);
529 switch (set->operation)
531 case GNUNET_SET_OPERATION_UNION:
532 _GSS_union_remove ((struct GNUNET_SET_ElementMessage *) m, set);
534 case GNUNET_SET_OPERATION_INTERSECTION:
535 //_GSS_intersection_remove ((struct GNUNET_SET_ElementMessage *) m, set);
542 GNUNET_SERVER_receive_done (client, GNUNET_OK);
548 * Called when the client wants to reject an operation
549 * request from another peer.
552 * @param client client that sent the message
553 * @param m message sent by the client
556 handle_client_reject (void *cls,
557 struct GNUNET_SERVER_Client *client,
558 const struct GNUNET_MessageHeader *m)
560 struct Incoming *incoming;
561 struct GNUNET_SET_AcceptRejectMessage *msg = (struct GNUNET_SET_AcceptRejectMessage *) m;
563 GNUNET_break (0 == ntohl (msg->request_id));
565 incoming = get_incoming (ntohl (msg->accept_reject_id));
566 if (NULL == incoming)
568 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
571 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "peer request rejected by client\n");
572 GNUNET_MESH_tunnel_destroy (incoming->tunnel);
573 GNUNET_SERVER_receive_done (client, GNUNET_OK);
579 * Called when a client wants to add an element to a
583 * @param client client that sent the message
584 * @param m message sent by the client
587 handle_client_add (void *cls,
588 struct GNUNET_SERVER_Client *client,
589 const struct GNUNET_MessageHeader *m)
593 set = set_get (client);
597 GNUNET_SERVER_client_disconnect (client);
600 switch (set->operation)
602 case GNUNET_SET_OPERATION_UNION:
603 _GSS_union_add ((struct GNUNET_SET_ElementMessage *) m, set);
605 case GNUNET_SET_OPERATION_INTERSECTION:
606 //_GSS_intersection_add ((struct GNUNET_SET_ElementMessage *) m, set);
613 GNUNET_SERVER_receive_done (client, GNUNET_OK);
618 * Called when a client wants to evaluate a set operation with another peer.
621 * @param client client that sent the message
622 * @param m message sent by the client
625 handle_client_evaluate (void *cls,
626 struct GNUNET_SERVER_Client *client,
627 const struct GNUNET_MessageHeader *m)
630 struct TunnelContext *tc;
631 struct GNUNET_MESH_Tunnel *tunnel;
632 struct GNUNET_SET_EvaluateMessage *msg;
633 struct OperationSpecification *spec;
635 set = set_get (client);
639 GNUNET_SERVER_client_disconnect (client);
643 msg = (struct GNUNET_SET_EvaluateMessage *) m;
644 tc = GNUNET_new (struct TunnelContext);
645 spec = GNUNET_new (struct OperationSpecification);
646 spec->operation = set->operation;
647 spec->app_id = msg->app_id;
648 spec->salt = ntohl (msg->salt);
649 spec->peer = msg->target_peer;
651 tunnel = GNUNET_MESH_tunnel_create (mesh, tc, &msg->target_peer,
652 GNUNET_APPLICATION_TYPE_SET);
654 switch (set->operation)
656 case GNUNET_SET_OPERATION_INTERSECTION:
657 tc->type = CONTEXT_OPERATION_INTERSECTION;
658 //_GSS_intersection_evaluate ((struct GNUNET_SET_EvaluateMessage *) m, set);
660 case GNUNET_SET_OPERATION_UNION:
661 tc->type = CONTEXT_OPERATION_UNION;
663 _GSS_union_evaluate (spec, tunnel);
670 GNUNET_SERVER_receive_done (client, GNUNET_OK);
675 * Handle an ack from a client.
678 * @param client the client
679 * @param m the message
682 handle_client_ack (void *cls,
683 struct GNUNET_SERVER_Client *client,
684 const struct GNUNET_MessageHeader *m)
686 /* FIXME: implement */
687 GNUNET_SERVER_receive_done (client, GNUNET_OK);
692 * Handle a request from the client to accept
693 * a set operation that came from a remote peer.
696 * @param client the client
697 * @param mh the message
700 handle_client_accept (void *cls,
701 struct GNUNET_SERVER_Client *client,
702 const struct GNUNET_MessageHeader *mh)
705 struct Incoming *incoming;
706 struct GNUNET_SET_AcceptRejectMessage *msg = (struct GNUNET_SET_AcceptRejectMessage *) mh;
707 struct GNUNET_MESH_Tunnel *tunnel;
708 struct TunnelContext *tc;
709 struct OperationSpecification *spec;
711 incoming = get_incoming (ntohl (msg->accept_reject_id));
713 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "client accepting %u\n", ntohl (msg->accept_reject_id));
715 if (NULL == incoming)
719 GNUNET_SERVER_client_disconnect (client);
723 set = set_get (client);
728 GNUNET_SERVER_client_disconnect (client);
732 tc = GNUNET_new (struct TunnelContext);
733 tunnel = GNUNET_MESH_tunnel_create (mesh, tc, &incoming->spec->peer,
734 GNUNET_APPLICATION_TYPE_SET);
735 spec = GNUNET_new (struct OperationSpecification);
737 switch (set->operation)
739 case GNUNET_SET_OPERATION_INTERSECTION:
740 tc->type = CONTEXT_OPERATION_INTERSECTION;
741 // _GSS_intersection_accept (msg, set, incoming);
743 case GNUNET_SET_OPERATION_UNION:
744 tc->type = CONTEXT_OPERATION_UNION;
745 tc->data.union_op = _GSS_union_accept (spec, tunnel);
752 /* note: _GSS_*_accept has to make sure the tunnel and mq are set to NULL,
753 * otherwise they will be destroyed and disconnected */
754 incoming_destroy (incoming);
755 GNUNET_SERVER_receive_done (client, GNUNET_OK);
760 * Called to clean up, after a shutdown has been requested.
763 * @param tc context information (why was this task triggered now)
766 shutdown_task (void *cls,
767 const struct GNUNET_SCHEDULER_TaskContext *tc)
771 GNUNET_MESH_disconnect (mesh);
775 while (NULL != incoming_head)
776 incoming_destroy (incoming_head);
778 while (NULL != listeners_head)
779 listener_destroy (listeners_head);
781 while (NULL != sets_head)
782 set_destroy (sets_head);
784 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "handled shutdown request\n");
790 * Signature of the main function of a task.
793 * @param tc context information (why was this task triggered now)
796 incoming_timeout_cb (void *cls,
797 const struct GNUNET_SCHEDULER_TaskContext *tc)
799 struct Incoming *incoming = cls;
801 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "remote peer timed out\n");
802 incoming_destroy (incoming);
807 * Method called whenever another peer has added us to a tunnel
808 * the other peer initiated.
809 * Only called (once) upon reception of data with a message type which was
810 * subscribed to in GNUNET_MESH_connect. A call to GNUNET_MESH_tunnel_destroy
811 * causes te tunnel to be ignored and no further notifications are sent about
815 * @param tunnel new handle to the tunnel
816 * @param initiator peer that started the tunnel
817 * @param port Port this tunnel is for.
818 * @return initial tunnel context for the tunnel
819 * (can be NULL -- that's not an error)
822 tunnel_new_cb (void *cls,
823 struct GNUNET_MESH_Tunnel *tunnel,
824 const struct GNUNET_PeerIdentity *initiator,
827 struct Incoming *incoming;
828 struct TunnelContext *tc;
830 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "new incoming tunnel\n");
832 GNUNET_assert (port == GNUNET_APPLICATION_TYPE_SET);
833 tc = GNUNET_new (struct TunnelContext);
834 incoming = GNUNET_new (struct Incoming);
835 incoming->peer = *initiator;
836 incoming->tunnel = tunnel;
837 tc->data.incoming = incoming;
838 tc->type = CONTEXT_INCOMING;
839 incoming->timeout_task =
840 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, incoming_timeout_cb, incoming);
841 GNUNET_CONTAINER_DLL_insert_tail (incoming_head, incoming_tail, incoming);
848 * Function called whenever a tunnel is destroyed. Should clean up
849 * any associated state.
850 * GNUNET_MESH_tunnel_destroy. It must NOT call GNUNET_MESH_tunnel_destroy on
853 * @param cls closure (set from GNUNET_MESH_connect)
854 * @param tunnel connection to the other end (henceforth invalid)
855 * @param tunnel_ctx place where local state associated
856 * with the tunnel is stored
859 tunnel_end_cb (void *cls,
860 const struct GNUNET_MESH_Tunnel *tunnel, void *tunnel_ctx)
862 struct TunnelContext *ctx = tunnel_ctx;
866 case CONTEXT_INCOMING:
867 incoming_destroy (ctx->data.incoming);
869 case CONTEXT_OPERATION_UNION:
870 _GSS_union_operation_destroy (ctx->data.union_op);
872 case CONTEXT_OPERATION_INTERSECTION:
880 GNUNET_free (tunnel_ctx);
885 * Function called by the service's run
886 * method to run service-specific setup code.
889 * @param server the initialized server
890 * @param cfg configuration to use
893 run (void *cls, struct GNUNET_SERVER_Handle *server,
894 const struct GNUNET_CONFIGURATION_Handle *cfg)
896 static const struct GNUNET_SERVER_MessageHandler server_handlers[] = {
897 {handle_client_accept, NULL, GNUNET_MESSAGE_TYPE_SET_ACCEPT, 0},
898 {handle_client_ack, NULL, GNUNET_MESSAGE_TYPE_SET_ACK, 0},
899 {handle_client_add, NULL, GNUNET_MESSAGE_TYPE_SET_ADD, 0},
900 {handle_client_create, NULL, GNUNET_MESSAGE_TYPE_SET_CREATE, 0},
901 {handle_client_evaluate, NULL, GNUNET_MESSAGE_TYPE_SET_EVALUATE, 0},
902 {handle_client_listen, NULL, GNUNET_MESSAGE_TYPE_SET_LISTEN, 0},
903 {handle_client_reject, NULL, GNUNET_MESSAGE_TYPE_SET_REJECT, 0},
904 {handle_client_remove, NULL, GNUNET_MESSAGE_TYPE_SET_REMOVE, 0},
907 static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = {
908 {handle_p2p_operation_request,
909 GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST, 0},
910 /* messages for the union operation */
911 {_GSS_union_handle_p2p_message,
912 GNUNET_MESSAGE_TYPE_SET_P2P_IBF, 0},
913 {_GSS_union_handle_p2p_message,
914 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS, 0},
915 {_GSS_union_handle_p2p_message,
916 GNUNET_MESSAGE_TYPE_SET_P2P_DONE, 0},
917 {_GSS_union_handle_p2p_message,
918 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS, 0},
919 {_GSS_union_handle_p2p_message,
920 GNUNET_MESSAGE_TYPE_SET_P2P_SE, 0},
921 /* FIXME: messages for intersection operation */
924 static const uint32_t mesh_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0};
927 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
928 &shutdown_task, NULL);
929 GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
930 GNUNET_SERVER_add_handlers (server, server_handlers);
932 mesh = GNUNET_MESH_connect (cfg, NULL, tunnel_new_cb, tunnel_end_cb,
933 mesh_handlers, mesh_ports);
936 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "could not connect to mesh\n");
940 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "service started\n");
945 * The main function for the set service.
947 * @param argc number of arguments from the command line
948 * @param argv command line arguments
949 * @return 0 ok, 1 on error
952 main (int argc, char *const *argv)
955 ret = GNUNET_SERVICE_run (argc, argv, "set",
956 GNUNET_SERVICE_OPTION_NONE, &run, NULL);
957 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "exit\n");
958 return (GNUNET_OK == ret) ? 0 : 1;