management of map that specifies which message types this peer supports More...
#include "gnunet_util_lib.h"
Go to the source code of this file.
Functions | |
void | GSC_TYPEMAP_add (const uint16_t *types, unsigned int tlen) |
Add a set of types to our type map. More... | |
void | GSC_TYPEMAP_remove (const uint16_t *types, unsigned int tlen) |
Remove a set of message types from our type map. More... | |
struct GNUNET_MessageHeader * | GSC_TYPEMAP_compute_type_map_message (void) |
Compute a type map message for this peer. More... | |
int | GSC_TYPEMAP_check_hash (const struct GNUNET_HashCode *hc) |
Check if the given hash matches our current type map. More... | |
void | GSC_TYPEMAP_hash (const struct GSC_TypeMap *tm, struct GNUNET_HashCode *hc) |
Hash the contents of a type map. More... | |
struct GSC_TypeMap * | GSC_TYPEMAP_get_from_message (const struct GNUNET_MessageHeader *msg) |
Extract a type map from a #GNUNET_MESSAGE_TYPE_CORE_COMRESSED_TYPE_MAP or GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP message. More... | |
int | GSC_TYPEMAP_test_match (const struct GSC_TypeMap *tmap, const uint16_t *types, unsigned int tcnt) |
Test if any of the types from the types array is in the given type map. More... | |
struct GSC_TypeMap * | GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap, const uint16_t *types, unsigned int tcnt) |
Add additional types to a given typemap. More... | |
struct GSC_TypeMap * | GSC_TYPEMAP_create (void) |
Create an empty type map. More... | |
void | GSC_TYPEMAP_destroy (struct GSC_TypeMap *tmap) |
Free the given type map. More... | |
void | GSC_TYPEMAP_init (void) |
Initialize typemap subsystem. More... | |
void | GSC_TYPEMAP_done (void) |
Shutdown typemap subsystem. More... | |
management of map that specifies which message types this peer supports
Definition in file gnunet-service-core_typemap.h.
void GSC_TYPEMAP_add | ( | const uint16_t * | types, |
unsigned int | tlen | ||
) |
Add a set of types to our type map.
types | array of message types supported by this peer |
tlen | number of entries in types |
Definition at line 232 of file gnunet-service-core_typemap.c.
References GSC_TypeMap::bits, broadcast_my_type_map(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_YES, map_counters, my_type_map, and rehash_typemap().
Referenced by handle_client_init().
void GSC_TYPEMAP_remove | ( | const uint16_t * | types, |
unsigned int | tlen | ||
) |
Remove a set of message types from our type map.
types | array of message types no longer supported by this peer |
tlen | number of entries in types |
Definition at line 256 of file gnunet-service-core_typemap.c.
References GSC_TypeMap::bits, broadcast_my_type_map(), GNUNET_NO, GNUNET_YES, map_counters, my_type_map, and rehash_typemap().
Referenced by client_disconnect_cb().
struct GNUNET_MessageHeader * GSC_TYPEMAP_compute_type_map_message | ( | void | ) |
Compute a type map message for this peer.
Definition at line 114 of file gnunet-service-core_typemap.c.
References GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP, GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP, my_type_map, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
Referenced by broadcast_my_type_map(), and transmit_typemap_task().
int GSC_TYPEMAP_check_hash | ( | const struct GNUNET_HashCode * | hc | ) |
Check if the given hash matches our current type map.
hc | hash code to check if it matches our type map |
Definition at line 95 of file gnunet-service-core_typemap.c.
References GNUNET_NO, GNUNET_YES, GSC_TYPEMAP_hash(), hash_current, my_tm_hash, and my_type_map.
Referenced by GSC_SESSIONS_confirm_typemap().
void GSC_TYPEMAP_hash | ( | const struct GSC_TypeMap * | tm, |
struct GNUNET_HashCode * | hc | ||
) |
Hash the contents of a type map.
tm | map to hash |
hc | where to store the hash code |
Definition at line 82 of file gnunet-service-core_typemap.c.
References GNUNET_CRYPTO_hash().
Referenced by GSC_SESSIONS_set_typemap(), and GSC_TYPEMAP_check_hash().
struct GSC_TypeMap * GSC_TYPEMAP_get_from_message | ( | const struct GNUNET_MessageHeader * | msg | ) |
Extract a type map from a #GNUNET_MESSAGE_TYPE_CORE_COMRESSED_TYPE_MAP or GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP message.
msg | a type map message |
Extract a type map from a #GNUNET_MESSAGE_TYPE_CORE_COMRESSED_TYPE_MAP or GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP message.
msg | a type map message |
Definition at line 158 of file gnunet-service-core_typemap.c.
References gettext_noop, GNUNET_break, GNUNET_break_op, GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP, GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP, GNUNET_new, GNUNET_NO, GNUNET_STATISTICS_update(), GSC_stats, msg, ret, GNUNET_MessageHeader::size, size, and GNUNET_MessageHeader::type.
Referenced by GSC_SESSIONS_set_typemap().
int GSC_TYPEMAP_test_match | ( | const struct GSC_TypeMap * | tmap, |
const uint16_t * | types, | ||
unsigned int | tcnt | ||
) |
Test if any of the types from the types array is in the given type map.
tmap | map to test |
types | array of types |
tcnt | number of entries in types |
Definition at line 287 of file gnunet-service-core_typemap.c.
References GSC_TypeMap::bits, GNUNET_NO, and GNUNET_YES.
Referenced by GSC_CLIENTS_notify_client_about_neighbour(), and GSC_SESSIONS_add_to_typemap().
struct GSC_TypeMap * GSC_TYPEMAP_extend | ( | const struct GSC_TypeMap * | tmap, |
const uint16_t * | types, | ||
unsigned int | tcnt | ||
) |
Add additional types to a given typemap.
tmap | map to extend (not changed) |
types | array of types to add |
tcnt | number of entries in types |
Definition at line 311 of file gnunet-service-core_typemap.c.
References GNUNET_memcpy, GNUNET_new, and ret.
Referenced by GSC_SESSIONS_add_to_typemap().
struct GSC_TypeMap * GSC_TYPEMAP_create | ( | void | ) |
Create an empty type map.
Definition at line 332 of file gnunet-service-core_typemap.c.
References GNUNET_new.
Referenced by GSC_SESSIONS_create().
void GSC_TYPEMAP_destroy | ( | struct GSC_TypeMap * | tmap | ) |
Free the given type map.
tmap | a type map |
Definition at line 344 of file gnunet-service-core_typemap.c.
References GNUNET_free.
Referenced by GSC_SESSIONS_add_to_typemap(), GSC_SESSIONS_end(), and GSC_SESSIONS_set_typemap().
void GSC_TYPEMAP_init | ( | void | ) |
Initialize typemap subsystem.
Definition at line 354 of file gnunet-service-core_typemap.c.
Referenced by run().
void GSC_TYPEMAP_done | ( | void | ) |
Shutdown typemap subsystem.
Definition at line 364 of file gnunet-service-core_typemap.c.
Referenced by shutdown_task().