diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-10-18 14:46:22 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-10-18 14:46:22 +0200 |
commit | 76299f0b66a3f8ce86df90171b450da6b9cd9b7c (patch) | |
tree | 381f49fb3208a4b9ae19781372ffd6c492eae19c /src/auction/gnunet-service-auction.c | |
parent | 2f93ff3b6d3524e1e6dc23f70966fbae3ca9d3af (diff) | |
download | gnunet-76299f0b66a3f8ce86df90171b450da6b9cd9b7c.tar.gz gnunet-76299f0b66a3f8ce86df90171b450da6b9cd9b7c.zip |
BUILD: Move experimental components to contrib
Diffstat (limited to 'src/auction/gnunet-service-auction.c')
-rw-r--r-- | src/auction/gnunet-service-auction.c | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/src/auction/gnunet-service-auction.c b/src/auction/gnunet-service-auction.c deleted file mode 100644 index c20f0bdbe..000000000 --- a/src/auction/gnunet-service-auction.c +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
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 | |||
21 | /** | ||
22 | * @file auction/gnunet-service-auction.c | ||
23 | * @brief service for executing auctions | ||
24 | * @author Markus Teich | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | |||
29 | #include "auction.h" | ||
30 | |||
31 | /** | ||
32 | * Check AUCTION CREATE messages from the client. | ||
33 | * | ||
34 | * @param cls the client we received this message from | ||
35 | * @param msg the actual message received | ||
36 | * @return #GNUNET_OK (always) | ||
37 | */ | ||
38 | static int | ||
39 | check_create (void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg) | ||
40 | { | ||
41 | /* always well-formed due to arbitrary length description */ | ||
42 | return GNUNET_OK; | ||
43 | } | ||
44 | |||
45 | |||
46 | /** | ||
47 | * Handler for CREATE messages. | ||
48 | * | ||
49 | * @param cls the client we received this message from | ||
50 | * @param msg the actual message received | ||
51 | */ | ||
52 | static void | ||
53 | handle_create (void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg) | ||
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 | |||
61 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
62 | "Received CREATE message from client\n"); | ||
63 | |||
64 | //size = ntohs (msg->header.size); | ||
65 | |||
66 | /**TODO: create auction and return auction object */ | ||
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 | |||
72 | GNUNET_SERVICE_client_continue (client); | ||
73 | } | ||
74 | |||
75 | |||
76 | /** | ||
77 | * Task run during shutdown. | ||
78 | * | ||
79 | * @param cls unused | ||
80 | */ | ||
81 | static void | ||
82 | cleanup_task (void *cls) | ||
83 | { | ||
84 | /* FIXME: do clean up here */ | ||
85 | } | ||
86 | |||
87 | |||
88 | /** | ||
89 | * Callback called when a client connects to the service. | ||
90 | * | ||
91 | * @param cls closure for the service | ||
92 | * @param c the new client that connected to the service | ||
93 | * @param mq the message queue used to send messages to the client | ||
94 | * @return @a c | ||
95 | */ | ||
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 | |||
105 | /** | ||
106 | * Callback called when a client disconnected from the service | ||
107 | * | ||
108 | * @param cls closure for the service | ||
109 | * @param c the client that disconnected | ||
110 | * @param internal_cls should be equal to @a c | ||
111 | */ | ||
112 | static void | ||
113 | client_disconnect_cb (void *cls, | ||
114 | struct GNUNET_SERVICE_Client *c, | ||
115 | void *internal_cls) | ||
116 | { | ||
117 | GNUNET_assert (c == internal_cls); | ||
118 | } | ||
119 | |||
120 | |||
121 | /** | ||
122 | * Process auction requests. | ||
123 | * | ||
124 | * @param cls closure | ||
125 | * @param cfg configuration to use | ||
126 | * @param service the initialized service | ||
127 | */ | ||
128 | static void | ||
129 | run (void *cls, | ||
130 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
131 | struct GNUNET_SERVICE_Handle *service) | ||
132 | { | ||
133 | /* FIXME: do setup here */ | ||
134 | GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL); | ||
135 | } | ||
136 | |||
137 | |||
138 | /** | ||
139 | * Define "main" method using service macro. | ||
140 | */ | ||
141 | GNUNET_SERVICE_MAIN | ||
142 | ("auction", | ||
143 | GNUNET_SERVICE_OPTION_NONE, | ||
144 | &run, | ||
145 | &client_connect_cb, | ||
146 | &client_disconnect_cb, | ||
147 | NULL, | ||
148 | GNUNET_MQ_hd_var_size (create, | ||
149 | GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_CREATE, | ||
150 | struct GNUNET_AUCTION_ClientCreateMessage, | ||
151 | NULL), | ||
152 | GNUNET_MQ_handler_end ()) | ||
153 | |||
154 | |||
155 | /* end of gnunet-service-auction.c */ | ||