30 #ifdef OPENDHT_JSONCPP 31 #include <json/json.h> 48 unsigned good_nodes {0},
52 unsigned table_depth {0};
53 unsigned getKnownNodes()
const {
return good_nodes + dubious_nodes; }
54 unsigned long getNetworkSizeEstimation()
const {
return 8 * std::exp2(table_depth); }
55 std::string toString()
const;
57 #ifdef OPENDHT_JSONCPP 61 Json::Value toJson()
const;
66 MSGPACK_DEFINE_MAP(good_nodes, dubious_nodes, cached_nodes, incoming_nodes, table_depth)
75 #ifdef OPENDHT_JSONCPP 79 Json::Value toJson()
const;
81 explicit NodeInfo(
const Json::Value& v);
84 MSGPACK_DEFINE_MAP(
id, node_id, ipv4, ipv6)
117 static constexpr
size_t DEFAULT_STORAGE_LIMIT {1024 * 1024 * 64};
119 using ValuesExport = std::pair<InfoHash, Blob>;
121 using QueryCallback = std::function<bool(const std::vector<std::shared_ptr<FieldValueIndex>>& fields)>;
122 using GetCallback = std::function<bool(const std::vector<std::shared_ptr<Value>>& values)>;
123 using ValueCallback = std::function<bool(const std::vector<std::shared_ptr<Value>>& values,
bool expired)>;
124 using GetCallbackSimple = std::function<bool(std::shared_ptr<Value> value)>;
125 using ShutdownCallback = std::function<void()>;
127 using CertificateStoreQuery = std::function<std::vector<std::shared_ptr<crypto::Certificate>>(
const InfoHash& pk_id)>;
129 typedef bool (*GetCallbackRaw)(std::shared_ptr<Value>,
void *user_data);
131 OPENDHT_PUBLIC GetCallbackSimple bindGetCb(GetCallbackRaw raw_cb,
void* user_data);
132 OPENDHT_PUBLIC GetCallback bindGetCb(GetCallbackSimple cb);
134 using DoneCallback = std::function<void(bool success, const std::vector<std::shared_ptr<Node>>& nodes)>;
135 typedef void (*DoneCallbackRaw)(bool, std::vector<std::shared_ptr<Node>>*,
void *user_data);
136 typedef void (*ShutdownCallbackRaw)(
void *user_data);
137 typedef void (*DoneCallbackSimpleRaw)(bool,
void *user_data);
138 typedef bool (*FilterRaw)(
const Value&,
void *user_data);
140 using DoneCallbackSimple = std::function<void(bool success)>;
142 OPENDHT_PUBLIC ShutdownCallback bindShutdownCb(ShutdownCallbackRaw shutdown_cb_raw,
void* user_data);
143 OPENDHT_PUBLIC DoneCallback bindDoneCb(DoneCallbackSimple donecb);
144 OPENDHT_PUBLIC DoneCallback bindDoneCb(DoneCallbackRaw raw_cb,
void* user_data);
145 OPENDHT_PUBLIC DoneCallbackSimple bindDoneCbSimple(DoneCallbackSimpleRaw raw_cb,
void* user_data);
146 OPENDHT_PUBLIC Value::Filter bindFilterRaw(FilterRaw raw_filter,
void* user_data);