Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
2a722771
Commit
2a722771
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
c wrapper: add dht_runner_get_id, get_node_id
parent
e8d96d3b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
c/opendht.cpp
+18
-2
18 additions, 2 deletions
c/opendht.cpp
c/opendht_c.h
+2
-0
2 additions, 0 deletions
c/opendht_c.h
with
20 additions
and
2 deletions
c/opendht.cpp
+
18
−
2
View file @
2a722771
...
@@ -95,14 +95,16 @@ int dht_publickey_pack(dht_publickey* pk, char* out, size_t* outlen) {
...
@@ -95,14 +95,16 @@ int dht_publickey_pack(dht_publickey* pk, char* out, size_t* outlen) {
}
}
dht_infohash
dht_publickey_get_id
(
const
dht_publickey
*
pk
)
{
dht_infohash
dht_publickey_get_id
(
const
dht_publickey
*
pk
)
{
auto
pkey
=
reinterpret_cast
<
const
dht
::
crypto
::
PublicKey
*>
(
pk
);
dht_infohash
h
;
dht_infohash
h
;
*
reinterpret_cast
<
dht
::
InfoHash
*>
(
&
h
)
=
reinterpret_cast
<
const
dht
::
crypto
::
PublicKey
*>
(
pk
)
->
getId
();
*
reinterpret_cast
<
dht
::
InfoHash
*>
(
&
h
)
=
pkey
->
getId
();
return
h
;
return
h
;
}
}
dht_pkid
dht_publickey_get_long_id
(
const
dht_publickey
*
pk
)
{
dht_pkid
dht_publickey_get_long_id
(
const
dht_publickey
*
pk
)
{
auto
pkey
=
reinterpret_cast
<
const
dht
::
crypto
::
PublicKey
*>
(
pk
);
dht_pkid
h
;
dht_pkid
h
;
*
reinterpret_cast
<
dht
::
PkId
*>
(
&
h
)
=
reinterpret_cast
<
const
dht
::
crypto
::
PublicKey
*>
(
pk
)
->
getLongId
();
*
reinterpret_cast
<
dht
::
PkId
*>
(
&
h
)
=
pkey
->
getLongId
();
return
h
;
return
h
;
}
}
...
@@ -278,6 +280,20 @@ void dht_runner_shutdown(dht_runner* r, dht_shutdown_cb done_cb, void* cb_user_d
...
@@ -278,6 +280,20 @@ void dht_runner_shutdown(dht_runner* r, dht_shutdown_cb done_cb, void* cb_user_d
});
});
}
}
dht_infohash
dht_runner_get_node_id
(
const
dht_runner
*
r
)
{
auto
runner
=
reinterpret_cast
<
const
dht
::
DhtRunner
*>
(
r
);
dht_infohash
ret
;
*
reinterpret_cast
<
dht
::
InfoHash
*>
(
&
ret
)
=
runner
->
getNodeId
();
return
ret
;
}
dht_infohash
dht_runner_get_id
(
const
dht_runner
*
r
)
{
auto
runner
=
reinterpret_cast
<
const
dht
::
DhtRunner
*>
(
r
);
dht_infohash
ret
;
*
reinterpret_cast
<
dht
::
InfoHash
*>
(
&
ret
)
=
runner
->
getId
();
return
ret
;
}
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
This diff is collapsed.
Click to expand it.
c/opendht_c.h
+
2
−
0
View file @
2a722771
...
@@ -135,6 +135,8 @@ OPENDHT_C_PUBLIC void dht_runner_put(dht_runner* runner, const dht_infohash* has
...
@@ -135,6 +135,8 @@ OPENDHT_C_PUBLIC void dht_runner_put(dht_runner* runner, const dht_infohash* has
OPENDHT_C_PUBLIC
void
dht_runner_put_permanent
(
dht_runner
*
runner
,
const
dht_infohash
*
hash
,
const
dht_value
*
value
,
dht_done_cb
done_cb
,
void
*
cb_user_data
);
OPENDHT_C_PUBLIC
void
dht_runner_put_permanent
(
dht_runner
*
runner
,
const
dht_infohash
*
hash
,
const
dht_value
*
value
,
dht_done_cb
done_cb
,
void
*
cb_user_data
);
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_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
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
);
OPENDHT_C_PUBLIC
dht_infohash
dht_runner_get_id
(
const
dht_runner
*
runner
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment