GNUnet 0.22.2
gnunet-service-auction.c File Reference

service for executing auctions More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "auction.h"
Include dependency graph for gnunet-service-auction.c:

Go to the source code of this file.

Functions

static int check_create (void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg)
 Check AUCTION CREATE messages from the client. More...
 
static void handle_create (void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg)
 Handler for CREATE messages. More...
 
static void cleanup_task (void *cls)
 Task run during shutdown. More...
 
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. More...
 
static void client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *c, void *internal_cls)
 Callback called when a client disconnected from the service. More...
 
static void run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service)
 Process auction requests. More...
 

Detailed Description

service for executing auctions

Author
Markus Teich

Definition in file gnunet-service-auction.c.

Function Documentation

◆ check_create()

static int check_create ( void *  cls,
const struct GNUNET_AUCTION_ClientCreateMessage msg 
)
static

Check AUCTION CREATE messages from the client.

Parameters
clsthe client we received this message from
msgthe actual message received
Returns
GNUNET_OK (always)

Definition at line 39 of file gnunet-service-auction.c.

40{
41 /* always well-formed due to arbitrary length description */
42 return GNUNET_OK;
43}
@ GNUNET_OK

References GNUNET_OK.

◆ handle_create()

static void handle_create ( void *  cls,
const struct GNUNET_AUCTION_ClientCreateMessage msg 
)
static

Handler for CREATE messages.

Parameters
clsthe client we received this message from
msgthe actual message received

TODO: create auction and return auction object

Definition at line 53 of file gnunet-service-auction.c.

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}
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_DEBUG
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2389
Handle to a client that is connected to a service.
Definition: service.c:249

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, and GNUNET_SERVICE_client_continue().

Here is the call graph for this function:

◆ cleanup_task()

static void cleanup_task ( void *  cls)
static

Task run during shutdown.

Parameters
clsunused

Definition at line 82 of file gnunet-service-auction.c.

83{
84 /* FIXME: do clean up here */
85}

Referenced by run().

Here is the caller graph for this function:

◆ client_connect_cb()

static void * client_connect_cb ( void *  cls,
struct GNUNET_SERVICE_Client c,
struct GNUNET_MQ_Handle mq 
)
static

Callback called when a client connects to the service.

Parameters
clsclosure for the service
cthe new client that connected to the service
mqthe message queue used to send messages to the client
Returns
c

Definition at line 97 of file gnunet-service-auction.c.

100{
101 return c;
102}

◆ client_disconnect_cb()

static void client_disconnect_cb ( void *  cls,
struct GNUNET_SERVICE_Client c,
void *  internal_cls 
)
static

Callback called when a client disconnected from the service.

Parameters
clsclosure for the service
cthe client that disconnected
internal_clsshould be equal to c

Definition at line 113 of file gnunet-service-auction.c.

116{
117 GNUNET_assert (c == internal_cls);
118}
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.

References GNUNET_assert.

◆ run()

static void run ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg,
struct GNUNET_SERVICE_Handle service 
)
static

Process auction requests.

Parameters
clsclosure
cfgconfiguration to use
servicethe initialized service

Definition at line 129 of file gnunet-service-auction.c.

132{
133 /* FIXME: do setup here */
135}
static void cleanup_task(void *cls)
Task run during shutdown.
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:1339

References cleanup_task(), and GNUNET_SCHEDULER_add_shutdown().

Here is the call graph for this function: