aboutsummaryrefslogtreecommitdiff
path: root/src/core/gnunet-service-core_typemap.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-06 13:19:16 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-06 13:19:16 +0000
commit4a5fc4b938bc98a2edc71d4875779619d0cebeec (patch)
treea816afcf4e6d7c25e0ea8217dc89d810b8fa1eac /src/core/gnunet-service-core_typemap.c
parent2fb1bb841a5a7ce3783d84cea68938a8202928aa (diff)
downloadgnunet-4a5fc4b938bc98a2edc71d4875779619d0cebeec.tar.gz
gnunet-4a5fc4b938bc98a2edc71d4875779619d0cebeec.zip
stuff
Diffstat (limited to 'src/core/gnunet-service-core_typemap.c')
-rw-r--r--src/core/gnunet-service-core_typemap.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/core/gnunet-service-core_typemap.c b/src/core/gnunet-service-core_typemap.c
index 45dcc65c9..0d270737b 100644
--- a/src/core/gnunet-service-core_typemap.c
+++ b/src/core/gnunet-service-core_typemap.c
@@ -16,6 +16,41 @@ static uint32_t my_type_map[(UINT16_MAX + 1) / 32];
16 16
17 17
18/** 18/**
19 * Add a set of types to our type map.
20 */
21void
22GSC_TYPEMAP_add (const uint16_t *types,
23 unsigned int tlen)
24{
25 unsigned int i;
26
27 for (i=0;i<tlen;i++)
28 my_type_map[types[i] / 32] |= (1 << (types[i] % 32));
29 if (tlen > 0)
30 broadcast_my_type_map ();
31}
32
33
34/**
35 * Remove a set of types from our type map.
36 */
37void
38GSC_TYPEMAP_remove (const uint16_t *types,
39 unsigned int tlen)
40{
41 /* rebuild my_type_map */
42 memset (my_type_map, 0, sizeof (my_type_map));
43 for (pos = clients; NULL != pos; pos = pos->next)
44 {
45 wtypes = (const uint16_t *) &pos[1];
46 for (i = 0; i < pos->tcnt; i++)
47 my_type_map[wtypes[i] / 32] |= (1 << (wtypes[i] % 32));
48 }
49 broadcast_my_type_map ();
50}
51
52
53/**
19 * Compute a type map message for this peer. 54 * Compute a type map message for this peer.
20 * 55 *
21 * @return this peers current type map message. 56 * @return this peers current type map message.