+/**
+ * Add a set of types to our type map.
+ *
+ * @param types array of message types supported by this peer
+ * @param tlen number of entries in @a types
+ */
+void
+GSC_TYPEMAP_add (const uint16_t *types,
+ unsigned int tlen)
+{
+ unsigned int i;
+ int changed;
+
+ changed = GNUNET_NO;
+ for (i = 0; i < tlen; i++)
+ {
+ if (0 == map_counters[types[i]]++)
+ {
+ my_type_map.bits[types[i] / 32] |= (1 << (types[i] % 32));
+ changed = GNUNET_YES;
+ }
+ }
+ if (GNUNET_YES == changed)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Typemap changed, broadcasting!\n");
+ rehash_typemap ();
+ broadcast_my_type_map ();
+ }
+}
+
+
+/**
+ * Remove a set of types from our type map.
+ *
+ * @param types array of types to remove
+ * @param tlen length of the @a types array
+ */
+void
+GSC_TYPEMAP_remove (const uint16_t *types,
+ unsigned int tlen)
+{
+ int changed;
+
+ changed = GNUNET_NO;
+ for (unsigned int i = 0; i < tlen; i++)
+ {
+ if (0 == --map_counters[types[i]])
+ {
+ my_type_map.bits[types[i] / 32] &= ~(1 << (types[i] % 32));
+ changed = GNUNET_YES;
+ }
+ }
+ if (GNUNET_YES == changed)
+ {
+ rehash_typemap ();
+ broadcast_my_type_map ();
+ }
+}
+
+
+/**
+ * Test if any of the types from the types array is in the
+ * given type map.
+ *
+ * @param tmap map to test
+ * @param types array of types
+ * @param tcnt number of entries in @a types
+ * @return #GNUNET_YES if a type is in the map, #GNUNET_NO if not
+ */
+int
+GSC_TYPEMAP_test_match (const struct GSC_TypeMap *tmap,
+ const uint16_t *types,
+ unsigned int tcnt)
+{
+ if (NULL == tmap)
+ return GNUNET_NO;
+ if (0 == tcnt)
+ return GNUNET_YES; /* matches all */
+ for (unsigned int i = 0; i < tcnt; i++)
+ if (0 != (tmap->bits[types[i] / 32] & (1 << (types[i] % 32))))
+ return GNUNET_YES;
+ return GNUNET_NO;
+}
+
+
+/**
+ * Add additional types to a given typemap.
+ *
+ * @param tmap map to extend (not changed)
+ * @param types array of types to add
+ * @param tcnt number of entries in @a types
+ * @return updated type map (fresh copy)
+ */
+struct GSC_TypeMap *
+GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap,
+ const uint16_t *types,
+ unsigned int tcnt)
+{
+ struct GSC_TypeMap *ret;
+
+ ret = GNUNET_new (struct GSC_TypeMap);
+ if (NULL != tmap)
+ GNUNET_memcpy (ret, tmap, sizeof (struct GSC_TypeMap));
+ for (unsigned int i = 0; i < tcnt; i++)
+ ret->bits[types[i] / 32] |= (1 << (types[i] % 32));
+ return ret;
+}
+
+
+/**
+ * Create an empty type map.
+ *
+ * @return an empty type map
+ */
+struct GSC_TypeMap *
+GSC_TYPEMAP_create ()
+{
+ return GNUNET_new (struct GSC_TypeMap);
+}
+
+
+/**
+ * Free the given type map.
+ *
+ * @param tmap a type map
+ */
+void
+GSC_TYPEMAP_destroy (struct GSC_TypeMap *tmap)
+{
+ GNUNET_free (tmap);
+}
+
+
+/**
+ * Initialize typemap subsystem.
+ */
+void
+GSC_TYPEMAP_init ()
+{
+ /* nothing to do */
+}
+
+
+/**
+ * Shutdown typemap subsystem.
+ */
+void
+GSC_TYPEMAP_done ()
+{
+ /* nothing to do */
+}