diff options
Diffstat (limited to 'src/hello/test_hello-ng.c')
-rw-r--r-- | src/hello/test_hello-ng.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/hello/test_hello-ng.c b/src/hello/test_hello-ng.c new file mode 100644 index 000000000..82b1ab6c6 --- /dev/null +++ b/src/hello/test_hello-ng.c | |||
@@ -0,0 +1,37 @@ | |||
1 | #include "platform.h" | ||
2 | #include "gnunet_util_lib.h" | ||
3 | #include "gnunet_nt_lib.h" | ||
4 | #include "gnunet_hello_lib.h" | ||
5 | |||
6 | int | ||
7 | main (int argc, | ||
8 | char *argv[]) | ||
9 | { | ||
10 | struct GNUNET_CRYPTO_EddsaPublicKey pubKey; | ||
11 | struct GNUNET_CRYPTO_EddsaPrivateKey privKey; | ||
12 | struct GNUNET_PeerIdentity pid; | ||
13 | struct GNUNET_TIME_Absolute t = GNUNET_TIME_absolute_get (); | ||
14 | char *res; | ||
15 | size_t res_len; | ||
16 | enum GNUNET_NetworkType nt; | ||
17 | |||
18 | GNUNET_CRYPTO_eddsa_key_create (&privKey); | ||
19 | GNUNET_CRYPTO_eddsa_key_get_public (&privKey, | ||
20 | &pubKey); | ||
21 | pid.public_key = pubKey; | ||
22 | GNUNET_HELLO_sign_address ("127.0.0.1:8080", | ||
23 | GNUNET_NT_LAN, | ||
24 | t, | ||
25 | &privKey, | ||
26 | (void**)&res, | ||
27 | &res_len); | ||
28 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
29 | "%s", res); | ||
30 | GNUNET_assert (NULL != | ||
31 | GNUNET_HELLO_extract_address ((void**)res, | ||
32 | res_len, | ||
33 | &pid, | ||
34 | &nt, | ||
35 | &t)); | ||
36 | return 0; | ||
37 | } | ||