diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-05-24 01:30:17 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-06-11 13:47:57 +0200 |
commit | d0eec6097f79c7fb3ea8b5d8bb0dcca1da1f85a6 (patch) | |
tree | c0cc57a0f066bc1d3c528323c33903038747eca8 /src/messenger/messenger_api_util.c | |
parent | 2549225b825f34b0dfbe9f4a13f134963f3ba58d (diff) | |
download | gnunet-d0eec6097f79c7fb3ea8b5d8bb0dcca1da1f85a6.tar.gz gnunet-d0eec6097f79c7fb3ea8b5d8bb0dcca1da1f85a6.zip |
-moved messenger service out of experimental
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-moved out of experimental, included protocol versions into ports and fixed byte-order of 32bit integers in messages
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/messenger/messenger_api_util.c')
-rw-r--r-- | src/messenger/messenger_api_util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/messenger/messenger_api_util.c b/src/messenger/messenger_api_util.c index 68e15d789..4ad00c45e 100644 --- a/src/messenger/messenger_api_util.c +++ b/src/messenger/messenger_api_util.c | |||
@@ -82,3 +82,19 @@ get_anonymous_public_key () | |||
82 | 82 | ||
83 | return &public_key; | 83 | return &public_key; |
84 | } | 84 | } |
85 | |||
86 | void | ||
87 | convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port) | ||
88 | { | ||
89 | static uint32_t version_value = 0; | ||
90 | static struct GNUNET_HashCode version; | ||
91 | |||
92 | if (!version_value) { | ||
93 | version_value = (uint32_t) (GNUNET_MESSENGER_VERSION); | ||
94 | version_value = ((version_value >> 16) & 0xFFFF); | ||
95 | version_value = GNUNET_htole32(version_value); | ||
96 | GNUNET_CRYPTO_hash(&version_value, sizeof(version_value), &version); | ||
97 | } | ||
98 | |||
99 | GNUNET_CRYPTO_hash_sum(key, &version, port); | ||
100 | } | ||