GNUnet  0.10.x
Functions
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.

References GNUNET_OK.

40 {
41  /* always well-formed due to arbitrary length description */
42  return GNUNET_OK;
43 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78

◆ 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.

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_SERVICE_client_continue(), GNUNET_AUCTION_ClientCreateMessage::header, size, and GNUNET_MessageHeader::size.

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 }
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
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_CREATE.
Definition: auction.h:42
static unsigned int size
Size of the "table".
Definition: peer.c:67
#define GNUNET_log(kind,...)
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2533
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.

Referenced by run().

83 {
84  /* FIXME: do clean up here */
85 }
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.

Referenced by run().

100 {
101  return c;
102 }
Here is the caller graph for this function:

◆ 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.

References GNUNET_assert.

Referenced by run().

116 {
117  GNUNET_assert (c == internal_cls);
118 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Here is the caller graph for this function:

◆ 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.

References cleanup_task(), client_connect_cb(), client_disconnect_cb(), GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_CREATE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SERVICE_MAIN, and GNUNET_SERVICE_OPTION_NONE.

132 {
133  /* FIXME: do setup here */
135 }
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
static void cleanup_task(void *cls)
Task run during shutdown.
Here is the call graph for this function: