GNUnet 0.21.1
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_FS_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 *

Definition at line 144 of file fs_publish_ksk.c.

145{
146 struct GNUNET_FS_PublishKskContext *pkc = cls;
147 const char *keyword;
148
149 pkc->ksk_task = NULL;
150 if ((pkc->i == pkc->ksk_uri->data.ksk.keywordCount) ||
151 (NULL == pkc->dsh))
152 {
154 "KSK PUT operation complete\n");
155 pkc->cont (pkc->cont_cls, pkc->ksk_uri,
156 NULL);
158 return;
159 }
160 keyword = pkc->ksk_uri->data.ksk.keywords[pkc->i++];
161 pkc->uc = GNUNET_FS_publish_ublock_ (pkc->h,
162 pkc->dsh,
163 keyword + 1 /* skip '+' */,
164 NULL,
166 pkc->meta,
167 pkc->uri,
168 &pkc->bo,
169 pkc->options,
170 &kb_put_cont, pkc);
171}
static void kb_put_cont(void *cls, const char *msg)
Function called by the datastore API with the result from the PUT request.
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_FS_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.
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:482
void GNUNET_FS_publish_ksk_cancel(struct GNUNET_FS_PublishKskContext *pkc)
Abort the KSK publishing operation.
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_DEBUG
Context for the KSK publication.
struct GNUNET_FS_Uri * uri
URI to publish.
struct GNUNET_FS_Uri * ksk_uri
Keywords to use.
struct GNUNET_DATASTORE_Handle * dsh
Handle to the datastore, NULL if we are just simulating.
struct GNUNET_FS_PublishUblockContext * uc
UBlock publishing operation that is active.
enum GNUNET_FS_PublishOptions options
Options to use.
struct GNUNET_SCHEDULER_Task * ksk_task
Current task.
struct GNUNET_FS_BlockOptions bo
When should the KBlocks expire?
struct GNUNET_FS_MetaData * meta
Metadata to use.
void * cont_cls
Closure for cont.
unsigned int i
Keyword that we are currently processing.
struct GNUNET_FS_Handle * h
Global FS context.
GNUNET_FS_PublishContinuation cont
Function to call once we're done.
char ** keywords
Keywords start with a '+' if they are mandatory (in which case the '+' is NOT part of the keyword) an...
Definition: fs_api.h:186
union GNUNET_FS_Uri::@49 data
struct GNUNET_FS_Uri::@49::@50 ksk
unsigned int keywordCount
Size of the keywords array.
Definition: fs_api.h:191

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::keywordCount, GNUNET_FS_Uri::keywords, 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().

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 125 of file fs_publish_ksk.c.

127{
128 struct GNUNET_FS_PublishKskContext *pkc = cls;
129
130 pkc->uc = NULL;
131 if (NULL != msg)
132 {
134 "KBlock PUT operation failed: %s\n", msg);
135 pkc->cont (pkc->cont_cls, NULL, msg);
137 return;
138 }
140}
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static void publish_ksk_cont(void *cls)
Continuation of GNUNET_FS_publish_ksk() that performs the actual publishing operation (iterating over...
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:1305

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, msg, publish_ksk_cont(), and GNUNET_FS_PublishKskContext::uc.

Referenced by publish_ksk_cont().

Here is the call graph for this function:
Here is the caller graph for this function: