2 This file is part of GNUnet.
3 (C) 2012 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 lockmanager/gnunet-service-lockmanager.c
23 * @brief implementation of the LOCKMANAGER service
24 * @author Sree Harsha Totakura
28 #include "gnunet_common.h"
29 #include "gnunet_protocols.h"
30 #include "gnunet_service_lib.h"
31 #include "gnunet_server_lib.h"
33 #include "lockmanager.h"
35 #define LOG(kind,...) \
36 GNUNET_log_from (kind, "gnunet-service-lockmanager",__VA_ARGS__)
40 * Handler for GNUNET_MESSAGE_TYPE_LOCKMANAGER_ACQUIRE
46 handle_acquire (void *cls,
47 struct GNUNET_SERVER_Client *client,
48 const struct GNUNET_MessageHeader *message)
50 // const struct GNUNET_LOCKMANAGER_Message *msg = message;
51 LOG (GNUNET_ERROR_TYPE_DEBUG,
52 "Received a ACQUIRE message\n");
54 GNUNET_SERVER_receive_done (client, GNUNET_OK);
59 * Handle for GNUNET_MESSAGE_TYPE_LOCKMANAGER_RELEASE
65 handle_release (void *cls,
66 struct GNUNET_SERVER_Client *client,
67 const struct GNUNET_MessageHeader *message)
69 LOG (GNUNET_ERROR_TYPE_DEBUG,
70 "Received a RELEASE message\n");
72 GNUNET_SERVER_receive_done (client, GNUNET_OK);
80 * @param server the initialized server
81 * @param cfg configuration to use
84 lockmanager_run (void *cls,
85 struct GNUNET_SERVER_Handle * server,
86 const struct GNUNET_CONFIGURATION_Handle *cfg)
88 struct GNUNET_SERVER_MessageHandler message_handlers[] =
90 {&handle_acquire, NULL, GNUNET_MESSAGE_TYPE_LOCKMANAGER_ACQUIRE, 0},
91 {&handle_release, NULL, GNUNET_MESSAGE_TYPE_LOCKMANAGER_RELEASE, 0},
95 LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting lockmanager\n");
96 GNUNET_SERVER_add_handlers (server,
102 * The starting point of execution
104 int main (int argc, char *const *argv)
108 LOG (GNUNET_ERROR_TYPE_DEBUG, "main()\n");
111 GNUNET_SERVICE_run (argc,
114 GNUNET_SERVICE_OPTION_NONE,
117 LOG (GNUNET_ERROR_TYPE_DEBUG, "main() END\n");