+/**
+ * glk_stream_iterate:
+ * @str: A stream, or #NULL.
+ * @rockptr: Return location for the next window's rock, or #NULL.
+ *
+ * Iterates over the list of streams; if @str is #NULL, it returns the first
+ * stream, otherwise the next stream after @str. If there are no more, it
+ * returns #NULL. The stream's rock is stored in @rockptr. If you don't want
+ * the rocks to be returned, you may set @rockptr to #NULL.
+ *
+ * The order in which streams are returned is arbitrary. The order may change
+ * every time you create or destroy a stream, invalidating the iteration.
+ *
+ * Returns: the next stream, or #NULL if there are no more.
+ */
+strid_t
+glk_stream_iterate(strid_t str, glui32 *rockptr)
+{
+ GList *retnode;
+
+ if(str == NULL)
+ retnode = stream_list;
+ else
+ retnode = str->stream_list->next;
+ strid_t retval = retnode? (strid_t)retnode->data : NULL;
+
+ /* Store the stream's rock in rockptr */
+ if(retval && rockptr)
+ *rockptr = glk_stream_get_rock(retval);
+
+ return retval;
+}
+
+/**
+ * glk_stream_get_rock:
+ * @str: A stream.
+ *
+ * Returns the stream @str's rock value.
+ *
+ * Returns: A rock value.
+ */
+glui32
+glk_stream_get_rock(strid_t str)
+{
+ g_return_val_if_fail(str != NULL, 0);
+ return str->rock;
+}
+