+/**
+ * Initialize the session manager with a 'max_session_count',
+ * an initial common 'timeout' and an initial common token 'initok'.
+ *
+ * @param max_session_count maximum allowed session count in the same time
+ * @param timeout the initial default timeout of sessions
+ * @param initok the initial default token of sessions
+ *
+ */
+int afb_session_init (int max_session_count, int timeout, const char *initok)
+{
+ /* check parameters */
+ if (initok && strlen(initok) >= sizeof sessions.initok) {
+ ERROR("initial token '%s' too long (max length %d)",
+ initok, ((int)(sizeof sessions.initok)) - 1);
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* init the sessionset (after cleanup) */
+ sessionset_lock();
+ sessionset_cleanup(1);
+ sessions.max = max_session_count;
+ sessions.timeout = timeout;
+ if (initok == NULL)
+ new_uuid(sessions.initok);
+ else
+ strcpy(sessions.initok, initok);
+ sessionset_unlock();
+ return 0;
+}
+
+/**
+ * Iterate the sessions and call 'callback' with
+ * the 'closure' for each session.
+ */
+void afb_session_foreach(void (*callback)(void *closure, struct afb_session *session), void *closure)