c wrapper: add dht_infohash_get

This commit is contained in:
Adrien Béraud committed 2019-10-16 15:07:31 -04:00
1 parent 22741436e3
commit 01bf8f9303
2 files changed
+7 -1

No files matched your search

+5
View File
@@ -22,6 +22,11 @@ void dht_infohash_random(dht_infohash* h)
*reinterpret_cast<dht::InfoHash*>(h) = dht::InfoHash::getRandom();
}
void dht_infohash_get(dht_infohash* h, const uint8_t* dat, size_t dat_size)
{
*reinterpret_cast<dht::InfoHash*>(h) = dht::InfoHash::get(dat, dat_size);
}
bool dht_infohash_is_zero(const dht_infohash* h) {
return static_cast<bool>(*reinterpret_cast<const dht::InfoHash*>(h));
}
+2 -1
View File
@@ -37,6 +37,7 @@ struct OPENDHT_C_PUBLIC dht_infohash { uint8_t d[HASH_LEN]; };
typedef struct dht_infohash dht_infohash;
OPENDHT_C_PUBLIC void dht_infohash_zero(dht_infohash* h);
OPENDHT_C_PUBLIC void dht_infohash_random(dht_infohash* h);
OPENDHT_C_PUBLIC void dht_infohash_get(dht_infohash* h, const uint8_t* dat, size_t dat_size);
OPENDHT_C_PUBLIC const char* dht_infohash_print(const dht_infohash* h);
OPENDHT_C_PUBLIC bool dht_infohash_is_zero(const dht_infohash* h);
@@ -63,7 +64,7 @@ typedef struct dht_privatekey dht_privatekey;
OPENDHT_C_PUBLIC dht_privatekey* dht_privatekey_generate(unsigned key_length_bits);
OPENDHT_C_PUBLIC dht_privatekey* dht_privatekey_import(const uint8_t* dat, size_t dat_size, const char* password);
OPENDHT_C_PUBLIC dht_publickey* dht_privatekey_get_publickey(const dht_privatekey*);
OPENDHT_C_PUBLIC void dht_privatekey_delete(dht_privatekey* pk);
OPENDHT_C_PUBLIC void dht_privatekey_delete(dht_privatekey*);
// dht::crypto::Certificate
struct OPENDHT_C_PUBLIC dht_certificate;