GNUnet  0.10.x
Data Structures | Functions
fs_publish_ksk.c File Reference

publish a URI under a keyword in GNUnet More...

#include "platform.h"
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
#include "gnunet_fs_service.h"
#include "fs_api.h"
#include "fs_tree.h"
#include "fs_publish_ublock.h"
Include dependency graph for fs_publish_ksk.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_FS_PublishKskContext
 Context for the KSK publication. More...
 

Functions

static void publish_ksk_cont (void *cls)
 Continuation of GNUNET_FS_publish_ksk() that performs the actual publishing operation (iterating over all of the keywords). More...
 
static void kb_put_cont (void *cls, const char *msg)
 Function called by the datastore API with the result from the PUT request. More...
 
struct GNUNET_FS_PublishKskContextGNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *ksk_uri, const struct GNUNET_CONTAINER_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_PublishContinuation cont, void *cont_cls)
 Publish a CHK under various keywords on GNUnet. More...
 
void GNUNET_FS_publish_ksk_cancel (struct GNUNET_FS_PublishKskContext *pkc)
 Abort the KSK publishing operation. More...
 

Detailed Description

publish a URI under a keyword in GNUnet

See also
https://gnunet.org/encoding and #2564
Author
Krista Bennett
Christian Grothoff

Definition in file fs_publish_ksk.c.

Function Documentation

◆ publish_ksk_cont()

static void publish_ksk_cont ( void *  cls)
static

Continuation of GNUNET_FS_publish_ksk() that performs the actual publishing operation (iterating over all of the keywords).

Parameters
clsclosure of type struct PublishKskContext *
clsclosure of type struct GNUNET_FS_PublishKskContext *

Definition at line 151 of file fs_publish_ksk.c.

References GNUNET_FS_PublishKskContext::bo, GNUNET_FS_PublishKskContext::cont, GNUNET_FS_PublishKskContext::cont_cls, GNUNET_FS_Uri::data, GNUNET_FS_PublishKskContext::dsh, GNUNET_CRYPTO_ecdsa_key_get_anonymous(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_FS_publish_ksk_cancel(), GNUNET_FS_publish_ublock_(), GNUNET_log, GNUNET_FS_PublishKskContext::h, GNUNET_FS_PublishKskContext::i, kb_put_cont(), GNUNET_FS_Uri::ksk, GNUNET_FS_PublishKskContext::ksk_task, GNUNET_FS_PublishKskContext::ksk_uri, GNUNET_FS_PublishKskContext::meta, GNUNET_FS_PublishKskContext::options, GNUNET_FS_PublishKskContext::uc, and GNUNET_FS_PublishKskContext::uri.

Referenced by GNUNET_FS_publish_ksk(), and kb_put_cont().

152 {
153  struct GNUNET_FS_PublishKskContext *pkc = cls;
154  const char *keyword;
155 
156  pkc->ksk_task = NULL;
157  if ( (pkc->i == pkc->ksk_uri->data.ksk.keywordCount) ||
158  (NULL == pkc->dsh) )
159  {
161  "KSK PUT operation complete\n");
162  pkc->cont (pkc->cont_cls, pkc->ksk_uri,
163  NULL);
165  return;
166  }
167  keyword = pkc->ksk_uri->data.ksk.keywords[pkc->i++];
168  pkc->uc = GNUNET_FS_publish_ublock_ (pkc->h,
169  pkc->dsh,
170  keyword + 1 /* skip '+' */,
171  NULL,
173  pkc->meta,
174  pkc->uri,
175  &pkc->bo,
176  pkc->options,
177  &kb_put_cont, pkc);
178 }
const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_key_get_anonymous(void)
Get the shared private key we use for anonymous users.
Definition: crypto_ecc.c:814
struct GNUNET_CONTAINER_MetaData * meta
Metadata to use.
unsigned int i
Keyword that we are currently processing.
void GNUNET_FS_publish_ksk_cancel(struct GNUNET_FS_PublishKskContext *pkc)
Abort the KSK publishing operation.
static void kb_put_cont(void *cls, const char *msg)
Function called by the datastore API with the result from the PUT request.
GNUNET_FS_PublishContinuation cont
Function to call once we're done.
struct GNUNET_DATASTORE_Handle * dsh
Handle to the datastore, NULL if we are just simulating.
struct GNUNET_SCHEDULER_Task * ksk_task
Current task.
struct GNUNET_FS_Uri::@16::@17 ksk
struct GNUNET_FS_PublishUblockContext * uc
UBlock publishing operation that is active.
struct GNUNET_FS_Uri * uri
URI to publish.
union GNUNET_FS_Uri::@16 data
Context for the KSK publication.
enum GNUNET_FS_PublishOptions options
Options to use.
struct GNUNET_FS_Handle * h
Global FS context.
struct GNUNET_FS_PublishUblockContext * GNUNET_FS_publish_ublock_(struct GNUNET_FS_Handle *h, struct GNUNET_DATASTORE_Handle *dsh, const char *label, const char *ulabel, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const struct GNUNET_CONTAINER_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_UBlockContinuation cont, void *cont_cls)
Publish a UBlock.
#define GNUNET_log(kind,...)
struct GNUNET_FS_Uri * ksk_uri
Keywords to use.
struct GNUNET_FS_BlockOptions bo
When should the KBlocks expire?
void * cont_cls
Closure for cont.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kb_put_cont()

static void kb_put_cont ( void *  cls,
const char *  msg 
)
static

Function called by the datastore API with the result from the PUT request.

Parameters
clsclosure of type struct GNUNET_FS_PublishKskContext *
msgerror message (or NULL)

Definition at line 126 of file fs_publish_ksk.c.

References GNUNET_FS_PublishKskContext::cont, GNUNET_FS_PublishKskContext::cont_cls, GNUNET_ERROR_TYPE_DEBUG, GNUNET_FS_publish_ksk_cancel(), GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_FS_PublishKskContext::ksk_task, publish_ksk_cont(), and GNUNET_FS_PublishKskContext::uc.

Referenced by publish_ksk_cont().

128 {
129  struct GNUNET_FS_PublishKskContext *pkc = cls;
130 
131  pkc->uc = NULL;
132  if (NULL != msg)
133  {
135  "KBlock PUT operation failed: %s\n", msg);
136  pkc->cont (pkc->cont_cls, NULL, msg);
138  return;
139  }
141 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
void GNUNET_FS_publish_ksk_cancel(struct GNUNET_FS_PublishKskContext *pkc)
Abort the KSK publishing operation.
GNUNET_FS_PublishContinuation cont
Function to call once we're done.
struct GNUNET_SCHEDULER_Task * ksk_task
Current task.
struct GNUNET_FS_PublishUblockContext * uc
UBlock publishing operation that is active.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
Context for the KSK publication.
static void publish_ksk_cont(void *cls)
Continuation of GNUNET_FS_publish_ksk() that performs the actual publishing operation (iterating over...
#define GNUNET_log(kind,...)
void * cont_cls
Closure for cont.
Here is the call graph for this function:
Here is the caller graph for this function: