GNUnet  0.20.0
gnunet-service-auction.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2009 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
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  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
28 
29 #include "auction.h"
30 
38 static int
40 {
41  /* always well-formed due to arbitrary length description */
42  return GNUNET_OK;
43 }
44 
45 
52 static void
54 {
55  struct GNUNET_SERVICE_Client *client = cls;
56 // struct GNUNET_MQ_Handle *mq;
57 // struct GNUNET_MQ_Envelope *env;
58 // struct GNUNET_AUCTION_blabla em;
59  //uint16_t size;
60 
62  "Received CREATE message from client\n");
63 
64  //size = ntohs (msg->header.size);
65 
67 // mq = GNUNET_SERVICE_client_get_mq (client);
68 // setup_info_message (&em);
69 // env = GNUNET_MQ_msg_copy (&em.header);
70 // GNUNET_MQ_send (mq, env);
71 
73 }
74 
75 
81 static void
82 cleanup_task (void *cls)
83 {
84  /* FIXME: do clean up here */
85 }
86 
87 
96 static void *
97 client_connect_cb (void *cls,
98  struct GNUNET_SERVICE_Client *c,
99  struct GNUNET_MQ_Handle *mq)
100 {
101  return c;
102 }
103 
104 
112 static void
114  struct GNUNET_SERVICE_Client *c,
115  void *internal_cls)
116 {
117  GNUNET_assert (c == internal_cls);
118 }
119 
120 
128 static void
129 run (void *cls,
130  const struct GNUNET_CONFIGURATION_Handle *cfg,
132 {
133  /* FIXME: do setup here */
135 }
136 
137 
142  ("auction",
144  &run,
147  NULL,
151  NULL),
153 
154 
155 /* end of gnunet-service-auction.c */
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
Common type definitions for the auction service and API.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static int create
Create DID Document Flag.
Definition: gnunet-did.c:71
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
static void * client_connect_cb(void *cls, struct GNUNET_SERVICE_Client *c, struct GNUNET_MQ_Handle *mq)
Callback called when a client connects to the service.
static void cleanup_task(void *cls)
Task run during shutdown.
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *c, void *internal_cls)
Callback called when a client disconnected from the service.
static int check_create(void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg)
Check AUCTION CREATE messages from the client.
static void run(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service)
Process auction requests.
static void handle_create(void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg)
Handler for CREATE messages.
#define GNUNET_log(kind,...)
@ GNUNET_OK
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_CREATE
Client wants to create a new auction.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
Definition: scheduler.c:1334
#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, connect_cb, disconnect_cb, cls,...)
Creates the "main" function for a GNUnet service.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2249
@ GNUNET_SERVICE_OPTION_NONE
Use defaults.
Auction creation request sent from the client to the service.
Definition: auction.h:38
Handle to a message queue.
Definition: mq.c:87
Handle to a client that is connected to a service.
Definition: service.c:252
Handle to a service.
Definition: service.c:118