+/**
+ * Set the verbosity level of the 'api'
+ * @param api the api to set (NULL set all)
+ */
+void afb_apis_set_verbosity(const char *api, int level)
+{
+ const struct api_desc *i, *e;
+
+ if (!api) {
+ i = apis_array;
+ e = &apis_array[apis_count];
+ } else {
+ i = search(api);
+ e = &i[!!i];
+ }
+ while (i != e) {
+ if (i->api.itf->set_verbosity)
+ i->api.itf->set_verbosity(i->api.closure, level);
+ i++;
+ }
+}
+
+/**
+ * Set the verbosity level of the 'api'
+ * @param api the api to set (NULL set all)
+ */
+int afb_apis_get_verbosity(const char *api)
+{
+ const struct api_desc *i;
+
+ i = api ? search(api) : NULL;
+ if (!i) {
+ errno = ENOENT;
+ return -1;
+ }
+ if (!i->api.itf->get_verbosity)
+ return 0;
+
+ return i->api.itf->get_verbosity(i->api.closure);
+}
+
+/**
+ * Get the list of api names
+ * @return a NULL terminated array of api names. Must be freed.
+ */
+const char **afb_apis_get_names()
+{
+ size_t size;
+ char *dest;
+ const char **names;
+ int i;
+
+ size = apis_count * (1 + sizeof(*names)) + sizeof(*names);
+ for (i = 0 ; i < apis_count ; i++)
+ size += strlen(apis_array[i].name);
+
+ names = malloc(size);
+ if (!names)
+ errno = ENOMEM;
+ else {
+ dest = (void*)&names[apis_count+1];
+ for (i = 0 ; i < apis_count ; i++) {
+ names[i] = dest;
+ dest = stpcpy(dest, apis_array[i].name) + 1;
+ }
+ names[i] = NULL;
+ }
+ return names;
+}
+