Index: uspace/srv/audio/hound/Makefile
===================================================================
--- uspace/srv/audio/hound/Makefile	(revision 2d1fdcad20d5485ced50d27d6d37bb9ea4d34e79)
+++ uspace/srv/audio/hound/Makefile	(revision 62beb4b057606f366113b0d1e85f082330798ec6)
@@ -47,4 +47,5 @@
 	audio_source.c \
 	hound.c \
+	hound_ctx.c \
 	iface.c \
 	main.c
Index: uspace/srv/audio/hound/hound.c
===================================================================
--- uspace/srv/audio/hound/hound.c	(revision 2d1fdcad20d5485ced50d27d6d37bb9ea4d34e79)
+++ uspace/srv/audio/hound/hound.c	(revision 62beb4b057606f366113b0d1e85f082330798ec6)
@@ -75,4 +75,5 @@
 	FIND_BY_NAME(sink);
 }
+
 static int hound_disconnect_internal(hound_t *hound, const char* source_name, const char* sink_name);
 
@@ -82,7 +83,42 @@
 	fibril_mutex_initialize(&hound->list_guard);
 	list_initialize(&hound->devices);
+	list_initialize(&hound->contexts);
 	list_initialize(&hound->sources);
 	list_initialize(&hound->sinks);
 	return EOK;
+}
+
+int hound_add_ctx(hound_t *hound, hound_ctx_t *ctx)
+{
+	log_info("Trying to add context %p", ctx);
+	assert(hound);
+	if (!ctx)
+		return EINVAL;
+	list_append(&ctx->link, &hound->contexts);
+	//TODO register sinks/sources
+	return EOK;
+}
+
+int hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx)
+{
+	assert(hound);
+	if (!ctx)
+		return EINVAL;
+	list_remove(&ctx->link);
+	return EOK;
+}
+
+hound_ctx_t *hound_get_ctx_by_id(hound_t *hound, hound_context_id_t id)
+{
+	assert(hound);
+
+	//TODO locking
+
+	list_foreach(hound->contexts, it) {
+		hound_ctx_t *ctx = hound_ctx_from_link(it);
+		if (hound_ctx_get_id(ctx) == id)
+			return ctx;
+	}
+	return NULL;
 }
 
Index: uspace/srv/audio/hound/hound.h
===================================================================
--- uspace/srv/audio/hound/hound.h	(revision 2d1fdcad20d5485ced50d27d6d37bb9ea4d34e79)
+++ uspace/srv/audio/hound/hound.h	(revision 62beb4b057606f366113b0d1e85f082330798ec6)
@@ -43,5 +43,7 @@
 #include <fibril_synch.h>
 #include <pcm/format.h>
+#include <hound/protocol.h>
 
+#include "hound_ctx.h"
 #include "audio_source.h"
 #include "audio_sink.h"
@@ -51,4 +53,5 @@
 	fibril_mutex_t list_guard;
 	list_t devices;
+	list_t contexts;
 	list_t sources;
 	list_t sinks;
@@ -56,4 +59,8 @@
 
 int hound_init(hound_t *hound);
+int hound_add_ctx(hound_t *hound, hound_ctx_t *ctx);
+int hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx);
+hound_ctx_t *hound_get_ctx_by_id(hound_t *hound, hound_context_id_t id);
+
 int hound_add_device(hound_t *hound, service_id_t id, const char* name);
 int hound_add_source(hound_t *hound, audio_source_t *source);
Index: uspace/srv/audio/hound/hound_ctx.c
===================================================================
--- uspace/srv/audio/hound/hound_ctx.c	(revision 62beb4b057606f366113b0d1e85f082330798ec6)
+++ uspace/srv/audio/hound/hound_ctx.c	(revision 62beb4b057606f366113b0d1e85f082330798ec6)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @addtogroup audio
+ * @brief HelenOS sound server.
+ * @{
+ */
+/** @file
+ */
+
+#include <malloc.h>
+
+#include "hound_ctx.h"
+
+static void hound_ctx_init_common(hound_ctx_t *ctx)
+{
+	if (!ctx)
+		return;
+	link_initialize(&ctx->link);
+}
+
+hound_ctx_t *hound_record_ctx_get(const char *name)
+{
+	return NULL;
+}
+
+hound_ctx_t *hound_playback_ctx_get(const char *name)
+{
+	hound_ctx_t *ctx = malloc(sizeof(hound_ctx_t));
+	hound_ctx_init_common(ctx);
+	return ctx;
+}
+
+void hound_ctx_destroy(hound_ctx_t *ctx)
+{
+	assert(ctx);
+	assert(!link_in_use(&ctx->link));
+	free(ctx);
+}
+
+hound_context_id_t hound_ctx_get_id(hound_ctx_t *ctx)
+{
+	assert(ctx);
+	return (hound_context_id_t)ctx;
+}
+
+bool hound_ctx_is_record(hound_ctx_t *ctx)
+{
+	assert(ctx);
+	//TODO fix this
+	return false;
+}
+
+/**
+ * @}
+ */
Index: uspace/srv/audio/hound/hound_ctx.h
===================================================================
--- uspace/srv/audio/hound/hound_ctx.h	(revision 62beb4b057606f366113b0d1e85f082330798ec6)
+++ uspace/srv/audio/hound/hound_ctx.h	(revision 62beb4b057606f366113b0d1e85f082330798ec6)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2013 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup audio
+ * @brief HelenOS sound server
+ * @{
+ */
+/** @file
+ */
+
+#ifndef HOUND_CTX_H_
+#define HOUND_CTX_H_
+
+#include <adt/list.h>
+#include <hound/protocol.h>
+
+typedef struct {
+	link_t link;
+} hound_ctx_t;
+
+static inline hound_ctx_t *hound_ctx_from_link(link_t *l)
+{
+	return list_get_instance(l, hound_ctx_t, link);
+}
+
+hound_ctx_t *hound_record_ctx_get(const char *name);
+hound_ctx_t *hound_playback_ctx_get(const char *name);
+void hound_ctx_destroy(hound_ctx_t *context);
+
+hound_context_id_t hound_ctx_get_id(hound_ctx_t *ctx);
+bool hound_ctx_is_record(hound_ctx_t *ctx);
+
+#endif
+
+/**
+ * @}
+ */
+
Index: uspace/srv/audio/hound/iface.c
===================================================================
--- uspace/srv/audio/hound/iface.c	(revision 2d1fdcad20d5485ced50d27d6d37bb9ea4d34e79)
+++ uspace/srv/audio/hound/iface.c	(revision 62beb4b057606f366113b0d1e85f082330798ec6)
@@ -38,4 +38,7 @@
 #include <hound/protocol.h>
 #include <malloc.h>
+
+#include "hound.h"
+#include "hound_ctx.h"
 #include "log.h"
 
@@ -43,19 +46,41 @@
     const char *name, bool record)
 {
-	log_info("%s: %p, %s, %s", __FUNCTION__, server, name, record ? "REC" : "PLAY");
-	*id = 1;
-	return EOK;
+	assert(server);
+	assert(id);
+	assert(name);
+
+	hound_ctx_t *ctx = record ? hound_record_ctx_get(name) :
+	    hound_playback_ctx_get(name);
+	if (!ctx)
+		return ENOMEM;
+
+	const int ret = hound_add_ctx(server, ctx);
+	if (ret != EOK)
+		hound_ctx_destroy(ctx);
+	else
+		*id = hound_ctx_get_id(ctx);
+	return ret;
 }
 
 static int iface_rem_context(void *server, hound_context_id_t id)
 {
+	assert(server);
+	hound_ctx_t *ctx = hound_get_ctx_by_id(server, id);
+	if (!ctx)
+		return EINVAL;
+	hound_remove_ctx(server, ctx);
+	hound_ctx_destroy(ctx);
 	log_info("%s: %p, %d", __FUNCTION__, server, id);
-	return ENOTSUP;
+	return EOK;
 }
 
 static bool iface_is_record_context(void *server, hound_context_id_t id)
 {
+	assert(server);
+	hound_ctx_t *ctx = hound_get_ctx_by_id(server, id);
+	if (!ctx)
+		return false;
 	log_info("%s: %p, %d", __FUNCTION__, server, id);
-	return false;
+	return hound_ctx_is_record(ctx);
 }
 
@@ -73,5 +98,5 @@
 {
 	log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink);
-	return EOK;
+	return ENOTSUP;
 }
 
@@ -89,5 +114,5 @@
 	    pcm_sample_format_str(format.sample_format));
 	*data = (void*)"TEST_STREAM";
-	return EOK;
+	return ENOTSUP;
 }
 
