40 uint32_t
bits[(UINT16_MAX + 1) / 32];
128 tmp = (
char *) &hdr[1];
129 if ((Z_OK != compress2 ((Bytef *) tmp,
188 if ((Z_OK != uncompress ((Bytef *)
ret,
190 (
const Bytef *) &
msg[1],
238 for (i = 0; i < tlen; i++)
261 for (
unsigned int i = 0; i < tlen; i++)
288 const uint16_t *types,
295 for (
unsigned int i = 0; i < tcnt; i++)
296 if (0 != (tmap->
bits[types[i] / 32] & (1 << (types[i] % 32))))
312 const uint16_t *types,
320 for (
unsigned int i = 0; i < tcnt; i++)
321 ret->bits[types[i] / 32] |= (1 << (types[i] % 32));
struct GNUNET_MessageHeader * msg
#define gettext_noop(String)
static int ret
Final status code.
struct GNUNET_STATISTICS_Handle * GSC_stats
For creating statistics.
Globals for gnunet-service-core.
void GSC_SESSIONS_broadcast_typemap(const struct GNUNET_MessageHeader *msg)
Broadcast an updated typemap message to all neighbours.
static struct GNUNET_HashCode my_tm_hash
Current hash of our (uncompressed) type map.
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.
void GSC_TYPEMAP_done()
Shutdown typemap subsystem.
void GSC_TYPEMAP_destroy(struct GSC_TypeMap *tmap)
Free the given type map.
static void rehash_typemap()
Our type map changed, recompute its hash.
static struct GSC_TypeMap my_type_map
Bitmap of message types this peer is able to handle.
int GSC_TYPEMAP_check_hash(const struct GNUNET_HashCode *hc)
Check if the given hash matches our current type map.
struct GSC_TypeMap * GSC_TYPEMAP_create()
Create an empty type map.
struct GSC_TypeMap * GSC_TYPEMAP_get_from_message(const struct GNUNET_MessageHeader *msg)
Extract a type map from a TYPE_MAP message.
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.
static uint8_t map_counters[UINT16_MAX+1]
Counters for message types this peer is able to handle.
struct GNUNET_MessageHeader * GSC_TYPEMAP_compute_type_map_message()
Compute a type map message for this peer.
void GSC_TYPEMAP_add(const uint16_t *types, unsigned int tlen)
Add a set of types to our type map.
void GSC_TYPEMAP_hash(const struct GSC_TypeMap *tm, struct GNUNET_HashCode *hc)
Hash the contents of a type map.
void GSC_TYPEMAP_init()
Initialize typemap subsystem.
static int hash_current
Is my_tm_hash() current with respect to our type map?
void GSC_TYPEMAP_remove(const uint16_t *types, unsigned int tlen)
Remove a set of message types from our type map.
static void broadcast_my_type_map()
Send my type map to all connected peers (it got changed).
management of map that specifies which message types this peer supports
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP
uncompressed type map of the sender
#define GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP
gzip-compressed type map of the sender
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
static unsigned int size
Size of the "table".
A type map describing which messages a given neighbour is able to process.
uint32_t bits[(UINT16_MAX+1)/32]