GNUnet  0.10.x
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,
148  GNUNET_MQ_hd_var_size (create,
151  NULL),
153 
154 
155 /* end of gnunet-service-auction.c */
Auction creation request sent from the client to the service.
Definition: auction.h:37
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
#define GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_CREATE
Client wants to create a new auction.
Handle to a service.
Definition: service.c:116
Common type definitions for the auction service and API.
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, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1293
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
Handle to a client that is connected to a service.
Definition: service.c:249
static void handle_create(void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg)
Handler for CREATE messages.
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_CREATE.
Definition: auction.h:42
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
static void run(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service)
Process auction requests.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
static unsigned int size
Size of the "table".
Definition: peer.c:67
#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, connect_cb, disconnect_cb, cls,...)
Creates the "main" function for a GNUnet service.
static int check_create(void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg)
Check AUCTION CREATE messages from the client.
Handle to a message queue.
Definition: mq.c:85
configuration data
Definition: configuration.c:85
static void cleanup_task(void *cls)
Task run during shutdown.
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
#define GNUNET_log(kind,...)
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *c, void *internal_cls)
Callback called when a client disconnected from the service.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
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.