Index: generic/include/ipc/ipc.h
===================================================================
--- generic/include/ipc/ipc.h	(revision 286e03db2e32133734e2e925985747e123632eca)
+++ generic/include/ipc/ipc.h	(revision 8dfef11fc8d83f91532e1905a1f846c9a6fb4da9)
@@ -69,4 +69,35 @@
 #define PHONE_NS              0
 
+/* System-specific methods - only through special syscalls
+ * These methods have special behaviour
+ */
+#define IPC_M_IAMCONNECTING   0
+/** Protocol for CONNECT - TO - ME 
+ *
+ * Calling process asks the callee to create a callback connection,
+ * so that it can start initiating new messages.
+ *
+ * The protocol for negotiating is as follows:
+ * - sys_connecttome - sends a message IPC_M_CONNECTTOME
+ * - sys_wait_for_call - upon receipt tries to allocate new phone
+ *                       - if it fails, responds with ELIMIT
+ *                     - passes call to userspace. If userspace
+ *                       responds with error, phone is deallocated and
+ *                       error is sent back to caller. Otherwise 
+ *                       the call is accepted and the response is sent back.
+ *                     - the allocated phoneid is passed to userspace as
+ *                       ARG3 of the call.
+ *                     - the caller obtains taskid of the called thread
+ */
+#define IPC_M_CONNECTTOME     1
+#define IPC_M_CONNECTMETO     2
+
+
+/* Well-known methods */
+#define IPC_M_FIRST_USER      512
+#define IPC_M_PING            512
+/* User methods */
+#define FIRST_USER_METHOD     1024
+
 #ifdef KERNEL
 
@@ -77,6 +108,6 @@
 #define IPC_MAX_PHONES  16
 
-
 typedef struct answerbox answerbox_t;
+typedef __native ipc_data_t[IPC_CALL_LEN];
 
 typedef struct {
@@ -85,9 +116,11 @@
 	int flags;
 	task_t *sender;
-	__native data[IPC_CALL_LEN];
+	ipc_data_t data;
 } call_t;
 
 struct answerbox {
 	SPINLOCK_DECLARE(lock);
+
+	task_t *task;
 
 	mutex_t mutex;
Index: generic/include/ipc/ns.h
===================================================================
--- generic/include/ipc/ns.h	(revision 286e03db2e32133734e2e925985747e123632eca)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (C) 2006 Ondrej Palkovsky
- * 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.
- */
-
-#ifndef __NS_H_
-#define __NS_H_
-
-/* NameService methods */
-
-/** Ping name service */
-#define NS_PING   1
-
-
-#ifdef KERNEL
-
-#include <ipc/ipc.h>
-
-extern void ns_start(void);
-
-#endif
-
-#endif
Index: generic/include/ipc/sysipc.h
===================================================================
--- generic/include/ipc/sysipc.h	(revision 8dfef11fc8d83f91532e1905a1f846c9a6fb4da9)
+++ generic/include/ipc/sysipc.h	(revision 8dfef11fc8d83f91532e1905a1f846c9a6fb4da9)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2006 Ondrej Palkovsky
+ * 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.
+ */
+
+#ifndef __SYSIPC_H__
+#define __SYSIPC_H__
+
+__native sys_ipc_call_sync_fast(__native phoneid, __native method, 
+				__native arg1, __native *data);
+__native sys_ipc_call_sync(__native phoneid, __native *question, 
+			   __native *reply);
+__native sys_ipc_call_async_fast(__native phoneid, __native method, 
+				 __native arg1, __native arg2);
+__native sys_ipc_call_async(__native phoneid, __native *data);
+__native sys_ipc_answer_fast(__native callid, __native retval, 
+			     __native arg1, __native arg2);
+__native sys_ipc_answer(__native callid, __native *data);
+__native sys_ipc_connect_to_me(__native phoneid, __native arg1,
+			       __native arg2, task_id_t *taskid);
+__native sys_ipc_wait_for_call(ipc_data_t *calldata, task_id_t *taskid,
+			       __native flags);
+
+#endif
