Skip to content
Permalink
Browse files

c wrapper: add support for putEncrypted

  • Loading branch information...
aberaud committed Oct 28, 2019
1 parent 95a65ce commit 142aee12a742009bde01b8bbfcce43d53bfba50f
Showing with 12 additions and 0 deletions.
  1. +11 −0 c/opendht.cpp
  2. +1 −0 c/opendht_c.h
@@ -361,6 +361,17 @@ void dht_runner_put_signed(dht_runner* r, const dht_infohash* h, const dht_value
}, permanent);
}

void dht_runner_put_encrypted(dht_runner* r, const dht_infohash* h, const dht_infohash* to, const dht_value* v, dht_done_cb done_cb, void* cb_user_data, bool permanent) {
auto runner = reinterpret_cast<dht::DhtRunner*>(r);
auto hash = reinterpret_cast<const dht::InfoHash*>(h);
auto toHash = reinterpret_cast<const dht::InfoHash*>(to);
auto value = reinterpret_cast<const ValueSp*>(v);
runner->putEncrypted(*hash, *toHash, *value, [done_cb, cb_user_data](bool ok){
if (done_cb)
done_cb(ok, cb_user_data);
}, permanent);
}

void dht_runner_cancel_put(dht_runner* r, const dht_infohash* h, dht_value_id value_id) {
auto runner = reinterpret_cast<dht::DhtRunner*>(r);
auto hash = reinterpret_cast<const dht::InfoHash*>(h);
@@ -143,6 +143,7 @@ OPENDHT_C_PUBLIC dht_op_token* dht_runner_listen(dht_runner* runner, const dht_i
OPENDHT_C_PUBLIC void dht_runner_cancel_listen(dht_runner* runner, const dht_infohash* hash, dht_op_token* token);
OPENDHT_C_PUBLIC void dht_runner_put(dht_runner* runner, const dht_infohash* hash, const dht_value* value, dht_done_cb done_cb, void* cb_user_data, bool permanent);
OPENDHT_C_PUBLIC void dht_runner_put_signed(dht_runner* runner, const dht_infohash* hash, const dht_value* value, dht_done_cb done_cb, void* cb_user_data, bool permanent);
OPENDHT_C_PUBLIC void dht_runner_put_encrypted(dht_runner* runner, const dht_infohash* hash, const dht_infohash* to, const dht_value* value, dht_done_cb done_cb, void* cb_user_data, bool permanent);
OPENDHT_C_PUBLIC void dht_runner_cancel_put(dht_runner* runner, const dht_infohash* hash, dht_value_id value_id);
OPENDHT_C_PUBLIC void dht_runner_shutdown(dht_runner* runner, dht_shutdown_cb done_cb, void* cb_user_data);
OPENDHT_C_PUBLIC dht_infohash dht_runner_get_node_id(const dht_runner* runner);

0 comments on commit 142aee1

Please sign in to comment.
You can’t perform that action at this time.