Skip to content

Commit

Permalink
fix GNUnet 0.19.0 compatiablity
Browse files Browse the repository at this point in the history
  • Loading branch information
marty1885 committed Dec 8, 2022
1 parent 66b9517 commit 6c2ecfd
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 24 deletions.
5 changes: 2 additions & 3 deletions gnunetpp/gnunetpp-crypto.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include "gnunet/platform.h"
#include <gnunet/gnunet_crypto_lib.h>
#include <gnunet/gnunet_util_lib.h>

#include <string>
#include <vector>
Expand Down Expand Up @@ -38,4 +37,4 @@ std::string to_string(const GNUNET_CRYPTO_EddsaPrivateKey& key);
std::string to_string(const GNUNET_CRYPTO_EddsaPublicKey& key);

GNUNET_CRYPTO_EcdsaPublicKey get_public_key(const GNUNET_CRYPTO_EcdsaPrivateKey& key);
}
}
3 changes: 1 addition & 2 deletions gnunetpp/gnunetpp-dht.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <gnunet/platform.h>
#include <gnunet/gnunet_core_service.h>
#include <gnunet/gnunet_dht_service.h>

Expand Down Expand Up @@ -93,4 +92,4 @@ struct DHT : public Service
std::set<GetCallbackPack*> get_handles;
};

}
}
13 changes: 8 additions & 5 deletions gnunetpp/gnunetpp-fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <stdexcept>
#include <iostream>

#include <unistd.h>
#include <gnunet/gnunet_fs_service.h>

namespace gnunetpp::FS
{
namespace detail
Expand Down Expand Up @@ -75,8 +78,8 @@ GNUNET_FS_FileInformation * get_file_information (GNUNET_FS_Handle* fsh, GNUNET_
if (GNUNET_YES == item->is_directory)
{
if (item->meta == NULL)
item->meta = GNUNET_CONTAINER_meta_data_create ();
GNUNET_CONTAINER_meta_data_delete (item->meta, EXTRACTOR_METATYPE_MIMETYPE, NULL, 0);
item->meta = GNUNET_FS_meta_data_create ();
GNUNET_FS_meta_data_delete (item->meta, EXTRACTOR_METATYPE_MIMETYPE, NULL, 0);
GNUNET_FS_meta_data_make_directory (item->meta);
if (item->ksk_uri == NULL) {
const char *mime = GNUNET_FS_DIRECTORY_MIME;
Expand All @@ -100,7 +103,7 @@ GNUNET_FS_FileInformation * get_file_information (GNUNET_FS_Handle* fsh, GNUNET_
}

static int publish_inspector (void *cls, GNUNET_FS_FileInformation *fi, uint64_t length,
GNUNET_CONTAINER_MetaData *m, GNUNET_FS_Uri **uri, GNUNET_FS_BlockOptions *bo,
GNUNET_FS_MetaData *m, GNUNET_FS_Uri **uri, GNUNET_FS_BlockOptions *bo,
int *do_index, void **client_info)
{
char *fn;
Expand All @@ -126,7 +129,7 @@ static int publish_inspector (void *cls, GNUNET_FS_FileInformation *fi, uint64_t
data->keywords.clear();
}
if (/*enable_creation_time*/ true)
GNUNET_CONTAINER_meta_data_add_publication_date (m);
GNUNET_FS_meta_data_add_publication_date (m);
if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory(m)) {
data->fi = fi;
GNUNET_FS_file_information_inspect(fi, &publish_inspector, data);
Expand Down Expand Up @@ -172,7 +175,7 @@ GNUNET_FS_SearchContext* search(
else if(info->status != GNUNET_FS_STATUS_SEARCH_RESULT)
return;
char* uri = GNUNET_FS_uri_to_string(info->value.search.specifics.result.uri);
char* filename = GNUNET_CONTAINER_meta_data_get_by_type (
char* filename = GNUNET_FS_meta_data_get_by_type (
info->value.search.specifics.result.meta,
(EXTRACTOR_MetaType)EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
bool keep_running = fn(uri, filename);
Expand Down
3 changes: 1 addition & 2 deletions gnunetpp/gnunetpp-fs.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <gnunet/platform.h>
#include <gnunet/gnunet_fs_service.h>

#include "inner/UniqueData.hpp"
Expand Down Expand Up @@ -98,4 +97,4 @@ GNUNET_FS_UnindexContext* unindex(
UnindexCallbackFunctor fn);

void cancel(GNUNET_FS_SearchContext* sc);
}
}
8 changes: 4 additions & 4 deletions gnunetpp/gnunetpp-identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ namespace gnunetpp::identity
{
namespace detail
{
static void identity_create_trampline(void* cls, const struct GNUNET_IDENTITY_PrivateKey* id, const char* emsg)
static void identity_create_trampline(void* cls, const struct GNUNET_IDENTITY_PrivateKey* id, GNUNET_ErrorCode ec)
{
auto cb = reinterpret_cast<std::function<void(const GNUNET_IDENTITY_PrivateKey& sk, const std::string& err)>*>(cls);
std::string err_msg = emsg ? emsg : "";
std::string err_msg = GNUNET_ErrorCode_get_hint(ec);
(*cb)(*id, err_msg);
delete cb;
}

static void identity_delete_trampline(void* cls, const char* emsg)
static void identity_delete_trampline(void* cls, GNUNET_ErrorCode ec)
{
auto cb = reinterpret_cast<std::function<void(const std::string& err)>*>(cls);
std::string err_msg = emsg ? emsg : "";
std::string err_msg = GNUNET_ErrorCode_get_hint(ec);
(*cb)(err_msg);
delete cb;
}
Expand Down
5 changes: 2 additions & 3 deletions gnunetpp/gnunetpp-identity.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once
#include <gnunet/platform.h>
#include <gnunet/gnunet_identity_service.h>
#include <gnunet/gnunet_crypto_lib.h>
#include <gnunet/gnunet_util_lib.h>

#include "inner/Infra.hpp"

Expand Down Expand Up @@ -41,4 +40,4 @@ const GNUNET_IDENTITY_PrivateKey* get_private_key(const GNUNET_IDENTITY_Ego* ego
GNUNET_IDENTITY_Ego* anonymous_ego();
GNUNET_IDENTITY_KeyType get_key_type(GNUNET_IDENTITY_Ego* ego);

}
}
3 changes: 1 addition & 2 deletions gnunetpp/gnunetpp-scheduler.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "gnunetpp-scheduler.hpp"
#include "gnunet/platform.h"
#include <gnunet/gnunet_core_service.h>

#include "inner/UniqueData.hpp"
Expand Down Expand Up @@ -93,4 +92,4 @@ void shutdown()
running = false;
}

}
}
1 change: 0 additions & 1 deletion gnunetpp/gnunetpp.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <gnunet/platform.h>
#include <gnunet/gnunet_core_service.h>
#include <gnunet/gnunet_dht_service.h>

Expand Down
1 change: 0 additions & 1 deletion gnunetpp/inner/Infra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <functional>

#include <gnunet/platform.h>
#include <gnunet/gnunet_core_service.h>

namespace gnunetpp
Expand Down
2 changes: 1 addition & 1 deletion gnunetpp/pch.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <gnunet/platform.h>
#include <gnunet/gnunet_core_service.h>
#include <gnunet/gnunet_util_lib.h>

#include <string>
#include <functional>
Expand Down

0 comments on commit 6c2ecfd

Please sign in to comment.