Index: boot/Makefile.common
===================================================================
--- boot/Makefile.common	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ boot/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -91,5 +91,4 @@
 	$(USPACEDIR)/srv/net/net/net \
 	$(USPACEDIR)/srv/net/netif/lo/lo \
-	$(USPACEDIR)/srv/net/netif/dp8390/dp8390 \
 	$(USPACEDIR)/srv/net/nil/eth/eth \
 	$(USPACEDIR)/srv/net/nil/nildummy/nildummy \
@@ -105,6 +104,10 @@
 NET_CFG = \
 	$(USPACEDIR)/srv/net/cfg/$(NETWORKING)/general \
-	$(USPACEDIR)/srv/net/cfg/$(NETWORKING)/lo \
-	$(USPACEDIR)/srv/net/cfg/$(NETWORKING)/ne2k
+	$(USPACEDIR)/srv/net/cfg/$(NETWORKING)/lo
+
+ifeq ($(CONFIG_NETIF_DP8390),y)
+	NET_SRVS	+=	$(USPACEDIR)/srv/net/netif/dp8390/dp8390
+
+	NET_CFG	+=	$(USPACEDIR)/srv/net/cfg/$(NETWORKING)/ne2k
 endif
 
@@ -130,3 +133,3 @@
 endif
 endif
-
+endif
Index: uspace/lib/libpci/Makefile.build
===================================================================
--- uspace/lib/libpci/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/lib/libpci/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
+# 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.
+#
+
+## Setup toolchain
+#
+
+include Makefile.common
+include $(LIBC_PREFIX)/Makefile.toolchain
+
+## Sources
+#
+
+SOURCES = \
+	access.c \
+	generic.c \
+	names.c \
+	i386-ports.c
+
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+.PHONY: all
+
+all: $(LIBPCI)
+
+-include $(DEPEND)
+
+$(LIBPCI): $(OBJECTS)
+	$(AR) rc $@ $(OBJECTS)
+
+%.o: %.c $(DEPEND)
+	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
+
+$(DEPEND):
+	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
+	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/lib/libpci/Makefile.common
===================================================================
--- uspace/lib/libpci/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/lib/libpci/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2005 Martin Decky
+# 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.
+#
+
+
+## Common names
+#
+
+LIBC_PREFIX = ../../../lib/libc
+DEPEND = Makefile.depend
+DEPEND_PREV = $(DEPEND).prev
+LIBPCI = libpci.a
Index: uspace/srv/bd/part/mbr_part/Makefile.build
===================================================================
--- uspace/srv/bd/part/mbr_part/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/bd/part/mbr_part/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,63 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
+# 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.
+#
+
+## Setup toolchain
+#
+
+include Makefile.common
+include $(LIBC_PREFIX)/Makefile.toolchain
+
+CFLAGS += -I$(LIBBLOCK_PREFIX)
+
+## Sources
+#
+
+SOURCES = \
+	mbr_part.c
+
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+.PHONY: all
+
+all: $(OUTPUT) $(OUTPUT).disasm
+
+-include $(DEPEND)
+
+$(OUTPUT).disasm: $(OUTPUT)
+	$(OBJDUMP) -d $< > $@
+
+$(OUTPUT): $(OBJECTS) $(LIBS)
+	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
+
+%.o: %.c $(DEPEND)
+	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
+
+$(DEPEND):
+	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
+	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/srv/bd/part/mbr_part/Makefile.common
===================================================================
--- uspace/srv/bd/part/mbr_part/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/bd/part/mbr_part/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2005 Martin Decky
+# 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.
+#
+
+
+## Common names
+#
+
+LIBC_PREFIX = ../../../lib/libc
+SOFTINT_PREFIX = ../../../lib/softint
+LIBBLOCK_PREFIX = ../../../lib/libblock
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a
+
+DEPEND = Makefile.depend
+DEPEND_PREV = $(DEPEND).prev
+OUTPUT = mbr_part
Index: uspace/srv/hid/char_mouse/Makefile.build
===================================================================
--- uspace/srv/hid/char_mouse/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hid/char_mouse/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,65 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
+# 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.
+#
+
+## Setup toolchain
+#
+
+include Makefile.common
+include $(LIBC_PREFIX)/Makefile.toolchain
+
+CFLAGS += -Iinclude
+
+## Sources
+#
+
+SOURCES = \
+	proto/ps2.c \
+	c_mouse.c \
+	chardev.c
+
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+.PHONY: all
+
+all: $(OUTPUT) $(OUTPUT).disasm
+
+-include $(DEPEND)
+
+$(OUTPUT).disasm: $(OUTPUT)
+	$(OBJDUMP) -d $< > $@
+
+$(OUTPUT): $(OBJECTS) $(LIBS)
+	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
+
+%.o: %.c $(DEPEND)
+	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
+
+$(DEPEND):
+	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
+	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/srv/hid/char_mouse/Makefile.common
===================================================================
--- uspace/srv/hid/char_mouse/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hid/char_mouse/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2005 Martin Decky
+# 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.
+#
+
+
+## Common names
+#
+
+LIBC_PREFIX = ../../../lib/libc
+SOFTINT_PREFIX = ../../../lib/softint
+LIBS = $(LIBC_PREFIX)/libc.a
+
+DEPEND = Makefile.depend
+DEPEND_PREV = $(DEPEND).prev
+OUTPUT = c_mouse
Index: uspace/srv/hw/bus/pci/Makefile.build
===================================================================
--- uspace/srv/hw/bus/pci/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hw/bus/pci/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
+# 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.
+#
+
+## Setup toolchain
+#
+
+include Makefile.common
+include $(LIBC_PREFIX)/Makefile.toolchain
+
+## Sources
+#
+
+SOURCES = \
+	pci.c
+
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+.PHONY: all
+
+all: $(OUTPUT) $(OUTPUT).disasm
+
+-include $(DEPEND)
+
+$(OUTPUT).disasm: $(OUTPUT)
+	$(OBJDUMP) -d $< > $@
+
+$(OUTPUT): $(OBJECTS) $(LIBS)
+	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
+
+%.o: %.c $(DEPEND)
+	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
+
+$(DEPEND):
+	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
+	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/srv/hw/bus/pci/Makefile.common
===================================================================
--- uspace/srv/hw/bus/pci/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hw/bus/pci/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2005 Martin Decky
+# 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.
+#
+
+
+## Common names
+#
+
+LIBC_PREFIX = ../../lib/libc
+SOFTINT_PREFIX = ../../lib/softint
+LIBPCI = libpci/libpci.a
+LIBS = $(LIBPCI) $(LIBC_PREFIX)/libc.a
+
+DEPEND = Makefile.depend
+DEPEND_PREV = $(DEPEND).prev
+OUTPUT = pci
Index: uspace/srv/hw/char/i8042/Makefile.build
===================================================================
--- uspace/srv/hw/char/i8042/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hw/char/i8042/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
+# 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.
+#
+
+## Setup toolchain
+#
+
+include Makefile.common
+include $(LIBC_PREFIX)/Makefile.toolchain
+
+## Sources
+#
+
+SOURCES = \
+	i8042.c
+
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+.PHONY: all
+
+all: $(OUTPUT) $(OUTPUT).disasm
+
+-include $(DEPEND)
+
+$(OUTPUT).disasm: $(OUTPUT)
+	$(OBJDUMP) -d $< > $@
+
+$(OUTPUT): $(OBJECTS) $(LIBS)
+	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
+
+%.o: %.c $(DEPEND)
+	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
+
+$(DEPEND):
+	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
+	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/srv/hw/char/i8042/Makefile.common
===================================================================
--- uspace/srv/hw/char/i8042/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hw/char/i8042/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2005 Martin Decky
+# 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.
+#
+
+
+## Common names
+#
+
+LIBC_PREFIX = ../../../lib/libc
+SOFTINT_PREFIX = ../../../lib/softint
+LIBS = $(LIBC_PREFIX)/libc.a
+
+DEPEND = Makefile.depend
+DEPEND_PREV = $(DEPEND).prev
+OUTPUT = i8042
Index: uspace/srv/hw/cir/fhc/Makefile.build
===================================================================
--- uspace/srv/hw/cir/fhc/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hw/cir/fhc/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
+# 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.
+#
+
+## Setup toolchain
+#
+
+include Makefile.common
+include $(LIBC_PREFIX)/Makefile.toolchain
+
+## Sources
+#
+
+SOURCES = \
+	fhc.c
+
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+.PHONY: all
+
+all: $(OUTPUT) $(OUTPUT).disasm
+
+-include $(DEPEND)
+
+$(OUTPUT).disasm: $(OUTPUT)
+	$(OBJDUMP) -d $< > $@
+
+$(OUTPUT): $(OBJECTS) $(LIBS)
+	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
+
+%.o: %.c $(DEPEND)
+	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
+
+$(DEPEND):
+	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
+	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/srv/hw/cir/fhc/Makefile.common
===================================================================
--- uspace/srv/hw/cir/fhc/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hw/cir/fhc/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2005 Martin Decky
+# 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.
+#
+
+
+## Common names
+#
+
+LIBC_PREFIX = ../../../lib/libc
+SOFTINT_PREFIX = ../../../lib/softint
+LIBS = $(LIBC_PREFIX)/libc.a
+
+DEPEND = Makefile.depend
+DEPEND_PREV = $(DEPEND).prev
+OUTPUT = fhc
Index: uspace/srv/hw/cir/obio/Makefile.build
===================================================================
--- uspace/srv/hw/cir/obio/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hw/cir/obio/Makefile.build	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
+# 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.
+#
+
+## Setup toolchain
+#
+
+include Makefile.common
+include $(LIBC_PREFIX)/Makefile.toolchain
+
+## Sources
+#
+
+SOURCES = \
+	obio.c
+
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+.PHONY: all
+
+all: $(OUTPUT) $(OUTPUT).disasm
+
+-include $(DEPEND)
+
+$(OUTPUT).disasm: $(OUTPUT)
+	$(OBJDUMP) -d $< > $@
+
+$(OUTPUT): $(OBJECTS) $(LIBS)
+	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
+
+%.o: %.c $(DEPEND)
+	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
+
+$(DEPEND):
+	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
+	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/srv/hw/cir/obio/Makefile.common
===================================================================
--- uspace/srv/hw/cir/obio/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
+++ uspace/srv/hw/cir/obio/Makefile.common	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2005 Martin Decky
+# 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.
+#
+
+
+## Common names
+#
+
+LIBC_PREFIX = ../../../lib/libc
+SOFTINT_PREFIX = ../../../lib/softint
+LIBS = $(LIBC_PREFIX)/libc.a
+
+DEPEND = Makefile.depend
+DEPEND_PREV = $(DEPEND).prev
+OUTPUT = obio
Index: uspace/srv/net/Makefile
===================================================================
--- uspace/srv/net/Makefile	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/Makefile	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -31,5 +31,4 @@
 DIRS = \
 	netif/lo \
-	netif/dp8390 \
 	nil/eth \
 	nil/nildummy \
@@ -48,4 +47,8 @@
 		tl/udp \
 		tl/tcp \
+
+ifeq ($(CONFIG_NETIF_DP8390),y)
+	DIRS += netif/dp8390
+endif
 
 DIRS_ALL = $(DIRS) $(DIRS_MODULAR)
Index: uspace/srv/net/app/echo/echo.c
===================================================================
--- uspace/srv/net/app/echo/echo.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/app/echo/echo.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -61,9 +61,9 @@
  *  @returns EOK on success.
  */
-int		main( int argc, char * argv[] );
+int main(int argc, char * argv[]);
 
 /** Prints the application help.
  */
-void	echo_print_help( void );
+void echo_print_help(void);
 
 /** Translates the character string to the protocol family number.
@@ -72,5 +72,5 @@
  *  @returns EPFNOSUPPORTED if the protocol family is not supported.
  */
-int		echo_parse_protocol_family( const char * name );
+int echo_parse_protocol_family(const char * name);
 
 /** Translates the character string to the socket type number.
@@ -79,7 +79,7 @@
  *  @returns ESOCKNOSUPPORTED if the socket type is not supported.
  */
-int		echo_parse_socket_type( const char * name );
-
-void echo_print_help( void ){
+int echo_parse_socket_type(const char * name);
+
+void echo_print_help(void){
 	printf(
 		"Network Echo aplication\n" \
@@ -115,8 +115,8 @@
 }
 
-int echo_parse_protocol_family( const char * name ){
-	if( str_lcmp( name, "PF_INET", 7 ) == 0 ){
+int echo_parse_protocol_family(const char * name){
+	if(str_lcmp(name, "PF_INET", 7) == 0){
 		return PF_INET;
-	}else if( str_lcmp( name, "PF_INET6", 8 ) == 0 ){
+	}else if(str_lcmp(name, "PF_INET6", 8) == 0){
 		return PF_INET6;
 	}
@@ -124,8 +124,8 @@
 }
 
-int echo_parse_socket_type( const char * name ){
-	if( str_lcmp( name, "SOCK_DGRAM", 11 ) == 0 ){
+int echo_parse_socket_type(const char * name){
+	if(str_lcmp(name, "SOCK_DGRAM", 11) == 0){
 		return SOCK_DGRAM;
-	}else if( str_lcmp( name, "SOCK_STREAM", 12 ) == 0 ){
+	}else if(str_lcmp(name, "SOCK_STREAM", 12) == 0){
 		return SOCK_STREAM;
 	}
@@ -133,95 +133,105 @@
 }
 
-int main( int argc, char * argv[] ){
+int main(int argc, char * argv[]){
 	ERROR_DECLARE;
 
-	size_t				size			= 1024;
-	int					verbose			= 0;
-	char *				reply			= NULL;
-	sock_type_t			type			= SOCK_DGRAM;
-	int					count			= -1;
-	int					family			= PF_INET;
-	uint16_t			port			= 7;
-	int					backlog			= 3;
-
-	socklen_t			max_length		= sizeof( struct sockaddr_in6 );
-	uint8_t				address_data[ max_length ];
-	struct sockaddr *		address		= ( struct sockaddr * ) address_data;
-	struct sockaddr_in *	address_in		= ( struct sockaddr_in * ) address;
-	struct sockaddr_in6 *	address_in6	= ( struct sockaddr_in6 * ) address;
-	socklen_t			addrlen;
-	char				address_string[ INET6_ADDRSTRLEN ];
-	uint8_t *			address_start;
-	int					socket_id;
-	int					listening_id;
+	size_t size			= 1024;
+	int verbose			= 0;
+	char * reply			= NULL;
+	sock_type_t type			= SOCK_DGRAM;
+	int count			= -1;
+	int family			= PF_INET;
+	uint16_t port			= 7;
+	int backlog			= 3;
+
+	socklen_t max_length		= sizeof(struct sockaddr_in6);
+	uint8_t address_data[max_length];
+	struct sockaddr * address		= (struct sockaddr *) address_data;
+	struct sockaddr_in * address_in		= (struct sockaddr_in *) address;
+	struct sockaddr_in6 * address_in6	= (struct sockaddr_in6 *) address;
+	socklen_t addrlen;
+	char address_string[INET6_ADDRSTRLEN];
+	uint8_t * address_start;
+	int socket_id;
+	int listening_id;
 	char * 				data;
-	size_t				length;
-	int					index;
-	size_t				reply_length;
-	int					value;
-
-	printf( "Task %d - ", task_get_id());
-	printf( "%s\n", NAME );
-
-	for( index = 1; index < argc; ++ index ){
-		if( argv[ index ][ 0 ] == '-' ){
-			switch( argv[ index ][ 1 ] ){
-				case 'b':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & backlog, "accepted sockets queue size", 0 ));
-							break;
-				case 'c':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & count, "message count", 0 ));
-							break;
-				case 'f':	ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "protocol family", 0, echo_parse_protocol_family ));
-							break;
-				case 'h':	echo_print_help();
-							return EOK;
-							break;
-				case 'p':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "port number", 0 ));
-							port = ( uint16_t ) value;
-							break;
-				case 'r':	ERROR_PROPAGATE( parse_parameter_string( argc, argv, & index, & reply, "reply string", 0 ));
-							break;
-				case 's':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "receive size", 0 ));
-							size = (value >= 0 ) ? ( size_t ) value : 0;
-							break;
-				case 't':	ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & value, "socket type", 0, echo_parse_socket_type ));
-							type = ( sock_type_t ) value;
-							break;
-				case 'v':	verbose = 1;
-							break;
-				case '-':	if( str_lcmp( argv[ index ] + 2, "backlog=", 6 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & backlog, "accepted sockets queue size", 8 ));
-							}else if( str_lcmp( argv[ index ] + 2, "count=", 6 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & count, "message count", 8 ));
-							}else if( str_lcmp( argv[ index ] + 2, "family=", 7 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "protocol family", 9, echo_parse_protocol_family ));
-							}else if( str_lcmp( argv[ index ] + 2, "help", 5 ) == 0 ){
-								echo_print_help();
-								return EOK;
-							}else if( str_lcmp( argv[ index ] + 2, "port=", 5 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "port number", 7 ));
-								port = ( uint16_t ) value;
-							}else if( str_lcmp( argv[ index ] + 2, "reply=", 6 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_string( argc, argv, & index, & reply, "reply string", 8 ));
-							}else if( str_lcmp( argv[ index ] + 2, "size=", 5 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "receive size", 7 ));
-								size = (value >= 0 ) ? ( size_t ) value : 0;
-							}else if( str_lcmp( argv[ index ] + 2, "type=", 5 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & value, "socket type", 7, echo_parse_socket_type ));
-								type = ( sock_type_t ) value;
-							}else if( str_lcmp( argv[ index ] + 2, "verbose", 8 ) == 0 ){
-								verbose = 1;
-							}else{
-								print_unrecognized( index, argv[ index ] + 2 );
-								echo_print_help();
-								return EINVAL;
-							}
-							break;
+	size_t length;
+	int index;
+	size_t reply_length;
+	int value;
+
+	printf("Task %d - ", task_get_id());
+	printf("%s\n", NAME);
+
+	for(index = 1; index < argc; ++ index){
+		if(argv[index][0] == '-'){
+			switch(argv[index][1]){
+				case 'b':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &backlog, "accepted sockets queue size", 0));
+					break;
+				case 'c':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "message count", 0));
+					break;
+				case 'f':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, echo_parse_protocol_family));
+					break;
+				case 'h':
+					echo_print_help();
+					return EOK;
+					break;
+				case 'p':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
+					port = (uint16_t) value;
+					break;
+				case 'r':
+					ERROR_PROPAGATE(parse_parameter_string(argc, argv, &index, &reply, "reply string", 0));
+					break;
+				case 's':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "receive size", 0));
+					size = (value >= 0) ? (size_t) value : 0;
+					break;
+				case 't':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 0, echo_parse_socket_type));
+					type = (sock_type_t) value;
+					break;
+				case 'v':
+					verbose = 1;
+					break;
+				case '-':
+					if(str_lcmp(argv[index] + 2, "backlog=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &backlog, "accepted sockets queue size", 8));
+					}else if(str_lcmp(argv[index] + 2, "count=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "message count", 8));
+					}else if(str_lcmp(argv[index] + 2, "family=", 7) == 0){
+						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 9, echo_parse_protocol_family));
+					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
+						echo_print_help();
+						return EOK;
+					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 7));
+						port = (uint16_t) value;
+					}else if(str_lcmp(argv[index] + 2, "reply=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_string(argc, argv, &index, &reply, "reply string", 8));
+					}else if(str_lcmp(argv[index] + 2, "size=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "receive size", 7));
+						size = (value >= 0) ? (size_t) value : 0;
+					}else if(str_lcmp(argv[index] + 2, "type=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 7, echo_parse_socket_type));
+						type = (sock_type_t) value;
+					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
+						verbose = 1;
+					}else{
+						print_unrecognized(index, argv[index] + 2);
+						echo_print_help();
+						return EINVAL;
+					}
+					break;
 				default:
-					print_unrecognized( index, argv[ index ] + 1 );
+					print_unrecognized(index, argv[index] + 1);
 					echo_print_help();
 					return EINVAL;
 			}
 		}else{
-			print_unrecognized( index, argv[ index ] );
+			print_unrecognized(index, argv[index]);
 			echo_print_help();
 			return EINVAL;
@@ -229,129 +239,139 @@
 	}
 
-	if( size <= 0 ){
-		fprintf( stderr, "Receive size too small (%d). Using 1024 bytes instead.\n", size );
+	if(size <= 0){
+		fprintf(stderr, "Receive size too small (%d). Using 1024 bytes instead.\n", size);
 		size = 1024;
 	}
 	// size plus terminating null (\0)
-	data = ( char * ) malloc( size + 1 );
-	if( ! data ){
-		fprintf( stderr, "Failed to allocate receive buffer.\n" );
+	data = (char *) malloc(size + 1);
+	if(! data){
+		fprintf(stderr, "Failed to allocate receive buffer.\n");
 		return ENOMEM;
 	}
 
-	reply_length = reply ? str_length( reply ) : 0;
-
-	listening_id = socket( family, type, 0 );
-	if( listening_id < 0 ){
-		socket_print_error( stderr, listening_id, "Socket create: ", "\n" );
+	reply_length = reply ? str_length(reply) : 0;
+
+	listening_id = socket(family, type, 0);
+	if(listening_id < 0){
+		socket_print_error(stderr, listening_id, "Socket create: ", "\n");
 		return listening_id;
 	}
 
-	bzero( address_data, max_length );
-	switch( family ){
+	bzero(address_data, max_length);
+	switch(family){
 		case PF_INET:
 			address_in->sin_family = AF_INET;
-			address_in->sin_port = htons( port );
-			addrlen = sizeof( struct sockaddr_in );
+			address_in->sin_port = htons(port);
+			addrlen = sizeof(struct sockaddr_in);
 			break;
 		case PF_INET6:
 			address_in6->sin6_family = AF_INET6;
-			address_in6->sin6_port = htons( port );
-			addrlen = sizeof( struct sockaddr_in6 );
+			address_in6->sin6_port = htons(port);
+			addrlen = sizeof(struct sockaddr_in6);
 			break;
 		default:
-			fprintf( stderr, "Protocol family is not supported\n" );
+			fprintf(stderr, "Protocol family is not supported\n");
 			return EAFNOSUPPORT;
 	}
 
-	listening_id = socket( family, type, 0 );
-	if( listening_id < 0 ){
-		socket_print_error( stderr, listening_id, "Socket create: ", "\n" );
+	listening_id = socket(family, type, 0);
+	if(listening_id < 0){
+		socket_print_error(stderr, listening_id, "Socket create: ", "\n");
 		return listening_id;
 	}
 
-	if( type == SOCK_STREAM ){
-		if( backlog <= 0 ){
-			fprintf( stderr, "Accepted sockets queue size too small (%d). Using 3 instead.\n", size );
+	if(type == SOCK_STREAM){
+		if(backlog <= 0){
+			fprintf(stderr, "Accepted sockets queue size too small (%d). Using 3 instead.\n", size);
 			backlog = 3;
 		}
-		if( ERROR_OCCURRED( listen( listening_id, backlog ))){
-			socket_print_error( stderr, ERROR_CODE, "Socket listen: ", "\n" );
+		if(ERROR_OCCURRED(listen(listening_id, backlog))){
+			socket_print_error(stderr, ERROR_CODE, "Socket listen: ", "\n");
 			return ERROR_CODE;
 		}
 	}
 
-	if( ERROR_OCCURRED( bind( listening_id, address, addrlen ))){
-		socket_print_error( stderr, ERROR_CODE, "Socket bind: ", "\n" );
+	if(ERROR_OCCURRED(bind(listening_id, address, addrlen))){
+		socket_print_error(stderr, ERROR_CODE, "Socket bind: ", "\n");
 		return ERROR_CODE;
 	}
 
-	if( verbose ) printf( "Socket %d listenning at %d\n", listening_id, port );
+	if(verbose){
+		printf("Socket %d listenning at %d\n", listening_id, port);
+	}
 
 	socket_id = listening_id;
 
-	while( count ){
+	while(count){
 		addrlen = max_length;
-		if( type == SOCK_STREAM ){
-			socket_id = accept( listening_id, address, & addrlen );
-			if( socket_id <= 0 ){
-				socket_print_error( stderr, socket_id, "Socket accept: ", "\n" );
+		if(type == SOCK_STREAM){
+			socket_id = accept(listening_id, address, &addrlen);
+			if(socket_id <= 0){
+				socket_print_error(stderr, socket_id, "Socket accept: ", "\n");
 			}else{
-				if( verbose ) printf( "Socket %d accepted\n", socket_id );
-			}
-		}
-		if( socket_id > 0 ){
-			value = recvfrom( socket_id, data, size, 0, address, & addrlen );
-			if( value < 0 ){
-				socket_print_error( stderr, value, "Socket receive: ", "\n" );
+				if(verbose){
+					printf("Socket %d accepted\n", socket_id);
+				}
+			}
+		}
+		if(socket_id > 0){
+			value = recvfrom(socket_id, data, size, 0, address, &addrlen);
+			if(value < 0){
+				socket_print_error(stderr, value, "Socket receive: ", "\n");
 			}else{
-				length = ( size_t ) value;
-				if( verbose ){
+				length = (size_t) value;
+				if(verbose){
 					address_start = NULL;
-					switch( address->sa_family ){
+					switch(address->sa_family){
 						case AF_INET:
-							port = ntohs( address_in->sin_port );
-							address_start = ( uint8_t * ) & address_in->sin_addr.s_addr;
+							port = ntohs(address_in->sin_port);
+							address_start = (uint8_t *) &address_in->sin_addr.s_addr;
 							break;
 						case AF_INET6:
-							port = ntohs( address_in6->sin6_port );
-							address_start = ( uint8_t * ) & address_in6->sin6_addr.s6_addr;
+							port = ntohs(address_in6->sin6_port);
+							address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
 							break;
 						default:
-							fprintf( stderr, "Address family %d (0x%X) is not supported.\n", address->sa_family );
+							fprintf(stderr, "Address family %d (0x%X) is not supported.\n", address->sa_family);
 					}
-					if( address_start ){
-						if( ERROR_OCCURRED( inet_ntop( address->sa_family, address_start, address_string, sizeof( address_string )))){
-							fprintf( stderr, "Received address error %d\n", ERROR_CODE );
+					if(address_start){
+						if(ERROR_OCCURRED(inet_ntop(address->sa_family, address_start, address_string, sizeof(address_string)))){
+							fprintf(stderr, "Received address error %d\n", ERROR_CODE);
 						}else{
-							data[ length ] = '\0';
-							printf( "Socket %d received %d bytes from %s:%d\n%s\n", socket_id, length, address_string, port, data );
+							data[length] = '\0';
+							printf("Socket %d received %d bytes from %s:%d\n%s\n", socket_id, length, address_string, port, data);
 						}
 					}
 				}
-				if( ERROR_OCCURRED( sendto( socket_id, reply ? reply : data, reply ? reply_length : length, 0, address, addrlen ))){
-					socket_print_error( stderr, ERROR_CODE, "Socket send: ", "\n" );
+				if(ERROR_OCCURRED(sendto(socket_id, reply ? reply : data, reply ? reply_length : length, 0, address, addrlen))){
+					socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
 				}
 			}
-			if( type == SOCK_STREAM ){
-				if( ERROR_OCCURRED( closesocket( socket_id ))){
-					socket_print_error( stderr, ERROR_CODE, "Close socket: ", "\n" );
+			if(type == SOCK_STREAM){
+				if(ERROR_OCCURRED(closesocket(socket_id))){
+					socket_print_error(stderr, ERROR_CODE, "Close socket: ", "\n");
 				}
 			}
 		}
-		if( count > 0 ){
+		if(count > 0){
 			-- count;
-			if( verbose ) printf( "Waiting for next %d packet(s)\n", count );
-		}
-	}
-
-	if( verbose ) printf( "Closing the socket\n" );
-
-	if( ERROR_OCCURRED( closesocket( listening_id ))){
-		socket_print_error( stderr, ERROR_CODE, "Close socket: ", "\n" );
+			if(verbose){
+				printf("Waiting for next %d packet(s)\n", count);
+			}
+		}
+	}
+
+	if(verbose){
+		printf("Closing the socket\n");
+	}
+
+	if(ERROR_OCCURRED(closesocket(listening_id))){
+		socket_print_error(stderr, ERROR_CODE, "Close socket: ", "\n");
 		return ERROR_CODE;
 	}
 
-	if( verbose ) printf( "Exiting\n" );
+	if(verbose){
+		printf("Exiting\n");
+	}
 
 	return EOK;
Index: uspace/srv/net/app/nettest1/nettest1.c
===================================================================
--- uspace/srv/net/app/nettest1/nettest1.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/app/nettest1/nettest1.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -65,9 +65,9 @@
  *  @returns EOK on success.
  */
-int		main( int argc, char * argv[] );
+int main(int argc, char * argv[]);
 
 /** Prints the application help.
  */
-void	print_help( void );
+void print_help(void);
 
 /** Translates the character string to the protocol family number.
@@ -76,5 +76,5 @@
  *  @returns EPFNOSUPPORTED if the protocol family is not supported.
  */
-int		parse_protocol_family( const char * name );
+int parse_protocol_family(const char * name);
 
 /** Translates the character string to the socket type number.
@@ -83,5 +83,5 @@
  *  @returns ESOCKNOSUPPORTED if the socket type is not supported.
  */
-int		parse_socket_type( const char * name );
+int parse_socket_type(const char * name);
 
 /** Refreshes the data.
@@ -90,5 +90,5 @@
  *  @param[in] size The data block size in bytes.
  */
-void	refresh_data( char * data, size_t size );
+void refresh_data(char * data, size_t size);
 
 /** Creates new sockets.
@@ -101,5 +101,5 @@
  *  @returns Other error codes as defined for the socket() function.
  */
-int	sockets_create( int verbose, int * socket_ids, int sockets, int family, sock_type_t type );
+int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type);
 
 /** Closes sockets.
@@ -110,5 +110,5 @@
  *  @returns Other error codes as defined for the closesocket() function.
  */
-int	sockets_close( int verbose, int * socket_ids, int sockets );
+int sockets_close(int verbose, int * socket_ids, int sockets);
 
 /** Connects sockets.
@@ -121,5 +121,5 @@
  *  @returns Other error codes as defined for the connect() function.
  */
-int	sockets_connect( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen );
+int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen);
 
 /** Sends data via sockets.
@@ -135,5 +135,5 @@
  *  @returns Other error codes as defined for the sendto() function.
  */
-int	sockets_sendto( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages );
+int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages);
 
 /** Receives data via sockets.
@@ -149,5 +149,5 @@
  *  @returns Other error codes as defined for the recvfrom() function.
  */
-int	sockets_recvfrom( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages );
+int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
 
 /** Sends and receives data via sockets.
@@ -165,5 +165,5 @@
  *  @returns Other error codes as defined for the recvfrom() function.
  */
-int	sockets_sendto_recvfrom( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages );
+int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
 
 /** Prints a mark.
@@ -171,7 +171,7 @@
  *  @param[in] index The index of the mark to be printed.
  */
-void	print_mark( int index );
-
-void print_help( void ){
+void print_mark(int index);
+
+void print_help(void){
 	printf(
 		"Network Networking test 1 aplication - sockets\n" \
@@ -201,8 +201,8 @@
 }
 
-int parse_protocol_family( const char * name ){
-	if( str_lcmp( name, "PF_INET", 7 ) == 0 ){
+int parse_protocol_family(const char * name){
+	if(str_lcmp(name, "PF_INET", 7) == 0){
 		return PF_INET;
-	}else if( str_lcmp( name, "PF_INET6", 8 ) == 0 ){
+	}else if(str_lcmp(name, "PF_INET6", 8) == 0){
 		return PF_INET6;
 	}
@@ -210,8 +210,8 @@
 }
 
-int parse_socket_type( const char * name ){
-	if( str_lcmp( name, "SOCK_DGRAM", 11 ) == 0 ){
+int parse_socket_type(const char * name){
+	if(str_lcmp(name, "SOCK_DGRAM", 11) == 0){
 		return SOCK_DGRAM;
-	}else if( str_lcmp( name, "SOCK_STREAM", 12 ) == 0 ){
+	}else if(str_lcmp(name, "SOCK_STREAM", 12) == 0){
 		return SOCK_STREAM;
 	}
@@ -219,31 +219,33 @@
 }
 
-void refresh_data( char * data, size_t size ){
-	size_t	length;
+void refresh_data(char * data, size_t size){
+	size_t length;
 
 	// fill the data
 	length = 0;
-	while( size > length + sizeof( NETTEST1_TEXT ) - 1 ){
-		memcpy( data + length, NETTEST1_TEXT, sizeof( NETTEST1_TEXT ) - 1 );
-		length += sizeof( NETTEST1_TEXT ) - 1;
-	}
-	memcpy( data + length, NETTEST1_TEXT, size - length );
-	data[ size ] = '\0';
-}
-
-int sockets_create( int verbose, int * socket_ids, int sockets, int family, sock_type_t type ){
-	int	index;
-
-	if( verbose ) printf( "Create\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		socket_ids[ index ] = socket( family, type, 0 );
-		if( socket_ids[ index ] < 0 ){
-			printf( "Socket %d (%d) error:\n", index, socket_ids[ index ] );
-			socket_print_error( stderr, socket_ids[ index ], "Socket create: ", "\n" );
-			return socket_ids[ index ];
-		}
-		if( verbose ){
-			print_mark( index );
+	while(size > length + sizeof(NETTEST1_TEXT) - 1){
+		memcpy(data + length, NETTEST1_TEXT, sizeof(NETTEST1_TEXT) - 1);
+		length += sizeof(NETTEST1_TEXT) - 1;
+	}
+	memcpy(data + length, NETTEST1_TEXT, size - length);
+	data[size] = '\0';
+}
+
+int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type){
+	int index;
+
+	if(verbose){
+		printf("Create\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		socket_ids[index] = socket(family, type, 0);
+		if(socket_ids[index] < 0){
+			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
+			socket_print_error(stderr, socket_ids[index], "Socket create: ", "\n");
+			return socket_ids[index];
+		}
+		if(verbose){
+			print_mark(index);
 		}
 	}
@@ -251,206 +253,235 @@
 }
 
-int sockets_close( int verbose, int * socket_ids, int sockets ){
+int sockets_close(int verbose, int * socket_ids, int sockets){
 	ERROR_DECLARE;
 
-	int	index;
-
-	if( verbose ) printf( "\tClose\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		if( ERROR_OCCURRED( closesocket( socket_ids[ index ] ))){
-			printf( "Socket %d (%d) error:\n", index, socket_ids[ index ] );
-			socket_print_error( stderr, ERROR_CODE, "Socket close: ", "\n" );
+	int index;
+
+	if(verbose){
+		printf("\tClose\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		if(ERROR_OCCURRED(closesocket(socket_ids[index]))){
+			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
+			socket_print_error(stderr, ERROR_CODE, "Socket close: ", "\n");
 			return ERROR_CODE;
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-int sockets_connect( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen ){
+int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen){
 	ERROR_DECLARE;
 
-	int	index;
-
-	if( verbose ) printf( "\tConnect\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		if( ERROR_OCCURRED( connect( socket_ids[ index ], address, addrlen ))){
-			socket_print_error( stderr, ERROR_CODE, "Socket connect: ", "\n" );
+	int index;
+
+	if(verbose){
+		printf("\tConnect\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		if(ERROR_OCCURRED(connect(socket_ids[index], address, addrlen))){
+			socket_print_error(stderr, ERROR_CODE, "Socket connect: ", "\n");
 			return ERROR_CODE;
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-int sockets_sendto( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages ){
+int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages){
 	ERROR_DECLARE;
 
-	int	index;
-	int	message;
-
-	if( verbose ) printf( "\tSendto\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		for( message = 0; message < messages; ++ message ){
-			if( ERROR_OCCURRED( sendto( socket_ids[ index ], data, size, 0, address, addrlen ))){
-				printf( "Socket %d (%d), message %d error:\n", index, socket_ids[ index ], message );
-				socket_print_error( stderr, ERROR_CODE, "Socket send: ", "\n" );
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tSendto\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, addrlen))){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
 				return ERROR_CODE;
 			}
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-int sockets_recvfrom( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages ){
-	int	value;
-	int	index;
-	int	message;
-
-	if( verbose ) printf( "\tRecvfrom\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		for( message = 0; message < messages; ++ message ){
-			value = recvfrom( socket_ids[ index ], data, size, 0, address, addrlen );
-			if( value < 0 ){
-				printf( "Socket %d (%d), message %d error:\n", index, socket_ids[ index ], message );
-				socket_print_error( stderr, value, "Socket receive: ", "\n" );
+int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
+	int value;
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tRecvfrom\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
+			if(value < 0){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, value, "Socket receive: ", "\n");
 				return value;
 			}
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-int sockets_sendto_recvfrom( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages ){
+int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
 	ERROR_DECLARE;
 
-	int	value;
-	int	index;
-	int	message;
-
-	if( verbose ) printf( "\tSendto and recvfrom\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		for( message = 0; message < messages; ++ message ){
-			if( ERROR_OCCURRED( sendto( socket_ids[ index ], data, size, 0, address, * addrlen ))){
-				printf( "Socket %d (%d), message %d error:\n", index, socket_ids[ index ], message );
-				socket_print_error( stderr, ERROR_CODE, "Socket send: ", "\n" );
+	int value;
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tSendto and recvfrom\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, * addrlen))){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
 				return ERROR_CODE;
 			}
-			value = recvfrom( socket_ids[ index ], data, size, 0, address, addrlen );
-			if( value < 0 ){
-				printf( "Socket %d (%d), message %d error:\n", index, socket_ids[ index ], message );
-				socket_print_error( stderr, value, "Socket receive: ", "\n" );
+			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
+			if(value < 0){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, value, "Socket receive: ", "\n");
 				return value;
 			}
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-void print_mark( int index ){
-	if(( index + 1 ) % 10 ){
-		printf( "*" );
+void print_mark(int index){
+	if((index + 1) % 10){
+		printf("*");
 	}else{
-		printf( "|" );
-	}
-	fflush( stdout );
-}
-
-int main( int argc, char * argv[] ){
+		printf("|");
+	}
+	fflush(stdout);
+}
+
+int main(int argc, char * argv[]){
 	ERROR_DECLARE;
 
-	size_t				size			= 27;
-	int					verbose			= 0;
-	sock_type_t			type			= SOCK_DGRAM;
-	int					sockets			= 10;
-	int					messages		= 10;
-	int					family			= PF_INET;
-	uint16_t			port			= 7;
-
-	socklen_t			max_length		= sizeof( struct sockaddr_in6 );
-	uint8_t				address_data[ max_length ];
-	struct sockaddr *		address		= ( struct sockaddr * ) address_data;
-	struct sockaddr_in *	address_in		= ( struct sockaddr_in * ) address;
-	struct sockaddr_in6 *	address_in6	= ( struct sockaddr_in6 * ) address;
-	socklen_t			addrlen;
-//	char				address_string[ INET6_ADDRSTRLEN ];
-	uint8_t *			address_start;
-
-	int *				socket_ids;
+	size_t size			= 27;
+	int verbose			= 0;
+	sock_type_t type			= SOCK_DGRAM;
+	int sockets			= 10;
+	int messages		= 10;
+	int family			= PF_INET;
+	uint16_t port			= 7;
+
+	socklen_t max_length		= sizeof(struct sockaddr_in6);
+	uint8_t address_data[max_length];
+	struct sockaddr * address		= (struct sockaddr *) address_data;
+	struct sockaddr_in * address_in		= (struct sockaddr_in *) address;
+	struct sockaddr_in6 * address_in6	= (struct sockaddr_in6 *) address;
+	socklen_t addrlen;
+//	char				address_string[INET6_ADDRSTRLEN];
+	uint8_t * address_start;
+
+	int * socket_ids;
 	char * 				data;
-	int					value;
-	int					index;
-	struct timeval		time_before;
-	struct timeval		time_after;
-
-	printf( "Task %d - ", task_get_id());
-	printf( "%s\n", NAME );
-
-	if( argc <= 1 ){
+	int value;
+	int index;
+	struct timeval time_before;
+	struct timeval time_after;
+
+	printf("Task %d - ", task_get_id());
+	printf("%s\n", NAME);
+
+	if(argc <= 1){
 		print_help();
 		return EINVAL;
 	}
 
-	for( index = 1; ( index < argc - 1 ) || (( index == argc ) && ( argv[ index ][ 0 ] == '-' )); ++ index ){
-		if( argv[ index ][ 0 ] == '-' ){
-			switch( argv[ index ][ 1 ] ){
-				case 'f':	ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "protocol family", 0, parse_protocol_family ));
-							break;
-				case 'h':	print_help();
-							return EOK;
-							break;
-				case 'm':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & messages, "message count", 0 ));
-							break;
-				case 'n':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & sockets, "socket count", 0 ));
-							break;
-				case 'p':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "port number", 0 ));
-							port = ( uint16_t ) value;
-							break;
-				case 's':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "packet size", 0 ));
-							size = (value >= 0 ) ? ( size_t ) value : 0;
-							break;
-				case 't':	ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & value, "socket type", 0, parse_socket_type ));
-							type = ( sock_type_t ) value;
-							break;
-				case 'v':	verbose = 1;
-							break;
-				case '-':	if( str_lcmp( argv[ index ] + 2, "family=", 7 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "protocol family", 9, parse_protocol_family ));
-							}else if( str_lcmp( argv[ index ] + 2, "help", 5 ) == 0 ){
-								print_help();
-								return EOK;
-							}else if( str_lcmp( argv[ index ] + 2, "messages=", 6 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & messages, "message count", 8 ));
-							}else if( str_lcmp( argv[ index ] + 2, "sockets=", 6 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & sockets, "socket count", 8 ));
-							}else if( str_lcmp( argv[ index ] + 2, "port=", 5 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "port number", 7 ));
-								port = ( uint16_t ) value;
-							}else if( str_lcmp( argv[ index ] + 2, "type=", 5 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & value, "socket type", 7, parse_socket_type ));
-								type = ( sock_type_t ) value;
-							}else if( str_lcmp( argv[ index ] + 2, "verbose", 8 ) == 0 ){
-								verbose = 1;
-							}else{
-								print_unrecognized( index, argv[ index ] + 2 );
-								print_help();
-								return EINVAL;
-							}
-							break;
+	for(index = 1; (index < argc - 1) || ((index == argc) && (argv[index][0] == '-')); ++ index){
+		if(argv[index][0] == '-'){
+			switch(argv[index][1]){
+				case 'f':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
+					break;
+				case 'h':
+					print_help();
+					return EOK;
+					break;
+				case 'm':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 0));
+					break;
+				case 'n':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 0));
+					break;
+				case 'p':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
+					port = (uint16_t) value;
+					break;
+				case 's':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 0));
+					size = (value >= 0) ? (size_t) value : 0;
+					break;
+				case 't':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
+					type = (sock_type_t) value;
+					break;
+				case 'v':
+					verbose = 1;
+					break;
+				case '-':
+					if(str_lcmp(argv[index] + 2, "family=", 7) == 0){
+						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 9, parse_protocol_family));
+					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
+						print_help();
+						return EOK;
+					}else if(str_lcmp(argv[index] + 2, "messages=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 8));
+					}else if(str_lcmp(argv[index] + 2, "sockets=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 8));
+					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 7));
+						port = (uint16_t) value;
+					}else if(str_lcmp(argv[index] + 2, "type=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 7, parse_socket_type));
+						type = (sock_type_t) value;
+					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
+						verbose = 1;
+					}else{
+						print_unrecognized(index, argv[index] + 2);
+						print_help();
+						return EINVAL;
+					}
+					break;
 				default:
-					print_unrecognized( index, argv[ index ] + 1 );
+					print_unrecognized(index, argv[index] + 1);
 					print_help();
 					return EINVAL;
 			}
 		}else{
-			print_unrecognized( index, argv[ index ] );
+			print_unrecognized(index, argv[index]);
 			print_help();
 			return EINVAL;
@@ -458,152 +489,184 @@
 	}
 
-	bzero( address_data, max_length );
-	switch( family ){
+	bzero(address_data, max_length);
+	switch(family){
 		case PF_INET:
 			address_in->sin_family = AF_INET;
-			address_in->sin_port = htons( port );
-			address_start = ( uint8_t * ) & address_in->sin_addr.s_addr;
-			addrlen = sizeof( struct sockaddr_in );
+			address_in->sin_port = htons(port);
+			address_start = (uint8_t *) &address_in->sin_addr.s_addr;
+			addrlen = sizeof(struct sockaddr_in);
 			break;
 		case PF_INET6:
 			address_in6->sin6_family = AF_INET6;
-			address_in6->sin6_port = htons( port );
-			address_start = ( uint8_t * ) & address_in6->sin6_addr.s6_addr;
-			addrlen = sizeof( struct sockaddr_in6 );
+			address_in6->sin6_port = htons(port);
+			address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
+			addrlen = sizeof(struct sockaddr_in6);
 			break;
 		default:
-			fprintf( stderr, "Address family is not supported\n" );
+			fprintf(stderr, "Address family is not supported\n");
 			return EAFNOSUPPORT;
 	}
 
-	if( ERROR_OCCURRED( inet_pton( family, argv[ argc - 1 ], address_start ))){
-		fprintf( stderr, "Address parse error %d\n", ERROR_CODE );
+	if(ERROR_OCCURRED(inet_pton(family, argv[argc - 1], address_start))){
+		fprintf(stderr, "Address parse error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	if( size <= 0 ){
-		fprintf( stderr, "Data buffer size too small (%d). Using 1024 bytes instead.\n", size );
+	if(size <= 0){
+		fprintf(stderr, "Data buffer size too small (%d). Using 1024 bytes instead.\n", size);
 		size = 1024;
 	}
 	// size plus terminating null (\0)
-	data = ( char * ) malloc( size + 1 );
-	if( ! data ){
-		fprintf( stderr, "Failed to allocate data buffer.\n" );
+	data = (char *) malloc(size + 1);
+	if(! data){
+		fprintf(stderr, "Failed to allocate data buffer.\n");
 		return ENOMEM;
 	}
-	refresh_data( data, size );
-
-	if( sockets <= 0 ){
-		fprintf( stderr, "Socket count too small (%d). Using 2 instead.\n", sockets );
+	refresh_data(data, size);
+
+	if(sockets <= 0){
+		fprintf(stderr, "Socket count too small (%d). Using 2 instead.\n", sockets);
 		sockets = 2;
 	}
 	// count plus terminating null (\0)
-	socket_ids = ( int * ) malloc( sizeof( int ) * ( sockets + 1 ));
-	if( ! socket_ids ){
-		fprintf( stderr, "Failed to allocate receive buffer.\n" );
+	socket_ids = (int *) malloc(sizeof(int) * (sockets + 1));
+	if(! socket_ids){
+		fprintf(stderr, "Failed to allocate receive buffer.\n");
 		return ENOMEM;
 	}
-	socket_ids[ sockets ] = NULL;
-
-	if( verbose ) printf( "Starting tests\n" );
-
-	if( verbose ) printf( "1 socket, 1 message\n" );
-
-	if( ERROR_OCCURRED( gettimeofday( & time_before, NULL ))){
-		fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+	socket_ids[sockets] = NULL;
+
+	if(verbose){
+		printf("Starting tests\n");
+	}
+
+	if(verbose){
+		printf("1 socket, 1 message\n");
+	}
+
+	if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, 1, family, type ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, 1 ));
-	if( verbose ) printf( "\tOK\n" );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, 1, family, type ));
-	if( type == SOCK_STREAM ){
-		ERROR_PROPAGATE( sockets_connect( verbose, socket_ids, 1, address, addrlen ));
-	}
-	ERROR_PROPAGATE( sockets_sendto_recvfrom( verbose, socket_ids, 1, address, & addrlen, data, size, 1 ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, 1 ));
-	if( verbose ) printf( "\tOK\n" );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, 1, family, type ));
-	if( type == SOCK_STREAM ){
-		ERROR_PROPAGATE( sockets_connect( verbose, socket_ids, 1, address, addrlen ));
-	}
-	ERROR_PROPAGATE( sockets_sendto( verbose, socket_ids, 1, address, addrlen, data, size, 1 ));
-	ERROR_PROPAGATE( sockets_recvfrom( verbose, socket_ids, 1, address, & addrlen, data, size, 1 ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, 1 ));
-	if( verbose ) printf( "\tOK\n" );
-
-	if( verbose ) printf( "1 socket, %d messages\n", messages );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, 1, family, type ));
-	if( type == SOCK_STREAM ){
-		ERROR_PROPAGATE( sockets_connect( verbose, socket_ids, 1, address, addrlen ));
-	}
-	ERROR_PROPAGATE( sockets_sendto_recvfrom( verbose, socket_ids, 1, address, & addrlen, data, size, messages ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, 1 ));
-	if( verbose ) printf( "\tOK\n" );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, 1, family, type ));
-	if( type == SOCK_STREAM ){
-		ERROR_PROPAGATE( sockets_connect( verbose, socket_ids, 1, address, addrlen ));
-	}
-	ERROR_PROPAGATE( sockets_sendto( verbose, socket_ids, 1, address, addrlen, data, size, messages ));
-	ERROR_PROPAGATE( sockets_recvfrom( verbose, socket_ids, 1, address, & addrlen, data, size, messages ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, 1 ));
-	if( verbose ) printf( "\tOK\n" );
-
-	if( verbose ) printf( "%d sockets, 1 message\n", sockets );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, sockets, family, type ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, sockets ));
-	if( verbose ) printf( "\tOK\n" );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, sockets, family, type ));
-	if( type == SOCK_STREAM ){
-		ERROR_PROPAGATE( sockets_connect( verbose, socket_ids, sockets, address, addrlen ));
-	}
-	ERROR_PROPAGATE( sockets_sendto_recvfrom( verbose, socket_ids, sockets, address, & addrlen, data, size, 1 ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, sockets ));
-	if( verbose ) printf( "\tOK\n" );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, sockets, family, type ));
-	if( type == SOCK_STREAM ){
-		ERROR_PROPAGATE( sockets_connect( verbose, socket_ids, sockets, address, addrlen ));
-	}
-	ERROR_PROPAGATE( sockets_sendto( verbose, socket_ids, sockets, address, addrlen, data, size, 1 ));
-	ERROR_PROPAGATE( sockets_recvfrom( verbose, socket_ids, sockets, address, & addrlen, data, size, 1 ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, sockets ));
-	if( verbose ) printf( "\tOK\n" );
-
-	if( verbose ) printf( "%d sockets, %d messages\n", sockets, messages );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, sockets, family, type ));
-	if( type == SOCK_STREAM ){
-		ERROR_PROPAGATE( sockets_connect( verbose, socket_ids, sockets, address, addrlen ));
-	}
-	ERROR_PROPAGATE( sockets_sendto_recvfrom( verbose, socket_ids, sockets, address, & addrlen, data, size, messages ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, sockets ));
-	if( verbose ) printf( "\tOK\n" );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, sockets, family, type ));
-	if( type == SOCK_STREAM ){
-		ERROR_PROPAGATE( sockets_connect( verbose, socket_ids, sockets, address, addrlen ));
-	}
-	ERROR_PROPAGATE( sockets_sendto( verbose, socket_ids, sockets, address, addrlen, data, size, messages ));
-	ERROR_PROPAGATE( sockets_recvfrom( verbose, socket_ids, sockets, address, & addrlen, data, size, messages ));
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, sockets ));
-
-	if( ERROR_OCCURRED( gettimeofday( & time_after, NULL ))){
-		fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, 1, address, addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	if(verbose){
+		printf("1 socket, %d messages\n", messages);
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, 1, address, addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	if(verbose){
+		printf("%d sockets, 1 message\n", sockets);
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, sockets, address, addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	if(verbose){
+		printf("%d sockets, %d messages\n", sockets, messages);
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, sockets, address, addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+
+	if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	if( verbose ) printf( "\tOK\n" );
-
-	printf( "Tested in %d microseconds\n", tv_sub( & time_after, & time_before ));
-
-	if( verbose ) printf( "Exiting\n" );
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	printf("Tested in %d microseconds\n", tv_sub(&time_after, &time_before));
+
+	if(verbose){
+		printf("Exiting\n");
+	}
 
 	return EOK;
Index: uspace/srv/net/app/nettest2/nettest2.c
===================================================================
--- uspace/srv/net/app/nettest2/nettest2.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/app/nettest2/nettest2.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -65,9 +65,9 @@
  *  @returns EOK on success.
  */
-int		main( int argc, char * argv[] );
+int main(int argc, char * argv[]);
 
 /** Prints the application help.
  */
-void	print_help( void );
+void print_help(void);
 
 /** Translates the character string to the protocol family number.
@@ -76,5 +76,5 @@
  *  @returns EPFNOSUPPORTED if the protocol family is not supported.
  */
-int		parse_protocol_family( const char * name );
+int parse_protocol_family(const char * name);
 
 /** Translates the character string to the socket type number.
@@ -83,5 +83,5 @@
  *  @returns ESOCKNOSUPPORTED if the socket type is not supported.
  */
-int		parse_socket_type( const char * name );
+int parse_socket_type(const char * name);
 
 /** Refreshes the data.
@@ -90,5 +90,5 @@
  *  @param[in] size The data block size in bytes.
  */
-void	refresh_data( char * data, size_t size );
+void refresh_data(char * data, size_t size);
 
 /** Creates new sockets.
@@ -101,5 +101,5 @@
  *  @returns Other error codes as defined for the socket() function.
  */
-int	sockets_create( int verbose, int * socket_ids, int sockets, int family, sock_type_t type );
+int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type);
 
 /** Closes sockets.
@@ -110,5 +110,5 @@
  *  @returns Other error codes as defined for the closesocket() function.
  */
-int	sockets_close( int verbose, int * socket_ids, int sockets );
+int sockets_close(int verbose, int * socket_ids, int sockets);
 
 /** Connects sockets.
@@ -121,5 +121,5 @@
  *  @returns Other error codes as defined for the connect() function.
  */
-int	sockets_connect( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen );
+int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen);
 
 /** Sends data via sockets.
@@ -135,5 +135,5 @@
  *  @returns Other error codes as defined for the sendto() function.
  */
-int	sockets_sendto( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages );
+int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages);
 
 /** Receives data via sockets.
@@ -149,5 +149,5 @@
  *  @returns Other error codes as defined for the recvfrom() function.
  */
-int	sockets_recvfrom( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages );
+int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
 
 /** Sends and receives data via sockets.
@@ -165,5 +165,5 @@
  *  @returns Other error codes as defined for the recvfrom() function.
  */
-int	sockets_sendto_recvfrom( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages );
+int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
 
 /** Prints a mark.
@@ -171,7 +171,7 @@
  *  @param[in] index The index of the mark to be printed.
  */
-void	print_mark( int index );
-
-void print_help( void ){
+void print_mark(int index);
+
+void print_help(void){
 	printf(
 		"Network Networking test 2 aplication - UDP transfer\n" \
@@ -201,8 +201,8 @@
 }
 
-int parse_protocol_family( const char * name ){
-	if( str_lcmp( name, "PF_INET", 7 ) == 0 ){
+int parse_protocol_family(const char * name){
+	if(str_lcmp(name, "PF_INET", 7) == 0){
 		return PF_INET;
-	}else if( str_lcmp( name, "PF_INET6", 8 ) == 0 ){
+	}else if(str_lcmp(name, "PF_INET6", 8) == 0){
 		return PF_INET6;
 	}
@@ -210,8 +210,8 @@
 }
 
-int parse_socket_type( const char * name ){
-	if( str_lcmp( name, "SOCK_DGRAM", 11 ) == 0 ){
+int parse_socket_type(const char * name){
+	if(str_lcmp(name, "SOCK_DGRAM", 11) == 0){
 		return SOCK_DGRAM;
-	}else if( str_lcmp( name, "SOCK_STREAM", 12 ) == 0 ){
+	}else if(str_lcmp(name, "SOCK_STREAM", 12) == 0){
 		return SOCK_STREAM;
 	}
@@ -219,236 +219,269 @@
 }
 
-void refresh_data( char * data, size_t size ){
-	size_t	length;
+void refresh_data(char * data, size_t size){
+	size_t length;
 
 	// fill the data
 	length = 0;
-	while( size > length + sizeof( NETTEST2_TEXT ) - 1 ){
-		memcpy( data + length, NETTEST2_TEXT, sizeof( NETTEST2_TEXT ) - 1 );
-		length += sizeof( NETTEST2_TEXT ) - 1;
-	}
-	memcpy( data + length, NETTEST2_TEXT, size - length );
-	data[ size ] = '\0';
-}
-
-int sockets_create( int verbose, int * socket_ids, int sockets, int family, sock_type_t type ){
-	int	index;
-
-	if( verbose ) printf( "Create\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		socket_ids[ index ] = socket( family, type, 0 );
-		if( socket_ids[ index ] < 0 ){
-			printf( "Socket %d (%d) error:\n", index, socket_ids[ index ] );
-			socket_print_error( stderr, socket_ids[ index ], "Socket create: ", "\n" );
-			return socket_ids[ index ];
-		}
-		if( verbose ) print_mark( index );
+	while(size > length + sizeof(NETTEST2_TEXT) - 1){
+		memcpy(data + length, NETTEST2_TEXT, sizeof(NETTEST2_TEXT) - 1);
+		length += sizeof(NETTEST2_TEXT) - 1;
+	}
+	memcpy(data + length, NETTEST2_TEXT, size - length);
+	data[size] = '\0';
+}
+
+int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type){
+	int index;
+
+	if(verbose){
+		printf("Create\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		socket_ids[index] = socket(family, type, 0);
+		if(socket_ids[index] < 0){
+			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
+			socket_print_error(stderr, socket_ids[index], "Socket create: ", "\n");
+			return socket_ids[index];
+		}
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-int sockets_close( int verbose, int * socket_ids, int sockets ){
+int sockets_close(int verbose, int * socket_ids, int sockets){
 	ERROR_DECLARE;
 
-	int	index;
-
-	if( verbose ) printf( "\tClose\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		if( ERROR_OCCURRED( closesocket( socket_ids[ index ] ))){
-			printf( "Socket %d (%d) error:\n", index, socket_ids[ index ] );
-			socket_print_error( stderr, ERROR_CODE, "Socket close: ", "\n" );
+	int index;
+
+	if(verbose){
+		printf("\tClose\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		if(ERROR_OCCURRED(closesocket(socket_ids[index]))){
+			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
+			socket_print_error(stderr, ERROR_CODE, "Socket close: ", "\n");
 			return ERROR_CODE;
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-int sockets_connect( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen ){
+int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen){
 	ERROR_DECLARE;
 
-	int	index;
-
-	if( verbose ) printf( "\tConnect\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		if( ERROR_OCCURRED( connect( socket_ids[ index ], address, addrlen ))){
-			socket_print_error( stderr, ERROR_CODE, "Socket connect: ", "\n" );
+	int index;
+
+	if(verbose){
+		printf("\tConnect\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		if(ERROR_OCCURRED(connect(socket_ids[index], address, addrlen))){
+			socket_print_error(stderr, ERROR_CODE, "Socket connect: ", "\n");
 			return ERROR_CODE;
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-int sockets_sendto( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages ){
+int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages){
 	ERROR_DECLARE;
 
-	int	index;
-	int	message;
-
-	if( verbose ) printf( "\tSendto\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		for( message = 0; message < messages; ++ message ){
-			if( ERROR_OCCURRED( sendto( socket_ids[ index ], data, size, 0, address, addrlen ))){
-				printf( "Socket %d (%d), message %d error:\n", index, socket_ids[ index ], message );
-				socket_print_error( stderr, ERROR_CODE, "Socket send: ", "\n" );
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tSendto\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, addrlen))){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
 				return ERROR_CODE;
 			}
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-int sockets_recvfrom( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages ){
-	int	value;
-	int	index;
-	int	message;
-
-	if( verbose ) printf( "\tRecvfrom\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		for( message = 0; message < messages; ++ message ){
-			value = recvfrom( socket_ids[ index ], data, size, 0, address, addrlen );
-			if( value < 0 ){
-				printf( "Socket %d (%d), message %d error:\n", index, socket_ids[ index ], message );
-				socket_print_error( stderr, value, "Socket receive: ", "\n" );
+int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
+	int value;
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tRecvfrom\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
+			if(value < 0){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, value, "Socket receive: ", "\n");
 				return value;
 			}
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-int sockets_sendto_recvfrom( int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages ){
+int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
 	ERROR_DECLARE;
 
-	int	value;
-	int	index;
-	int	message;
-
-	if( verbose ) printf( "\tSendto and recvfrom\t" );
-	fflush( stdout );
-	for( index = 0; index < sockets; ++ index ){
-		for( message = 0; message < messages; ++ message ){
-			if( ERROR_OCCURRED( sendto( socket_ids[ index ], data, size, 0, address, * addrlen ))){
-				printf( "Socket %d (%d), message %d error:\n", index, socket_ids[ index ], message );
-				socket_print_error( stderr, ERROR_CODE, "Socket send: ", "\n" );
+	int value;
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tSendto and recvfrom\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, * addrlen))){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
 				return ERROR_CODE;
 			}
-			value = recvfrom( socket_ids[ index ], data, size, 0, address, addrlen );
-			if( value < 0 ){
-				printf( "Socket %d (%d), message %d error:\n", index, socket_ids[ index ], message );
-				socket_print_error( stderr, value, "Socket receive: ", "\n" );
+			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
+			if(value < 0){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, value, "Socket receive: ", "\n");
 				return value;
 			}
 		}
-		if( verbose ) print_mark( index );
+		if(verbose){
+			print_mark(index);
+		}
 	}
 	return EOK;
 }
 
-void print_mark( int index ){
-	if(( index + 1 ) % 10 ){
-		printf( "*" );
+void print_mark(int index){
+	if((index + 1) % 10){
+		printf("*");
 	}else{
-		printf( "|" );
-	}
-	fflush( stdout );
-}
-
-int main( int argc, char * argv[] ){
+		printf("|");
+	}
+	fflush(stdout);
+}
+
+int main(int argc, char * argv[]){
 	ERROR_DECLARE;
 
-	size_t				size			= 28;
-	int					verbose			= 0;
-	sock_type_t			type			= SOCK_DGRAM;
-	int					sockets			= 10;
-	int					messages		= 10;
-	int					family			= PF_INET;
-	uint16_t			port			= 7;
-
-	socklen_t			max_length		= sizeof( struct sockaddr_in6 );
-	uint8_t				address_data[ max_length ];
-	struct sockaddr *		address		= ( struct sockaddr * ) address_data;
-	struct sockaddr_in *	address_in		= ( struct sockaddr_in * ) address;
-	struct sockaddr_in6 *	address_in6	= ( struct sockaddr_in6 * ) address;
-	socklen_t			addrlen;
-//	char				address_string[ INET6_ADDRSTRLEN ];
-	uint8_t *			address_start;
-
-	int *				socket_ids;
+	size_t size			= 28;
+	int verbose			= 0;
+	sock_type_t type			= SOCK_DGRAM;
+	int sockets			= 10;
+	int messages		= 10;
+	int family			= PF_INET;
+	uint16_t port			= 7;
+
+	socklen_t max_length		= sizeof(struct sockaddr_in6);
+	uint8_t address_data[max_length];
+	struct sockaddr * address		= (struct sockaddr *) address_data;
+	struct sockaddr_in * address_in		= (struct sockaddr_in *) address;
+	struct sockaddr_in6 * address_in6	= (struct sockaddr_in6 *) address;
+	socklen_t addrlen;
+//	char				address_string[INET6_ADDRSTRLEN];
+	uint8_t * address_start;
+
+	int * socket_ids;
 	char * 				data;
-	int					value;
-	int					index;
-	struct timeval		time_before;
-	struct timeval		time_after;
-
-	printf( "Task %d - ", task_get_id());
-	printf( "%s\n", NAME );
-
-	if( argc <= 1 ){
+	int value;
+	int index;
+	struct timeval time_before;
+	struct timeval time_after;
+
+	printf("Task %d - ", task_get_id());
+	printf("%s\n", NAME);
+
+	if(argc <= 1){
 		print_help();
 		return EINVAL;
 	}
 
-	for( index = 1; ( index < argc - 1 ) || (( index == argc ) && ( argv[ index ][ 0 ] == '-' )); ++ index ){
-		if( argv[ index ][ 0 ] == '-' ){
-			switch( argv[ index ][ 1 ] ){
-				case 'f':	ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "protocol family", 0, parse_protocol_family ));
-							break;
-				case 'h':	print_help();
-							return EOK;
-							break;
-				case 'm':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & messages, "message count", 0 ));
-							break;
-				case 'n':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & sockets, "socket count", 0 ));
-							break;
-				case 'p':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "port number", 0 ));
-							port = ( uint16_t ) value;
-							break;
-				case 's':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "packet size", 0 ));
-							size = (value >= 0 ) ? ( size_t ) value : 0;
-							break;
-				case 't':	ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & value, "socket type", 0, parse_socket_type ));
-							type = ( sock_type_t ) value;
-							break;
-				case 'v':	verbose = 1;
-							break;
-				case '-':	if( str_lcmp( argv[ index ] + 2, "family=", 7 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "protocol family", 9, parse_protocol_family ));
-							}else if( str_lcmp( argv[ index ] + 2, "help", 5 ) == 0 ){
-								print_help();
-								return EOK;
-							}else if( str_lcmp( argv[ index ] + 2, "messages=", 6 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & messages, "message count", 8 ));
-							}else if( str_lcmp( argv[ index ] + 2, "sockets=", 6 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & sockets, "socket count", 8 ));
-							}else if( str_lcmp( argv[ index ] + 2, "port=", 5 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "port number", 7 ));
-								port = ( uint16_t ) value;
-							}else if( str_lcmp( argv[ index ] + 2, "type=", 5 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & value, "socket type", 7, parse_socket_type ));
-								type = ( sock_type_t ) value;
-							}else if( str_lcmp( argv[ index ] + 2, "verbose", 8 ) == 0 ){
-								verbose = 1;
-							}else{
-								print_unrecognized( index, argv[ index ] + 2 );
-								print_help();
-								return EINVAL;
-							}
-							break;
+	for(index = 1; (index < argc - 1) || ((index == argc) && (argv[index][0] == '-')); ++ index){
+		if(argv[index][0] == '-'){
+			switch(argv[index][1]){
+				case 'f':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
+					break;
+				case 'h':
+					print_help();
+					return EOK;
+					break;
+				case 'm':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 0));
+					break;
+				case 'n':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 0));
+					break;
+				case 'p':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
+					port = (uint16_t) value;
+					break;
+				case 's':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 0));
+					size = (value >= 0) ? (size_t) value : 0;
+					break;
+				case 't':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
+					type = (sock_type_t) value;
+					break;
+				case 'v':
+					verbose = 1;
+					break;
+				case '-':
+					if(str_lcmp(argv[index] + 2, "family=", 7) == 0){
+						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 9, parse_protocol_family));
+					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
+						print_help();
+						return EOK;
+					}else if(str_lcmp(argv[index] + 2, "messages=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 8));
+					}else if(str_lcmp(argv[index] + 2, "sockets=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 8));
+					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 7));
+						port = (uint16_t) value;
+					}else if(str_lcmp(argv[index] + 2, "type=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 7, parse_socket_type));
+						type = (sock_type_t) value;
+					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
+						verbose = 1;
+					}else{
+						print_unrecognized(index, argv[index] + 2);
+						print_help();
+						return EINVAL;
+					}
+					break;
 				default:
-					print_unrecognized( index, argv[ index ] + 1 );
+					print_unrecognized(index, argv[index] + 1);
 					print_help();
 					return EINVAL;
 			}
 		}else{
-			print_unrecognized( index, argv[ index ] );
+			print_unrecognized(index, argv[index]);
 			print_help();
 			return EINVAL;
@@ -456,98 +489,108 @@
 	}
 
-	bzero( address_data, max_length );
-	switch( family ){
+	bzero(address_data, max_length);
+	switch(family){
 		case PF_INET:
 			address_in->sin_family = AF_INET;
-			address_in->sin_port = htons( port );
-			address_start = ( uint8_t * ) & address_in->sin_addr.s_addr;
-			addrlen = sizeof( struct sockaddr_in );
+			address_in->sin_port = htons(port);
+			address_start = (uint8_t *) &address_in->sin_addr.s_addr;
+			addrlen = sizeof(struct sockaddr_in);
 			break;
 		case PF_INET6:
 			address_in6->sin6_family = AF_INET6;
-			address_in6->sin6_port = htons( port );
-			address_start = ( uint8_t * ) & address_in6->sin6_addr.s6_addr;
-			addrlen = sizeof( struct sockaddr_in6 );
+			address_in6->sin6_port = htons(port);
+			address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
+			addrlen = sizeof(struct sockaddr_in6);
 			break;
 		default:
-			fprintf( stderr, "Address family is not supported\n" );
+			fprintf(stderr, "Address family is not supported\n");
 			return EAFNOSUPPORT;
 	}
 
-	if( ERROR_OCCURRED( inet_pton( family, argv[ argc - 1 ], address_start ))){
-		fprintf( stderr, "Address parse error %d\n", ERROR_CODE );
+	if(ERROR_OCCURRED(inet_pton(family, argv[argc - 1], address_start))){
+		fprintf(stderr, "Address parse error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	if( size <= 0 ){
-		fprintf( stderr, "Data buffer size too small (%d). Using 1024 bytes instead.\n", size );
+	if(size <= 0){
+		fprintf(stderr, "Data buffer size too small (%d). Using 1024 bytes instead.\n", size);
 		size = 1024;
 	}
 	// size plus terminating null (\0)
-	data = ( char * ) malloc( size + 1 );
-	if( ! data ){
-		fprintf( stderr, "Failed to allocate data buffer.\n" );
+	data = (char *) malloc(size + 1);
+	if(! data){
+		fprintf(stderr, "Failed to allocate data buffer.\n");
 		return ENOMEM;
 	}
-	refresh_data( data, size );
-
-	if( sockets <= 0 ){
-		fprintf( stderr, "Socket count too small (%d). Using 2 instead.\n", sockets );
+	refresh_data(data, size);
+
+	if(sockets <= 0){
+		fprintf(stderr, "Socket count too small (%d). Using 2 instead.\n", sockets);
 		sockets = 2;
 	}
 	// count plus terminating null (\0)
-	socket_ids = ( int * ) malloc( sizeof( int ) * ( sockets + 1 ));
-	if( ! socket_ids ){
-		fprintf( stderr, "Failed to allocate receive buffer.\n" );
+	socket_ids = (int *) malloc(sizeof(int) * (sockets + 1));
+	if(! socket_ids){
+		fprintf(stderr, "Failed to allocate receive buffer.\n");
 		return ENOMEM;
 	}
-	socket_ids[ sockets ] = NULL;
-
-	if( verbose ) printf( "Starting tests\n" );
-
-	ERROR_PROPAGATE( sockets_create( verbose, socket_ids, sockets, family, type ));
-
-	if( type == SOCK_STREAM ){
-		ERROR_PROPAGATE( sockets_connect( verbose, socket_ids, sockets, address, addrlen ));
-	}
-
-	if( verbose ) printf( "\n" );
-
-	if( ERROR_OCCURRED( gettimeofday( & time_before, NULL ))){
-		fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+	socket_ids[sockets] = NULL;
+
+	if(verbose){
+		printf("Starting tests\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+
+	if(verbose){
+		printf("\n");
+	}
+
+	if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	ERROR_PROPAGATE( sockets_sendto_recvfrom( verbose, socket_ids, sockets, address, & addrlen, data, size, messages ));
-
-	if( ERROR_OCCURRED( gettimeofday( & time_after, NULL ))){
-		fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
+
+	if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	if( verbose ) printf( "\tOK\n" );
-
-	printf( "sendto + recvfrom tested in %d microseconds\n", tv_sub( & time_after, & time_before ));
-
-	if( ERROR_OCCURRED( gettimeofday( & time_before, NULL ))){
-		fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	printf("sendto + recvfrom tested in %d microseconds\n", tv_sub(&time_after, &time_before));
+
+	if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	ERROR_PROPAGATE( sockets_sendto( verbose, socket_ids, sockets, address, addrlen, data, size, messages ));
-	ERROR_PROPAGATE( sockets_recvfrom( verbose, socket_ids, sockets, address, & addrlen, data, size, messages ));
-
-	if( ERROR_OCCURRED( gettimeofday( & time_after, NULL ))){
-		fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, sockets, address, addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
+
+	if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	if( verbose ) printf( "\tOK\n" );
-
-	printf( "sendto, recvfrom tested in %d microseconds\n", tv_sub( & time_after, & time_before ));
-
-	ERROR_PROPAGATE( sockets_close( verbose, socket_ids, sockets ));
-
-	if( verbose ) printf( "\nExiting\n" );
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	printf("sendto, recvfrom tested in %d microseconds\n", tv_sub(&time_after, &time_before));
+
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+
+	if(verbose){
+		printf("\nExiting\n");
+	}
 
 	return EOK;
Index: uspace/srv/net/app/parse.c
===================================================================
--- uspace/srv/net/app/parse.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/app/parse.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -42,18 +42,18 @@
 #include "parse.h"
 
-int parse_parameter_int( int argc, char ** argv, int * index, int * value, const char * name, int offset ){
-	char *	rest;
+int parse_parameter_int(int argc, char ** argv, int * index, int * value, const char * name, int offset){
+	char * rest;
 
-	if( offset ){
-		* value = strtol( argv[ * index ] + offset, & rest, 10 );
-	}else if(( * index ) + 1 < argc ){
-		++ ( * index );
-		* value = strtol( argv[ * index ], & rest, 10 );
+	if(offset){
+		*value = strtol(argv[*index] + offset, &rest, 10);
+	}else if((*index) + 1 < argc){
+		++ (*index);
+		*value = strtol(argv[*index], &rest, 10);
 	}else{
-		fprintf( stderr, "Command line error: missing %s\n", name );
+		fprintf(stderr, "Command line error: missing %s\n", name);
 		return EINVAL;
 	}
-	if( rest && ( * rest )){
-		fprintf( stderr, "Command line error: %s unrecognized (%d: %s)\n", name, * index, argv[ * index ] );
+	if(rest && (*rest)){
+		fprintf(stderr, "Command line error: %s unrecognized (%d: %s)\n", name, * index, argv[*index]);
 		return EINVAL;
 	}
@@ -61,12 +61,12 @@
 }
 
-int parse_parameter_string( int argc, char ** argv, int * index, char ** value, const char * name, int offset ){
-	if( offset ){
-		* value = argv[ * index ] + offset;
-	}else if(( * index ) + 1 < argc ){
-		++ ( * index );
-		* value = argv[ * index ];
+int parse_parameter_string(int argc, char ** argv, int * index, char ** value, const char * name, int offset){
+	if(offset){
+		*value = argv[*index] + offset;
+	}else if((*index) + 1 < argc){
+		++ (*index);
+		*value = argv[*index];
 	}else{
-		fprintf( stderr, "Command line error: missing %s\n", name );
+		fprintf(stderr, "Command line error: missing %s\n", name);
 		return EINVAL;
 	}
@@ -74,13 +74,13 @@
 }
 
-int parse_parameter_name_int( int argc, char ** argv, int * index, int * value, const char * name, int offset, int ( * parse_value )( const char * value )){
+int parse_parameter_name_int(int argc, char ** argv, int * index, int * value, const char * name, int offset, int (*parse_value)(const char * value)){
 	ERROR_DECLARE;
 
-	char *	parameter;
+	char * parameter;
 
-	ERROR_PROPAGATE( parse_parameter_string( argc, argv, index, & parameter, name, offset ));
-	* value = ( * parse_value )( parameter );
-	if(( * value ) == ENOENT ){
-		fprintf( stderr, "Command line error: unrecognized %s value (%d: %s)\n", name, * index, parameter );
+	ERROR_PROPAGATE(parse_parameter_string(argc, argv, index, &parameter, name, offset));
+	*value = (*parse_value)(parameter);
+	if((*value) == ENOENT){
+		fprintf(stderr, "Command line error: unrecognized %s value (%d: %s)\n", name, * index, parameter);
 		return ENOENT;
 	}
@@ -88,6 +88,6 @@
 }
 
-void print_unrecognized( int index, const char * parameter ){
-	fprintf( stderr, "Command line error - unrecognized parameter (%d: %s)\n", index, parameter );
+void print_unrecognized(int index, const char * parameter){
+	fprintf(stderr, "Command line error - unrecognized parameter (%d: %s)\n", index, parameter);
 }
 
Index: uspace/srv/net/app/parse.h
===================================================================
--- uspace/srv/net/app/parse.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/app/parse.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -42,5 +42,5 @@
  *  @param[in] parameter The parameter name.
  */
-void	print_unrecognized( int index, const char * parameter );
+void print_unrecognized(int index, const char * parameter);
 
 /** Parses the next parameter as an integral number.
@@ -57,5 +57,5 @@
  *  @returns EINVAL if the parameter is in wrong format.
  */
-int	parse_parameter_int( int argc, char ** argv, int * index, int * value, const char * name, int offset );
+int parse_parameter_int(int argc, char ** argv, int * index, int * value, const char * name, int offset);
 
 /** Parses the next parameter as a character string.
@@ -72,5 +72,5 @@
  *  @returns EINVAL if the parameter is missing.
  */
-int	parse_parameter_string( int argc, char ** argv, int * index, char ** value, const char * name, int offset );
+int parse_parameter_string(int argc, char ** argv, int * index, char ** value, const char * name, int offset);
 
 /** Parses the next named parameter as an integral number.
@@ -90,5 +90,5 @@
  *  @returns ENOENT if the parameter name has not been found.
  */
-int	parse_parameter_name_int( int argc, char ** argv, int * index, int * value, const char * name, int offset, int ( * parse_value )( const char * value ));
+int parse_parameter_name_int(int argc, char ** argv, int * index, int * value, const char * name, int offset, int (*parse_value)(const char * value));
 
 #endif
Index: uspace/srv/net/app/ping/ping.c
===================================================================
--- uspace/srv/net/app/ping/ping.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/app/ping/ping.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -63,9 +63,9 @@
  *  @returns EOK on success.
  */
-int		main( int argc, char * argv[] );
+int main(int argc, char * argv[]);
 
 /** Prints the application help.
  */
-void	print_help( void );
+void print_help(void);
 
 /** Translates the character string to the address family number.
@@ -74,7 +74,7 @@
  *  @returns EAFNOSUPPORTED if the address family is not supported.
  */
-int		parse_address_family( const char * name );
-
-void print_help( void ){
+int parse_address_family(const char * name);
+
+void print_help(void){
 	printf(
 		"Network Ping aplication\n" \
@@ -111,8 +111,8 @@
 }
 
-int parse_address_family( const char * name ){
-	if( str_lcmp( name, "AF_INET", 7 ) == 0 ){
+int parse_address_family(const char * name){
+	if(str_lcmp(name, "AF_INET", 7) == 0){
 		return AF_INET;
-	}else if( str_lcmp( name, "AF_INET6", 8 ) == 0 ){
+	}else if(str_lcmp(name, "AF_INET6", 8) == 0){
 		return AF_INET6;
 	}
@@ -120,93 +120,100 @@
 }
 
-int main( int argc, char * argv[] ){
+int main(int argc, char * argv[]){
 	ERROR_DECLARE;
 
-	size_t				size			= 38;
-	int					verbose			= 0;
-	int					dont_fragment	= 0;
-	ip_ttl_t			ttl				= 0;
-	ip_tos_t			tos				= 0;
-	int					count			= 3;
-	suseconds_t			timeout			= 3000;
-	int					family			= AF_INET;
-
-	socklen_t			max_length		= sizeof( struct sockaddr_in6 );
-	uint8_t				address_data[ max_length ];
-	struct sockaddr *		address		= ( struct sockaddr * ) address_data;
-	struct sockaddr_in *	address_in		= ( struct sockaddr_in * ) address;
-	struct sockaddr_in6 *	address_in6	= ( struct sockaddr_in6 * ) address;
-	socklen_t			addrlen;
-	char				address_string[ INET6_ADDRSTRLEN ];
-	uint8_t *			address_start;
-	int					icmp_phone;
-	struct timeval		time_before;
-	struct timeval		time_after;
-	int					result;
-	int					value;
-	int					index;
-
-	printf( "Task %d - ", task_get_id());
-	printf( "%s\n", NAME );
-
-	if( argc <= 1 ){
+	size_t size			= 38;
+	int verbose			= 0;
+	int dont_fragment	= 0;
+	ip_ttl_t ttl				= 0;
+	ip_tos_t tos				= 0;
+	int count			= 3;
+	suseconds_t timeout			= 3000;
+	int family			= AF_INET;
+
+	socklen_t max_length		= sizeof(struct sockaddr_in6);
+	uint8_t address_data[max_length];
+	struct sockaddr * address		= (struct sockaddr *) address_data;
+	struct sockaddr_in * address_in		= (struct sockaddr_in *) address;
+	struct sockaddr_in6 * address_in6	= (struct sockaddr_in6 *) address;
+	socklen_t addrlen;
+	char address_string[INET6_ADDRSTRLEN];
+	uint8_t * address_start;
+	int icmp_phone;
+	struct timeval time_before;
+	struct timeval time_after;
+	int result;
+	int value;
+	int index;
+
+	printf("Task %d - ", task_get_id());
+	printf("%s\n", NAME);
+
+	if(argc <= 1){
 		print_help();
 		return EINVAL;
 	}
 
-	for( index = 1; ( index < argc - 1 ) || (( index == argc ) && ( argv[ index ][ 0 ] == '-' )); ++ index ){
-		if( argv[ index ][ 0 ] == '-' ){
-			switch( argv[ index ][ 1 ] ){
-				case 'c':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & count, "count", 0 ));
-							break;
-				case 'f':	ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "address family", 0, parse_address_family ));
-							break;
-				case 'h':	print_help();
-							return EOK;
-							break;
-				case 's':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "packet size", 0 ));
-							size = (value >= 0 ) ? ( size_t ) value : 0;
-							break;
-				case 't':	ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "timeout", 0 ));
-							timeout = (value >= 0 ) ? ( suseconds_t ) value : 0;
-							break;
-				case 'v':	verbose = 1;
-							break;
-				case '-':	if( str_lcmp( argv[ index ] + 2, "count=", 6 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & count, "received count", 8 ));
-							}else if( str_lcmp( argv[ index ] + 2, "dont_fragment", 13 ) == 0 ){
-								dont_fragment = 1;
-							}else if( str_lcmp( argv[ index ] + 2, "family=", 7 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_name_int( argc, argv, & index, & family, "address family", 9, parse_address_family ));
-							}else if( str_lcmp( argv[ index ] + 2, "help", 5 ) == 0 ){
-								print_help();
-								return EOK;
-							}else if( str_lcmp( argv[ index ] + 2, "size=", 5 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "packet size", 7 ));
-								size = (value >= 0 ) ? ( size_t ) value : 0;
-							}else if( str_lcmp( argv[ index ] + 2, "timeout=", 8 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "timeout", 7 ));
-								timeout = (value >= 0 ) ? ( suseconds_t ) value : 0;
-							}else if( str_lcmp( argv[ index ] + 2, "tos=", 4 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "type of service", 7 ));
-								tos = (value >= 0 ) ? ( ip_tos_t ) value : 0;
-							}else if( str_lcmp( argv[ index ] + 2, "ttl=", 4 ) == 0 ){
-								ERROR_PROPAGATE( parse_parameter_int( argc, argv, & index, & value, "time to live", 7 ));
-								ttl = (value >= 0 ) ? ( ip_ttl_t ) value : 0;
-							}else if( str_lcmp( argv[ index ] + 2, "verbose", 8 ) == 0 ){
-								verbose = 1;
-							}else{
-								print_unrecognized( index, argv[ index ] + 2 );
-								print_help();
-								return EINVAL;
-							}
-							break;
+	for(index = 1; (index < argc - 1) || ((index == argc) && (argv[index][0] == '-')); ++ index){
+		if(argv[index][0] == '-'){
+			switch(argv[index][1]){
+				case 'c':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "count", 0));
+					break;
+				case 'f':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "address family", 0, parse_address_family));
+					break;
+				case 'h':
+					print_help();
+					return EOK;
+					break;
+				case 's':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 0));
+					size = (value >= 0) ? (size_t) value : 0;
+					break;
+				case 't':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "timeout", 0));
+					timeout = (value >= 0) ? (suseconds_t) value : 0;
+					break;
+				case 'v':
+					verbose = 1;
+					break;
+				case '-':
+					if(str_lcmp(argv[index] + 2, "count=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "received count", 8));
+					}else if(str_lcmp(argv[index] + 2, "dont_fragment", 13) == 0){
+						dont_fragment = 1;
+					}else if(str_lcmp(argv[index] + 2, "family=", 7) == 0){
+						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "address family", 9, parse_address_family));
+					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
+						print_help();
+						return EOK;
+					}else if(str_lcmp(argv[index] + 2, "size=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 7));
+						size = (value >= 0) ? (size_t) value : 0;
+					}else if(str_lcmp(argv[index] + 2, "timeout=", 8) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "timeout", 7));
+						timeout = (value >= 0) ? (suseconds_t) value : 0;
+					}else if(str_lcmp(argv[index] + 2, "tos=", 4) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "type of service", 7));
+						tos = (value >= 0) ? (ip_tos_t) value : 0;
+					}else if(str_lcmp(argv[index] + 2, "ttl=", 4) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "time to live", 7));
+						ttl = (value >= 0) ? (ip_ttl_t) value : 0;
+					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
+						verbose = 1;
+					}else{
+						print_unrecognized(index, argv[index] + 2);
+						print_help();
+						return EINVAL;
+					}
+					break;
 				default:
-					print_unrecognized( index, argv[ index ] + 1 );
+					print_unrecognized(index, argv[index] + 1);
 					print_help();
 					return EINVAL;
 			}
 		}else{
-			print_unrecognized( index, argv[ index ] );
+			print_unrecognized(index, argv[index]);
 			print_help();
 			return EINVAL;
@@ -214,63 +221,65 @@
 	}
 
-	bzero( address_data, max_length );
-	switch( family ){
+	bzero(address_data, max_length);
+	switch(family){
 		case AF_INET:
 			address_in->sin_family = AF_INET;
-			address_start = ( uint8_t * ) & address_in->sin_addr.s_addr;
-			addrlen = sizeof( struct sockaddr_in );
+			address_start = (uint8_t *) &address_in->sin_addr.s_addr;
+			addrlen = sizeof(struct sockaddr_in);
 			break;
 		case AF_INET6:
 			address_in6->sin6_family = AF_INET6;
-			address_start = ( uint8_t * ) & address_in6->sin6_addr.s6_addr;
-			addrlen = sizeof( struct sockaddr_in6 );
+			address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
+			addrlen = sizeof(struct sockaddr_in6);
 			break;
 		default:
-			fprintf( stderr, "Address family is not supported\n" );
+			fprintf(stderr, "Address family is not supported\n");
 			return EAFNOSUPPORT;
 	}
 
-	if( ERROR_OCCURRED( inet_pton( family, argv[ argc - 1 ], address_start ))){
-		fprintf( stderr, "Address parse error %d\n", ERROR_CODE );
+	if(ERROR_OCCURRED(inet_pton(family, argv[argc - 1], address_start))){
+		fprintf(stderr, "Address parse error %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
 
-	icmp_phone = icmp_connect_module( SERVICE_ICMP, ICMP_CONNECT_TIMEOUT );
-	if( icmp_phone < 0 ){
-		fprintf( stderr, "ICMP connect error %d\n", icmp_phone );
+	icmp_phone = icmp_connect_module(SERVICE_ICMP, ICMP_CONNECT_TIMEOUT);
+	if(icmp_phone < 0){
+		fprintf(stderr, "ICMP connect error %d\n", icmp_phone);
 		return icmp_phone;
 	}
 
-	printf( "PING %d bytes of data\n", size );
-	if( ERROR_OCCURRED( inet_ntop( address->sa_family, address_start, address_string, sizeof( address_string )))){
-		fprintf( stderr, "Address error %d\n", ERROR_CODE );
+	printf("PING %d bytes of data\n", size);
+	if(ERROR_OCCURRED(inet_ntop(address->sa_family, address_start, address_string, sizeof(address_string)))){
+		fprintf(stderr, "Address error %d\n", ERROR_CODE);
 	}else{
-		printf( "Address %s:\n", address_string );
-	}
-
-	while( count > 0 ){
-		if( ERROR_OCCURRED( gettimeofday( & time_before, NULL ))){
-			fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+		printf("Address %s:\n", address_string);
+	}
+
+	while(count > 0){
+		if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
+			fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 			return ERROR_CODE;
 		}
-		result = icmp_echo_msg( icmp_phone, size, timeout, ttl, tos, dont_fragment, address, addrlen );
-		if( ERROR_OCCURRED( gettimeofday( & time_after, NULL ))){
-			fprintf( stderr, "Get time of day error %d\n", ERROR_CODE );
+		result = icmp_echo_msg(icmp_phone, size, timeout, ttl, tos, dont_fragment, address, addrlen);
+		if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
+			fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
 			return ERROR_CODE;
 		}
-		switch( result ){
+		switch(result){
 			case ICMP_ECHO:
-				printf( "Ping round trip time %d miliseconds\n", tv_sub( & time_after, & time_before ) / 1000 );
+				printf("Ping round trip time %d miliseconds\n", tv_sub(&time_after, &time_before) / 1000);
 				break;
 			case ETIMEOUT:
-				printf( "Timed out.\n" );
+				printf("Timed out.\n");
 				break;
 			default:
-				print_error( stdout, result, NULL, "\n" );
+				print_error(stdout, result, NULL, "\n");
 		}
 		-- count;
 	}
 
-	if( verbose ) printf( "Exiting\n" );
+	if(verbose){
+		printf("Exiting\n");
+	}
 
 	return EOK;
Index: uspace/srv/net/app/print_error.c
===================================================================
--- uspace/srv/net/app/print_error.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/app/print_error.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -42,105 +42,105 @@
 #include "print_error.h"
 
-void print_error( FILE * output, int error_code, const char * prefix, const char * suffix ){
-	if( IS_ICMP_ERROR( error_code )){
-		icmp_print_error( output, error_code, prefix, suffix );
-	}else if( IS_SOCKET_ERROR( error_code )){
-		socket_print_error( output, error_code, prefix, suffix );
+void print_error(FILE * output, int error_code, const char * prefix, const char * suffix){
+	if(IS_ICMP_ERROR(error_code)){
+		icmp_print_error(output, error_code, prefix, suffix);
+	}else if(IS_SOCKET_ERROR(error_code)){
+		socket_print_error(output, error_code, prefix, suffix);
 	}
 }
 
-void icmp_print_error( FILE * output, int error_code, const char * prefix, const char * suffix ){
-	if( output ){
-		if( prefix ){
-			fprintf( output, "%s", prefix );
+void icmp_print_error(FILE * output, int error_code, const char * prefix, const char * suffix){
+	if(output){
+		if(prefix){
+			fprintf(output, "%s", prefix);
 		}
-		switch( error_code ){
+		switch(error_code){
 			case ICMP_DEST_UNREACH:
-				fprintf( output, "ICMP Destination Unreachable (%d) error", error_code );
+				fprintf(output, "ICMP Destination Unreachable (%d) error", error_code);
 				break;
 			case ICMP_SOURCE_QUENCH:
-				fprintf( output, "ICMP Source Quench (%d) error", error_code );
+				fprintf(output, "ICMP Source Quench (%d) error", error_code);
 				break;
 			case ICMP_REDIRECT:
-				fprintf( output, "ICMP Redirect (%d) error", error_code );
+				fprintf(output, "ICMP Redirect (%d) error", error_code);
 				break;
 			case ICMP_ALTERNATE_ADDR:
-				fprintf( output, "ICMP Alternate Host Address (%d) error", error_code );
+				fprintf(output, "ICMP Alternate Host Address (%d) error", error_code);
 				break;
 			case ICMP_ROUTER_ADV:
-				fprintf( output, "ICMP Router Advertisement (%d) error", error_code );
+				fprintf(output, "ICMP Router Advertisement (%d) error", error_code);
 				break;
 			case ICMP_ROUTER_SOL:
-				fprintf( output, "ICMP Router Solicitation (%d) error", error_code );
+				fprintf(output, "ICMP Router Solicitation (%d) error", error_code);
 				break;
 			case ICMP_TIME_EXCEEDED:
-				fprintf( output, "ICMP Time Exceeded (%d) error", error_code );
+				fprintf(output, "ICMP Time Exceeded (%d) error", error_code);
 				break;
 			case ICMP_PARAMETERPROB:
-				fprintf( output, "ICMP Paramenter Problem (%d) error", error_code );
+				fprintf(output, "ICMP Paramenter Problem (%d) error", error_code);
 				break;
 			case ICMP_CONVERSION_ERROR:
-				fprintf( output, "ICMP Datagram Conversion Error (%d) error", error_code );
+				fprintf(output, "ICMP Datagram Conversion Error (%d) error", error_code);
 				break;
 			case ICMP_REDIRECT_MOBILE:
-				fprintf( output, "ICMP Mobile Host Redirect (%d) error", error_code );
+				fprintf(output, "ICMP Mobile Host Redirect (%d) error", error_code);
 				break;
 			case ICMP_SKIP:
-				fprintf( output, "ICMP SKIP (%d) error", error_code );
+				fprintf(output, "ICMP SKIP (%d) error", error_code);
 				break;
 			case ICMP_PHOTURIS:
-				fprintf( output, "ICMP Photuris (%d) error", error_code );
+				fprintf(output, "ICMP Photuris (%d) error", error_code);
 				break;
 			default:
-				fprintf( output, "Other (%d) error", error_code );
+				fprintf(output, "Other (%d) error", error_code);
 		}
-		if( suffix ){
-			fprintf( output, "%s", suffix );
+		if(suffix){
+			fprintf(output, "%s", suffix);
 		}
 	}
 }
 
-void socket_print_error( FILE * output, int error_code, const char * prefix, const char * suffix ){
-	if( output ){
-		if( prefix ){
-			fprintf( output, "%s", prefix );
+void socket_print_error(FILE * output, int error_code, const char * prefix, const char * suffix){
+	if(output){
+		if(prefix){
+			fprintf(output, "%s", prefix);
 		}
-		switch( error_code ){
+		switch(error_code){
 			case ENOTSOCK:
-				fprintf( output, "Not a socket (%d) error", error_code );
+				fprintf(output, "Not a socket (%d) error", error_code);
 				break;
 			case EPROTONOSUPPORT:
-				fprintf( output, "Protocol not supported (%d) error", error_code );
+				fprintf(output, "Protocol not supported (%d) error", error_code);
 				break;
 			case ESOCKTNOSUPPORT:
-				fprintf( output, "Socket type not supported (%d) error", error_code );
+				fprintf(output, "Socket type not supported (%d) error", error_code);
 				break;
 			case EPFNOSUPPORT:
-				fprintf( output, "Protocol family not supported (%d) error", error_code );
+				fprintf(output, "Protocol family not supported (%d) error", error_code);
 				break;
 			case EAFNOSUPPORT:
-				fprintf( output, "Address family not supported (%d) error", error_code );
+				fprintf(output, "Address family not supported (%d) error", error_code);
 				break;
 			case EADDRINUSE:
-				fprintf( output, "Address already in use (%d) error", error_code );
+				fprintf(output, "Address already in use (%d) error", error_code);
 				break;
 			case ENOTCONN:
-				fprintf( output, "Socket not connected (%d) error", error_code );
+				fprintf(output, "Socket not connected (%d) error", error_code);
 				break;
 			case NO_DATA:
-				fprintf( output, "No data (%d) error", error_code );
+				fprintf(output, "No data (%d) error", error_code);
 				break;
 			case EINPROGRESS:
-				fprintf( output, "Another operation in progress (%d) error", error_code );
+				fprintf(output, "Another operation in progress (%d) error", error_code);
 				break;
 			case EDESTADDRREQ:
-				fprintf( output, "Destination address required (%d) error", error_code );
+				fprintf(output, "Destination address required (%d) error", error_code);
 			case TRY_AGAIN:
-				fprintf( output, "Try again (%d) error", error_code );
+				fprintf(output, "Try again (%d) error", error_code);
 			default:
-				fprintf( output, "Other (%d) error", error_code );
+				fprintf(output, "Other (%d) error", error_code);
 		}
-		if( suffix ){
-			fprintf( output, "%s", suffix );
+		if(suffix){
+			fprintf(output, "%s", suffix);
 		}
 	}
Index: uspace/srv/net/app/print_error.h
===================================================================
--- uspace/srv/net/app/print_error.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/app/print_error.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -42,5 +42,5 @@
  *  @returns A value indicating whether the error code may be an ICMP error code.
  */
-#define IS_ICMP_ERROR( error_code )		(( error_code ) > 0 )
+#define IS_ICMP_ERROR(error_code)		((error_code) > 0)
 
 /** Returns whether the error code may be socket error code.
@@ -48,5 +48,5 @@
  *  @returns A value indicating whether the error code may be a socket error code.
  */
-#define IS_SOCKET_ERROR( error_code )	(( error_code ) < 0 )
+#define IS_SOCKET_ERROR(error_code)	((error_code) < 0)
 
 /** Prints the error description.
@@ -57,5 +57,5 @@
  *  @param[in] suffix The error description suffix. May be NULL.
  */
-void print_error( FILE * output, int error_code, const char * prefix, const char * suffix );
+void print_error(FILE * output, int error_code, const char * prefix, const char * suffix);
 
 /** Prints the specific ICMP error description.
@@ -65,5 +65,5 @@
  *  @param[in] suffix The error description suffix. May be NULL.
  */
-void icmp_print_error( FILE * output, int error_code, const char * prefix, const char * suffix );
+void icmp_print_error(FILE * output, int error_code, const char * prefix, const char * suffix);
 
 /** Prints the specific socket error description.
@@ -73,5 +73,5 @@
  *  @param[in] suffix The error description suffix. May be NULL.
  */
-void socket_print_error( FILE * output, int error_code, const char * prefix, const char * suffix );
+void socket_print_error(FILE * output, int error_code, const char * prefix, const char * suffix);
 
 #endif
Index: uspace/srv/net/checksum.c
===================================================================
--- uspace/srv/net/checksum.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/checksum.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -47,12 +47,12 @@
 #define CRC_DIVIDER_LE	0xEDB88320
 
-uint32_t compute_crc32_le( uint32_t seed, uint8_t * data, size_t length ){
-	size_t	index;
+uint32_t compute_crc32_le(uint32_t seed, uint8_t * data, size_t length){
+	size_t index;
 
-	while( length >= 8 ){
-		seed ^= ( * data );
-		for( index = 0; index < 8; ++ index ){
-			if( seed & 1 ){
-				seed = ( seed >> 1 ) ^ (( uint32_t ) CRC_DIVIDER_LE );
+	while(length >= 8){
+		seed ^= (*data);
+		for(index = 0; index < 8; ++ index){
+			if(seed &1){
+				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
 			}else{
 				seed >>= 1;
@@ -62,9 +62,9 @@
 		length -= 8;
 	}
-	if( length > 0 ){
-		seed ^= ( * data ) >> ( 8 - length );
-		for( index = 0; index < length; ++ index ){
-			if( seed & 1 ){
-				seed = ( seed >> 1 ) ^ (( uint32_t ) CRC_DIVIDER_LE );
+	if(length > 0){
+		seed ^= (*data) >> (8 - length);
+		for(index = 0; index < length; ++ index){
+			if(seed &1){
+				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
 			}else{
 				seed >>= 1;
@@ -76,12 +76,12 @@
 }
 
-uint32_t compute_crc32_be( uint32_t seed, uint8_t * data, size_t length ){
-	size_t	index;
+uint32_t compute_crc32_be(uint32_t seed, uint8_t * data, size_t length){
+	size_t index;
 
-	while( length >= 8 ){
-		seed ^= ( * data ) << 24;
-		for( index = 0; index < 8; ++ index ){
-			if( seed & 0x80000000 ){
-				seed = ( seed << 1 ) ^ (( uint32_t ) CRC_DIVIDER_BE );
+	while(length >= 8){
+		seed ^= (*data) << 24;
+		for(index = 0; index < 8; ++ index){
+			if(seed &0x80000000){
+				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
 			}else{
 				seed <<= 1;
@@ -91,9 +91,9 @@
 		length -= 8;
 	}
-	if( length > 0 ){
-		seed ^= (( * data ) & ( 0xFF << ( 8 - length ))) << 24;
-		for( index = 0; index < length; ++ index ){
-			if( seed & 0x80000000 ){
-				seed = ( seed << 1 ) ^ (( uint32_t ) CRC_DIVIDER_BE );
+	if(length > 0){
+		seed ^= ((*data) &(0xFF << (8 - length))) << 24;
+		for(index = 0; index < length; ++ index){
+			if(seed &0x80000000){
+				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
 			}else{
 				seed <<= 1;
@@ -105,15 +105,15 @@
 }
 
-uint32_t compute_checksum( uint32_t seed, uint8_t * data, size_t length ){
-	size_t	index;
+uint32_t compute_checksum(uint32_t seed, uint8_t * data, size_t length){
+	size_t index;
 
 	// sum all the 16 bit fields
-	for( index = 0; index + 1 < length; index += 2 ){
-		seed += ( data[ index ] << 8 ) + data[ index + 1 ];
+	for(index = 0; index + 1 < length; index += 2){
+		seed += (data[index] << 8) + data[index + 1];
 	}
 
 	// last odd byte with zero padding
-	if( index + 1 == length ){
-		seed += data[ index ] << 8;
+	if(index + 1 == length){
+		seed += data[index] << 8;
 	}
 
@@ -121,12 +121,14 @@
 }
 
-uint16_t compact_checksum( uint32_t sum ){
+uint16_t compact_checksum(uint32_t sum){
 	// shorten to the 16 bits
-	while( sum >> 16 ) sum = ( sum & 0xFFFF ) + ( sum >> 16 );
+	while(sum >> 16){
+		sum = (sum &0xFFFF) + (sum >> 16);
+	}
 
-	return ( uint16_t ) sum;
+	return (uint16_t) sum;
 }
 
-uint16_t flip_checksum( uint16_t checksum ){
+uint16_t flip_checksum(uint16_t checksum){
 	// flip, zero is returned as 0xFFFF (not flipped)
 	checksum = ~ checksum;
@@ -134,6 +136,6 @@
 }
 
-uint16_t ip_checksum( uint8_t * data, size_t length ){
-	return flip_checksum( compact_checksum( compute_checksum( 0, data, length )));
+uint16_t ip_checksum(uint8_t * data, size_t length){
+	return flip_checksum(compact_checksum(compute_checksum(0, data, length)));
 }
 
Index: uspace/srv/net/err.h
===================================================================
--- uspace/srv/net/err.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/err.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -62,9 +62,9 @@
 #ifdef CONFIG_DEBUG
 
-#define ERROR_OCCURRED( value )		((( ERROR_CODE = ( value )) != EOK ) && ({ printf( "error at %s:%d %d\n", __FILE__, __LINE__, ERROR_CODE ); 1; }))
+#define ERROR_OCCURRED(value)		(((ERROR_CODE = (value)) != EOK) && ({printf("error at %s:%d %d\n", __FILE__, __LINE__, ERROR_CODE); 1;}))
 
 #else
 
-#define ERROR_OCCURRED( value )		(( ERROR_CODE = ( value )) != EOK )
+#define ERROR_OCCURRED(value)		((ERROR_CODE = (value)) != EOK)
 
 #endif
@@ -74,5 +74,5 @@
  */
 
-#define ERROR_PROPAGATE( value )	if( ERROR_OCCURRED( value )) return ERROR_CODE
+#define ERROR_PROPAGATE(value)	if(ERROR_OCCURRED(value)) return ERROR_CODE
 
 #endif
Index: uspace/srv/net/il/arp/arp.c
===================================================================
--- uspace/srv/net/il/arp/arp.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/arp/arp.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -81,10 +81,10 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	arp_proto_create( arp_proto_ref * proto, services_t service, measured_string_ref address );
+int arp_proto_create(arp_proto_ref * proto, services_t service, measured_string_ref address);
 
 /** Clears the device specific data.
  *  @param[in] device The device specific data.
  */
-void	arp_clear_device( arp_device_ref device );
+void arp_clear_device(arp_device_ref device);
 
 /** @name Message processing functions
@@ -103,5 +103,5 @@
  *  @returns Other error codes as defined for the measured_strings_return() function.
  */
-int	arp_device_message( device_id_t device_id, services_t service, services_t protocol, measured_string_ref address );
+int arp_device_message(device_id_t device_id, services_t service, services_t protocol, measured_string_ref address);
 
 /** Returns the hardware address for the given protocol address.
@@ -116,5 +116,5 @@
  *  @returns NULL if the hardware address is not found in the cache.
  */
-measured_string_ref	arp_translate_message( device_id_t device_id, services_t protocol, measured_string_ref target );
+measured_string_ref arp_translate_message(device_id_t device_id, services_t protocol, measured_string_ref target);
 
 /** Processes the received ARP packet.
@@ -131,5 +131,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	arp_receive_message( device_id_t device_id, packet_t packet );
+int arp_receive_message(device_id_t device_id, packet_t packet);
 
 /** Updates the device content length according to the new MTU value.
@@ -139,73 +139,77 @@
  *  @returns EOK on success.
  */
-int	arp_mtu_changed_message( device_id_t device_id, size_t mtu );
+int arp_mtu_changed_message(device_id_t device_id, size_t mtu);
 
 /*@}*/
 
-DEVICE_MAP_IMPLEMENT( arp_cache, arp_device_t )
-
-INT_MAP_IMPLEMENT( arp_protos, arp_proto_t )
-
-GENERIC_CHAR_MAP_IMPLEMENT( arp_addr, measured_string_t )
-
-task_id_t arp_task_get_id( void ){
+DEVICE_MAP_IMPLEMENT(arp_cache, arp_device_t)
+
+INT_MAP_IMPLEMENT(arp_protos, arp_proto_t)
+
+GENERIC_CHAR_MAP_IMPLEMENT(arp_addr, measured_string_t)
+
+task_id_t arp_task_get_id(void){
 	return task_get_id();
 }
 
-int arp_clear_device_req( int arp_phone, device_id_t device_id ){
-	arp_device_ref	device;
-
-	fibril_rwlock_write_lock( & arp_globals.lock );
-	device = arp_cache_find( & arp_globals.cache, device_id );
-	if( ! device ){
-		fibril_rwlock_write_unlock( & arp_globals.lock );
+int arp_clear_device_req(int arp_phone, device_id_t device_id){
+	arp_device_ref device;
+
+	fibril_rwlock_write_lock(&arp_globals.lock);
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		fibril_rwlock_write_unlock(&arp_globals.lock);
 		return ENOENT;
 	}
-	arp_clear_device( device );
-	printf( "Device %d cleared\n", device_id );
-	fibril_rwlock_write_unlock( & arp_globals.lock );
-	return EOK;
-}
-
-int arp_clear_address_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address ){
-	arp_device_ref	device;
-	arp_proto_ref	proto;
-
-	fibril_rwlock_write_lock( & arp_globals.lock );
-	device = arp_cache_find( & arp_globals.cache, device_id );
-	if( ! device ){
-		fibril_rwlock_write_unlock( & arp_globals.lock );
+	arp_clear_device(device);
+	printf("Device %d cleared\n", device_id);
+	fibril_rwlock_write_unlock(&arp_globals.lock);
+	return EOK;
+}
+
+int arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address){
+	arp_device_ref device;
+	arp_proto_ref proto;
+
+	fibril_rwlock_write_lock(&arp_globals.lock);
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		fibril_rwlock_write_unlock(&arp_globals.lock);
 		return ENOENT;
 	}
-	proto = arp_protos_find( & device->protos, protocol );
-	if( ! proto ){
-		fibril_rwlock_write_unlock( & arp_globals.lock );
+	proto = arp_protos_find(&device->protos, protocol);
+	if(! proto){
+		fibril_rwlock_write_unlock(&arp_globals.lock);
 		return ENOENT;
 	}
-	arp_addr_exclude( & proto->addresses, address->value, address->length );
-	fibril_rwlock_write_unlock( & arp_globals.lock );
-	return EOK;
-}
-
-int arp_clean_cache_req( int arp_phone ){
-	int				count;
-	arp_device_ref	device;
-
-	fibril_rwlock_write_lock( & arp_globals.lock );
-	for( count = arp_cache_count( & arp_globals.cache ) - 1; count >= 0; -- count ){
-		device = arp_cache_get_index( & arp_globals.cache, count );
-		if( device ){
-			arp_clear_device( device );
-			if( device->addr_data ) free( device->addr_data );
-			if( device->broadcast_data ) free( device->broadcast_data );
-		}
-	}
-	arp_cache_clear( & arp_globals.cache );
-	fibril_rwlock_write_unlock( & arp_globals.lock );
-	printf( "Cache cleaned\n" );
-	return EOK;
-}
-
-int arp_device_req( int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address ){
+	arp_addr_exclude(&proto->addresses, address->value, address->length);
+	fibril_rwlock_write_unlock(&arp_globals.lock);
+	return EOK;
+}
+
+int arp_clean_cache_req(int arp_phone){
+	int count;
+	arp_device_ref device;
+
+	fibril_rwlock_write_lock(&arp_globals.lock);
+	for(count = arp_cache_count(&arp_globals.cache) - 1; count >= 0; -- count){
+		device = arp_cache_get_index(&arp_globals.cache, count);
+		if(device){
+			arp_clear_device(device);
+			if(device->addr_data){
+				free(device->addr_data);
+			}
+			if(device->broadcast_data){
+				free(device->broadcast_data);
+			}
+		}
+	}
+	arp_cache_clear(&arp_globals.cache);
+	fibril_rwlock_write_unlock(&arp_globals.lock);
+	printf("Cache cleaned\n");
+	return EOK;
+}
+
+int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address){
 	ERROR_DECLARE;
 
@@ -213,22 +217,22 @@
 
 	// copy the given address for exclusive use
-	tmp = measured_string_copy( address );
-	if( ERROR_OCCURRED( arp_device_message( device_id, netif, protocol, tmp ))){
-		free( tmp->value );
-		free( tmp );
+	tmp = measured_string_copy(address);
+	if(ERROR_OCCURRED(arp_device_message(device_id, netif, protocol, tmp))){
+		free(tmp->value);
+		free(tmp);
 	}
 	return ERROR_CODE;
 }
 
-int arp_translate_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data ){
-	measured_string_ref	tmp;
-
-	fibril_rwlock_read_lock( & arp_globals.lock );
-	tmp = arp_translate_message( device_id, protocol, address );
-	if( tmp ){
-		* translation = measured_string_copy( tmp );
-		fibril_rwlock_read_unlock( & arp_globals.lock );
-		if( * translation ){
-			* data = ( ** translation ).value;
+int arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data){
+	measured_string_ref tmp;
+
+	fibril_rwlock_read_lock(&arp_globals.lock);
+	tmp = arp_translate_message(device_id, protocol, address);
+	if(tmp){
+		*translation = measured_string_copy(tmp);
+		fibril_rwlock_read_unlock(&arp_globals.lock);
+		if(*translation){
+			*data = (** translation).value;
 			return EOK;
 		}else{
@@ -236,30 +240,32 @@
 		}
 	}else{
-		fibril_rwlock_read_unlock( & arp_globals.lock );
+		fibril_rwlock_read_unlock(&arp_globals.lock);
 		return ENOENT;
 	}
 }
 
-int arp_initialize( async_client_conn_t client_connection ){
+int arp_initialize(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	fibril_rwlock_initialize( & arp_globals.lock );
-	fibril_rwlock_write_lock( & arp_globals.lock );
+	fibril_rwlock_initialize(&arp_globals.lock);
+	fibril_rwlock_write_lock(&arp_globals.lock);
 	arp_globals.client_connection = client_connection;
-	ERROR_PROPAGATE( arp_cache_initialize( & arp_globals.cache ));
-	fibril_rwlock_write_unlock( & arp_globals.lock );
-	return EOK;
-}
-
-int arp_proto_create( arp_proto_ref * proto, services_t service, measured_string_ref address ){
+	ERROR_PROPAGATE(arp_cache_initialize(&arp_globals.cache));
+	fibril_rwlock_write_unlock(&arp_globals.lock);
+	return EOK;
+}
+
+int arp_proto_create(arp_proto_ref * proto, services_t service, measured_string_ref address){
 	ERROR_DECLARE;
 
-	* proto = ( arp_proto_ref ) malloc( sizeof( arp_proto_t ));
-	if( !( * proto )) return ENOMEM;
-	( ** proto ).service = service;
-	( ** proto ).addr = address;
-	( ** proto ).addr_data = address->value;
-	if( ERROR_OCCURRED( arp_addr_initialize( &( ** proto).addresses ))){
-		free( * proto );
+	*proto = (arp_proto_ref) malloc(sizeof(arp_proto_t));
+	if(!(*proto)){
+		return ENOMEM;
+	}
+	(** proto).service = service;
+	(** proto).addr = address;
+	(** proto).addr_data = address->value;
+	if(ERROR_OCCURRED(arp_addr_initialize(&(** proto).addresses))){
+		free(*proto);
 		return ERROR_CODE;
 	}
@@ -267,213 +273,235 @@
 }
 
-int arp_device_message( device_id_t device_id, services_t service, services_t protocol, measured_string_ref address ){
+int arp_device_message(device_id_t device_id, services_t service, services_t protocol, measured_string_ref address){
 	ERROR_DECLARE;
 
-	arp_device_ref	device;
-	arp_proto_ref	proto;
-	int				index;
-	hw_type_t		hardware;
-
-	fibril_rwlock_write_lock( & arp_globals.lock );
+	arp_device_ref device;
+	arp_proto_ref proto;
+	int index;
+	hw_type_t hardware;
+
+	fibril_rwlock_write_lock(&arp_globals.lock);
 	// an existing device?
-	device = arp_cache_find( & arp_globals.cache, device_id );
-	if( device ){
-		if( device->service != service ){
-			printf( "Device %d already exists\n", device->device_id );
-			fibril_rwlock_write_unlock( & arp_globals.lock );
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(device){
+		if(device->service != service){
+			printf("Device %d already exists\n", device->device_id);
+			fibril_rwlock_write_unlock(&arp_globals.lock);
 			return EEXIST;
 		}
-		proto = arp_protos_find( & device->protos, protocol );
-		if( proto ){
-			free( proto->addr );
-			free( proto->addr_data );
+		proto = arp_protos_find(&device->protos, protocol);
+		if(proto){
+			free(proto->addr);
+			free(proto->addr_data);
 			proto->addr = address;
 			proto->addr_data = address->value;
 		}else{
-			if( ERROR_OCCURRED( arp_proto_create( & proto, protocol, address ))){
-				fibril_rwlock_write_unlock( & arp_globals.lock );
+			if(ERROR_OCCURRED(arp_proto_create(&proto, protocol, address))){
+				fibril_rwlock_write_unlock(&arp_globals.lock);
 				return ERROR_CODE;
 			}
-			index = arp_protos_add( & device->protos, proto->service, proto );
-			if( index < 0 ){
-				fibril_rwlock_write_unlock( & arp_globals.lock );
-				free( proto );
+			index = arp_protos_add(&device->protos, proto->service, proto);
+			if(index < 0){
+				fibril_rwlock_write_unlock(&arp_globals.lock);
+				free(proto);
 				return index;
 			}
-			printf( "New protocol added:\n\tdevice id\t= %d\n\tproto\t= %d", device_id, protocol );
+			printf("New protocol added:\n\tdevice id\t= %d\n\tproto\t= %d", device_id, protocol);
 		}
 	}else{
-		hardware = hardware_map( service );
-		if( ! hardware ) return ENOENT;
+		hardware = hardware_map(service);
+		if(! hardware){
+			return ENOENT;
+		}
 		// create a new device
-		device = ( arp_device_ref ) malloc( sizeof( arp_device_t ));
-		if( ! device ){
-			fibril_rwlock_write_unlock( & arp_globals.lock );
+		device = (arp_device_ref) malloc(sizeof(arp_device_t));
+		if(! device){
+			fibril_rwlock_write_unlock(&arp_globals.lock);
 			return ENOMEM;
 		}
 		device->hardware = hardware;
 		device->device_id = device_id;
-		if( ERROR_OCCURRED( arp_protos_initialize( & device->protos ))
-		|| ERROR_OCCURRED( arp_proto_create( & proto, protocol, address ))){
-			fibril_rwlock_write_unlock( & arp_globals.lock );
-			free( device );
-			return ERROR_CODE;
-		}
-		index = arp_protos_add( & device->protos, proto->service, proto );
-		if( index < 0 ){
-			fibril_rwlock_write_unlock( & arp_globals.lock );
-			arp_protos_destroy( & device->protos );
-			free( device );
+		if(ERROR_OCCURRED(arp_protos_initialize(&device->protos))
+			|| ERROR_OCCURRED(arp_proto_create(&proto, protocol, address))){
+			fibril_rwlock_write_unlock(&arp_globals.lock);
+			free(device);
+			return ERROR_CODE;
+		}
+		index = arp_protos_add(&device->protos, proto->service, proto);
+		if(index < 0){
+			fibril_rwlock_write_unlock(&arp_globals.lock);
+			arp_protos_destroy(&device->protos);
+			free(device);
 			return index;
 		}
 		device->service = service;
 		// bind the new one
-		device->phone = nil_bind_service( device->service, ( ipcarg_t ) device->device_id, SERVICE_ARP, arp_globals.client_connection );
-		if( device->phone < 0 ){
-			fibril_rwlock_write_unlock( & arp_globals.lock );
-			arp_protos_destroy( & device->protos );
-			free( device );
+		device->phone = nil_bind_service(device->service, (ipcarg_t) device->device_id, SERVICE_ARP, arp_globals.client_connection);
+		if(device->phone < 0){
+			fibril_rwlock_write_unlock(&arp_globals.lock);
+			arp_protos_destroy(&device->protos);
+			free(device);
 			return EREFUSED;
 		}
 		// get packet dimensions
-		if( ERROR_OCCURRED( nil_packet_size_req( device->phone, device_id, & device->packet_dimension ))){
-			fibril_rwlock_write_unlock( & arp_globals.lock );
-			arp_protos_destroy( & device->protos );
-			free( device );
+		if(ERROR_OCCURRED(nil_packet_size_req(device->phone, device_id, &device->packet_dimension))){
+			fibril_rwlock_write_unlock(&arp_globals.lock);
+			arp_protos_destroy(&device->protos);
+			free(device);
 			return ERROR_CODE;
 		}
 		// get hardware address
-		if( ERROR_OCCURRED( nil_get_addr_req( device->phone, device_id, & device->addr, & device->addr_data ))){
-			fibril_rwlock_write_unlock( & arp_globals.lock );
-			arp_protos_destroy( & device->protos );
-			free( device );
+		if(ERROR_OCCURRED(nil_get_addr_req(device->phone, device_id, &device->addr, &device->addr_data))){
+			fibril_rwlock_write_unlock(&arp_globals.lock);
+			arp_protos_destroy(&device->protos);
+			free(device);
 			return ERROR_CODE;
 		}
 		// get broadcast address
-		if( ERROR_OCCURRED( nil_get_broadcast_addr_req( device->phone, device_id, & device->broadcast_addr, & device->broadcast_data ))){
-			fibril_rwlock_write_unlock( & arp_globals.lock );
-			free( device->addr );
-			free( device->addr_data );
-			arp_protos_destroy( & device->protos );
-			free( device );
-			return ERROR_CODE;
-		}
-		if( ERROR_OCCURRED( arp_cache_add( & arp_globals.cache, device->device_id, device ))){
-			fibril_rwlock_write_unlock( & arp_globals.lock );
-			free( device->addr );
-			free( device->addr_data );
-			free( device->broadcast_addr );
-			free( device->broadcast_data );
-			arp_protos_destroy( & device->protos );
-			free( device );
-			return ERROR_CODE;
-		}
-		printf( "New device registered:\n\tid\t= %d\n\ttype\t= 0x%x\n\tservice\t= %d\n\tproto\t= %d\n", device->device_id, device->hardware, device->service, protocol );
-	}
-	fibril_rwlock_write_unlock( & arp_globals.lock );
-	return EOK;
-}
-
-measured_string_ref arp_translate_message( device_id_t device_id, services_t protocol, measured_string_ref target ){
-	arp_device_ref		device;
-	arp_proto_ref		proto;
-	measured_string_ref	addr;
-	size_t				length;
-	packet_t			packet;
-	arp_header_ref		header;
-
-	if( ! target ) return NULL;
-	device = arp_cache_find( & arp_globals.cache, device_id );
-	if( ! device ) return NULL;
-	proto = arp_protos_find( & device->protos, protocol );
-	if(( ! proto ) || ( proto->addr->length != target->length )) return NULL;
-	addr = arp_addr_find( & proto->addresses, target->value, target->length );
-	if( addr ) return addr;
-	// ARP packet content size = header + ( address + translation ) * 2
-	length = 8 + ( CONVERT_SIZE( char, uint8_t, proto->addr->length ) + CONVERT_SIZE( char, uint8_t, device->addr->length )) * 2;
-	if( length > device->packet_dimension.content ) return NULL;
-	packet = packet_get_4( arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix );
-	if( ! packet ) return NULL;
-	header = ( arp_header_ref ) packet_suffix( packet, length );
-	if( ! header ){
-		pq_release( arp_globals.net_phone, packet_get_id( packet ));
+		if(ERROR_OCCURRED(nil_get_broadcast_addr_req(device->phone, device_id, &device->broadcast_addr, &device->broadcast_data))){
+			fibril_rwlock_write_unlock(&arp_globals.lock);
+			free(device->addr);
+			free(device->addr_data);
+			arp_protos_destroy(&device->protos);
+			free(device);
+			return ERROR_CODE;
+		}
+		if(ERROR_OCCURRED(arp_cache_add(&arp_globals.cache, device->device_id, device))){
+			fibril_rwlock_write_unlock(&arp_globals.lock);
+			free(device->addr);
+			free(device->addr_data);
+			free(device->broadcast_addr);
+			free(device->broadcast_data);
+			arp_protos_destroy(&device->protos);
+			free(device);
+			return ERROR_CODE;
+		}
+		printf("New device registered:\n\tid\t= %d\n\ttype\t= 0x%x\n\tservice\t= %d\n\tproto\t= %d\n", device->device_id, device->hardware, device->service, protocol);
+	}
+	fibril_rwlock_write_unlock(&arp_globals.lock);
+	return EOK;
+}
+
+measured_string_ref arp_translate_message(device_id_t device_id, services_t protocol, measured_string_ref target){
+	arp_device_ref device;
+	arp_proto_ref proto;
+	measured_string_ref addr;
+	size_t length;
+	packet_t packet;
+	arp_header_ref header;
+
+	if(! target){
 		return NULL;
 	}
-	header->hardware = htons( device->hardware );
-	header->hardware_length = ( uint8_t ) device->addr->length;
-	header->protocol = htons( protocol_map( device->service, protocol ));
-	header->protocol_length = ( uint8_t ) proto->addr->length;
-	header->operation = htons( ARPOP_REQUEST );
-	length = sizeof( arp_header_t );
-	memcpy((( uint8_t * ) header ) + length, device->addr->value, device->addr->length );
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		return NULL;
+	}
+	proto = arp_protos_find(&device->protos, protocol);
+	if((! proto) || (proto->addr->length != target->length)){
+		return NULL;
+	}
+	addr = arp_addr_find(&proto->addresses, target->value, target->length);
+	if(addr){
+		return addr;
+	}
+	// ARP packet content size = header + (address + translation) * 2
+	length = 8 + (CONVERT_SIZE(char, uint8_t, proto->addr->length) + CONVERT_SIZE(char, uint8_t, device->addr->length)) * 2;
+	if(length > device->packet_dimension.content){
+		return NULL;
+	}
+	packet = packet_get_4(arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix);
+	if(! packet){
+		return NULL;
+	}
+	header = (arp_header_ref) packet_suffix(packet, length);
+	if(! header){
+		pq_release(arp_globals.net_phone, packet_get_id(packet));
+		return NULL;
+	}
+	header->hardware = htons(device->hardware);
+	header->hardware_length = (uint8_t) device->addr->length;
+	header->protocol = htons(protocol_map(device->service, protocol));
+	header->protocol_length = (uint8_t) proto->addr->length;
+	header->operation = htons(ARPOP_REQUEST);
+	length = sizeof(arp_header_t);
+	memcpy(((uint8_t *) header) + length, device->addr->value, device->addr->length);
 	length += device->addr->length;
-	memcpy((( uint8_t * ) header ) + length, proto->addr->value, proto->addr->length );
+	memcpy(((uint8_t *) header) + length, proto->addr->value, proto->addr->length);
 	length += proto->addr->length;
-	bzero((( uint8_t * ) header ) + length, device->addr->length );
+	bzero(((uint8_t *) header) + length, device->addr->length);
 	length += device->addr->length;
-	memcpy((( uint8_t * ) header ) + length, target->value, target->length );
-	if( packet_set_addr( packet, ( uint8_t * ) device->addr->value, ( uint8_t * ) device->broadcast_addr->value, CONVERT_SIZE( char, uint8_t, device->addr->length )) != EOK ){
-		pq_release( arp_globals.net_phone, packet_get_id( packet ));
+	memcpy(((uint8_t *) header) + length, target->value, target->length);
+	if(packet_set_addr(packet, (uint8_t *) device->addr->value, (uint8_t *) device->broadcast_addr->value, CONVERT_SIZE(char, uint8_t, device->addr->length)) != EOK){
+		pq_release(arp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
-	nil_send_msg( device->phone, device_id, packet, SERVICE_ARP );
+	nil_send_msg(device->phone, device_id, packet, SERVICE_ARP);
 	return NULL;
 }
 
-int arp_receive_message( device_id_t device_id, packet_t packet ){
+int arp_receive_message(device_id_t device_id, packet_t packet){
 	ERROR_DECLARE;
 
-	size_t				length;
-	arp_header_ref		header;
-	arp_device_ref		device;
-	arp_proto_ref		proto;
-	measured_string_ref	hw_source;
-	uint8_t *			src_hw;
-	uint8_t *			src_proto;
-	uint8_t *			des_hw;
-	uint8_t *			des_proto;
-
-	length = packet_get_data_length( packet );
-	if( length <= sizeof( arp_header_t )) return EINVAL;
-	device = arp_cache_find( & arp_globals.cache, device_id );
-	if( ! device ) return ENOENT;
-	header = ( arp_header_ref ) packet_get_data( packet );
-	if(( ntohs( header->hardware ) != device->hardware )
-	|| ( length < sizeof( arp_header_t ) + header->hardware_length * 2u + header->protocol_length * 2u )){
+	size_t length;
+	arp_header_ref header;
+	arp_device_ref device;
+	arp_proto_ref proto;
+	measured_string_ref hw_source;
+	uint8_t * src_hw;
+	uint8_t * src_proto;
+	uint8_t * des_hw;
+	uint8_t * des_proto;
+
+	length = packet_get_data_length(packet);
+	if(length <= sizeof(arp_header_t)){
 		return EINVAL;
 	}
-	proto = arp_protos_find( & device->protos, protocol_unmap( device->service, ntohs( header->protocol )));
-	if( ! proto ) return ENOENT;
-	src_hw = (( uint8_t * ) header ) + sizeof( arp_header_t );
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		return ENOENT;
+	}
+	header = (arp_header_ref) packet_get_data(packet);
+	if((ntohs(header->hardware) != device->hardware)
+		|| (length < sizeof(arp_header_t) + header->hardware_length * 2u + header->protocol_length * 2u)){
+		return EINVAL;
+	}
+	proto = arp_protos_find(&device->protos, protocol_unmap(device->service, ntohs(header->protocol)));
+	if(! proto){
+		return ENOENT;
+	}
+	src_hw = ((uint8_t *) header) + sizeof(arp_header_t);
 	src_proto = src_hw + header->hardware_length;
 	des_hw = src_proto + header->protocol_length;
 	des_proto = des_hw + header->hardware_length;
-	hw_source = arp_addr_find( & proto->addresses, ( char * ) src_proto, CONVERT_SIZE( uint8_t, char, header->protocol_length ));
+	hw_source = arp_addr_find(&proto->addresses, (char *) src_proto, CONVERT_SIZE(uint8_t, char, header->protocol_length));
 	// exists?
-	if( hw_source ){
-		if( hw_source->length != CONVERT_SIZE( uint8_t, char, header->hardware_length )){
+	if(hw_source){
+		if(hw_source->length != CONVERT_SIZE(uint8_t, char, header->hardware_length)){
 			return EINVAL;
 		}
-		memcpy( hw_source->value, src_hw, hw_source->length );
+		memcpy(hw_source->value, src_hw, hw_source->length);
 	}
 	// is my protocol address?
-	if( proto->addr->length != CONVERT_SIZE( uint8_t, char, header->protocol_length )){
+	if(proto->addr->length != CONVERT_SIZE(uint8_t, char, header->protocol_length)){
 		return EINVAL;
 	}
-	if( ! str_lcmp( proto->addr->value, ( char * ) des_proto, proto->addr->length )){
+	if(! str_lcmp(proto->addr->value, (char *) des_proto, proto->addr->length)){
 		// not already upadted?
-		if( ! hw_source ){
-			hw_source = measured_string_create_bulk(( char * ) src_hw, CONVERT_SIZE( uint8_t, char, header->hardware_length ));
-			if( ! hw_source ) return ENOMEM;
-			ERROR_PROPAGATE( arp_addr_add( & proto->addresses, ( char * ) src_proto, CONVERT_SIZE( uint8_t, char, header->protocol_length ), hw_source ));
-		}
-		if( ntohs( header->operation ) == ARPOP_REQUEST ){
-			header->operation = htons( ARPOP_REPLY );
-			memcpy( des_proto, src_proto, header->protocol_length );
-			memcpy( src_proto, proto->addr->value, header->protocol_length );
-			memcpy( src_hw, device->addr->value, device->packet_dimension.addr_len );
-			memcpy( des_hw, hw_source->value, header->hardware_length );
-			ERROR_PROPAGATE( packet_set_addr( packet, src_hw, des_hw, header->hardware_length ));
-			nil_send_msg( device->phone, device_id, packet, SERVICE_ARP );
+		if(! hw_source){
+			hw_source = measured_string_create_bulk((char *) src_hw, CONVERT_SIZE(uint8_t, char, header->hardware_length));
+			if(! hw_source){
+				return ENOMEM;
+			}
+			ERROR_PROPAGATE(arp_addr_add(&proto->addresses, (char *) src_proto, CONVERT_SIZE(uint8_t, char, header->protocol_length), hw_source));
+		}
+		if(ntohs(header->operation) == ARPOP_REQUEST){
+			header->operation = htons(ARPOP_REPLY);
+			memcpy(des_proto, src_proto, header->protocol_length);
+			memcpy(src_proto, proto->addr->value, header->protocol_length);
+			memcpy(src_hw, device->addr->value, device->packet_dimension.addr_len);
+			memcpy(des_hw, hw_source->value, header->hardware_length);
+			ERROR_PROPAGATE(packet_set_addr(packet, src_hw, des_hw, header->hardware_length));
+			nil_send_msg(device->phone, device_id, packet, SERVICE_ARP);
 			return 1;
 		}
@@ -482,100 +510,108 @@
 }
 
-void arp_clear_device( arp_device_ref device ){
-	int				count;
-	arp_proto_ref	proto;
-
-	for( count = arp_protos_count( & device->protos ) - 1; count >= 0; -- count ){
-		proto = arp_protos_get_index( & device->protos, count );
-		if( proto ){
-			if( proto->addr ) free( proto->addr );
-			if( proto->addr_data ) free( proto->addr_data );
-			arp_addr_destroy( & proto->addresses );
-		}
-	}
-	arp_protos_clear( & device->protos );
-}
-
-int arp_connect_module( services_t service ){
-	if( service != SERVICE_ARP ) return EINVAL;
-	return EOK;
-}
-
-int arp_mtu_changed_message( device_id_t device_id, size_t mtu ){
-	arp_device_ref	device;
-
-	fibril_rwlock_write_lock( & arp_globals.lock );
-	device = arp_cache_find( & arp_globals.cache, device_id );
-	if( ! device ){
-		fibril_rwlock_write_unlock( & arp_globals.lock );
+void arp_clear_device(arp_device_ref device){
+	int count;
+	arp_proto_ref proto;
+
+	for(count = arp_protos_count(&device->protos) - 1; count >= 0; -- count){
+		proto = arp_protos_get_index(&device->protos, count);
+		if(proto){
+			if(proto->addr){
+				free(proto->addr);
+			}
+			if(proto->addr_data){
+				free(proto->addr_data);
+			}
+			arp_addr_destroy(&proto->addresses);
+		}
+	}
+	arp_protos_clear(&device->protos);
+}
+
+int arp_connect_module(services_t service){
+	if(service != SERVICE_ARP){
+		return EINVAL;
+	}
+	return EOK;
+}
+
+int arp_mtu_changed_message(device_id_t device_id, size_t mtu){
+	arp_device_ref device;
+
+	fibril_rwlock_write_lock(&arp_globals.lock);
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		fibril_rwlock_write_unlock(&arp_globals.lock);
 		return ENOENT;
 	}
 	device->packet_dimension.content = mtu;
-	printf( "arp - device %d changed mtu to %d\n\n", device_id, mtu );
-	fibril_rwlock_write_unlock( & arp_globals.lock );
-	return EOK;
-}
-
-int arp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+	printf("arp - device %d changed mtu to %d\n\n", device_id, mtu);
+	fibril_rwlock_write_unlock(&arp_globals.lock);
+	return EOK;
+}
+
+int arp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
-	measured_string_ref	address;
-	measured_string_ref	translation;
-	char *				data;
-	packet_t			packet;
-	packet_t			next;
-
-//	printf( "message %d - %d\n", IPC_GET_METHOD( * call ), NET_ARP_FIRST );
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+	measured_string_ref address;
+	measured_string_ref translation;
+	char * data;
+	packet_t packet;
+	packet_t next;
+
+//	printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_ARP_FIRST);
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_ARP_DEVICE:
-			ERROR_PROPAGATE( measured_strings_receive( & address, & data, 1 ));
-			if( ERROR_OCCURRED( arp_device_message( IPC_GET_DEVICE( call ), IPC_GET_SERVICE( call ), ARP_GET_NETIF( call ), address ))){
-				free( address );
-				free( data );
+			ERROR_PROPAGATE(measured_strings_receive(&address, &data, 1));
+			if(ERROR_OCCURRED(arp_device_message(IPC_GET_DEVICE(call), IPC_GET_SERVICE(call), ARP_GET_NETIF(call), address))){
+				free(address);
+				free(data);
 			}
 			return ERROR_CODE;
 		case NET_ARP_TRANSLATE:
-			ERROR_PROPAGATE( measured_strings_receive( & address, & data, 1 ));
-			fibril_rwlock_read_lock( & arp_globals.lock );
-			translation = arp_translate_message( IPC_GET_DEVICE( call ), IPC_GET_SERVICE( call ), address );
-			free( address );
-			free( data );
-			if( ! translation ){
-				fibril_rwlock_read_unlock( & arp_globals.lock );
+			ERROR_PROPAGATE(measured_strings_receive(&address, &data, 1));
+			fibril_rwlock_read_lock(&arp_globals.lock);
+			translation = arp_translate_message(IPC_GET_DEVICE(call), IPC_GET_SERVICE(call), address);
+			free(address);
+			free(data);
+			if(! translation){
+				fibril_rwlock_read_unlock(&arp_globals.lock);
 				return ENOENT;
 			}
-			ERROR_CODE = measured_strings_reply( translation, 1 );
-			fibril_rwlock_read_unlock( & arp_globals.lock );
+			ERROR_CODE = measured_strings_reply(translation, 1);
+			fibril_rwlock_read_unlock(&arp_globals.lock);
 			return ERROR_CODE;
 		case NET_ARP_CLEAR_DEVICE:
-			return arp_clear_device_req( 0, IPC_GET_DEVICE( call ));
+			return arp_clear_device_req(0, IPC_GET_DEVICE(call));
 		case NET_ARP_CLEAR_ADDRESS:
-			ERROR_PROPAGATE( measured_strings_receive( & address, & data, 1 ));
-			arp_clear_address_req( 0, IPC_GET_DEVICE( call ), IPC_GET_SERVICE( call ), address );
-			free( address );
-			free( data );
+			ERROR_PROPAGATE(measured_strings_receive(&address, &data, 1));
+			arp_clear_address_req(0, IPC_GET_DEVICE(call), IPC_GET_SERVICE(call), address);
+			free(address);
+			free(data);
 			return EOK;
 		case NET_ARP_CLEAN_CACHE:
-			return arp_clean_cache_req( 0 );
+			return arp_clean_cache_req(0);
 		case NET_IL_DEVICE_STATE:
 			// do nothing - keep the cache
 			return EOK;
 		case NET_IL_RECEIVED:
-			if( ! ERROR_OCCURRED( packet_translate( arp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){
-				fibril_rwlock_read_lock( & arp_globals.lock );
+			if(! ERROR_OCCURRED(packet_translate(arp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+				fibril_rwlock_read_lock(&arp_globals.lock);
 				do{
-					next = pq_detach( packet );
-					ERROR_CODE = arp_receive_message( IPC_GET_DEVICE( call ), packet );
-					if( ERROR_CODE != 1 ) pq_release( arp_globals.net_phone, packet_get_id( packet ));
+					next = pq_detach(packet);
+					ERROR_CODE = arp_receive_message(IPC_GET_DEVICE(call), packet);
+					if(ERROR_CODE != 1){
+						pq_release(arp_globals.net_phone, packet_get_id(packet));
+					}
 					packet = next;
-				}while( packet );
-				fibril_rwlock_read_unlock( & arp_globals.lock );
+				}while(packet);
+				fibril_rwlock_read_unlock(&arp_globals.lock);
 			}
 			return ERROR_CODE;
 		case NET_IL_MTU_CHANGED:
-			return arp_mtu_changed_message( IPC_GET_DEVICE( call ), IPC_GET_MTU( call ));
+			return arp_mtu_changed_message(IPC_GET_DEVICE(call), IPC_GET_MTU(call));
 	}
 	return ENOTSUP;
Index: uspace/srv/net/il/arp/arp.h
===================================================================
--- uspace/srv/net/il/arp/arp.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/arp/arp.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -80,5 +80,5 @@
  *  @see device.h
  */
-DEVICE_MAP_DECLARE( arp_cache, arp_device_t )
+DEVICE_MAP_DECLARE(arp_cache, arp_device_t)
 
 /** ARP protocol map.
@@ -86,5 +86,5 @@
  *  @see int_map.h
  */
-INT_MAP_DECLARE( arp_protos, arp_proto_t )
+INT_MAP_DECLARE(arp_protos, arp_proto_t)
 
 /** ARP address map.
@@ -92,5 +92,5 @@
  *  @see generic_char_map.h
  */
-GENERIC_CHAR_MAP_DECLARE( arp_addr, measured_string_t )
+GENERIC_CHAR_MAP_DECLARE(arp_addr, measured_string_t)
 
 /** ARP device specific data.
@@ -99,33 +99,33 @@
 	/** Device identifier.
 	 */
-	device_id_t			device_id;
+	device_id_t device_id;
 	/** Hardware type.
 	 */
-	hw_type_t			hardware;
+	hw_type_t hardware;
 	/** Packet dimension.
 	 */
-	packet_dimension_t	packet_dimension;
+	packet_dimension_t packet_dimension;
 	/** Actual device hardware address.
 	 */
-	measured_string_ref	addr;
+	measured_string_ref addr;
 	/** Actual device hardware address data.
 	 */
-	char *				addr_data;
+	char * addr_data;
 	/** Broadcast device hardware address.
 	 */
-	measured_string_ref	broadcast_addr;
+	measured_string_ref broadcast_addr;
 	/** Broadcast device hardware address data.
 	 */
-	char *				broadcast_data;
+	char * broadcast_data;
 	/** Device module service.
 	 */
-	services_t			service;
+	services_t service;
 	/** Device module phone.
 	 */
-	int					phone;
+	int phone;
 	/** Protocol map.
 	 *  Address map for each protocol.
 	 */
-	arp_protos_t		protos;
+	arp_protos_t protos;
 };
 
@@ -135,14 +135,14 @@
 	/** Protocol service.
 	 */
-	services_t			service;
+	services_t service;
 	/** Actual device protocol address.
 	 */
-	measured_string_ref	addr;
+	measured_string_ref addr;
 	/** Actual device protocol address data.
 	 */
-	char *				addr_data;
+	char * addr_data;
 	/** Address map.
 	 */
-	arp_addr_t			addresses;
+	arp_addr_t addresses;
 };
 
@@ -152,11 +152,11 @@
 	/** Networking module phone.
 	 */
-	int			net_phone;
+	int net_phone;
 	/** Safety lock.
 	 */
-	fibril_rwlock_t		lock;
+	fibril_rwlock_t lock;
 	/** ARP address cache.
 	 */
-	arp_cache_t	cache;
+	arp_cache_t cache;
 	/** The client connection processing function.
 	 *  The module skeleton propagates its own one.
Index: uspace/srv/net/il/arp/arp_header.h
===================================================================
--- uspace/srv/net/il/arp/arp_header.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/arp/arp_header.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -57,18 +57,18 @@
 	 *  @see hardware.h
 	 */
-	uint16_t	hardware;
+	uint16_t hardware;
 	/** Protocol identifier.
 	 */
-	uint16_t	protocol;
+	uint16_t protocol;
 	/** Hardware address length in bytes.
 	 */
-	uint8_t		hardware_length;
+	uint8_t hardware_length;
 	/** Protocol address length in bytes.
 	 */
-	uint8_t		protocol_length;
+	uint8_t protocol_length;
 	/** ARP packet type.
 	 *  @see arp_oc.h
 	 */
-	uint16_t	operation;
+	uint16_t operation;
 } __attribute__ ((packed));
 
Index: uspace/srv/net/il/arp/arp_messages.h
===================================================================
--- uspace/srv/net/il/arp/arp_messages.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/arp/arp_messages.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -75,5 +75,5 @@
  *  @param[in] call The message call structure.
  */
-#define ARP_GET_NETIF( call )		( services_t ) IPC_GET_ARG2( * call )
+#define ARP_GET_NETIF(call)		(services_t) IPC_GET_ARG2(*call)
 
 /*@}*/
Index: uspace/srv/net/il/arp/arp_module.c
===================================================================
--- uspace/srv/net/il/arp/arp_module.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/arp/arp_module.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -61,5 +61,5 @@
  *  @see NAME
  */
-void	module_print_name( void );
+void module_print_name(void);
 
 /** Starts the ARP module.
@@ -70,5 +70,5 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int	module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
 /** Processes the ARP message.
@@ -80,5 +80,5 @@
  *  @returns Other error codes as defined for the arp_message() function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** ARP module global data.
@@ -86,18 +86,18 @@
 extern arp_globals_t	arp_globals;
 
-void module_print_name( void ){
-	printf( "%s", NAME );
+void module_print_name(void){
+	printf("%s", NAME);
 }
 
-int module_start( async_client_conn_t client_connection ){
+int module_start(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ipcarg_t	phonehash;
+	ipcarg_t phonehash;
 
-	async_set_client_connection( client_connection );
-	arp_globals.net_phone = net_connect_module( SERVICE_NETWORKING );
-	ERROR_PROPAGATE( pm_init());
-	if( ERROR_OCCURRED( arp_initialize( client_connection ))
-	|| ERROR_OCCURRED( REGISTER_ME( SERVICE_ARP, & phonehash ))){
+	async_set_client_connection(client_connection);
+	arp_globals.net_phone = net_connect_module(SERVICE_NETWORKING);
+	ERROR_PROPAGATE(pm_init());
+	if(ERROR_OCCURRED(arp_initialize(client_connection))
+		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_ARP, &phonehash))){
 		pm_destroy();
 		return ERROR_CODE;
@@ -110,6 +110,6 @@
 }
 
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	return arp_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return arp_message(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/il/arp/arp_module.h
===================================================================
--- uspace/srv/net/il/arp/arp_module.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/arp/arp_module.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -46,5 +46,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	arp_initialize( async_client_conn_t client_connection );
+int arp_initialize(async_client_conn_t client_connection);
 
 /** Processes the ARP message.
@@ -58,5 +58,5 @@
  *  @see IS_NET_ARP_MESSAGE()
  */
-int	arp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int arp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/il/arp/arp_remote.c
===================================================================
--- uspace/srv/net/il/arp/arp_remote.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/arp/arp_remote.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -52,42 +52,44 @@
 #include "arp_messages.h"
 
-int arp_device_req( int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address ){
-	aid_t			message_id;
-	ipcarg_t		result;
+int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address){
+	aid_t message_id;
+	ipcarg_t result;
 
-	message_id = async_send_3( arp_phone, NET_ARP_DEVICE, ( ipcarg_t ) device_id, protocol, netif, NULL );
-	measured_strings_send( arp_phone, address, 1 );
-	async_wait_for( message_id, & result );
-	return ( int ) result;
+	message_id = async_send_3(arp_phone, NET_ARP_DEVICE, (ipcarg_t) device_id, protocol, netif, NULL);
+	measured_strings_send(arp_phone, address, 1);
+	async_wait_for(message_id, &result);
+	return (int) result;
 }
 
-int arp_translate_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data ){
-	return generic_translate_req( arp_phone, NET_ARP_TRANSLATE, device_id, protocol, address, 1, translation, data );
+int arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data){
+	return generic_translate_req(arp_phone, NET_ARP_TRANSLATE, device_id, protocol, address, 1, translation, data);
 }
 
-int arp_clear_device_req( int arp_phone, device_id_t device_id ){
-	return ( int ) async_req_1_0( arp_phone, NET_ARP_CLEAR_DEVICE, ( ipcarg_t ) device_id );
+int arp_clear_device_req(int arp_phone, device_id_t device_id){
+	return (int) async_req_1_0(arp_phone, NET_ARP_CLEAR_DEVICE, (ipcarg_t) device_id);
 }
 
-int arp_clear_address_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address ){
-	aid_t			message_id;
-	ipcarg_t		result;
+int arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address){
+	aid_t message_id;
+	ipcarg_t result;
 
-	message_id = async_send_2( arp_phone, NET_ARP_CLEAR_ADDRESS, ( ipcarg_t ) device_id, protocol, NULL );
-	measured_strings_send( arp_phone, address, 1 );
-	async_wait_for( message_id, & result );
-	return ( int ) result;
+	message_id = async_send_2(arp_phone, NET_ARP_CLEAR_ADDRESS, (ipcarg_t) device_id, protocol, NULL);
+	measured_strings_send(arp_phone, address, 1);
+	async_wait_for(message_id, &result);
+	return (int) result;
 }
 
-int arp_clean_cache_req( int arp_phone ){
-	return ( int ) async_req_0_0( arp_phone, NET_ARP_CLEAN_CACHE );
+int arp_clean_cache_req(int arp_phone){
+	return (int) async_req_0_0(arp_phone, NET_ARP_CLEAN_CACHE);
 }
 
-int arp_connect_module( services_t service ){
-	if( service != SERVICE_ARP ) return EINVAL;
-	return connect_to_service( SERVICE_ARP );
+int arp_connect_module(services_t service){
+	if(service != SERVICE_ARP){
+		return EINVAL;
+	}
+	return connect_to_service(SERVICE_ARP);
 }
 
-task_id_t arp_task_get_id( void ){
+task_id_t arp_task_get_id(void){
 	return 0;
 }
Index: uspace/srv/net/il/il_messages.h
===================================================================
--- uspace/srv/net/il/il_messages.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/il_messages.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -78,10 +78,10 @@
  *  @param[in] call The message call structure.
  */
-#define IL_GET_PROTO( call )		( int ) IPC_GET_ARG1( * call )
+#define IL_GET_PROTO(call)		(int) IPC_GET_ARG1(*call)
 
 /** Returns the registering service message parameter.
  *  @param[in] call The message call structure.
  */
-#define IL_GET_SERVICE( call )		( services_t ) IPC_GET_ARG2( * call )
+#define IL_GET_SERVICE(call)		(services_t) IPC_GET_ARG2(*call)
 
 /*@}*/
Index: uspace/srv/net/il/ip/ip.c
===================================================================
--- uspace/srv/net/il/ip/ip.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/ip/ip.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -108,9 +108,9 @@
 /** IP packet address length.
  */
-#define IP_ADDR							sizeof( struct sockaddr_in6 )
+#define IP_ADDR							sizeof(struct sockaddr_in6)
 
 /** IP packet prefix length.
  */
-#define IP_PREFIX						sizeof( ip_header_t )
+#define IP_PREFIX						sizeof(ip_header_t)
 
 /** IP packet suffix length.
@@ -124,5 +124,5 @@
 /** The IP localhost address.
  */
-#define IPV4_LOCALHOST_ADDRESS	htonl(( 127 << 24 ) + 1 )
+#define IPV4_LOCALHOST_ADDRESS	htonl((127 << 24) + 1)
 
 /** IP global data.
@@ -130,9 +130,9 @@
 ip_globals_t	ip_globals;
 
-DEVICE_MAP_IMPLEMENT( ip_netifs, ip_netif_t )
-
-INT_MAP_IMPLEMENT( ip_protos, ip_proto_t )
-
-GENERIC_FIELD_IMPLEMENT( ip_routes, ip_route_t )
+DEVICE_MAP_IMPLEMENT(ip_netifs, ip_netif_t)
+
+INT_MAP_IMPLEMENT(ip_protos, ip_proto_t)
+
+GENERIC_FIELD_IMPLEMENT(ip_routes, ip_route_t)
 
 /** Updates the device content length according to the new MTU value.
@@ -142,5 +142,5 @@
  *  @returns ENOENT if device is not found.
  */
-int	ip_mtu_changed_message( device_id_t device_id, size_t mtu );
+int ip_mtu_changed_message(device_id_t device_id, size_t mtu);
 
 /** Updates the device state.
@@ -150,5 +150,5 @@
  *  @returns ENOENT if device is not found.
  */
-int	ip_device_state_message( device_id_t device_id, device_state_t state );
+int ip_device_state_message(device_id_t device_id, device_state_t state);
 
 /** Returns the device packet dimensions for sending.
@@ -162,5 +162,5 @@
  *  @returns EOK on success.
  */
-int	ip_packet_size_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix );
+int ip_packet_size_message(device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix);
 
 /** Registers the transport layer protocol.
@@ -175,5 +175,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	ip_register( int protocol, services_t service, int phone, tl_received_msg_t tl_received_msg );
+int ip_register(int protocol, services_t service, int phone, tl_received_msg_t tl_received_msg);
 
 /** Initializes a new network interface specific data.
@@ -192,5 +192,5 @@
  *  @returns Other error codes as defined for the nil_packet_size_req() function.
  */
-int	ip_netif_initialize( ip_netif_ref ip_netif );
+int ip_netif_initialize(ip_netif_ref ip_netif);
 
 /** Sends the packet or the packet queue via the specified route.
@@ -206,5 +206,5 @@
  *  @returns Other error codes as defined for the ip_prepare_packet() function.
  */
-int	ip_send_route( packet_t packet, ip_netif_ref netif, ip_route_ref route, in_addr_t * src, in_addr_t dest, services_t error );
+int ip_send_route(packet_t packet, ip_netif_ref netif, ip_route_ref route, in_addr_t * src, in_addr_t dest, services_t error);
 
 /** Prepares the outgoing packet or the packet queue.
@@ -222,5 +222,5 @@
  *  @returns Other error codes as defined for the packet_set_addr() function.
  */
-int	ip_prepare_packet( in_addr_t * source, in_addr_t dest, packet_t packet, measured_string_ref destination );
+int ip_prepare_packet(in_addr_t * source, in_addr_t dest, packet_t packet, measured_string_ref destination);
 
 /** Checks the packet queue lengths and fragments the packets if needed.
@@ -235,5 +235,5 @@
  *  @returns NULL if there are no packets left.
  */
-packet_t	ip_split_packet( packet_t packet, size_t prefix, size_t content, size_t suffix, socklen_t addr_len, services_t error );
+packet_t ip_split_packet(packet_t packet, size_t prefix, size_t content, size_t suffix, socklen_t addr_len, services_t error);
 
 /** Checks the packet length and fragments it if needed.
@@ -255,5 +255,5 @@
  *  @returns Other error codes as defined for the ip_fragment_packet_data() function.
  */
-int	ip_fragment_packet( packet_t packet, size_t length, size_t prefix, size_t suffix, socklen_t addr_len );
+int ip_fragment_packet(packet_t packet, size_t length, size_t prefix, size_t suffix, socklen_t addr_len);
 
 /** Fragments the packet from the end.
@@ -271,5 +271,5 @@
  *  @returns Other error codes as defined for the pq_insert_after() function.
  */
-int	ip_fragment_packet_data( packet_t packet, packet_t new_packet, ip_header_ref header, ip_header_ref new_header, size_t length, const struct sockaddr * src, const struct sockaddr * dest, socklen_t addrlen );
+int ip_fragment_packet_data(packet_t packet, packet_t new_packet, ip_header_ref header, ip_header_ref new_header, size_t length, const struct sockaddr * src, const struct sockaddr * dest, socklen_t addrlen);
 
 /** Prefixes a middle fragment header based on the last fragment header to the packet.
@@ -279,5 +279,5 @@
  *  @returns NULL on error.
  */
-ip_header_ref	ip_create_middle_header( packet_t packet, ip_header_ref last );
+ip_header_ref ip_create_middle_header(packet_t packet, ip_header_ref last);
 
 /** Copies the fragment header.
@@ -286,5 +286,5 @@
  *  @param[in] first The original header to be copied.
  */
-void ip_create_last_header( ip_header_ref last, ip_header_ref first );
+void ip_create_last_header(ip_header_ref last, ip_header_ref first);
 
 /** Returns the network interface's IP address.
@@ -293,5 +293,5 @@
  *  @returns NULL if no IP address was found.
  */
-in_addr_t *	ip_netif_address( ip_netif_ref netif );
+in_addr_t * ip_netif_address(ip_netif_ref netif);
 
 /** Searches all network interfaces if there is a suitable route.
@@ -300,5 +300,5 @@
  *  @returns NULL if no route was found.
  */
-ip_route_ref	ip_find_route( in_addr_t destination );
+ip_route_ref ip_find_route(in_addr_t destination);
 
 /** Searches the network interfaces if there is a suitable route.
@@ -308,5 +308,5 @@
  *  @returns NULL if no route was found.
  */
-ip_route_ref	ip_netif_find_route( ip_netif_ref netif, in_addr_t destination );
+ip_route_ref ip_netif_find_route(ip_netif_ref netif, in_addr_t destination);
 
 /** Processes the received IP packet or the packet queue one by one.
@@ -321,5 +321,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	ip_receive_message( device_id_t device_id, packet_t packet );
+int ip_receive_message(device_id_t device_id, packet_t packet);
 
 /** Processes the received packet.
@@ -338,5 +338,5 @@
  *  @returns ENOENT if the packet is for another host and the routing is disabled.
  */
-int	ip_process_packet( device_id_t device_id, packet_t packet );
+int ip_process_packet(device_id_t device_id, packet_t packet);
 
 /** Returns the packet destination address from the IP header.
@@ -344,5 +344,5 @@
  *  @returns The packet destination address.
  */
-in_addr_t	ip_get_destination( ip_header_ref header );
+in_addr_t ip_get_destination(ip_header_ref header);
 
 /** Delivers the packet to the local host.
@@ -361,5 +361,5 @@
  *  @returns Other error codes as defined for the protocol specific tl_received_msg function.
  */
-int	ip_deliver_local( device_id_t device_id, packet_t packet, ip_header_ref header, services_t error );
+int ip_deliver_local(device_id_t device_id, packet_t packet, ip_header_ref header, services_t error);
 
 /** Prepares the ICMP notification packet.
@@ -374,5 +374,5 @@
  *  @returns EINVAL if the ip_prepare_icmp() fails.
  */
-int	ip_prepare_icmp_and_get_phone( services_t error, packet_t packet, ip_header_ref header );
+int ip_prepare_icmp_and_get_phone(services_t error, packet_t packet, ip_header_ref header);
 
 /** Returns the ICMP phone.
@@ -381,5 +381,5 @@
  *  @returns ENOENT if the ICMP is not registered.
  */
-int	ip_get_icmp_phone( void );
+int ip_get_icmp_phone(void);
 
 /** Prepares the ICMP notification packet.
@@ -395,5 +395,5 @@
  *  @returns Other error codes as defined for the packet_set_addr().
  */
-int	ip_prepare_icmp( packet_t packet, ip_header_ref header );
+int ip_prepare_icmp(packet_t packet, ip_header_ref header);
 
 /** Releases the packet and returns the result.
@@ -402,13 +402,13 @@
  *  @return The result parameter.
  */
-int	ip_release_and_return( packet_t packet, int result );
-
-int ip_initialize( async_client_conn_t client_connection ){
+int ip_release_and_return(packet_t packet, int result);
+
+int ip_initialize(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	fibril_rwlock_initialize( & ip_globals.lock );
-	fibril_rwlock_write_lock( & ip_globals.lock );
-	fibril_rwlock_initialize( & ip_globals.protos_lock );
-	fibril_rwlock_initialize( & ip_globals.netifs_lock );
+	fibril_rwlock_initialize(&ip_globals.lock);
+	fibril_rwlock_write_lock(&ip_globals.lock);
+	fibril_rwlock_initialize(&ip_globals.protos_lock);
+	fibril_rwlock_initialize(&ip_globals.netifs_lock);
 	ip_globals.packet_counter = 0;
 	ip_globals.gateway.address.s_addr = 0;
@@ -416,25 +416,27 @@
 	ip_globals.gateway.gateway.s_addr = 0;
 	ip_globals.gateway.netif = NULL;
-	ERROR_PROPAGATE( ip_netifs_initialize( & ip_globals.netifs ));
-	ERROR_PROPAGATE( ip_protos_initialize( & ip_globals.protos ));
+	ERROR_PROPAGATE(ip_netifs_initialize(&ip_globals.netifs));
+	ERROR_PROPAGATE(ip_protos_initialize(&ip_globals.protos));
 	ip_globals.client_connection = client_connection;
-	ERROR_PROPAGATE( modules_initialize( & ip_globals.modules ));
-	ERROR_PROPAGATE( add_module( NULL, & ip_globals.modules, ARP_NAME, ARP_FILENAME, SERVICE_ARP, arp_task_get_id(), arp_connect_module ));
-	fibril_rwlock_write_unlock( & ip_globals.lock );
+	ERROR_PROPAGATE(modules_initialize(&ip_globals.modules));
+	ERROR_PROPAGATE(add_module(NULL, &ip_globals.modules, ARP_NAME, ARP_FILENAME, SERVICE_ARP, arp_task_get_id(), arp_connect_module));
+	fibril_rwlock_write_unlock(&ip_globals.lock);
 	return EOK;
 }
 
-int ip_device_req( int il_phone, device_id_t device_id, services_t netif ){
+int ip_device_req(int il_phone, device_id_t device_id, services_t netif){
 	ERROR_DECLARE;
 
-	ip_netif_ref	ip_netif;
-	ip_route_ref	route;
-	int				index;
-	char *			data;
-
-	ip_netif = ( ip_netif_ref ) malloc( sizeof( ip_netif_t ));
-	if( ! ip_netif ) return ENOMEM;
-	if( ERROR_OCCURRED( ip_routes_initialize( & ip_netif->routes ))){
-		free( ip_netif );
+	ip_netif_ref ip_netif;
+	ip_route_ref route;
+	int index;
+	char * data;
+
+	ip_netif = (ip_netif_ref) malloc(sizeof(ip_netif_t));
+	if(! ip_netif){
+		return ENOMEM;
+	}
+	if(ERROR_OCCURRED(ip_routes_initialize(&ip_netif->routes))){
+		free(ip_netif);
 		return ERROR_CODE;
 	}
@@ -442,49 +444,51 @@
 	ip_netif->service = netif;
 	ip_netif->state = NETIF_STOPPED;
-	fibril_rwlock_write_lock( & ip_globals.netifs_lock );
-	if( ERROR_OCCURRED( ip_netif_initialize( ip_netif ))){
-		fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
-		ip_routes_destroy( & ip_netif->routes );
-		free( ip_netif );
+	fibril_rwlock_write_lock(&ip_globals.netifs_lock);
+	if(ERROR_OCCURRED(ip_netif_initialize(ip_netif))){
+		fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
+		ip_routes_destroy(&ip_netif->routes);
+		free(ip_netif);
 		return ERROR_CODE;
 	}
-	if( ip_netif->arp ) ++ ip_netif->arp->usage;
+	if(ip_netif->arp){
+		++ ip_netif->arp->usage;
+	}
 	// print the settings
-	printf( "New device registered:\n\tid\t= %d\n\tphone\t= %d\n\tIPV\t= %d\n", ip_netif->device_id, ip_netif->phone, ip_netif->ipv );
-	printf( "\tconfiguration\t= %s\n", ip_netif->dhcp ? "dhcp" : "static" );
+	printf("New device registered:\n\tid\t= %d\n\tphone\t= %d\n\tIPV\t= %d\n", ip_netif->device_id, ip_netif->phone, ip_netif->ipv);
+	printf("\tconfiguration\t= %s\n", ip_netif->dhcp ? "dhcp" : "static");
 	// TODO ipv6 addresses
-	data = ( char * ) malloc( INET_ADDRSTRLEN );
-	if( data ){
-		for( index = 0; index < ip_routes_count( & ip_netif->routes ); ++ index ){
-			route = ip_routes_get_index( & ip_netif->routes, index );
-			if( route ){
-				printf( "\tRouting %d:\n", index );
-				inet_ntop( AF_INET, ( uint8_t * ) & route->address.s_addr, data, INET_ADDRSTRLEN );
-				printf( "\t\taddress\t= %s\n", data );
-				inet_ntop( AF_INET, ( uint8_t * ) & route->netmask.s_addr, data, INET_ADDRSTRLEN );
-				printf( "\t\tnetmask\t= %s\n", data );
-				inet_ntop( AF_INET, ( uint8_t * ) & route->gateway.s_addr, data, INET_ADDRSTRLEN );
-				printf( "\t\tgateway\t= %s\n", data );
-			}
-		}
-		inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->broadcast.s_addr, data, INET_ADDRSTRLEN );
-		printf( "\t\tbroadcast\t= %s\n", data );
-		free( data );
-	}
-	fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+	data = (char *) malloc(INET_ADDRSTRLEN);
+	if(data){
+		for(index = 0; index < ip_routes_count(&ip_netif->routes); ++ index){
+			route = ip_routes_get_index(&ip_netif->routes, index);
+			if(route){
+				printf("\tRouting %d:\n", index);
+				inet_ntop(AF_INET, (uint8_t *) &route->address.s_addr, data, INET_ADDRSTRLEN);
+				printf("\t\taddress\t= %s\n", data);
+				inet_ntop(AF_INET, (uint8_t *) &route->netmask.s_addr, data, INET_ADDRSTRLEN);
+				printf("\t\tnetmask\t= %s\n", data);
+				inet_ntop(AF_INET, (uint8_t *) &route->gateway.s_addr, data, INET_ADDRSTRLEN);
+				printf("\t\tgateway\t= %s\n", data);
+			}
+		}
+		inet_ntop(AF_INET, (uint8_t *) &ip_netif->broadcast.s_addr, data, INET_ADDRSTRLEN);
+		printf("\t\tbroadcast\t= %s\n", data);
+		free(data);
+	}
+	fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 	return EOK;
 }
 
-int ip_netif_initialize( ip_netif_ref ip_netif ){
+int ip_netif_initialize(ip_netif_ref ip_netif){
 	ERROR_DECLARE;
 
-	measured_string_t	names[] = {{ str_dup("IPV"), 3 }, { str_dup("IP_CONFIG"), 9 }, { str_dup("IP_ADDR"), 7 }, { str_dup("IP_NETMASK"), 10 }, { str_dup("IP_GATEWAY"), 10 }, { str_dup("IP_BROADCAST"), 12 }, { str_dup("ARP"), 3 }, { str_dup("IP_ROUTING"), 10 }};
-	measured_string_ref	configuration;
-	size_t				count = sizeof( names ) / sizeof( measured_string_t );
-	char *				data;
-	measured_string_t	address;
-	int					index;
-	ip_route_ref		route;
-	in_addr_t			gateway;
+	measured_string_t names[] = {{str_dup("IPV"), 3}, {str_dup("IP_CONFIG"), 9}, {str_dup("IP_ADDR"), 7}, {str_dup("IP_NETMASK"), 10}, {str_dup("IP_GATEWAY"), 10}, {str_dup("IP_BROADCAST"), 12}, {str_dup("ARP"), 3}, {str_dup("IP_ROUTING"), 10}};
+	measured_string_ref configuration;
+	size_t count = sizeof(names) / sizeof(measured_string_t);
+	char * data;
+	measured_string_t address;
+	int index;
+	ip_route_ref route;
+	in_addr_t gateway;
 
 	ip_netif->arp = NULL;
@@ -493,20 +497,20 @@
 	ip_netif->dhcp = false;
 	ip_netif->routing = NET_DEFAULT_IP_ROUTING;
-	configuration = & names[ 0 ];
+	configuration = &names[0];
 	// get configuration
-	ERROR_PROPAGATE( net_get_device_conf_req( ip_globals.net_phone, ip_netif->device_id, & configuration, count, & data ));
-	if( configuration ){
-		if( configuration[ 0 ].value ){
-			ip_netif->ipv = strtol( configuration[ 0 ].value, NULL, 0 );
-		}
-		ip_netif->dhcp = ! str_lcmp( configuration[ 1 ].value, "dhcp", configuration[ 1 ].length );
-		if( ip_netif->dhcp ){
+	ERROR_PROPAGATE(net_get_device_conf_req(ip_globals.net_phone, ip_netif->device_id, &configuration, count, &data));
+	if(configuration){
+		if(configuration[0].value){
+			ip_netif->ipv = strtol(configuration[0].value, NULL, 0);
+		}
+		ip_netif->dhcp = ! str_lcmp(configuration[1].value, "dhcp", configuration[1].length);
+		if(ip_netif->dhcp){
 			// TODO dhcp
-			net_free_settings( configuration, data );
+			net_free_settings(configuration, data);
 			return ENOTSUP;
-		}else if( ip_netif->ipv == IPV4 ){
-			route = ( ip_route_ref ) malloc( sizeof( ip_route_t ));
-			if( ! route ){
-				net_free_settings( configuration, data );
+		}else if(ip_netif->ipv == IPV4){
+			route = (ip_route_ref) malloc(sizeof(ip_route_t));
+			if(! route){
+				net_free_settings(configuration, data);
 				return ENOMEM;
 			}
@@ -515,47 +519,47 @@
 			route->gateway.s_addr = 0;
 			route->netif = ip_netif;
-			index = ip_routes_add( & ip_netif->routes, route );
-			if( index < 0 ){
-				net_free_settings( configuration, data );
-				free( route );
+			index = ip_routes_add(&ip_netif->routes, route);
+			if(index < 0){
+				net_free_settings(configuration, data);
+				free(route);
 				return index;
 			}
-			if( ERROR_OCCURRED( inet_pton( AF_INET, configuration[ 2 ].value, ( uint8_t * ) & route->address.s_addr ))
-			|| ERROR_OCCURRED( inet_pton( AF_INET, configuration[ 3 ].value, ( uint8_t * ) & route->netmask.s_addr ))
-			|| ( inet_pton( AF_INET, configuration[ 4 ].value, ( uint8_t * ) & gateway.s_addr ) == EINVAL )
-			|| ( inet_pton( AF_INET, configuration[ 5 ].value, ( uint8_t * ) & ip_netif->broadcast.s_addr ) == EINVAL )){
-				net_free_settings( configuration, data );
+			if(ERROR_OCCURRED(inet_pton(AF_INET, configuration[2].value, (uint8_t *) &route->address.s_addr))
+				|| ERROR_OCCURRED(inet_pton(AF_INET, configuration[3].value, (uint8_t *) &route->netmask.s_addr))
+				|| (inet_pton(AF_INET, configuration[4].value, (uint8_t *) &gateway.s_addr) == EINVAL)
+				|| (inet_pton(AF_INET, configuration[5].value, (uint8_t *) &ip_netif->broadcast.s_addr) == EINVAL)){
+				net_free_settings(configuration, data);
 				return EINVAL;
 			}
 		}else{
 			// TODO ipv6 in separate module
-			net_free_settings( configuration, data );
+			net_free_settings(configuration, data);
 			return ENOTSUP;
 		}
-		if( configuration[ 6 ].value ){
-			ip_netif->arp = get_running_module( & ip_globals.modules, configuration[ 6 ].value );
-			if( ! ip_netif->arp ){
-				printf( "Failed to start the arp %s\n", configuration[ 6 ].value );
-				net_free_settings( configuration, data );
+		if(configuration[6].value){
+			ip_netif->arp = get_running_module(&ip_globals.modules, configuration[6].value);
+			if(! ip_netif->arp){
+				printf("Failed to start the arp %s\n", configuration[6].value);
+				net_free_settings(configuration, data);
 				return EINVAL;
 			}
 		}
-		if( configuration[ 7 ].value ){
-			ip_netif->routing = ( configuration[ 7 ].value[ 0 ] == 'y' );
-		}
-		net_free_settings( configuration, data );
+		if(configuration[7].value){
+			ip_netif->routing = (configuration[7].value[0] == 'y');
+		}
+		net_free_settings(configuration, data);
 	}
 	// binds the netif service which also initializes the device
-	ip_netif->phone = nil_bind_service( ip_netif->service, ( ipcarg_t ) ip_netif->device_id, SERVICE_IP, ip_globals.client_connection );
-	if( ip_netif->phone < 0 ){
-		printf( "Failed to contact the nil service %d\n", ip_netif->service );
+	ip_netif->phone = nil_bind_service(ip_netif->service, (ipcarg_t) ip_netif->device_id, SERVICE_IP, ip_globals.client_connection);
+	if(ip_netif->phone < 0){
+		printf("Failed to contact the nil service %d\n", ip_netif->service);
 		return ip_netif->phone;
 	}
 	// has to be after the device netif module initialization
-	if( ip_netif->arp ){
-		if( route ){
-			address.value = ( char * ) & route->address.s_addr;
-			address.length = CONVERT_SIZE( in_addr_t, char, 1 );
-			ERROR_PROPAGATE( arp_device_req( ip_netif->arp->phone, ip_netif->device_id, SERVICE_IP, ip_netif->service, & address ));
+	if(ip_netif->arp){
+		if(route){
+			address.value = (char *) &route->address.s_addr;
+			address.length = CONVERT_SIZE(in_addr_t, char, 1);
+			ERROR_PROPAGATE(arp_device_req(ip_netif->arp->phone, ip_netif->device_id, SERVICE_IP, ip_netif->service, &address));
 		}else{
 			ip_netif->arp = 0;
@@ -563,12 +567,14 @@
 	}
 	// get packet dimensions
-	ERROR_PROPAGATE( nil_packet_size_req( ip_netif->phone, ip_netif->device_id, & ip_netif->packet_dimension ));
-	if( ip_netif->packet_dimension.content < IP_MIN_CONTENT ){
-		printf( "Maximum transmission unit %d bytes is too small, at least %d bytes are needed\n", ip_netif->packet_dimension.content, IP_MIN_CONTENT );
+	ERROR_PROPAGATE(nil_packet_size_req(ip_netif->phone, ip_netif->device_id, &ip_netif->packet_dimension));
+	if(ip_netif->packet_dimension.content < IP_MIN_CONTENT){
+		printf("Maximum transmission unit %d bytes is too small, at least %d bytes are needed\n", ip_netif->packet_dimension.content, IP_MIN_CONTENT);
 		ip_netif->packet_dimension.content = IP_MIN_CONTENT;
 	}
-	index = ip_netifs_add( & ip_globals.netifs, ip_netif->device_id, ip_netif );
-	if( index < 0 ) return index;
-	if( gateway.s_addr ){
+	index = ip_netifs_add(&ip_globals.netifs, ip_netif->device_id, ip_netif);
+	if(index < 0){
+		return index;
+	}
+	if(gateway.s_addr){
 		// the default gateway
 		ip_globals.gateway.address.s_addr = 0;
@@ -580,96 +586,100 @@
 }
 
-int ip_mtu_changed_message( device_id_t device_id, size_t mtu ){
-	ip_netif_ref	netif;
-
-	fibril_rwlock_write_lock( & ip_globals.netifs_lock );
-	netif = ip_netifs_find( & ip_globals.netifs, device_id );
-	if( ! netif ){
-		fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+int ip_mtu_changed_message(device_id_t device_id, size_t mtu){
+	ip_netif_ref netif;
+
+	fibril_rwlock_write_lock(&ip_globals.netifs_lock);
+	netif = ip_netifs_find(&ip_globals.netifs, device_id);
+	if(! netif){
+		fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 		return ENOENT;
 	}
 	netif->packet_dimension.content = mtu;
-	printf( "ip - device %d changed mtu to %d\n\n", device_id, mtu );
-	fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+	printf("ip - device %d changed mtu to %d\n\n", device_id, mtu);
+	fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 	return EOK;
 }
 
-int ip_device_state_message( device_id_t device_id, device_state_t state ){
-	ip_netif_ref	netif;
-
-	fibril_rwlock_write_lock( & ip_globals.netifs_lock );
+int ip_device_state_message(device_id_t device_id, device_state_t state){
+	ip_netif_ref netif;
+
+	fibril_rwlock_write_lock(&ip_globals.netifs_lock);
 	// find the device
-	netif = ip_netifs_find( & ip_globals.netifs, device_id );
-	if( ! netif ){
-		fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+	netif = ip_netifs_find(&ip_globals.netifs, device_id);
+	if(! netif){
+		fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 		return ENOENT;
 	}
 	netif->state = state;
-	printf( "ip - device %d changed state to %d\n\n", device_id, state );
-	fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+	printf("ip - device %d changed state to %d\n\n", device_id, state);
+	fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 	return EOK;
 }
 
-int ip_connect_module( services_t service ){
+int ip_connect_module(services_t service){
 	return EOK;
 }
 
-int ip_bind_service( services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t received_msg ){
-	return ip_register( protocol, me, 0, received_msg );
-}
-
-int ip_register( int protocol, services_t service, int phone, tl_received_msg_t received_msg ){
-	ip_proto_ref	proto;
-	int				index;
-
-	if( !( protocol && service && (( phone > 0 ) || ( received_msg )))) return EINVAL;
-	proto = ( ip_proto_ref ) malloc( sizeof( ip_protos_t ));
-	if( ! proto ) return ENOMEM;
+int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t received_msg){
+	return ip_register(protocol, me, 0, received_msg);
+}
+
+int ip_register(int protocol, services_t service, int phone, tl_received_msg_t received_msg){
+	ip_proto_ref proto;
+	int index;
+
+	if(!(protocol && service && ((phone > 0) || (received_msg)))){
+		return EINVAL;
+	}
+	proto = (ip_proto_ref) malloc(sizeof(ip_protos_t));
+	if(! proto){
+		return ENOMEM;
+	}
 	proto->protocol = protocol;
 	proto->service = service;
 	proto->phone = phone;
 	proto->received_msg = received_msg;
-	fibril_rwlock_write_lock( & ip_globals.protos_lock );
-	index = ip_protos_add( & ip_globals.protos, proto->protocol, proto );
-	if( index < 0 ){
-		fibril_rwlock_write_unlock( & ip_globals.protos_lock );
-		free( proto );
+	fibril_rwlock_write_lock(&ip_globals.protos_lock);
+	index = ip_protos_add(&ip_globals.protos, proto->protocol, proto);
+	if(index < 0){
+		fibril_rwlock_write_unlock(&ip_globals.protos_lock);
+		free(proto);
 		return index;
 	}
-	printf( "New protocol registered:\n\tprotocol\t= %d\n\tphone\t= %d\n", proto->protocol, proto->phone );
-	fibril_rwlock_write_unlock( & ip_globals.protos_lock );
+	printf("New protocol registered:\n\tprotocol\t= %d\n\tphone\t= %d\n", proto->protocol, proto->phone);
+	fibril_rwlock_write_unlock(&ip_globals.protos_lock);
 	return EOK;
 }
 
-int ip_send_msg( int il_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error ){
+int ip_send_msg(int il_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error){
 	ERROR_DECLARE;
 
-	int					addrlen;
-	ip_netif_ref		netif;
-	ip_route_ref		route;
-	struct sockaddr *		addr;
-	struct sockaddr_in *	address_in;
+	int addrlen;
+	ip_netif_ref netif;
+	ip_route_ref route;
+	struct sockaddr * addr;
+	struct sockaddr_in * address_in;
 //	struct sockaddr_in6 *	address_in6;
-	in_addr_t *			dest;
-	in_addr_t *			src;
-	int					phone;
+	in_addr_t * dest;
+	in_addr_t * src;
+	int phone;
 
 	// addresses in the host byte order
 	// should be the next hop address or the target destination address
-	addrlen = packet_get_addr( packet, NULL, ( uint8_t ** ) & addr );
-	if( addrlen < 0 ){
-		return ip_release_and_return( packet, addrlen );
-	}
-	if(( size_t ) addrlen < sizeof( struct sockaddr )){
-		return ip_release_and_return( packet, EINVAL );
-	}
-	switch( addr->sa_family ){
+	addrlen = packet_get_addr(packet, NULL, (uint8_t **) &addr);
+	if(addrlen < 0){
+		return ip_release_and_return(packet, addrlen);
+	}
+	if((size_t) addrlen < sizeof(struct sockaddr)){
+		return ip_release_and_return(packet, EINVAL);
+	}
+	switch(addr->sa_family){
 		case AF_INET:
-			if( addrlen != sizeof( struct sockaddr_in )){
-				return ip_release_and_return( packet, EINVAL );
-			}
-			address_in = ( struct sockaddr_in * ) addr;
-			dest = & address_in->sin_addr;
-			if( ! dest->s_addr ){
+			if(addrlen != sizeof(struct sockaddr_in)){
+				return ip_release_and_return(packet, EINVAL);
+			}
+			address_in = (struct sockaddr_in *) addr;
+			dest = &address_in->sin_addr;
+			if(! dest->s_addr){
 				dest->s_addr = IPV4_LOCALHOST_ADDRESS;
 			}
@@ -677,135 +687,139 @@
 		// TODO IPv6
 /*		case AF_INET6:
-			if( addrlen != sizeof( struct sockaddr_in6 )) return EINVAL;
-			address_in6 = ( struct sockaddr_in6 * ) dest;
+			if(addrlen != sizeof(struct sockaddr_in6)){
+				return EINVAL;
+			}
+			address_in6 = (struct sockaddr_in6 *) dest;
 			address_in6.sin6_addr.s6_addr;
 			IPV6_LOCALHOST_ADDRESS;
 */		default:
-			return ip_release_and_return( packet, EAFNOSUPPORT );
-	}
-	fibril_rwlock_read_lock( & ip_globals.netifs_lock );
+			return ip_release_and_return(packet, EAFNOSUPPORT);
+	}
+	fibril_rwlock_read_lock(&ip_globals.netifs_lock);
 	// device specified?
-	if( device_id > 0 ){
-		netif = ip_netifs_find( & ip_globals.netifs, device_id );
-		route = ip_netif_find_route( netif, * dest );
-		if( netif && ( ! route ) && ( ip_globals.gateway.netif == netif )){
-			route = & ip_globals.gateway;
+	if(device_id > 0){
+		netif = ip_netifs_find(&ip_globals.netifs, device_id);
+		route = ip_netif_find_route(netif, * dest);
+		if(netif && (! route) && (ip_globals.gateway.netif == netif)){
+			route = &ip_globals.gateway;
 		}
 	}else{
-		route = ip_find_route( * dest );
+		route = ip_find_route(*dest);
 		netif = route ? route->netif : NULL;
 	}
-	if( !( netif && route )){
-		fibril_rwlock_read_unlock( & ip_globals.netifs_lock );
-		phone = ip_prepare_icmp_and_get_phone( error, packet, NULL );
-		if( phone >= 0 ){
+	if(!(netif && route)){
+		fibril_rwlock_read_unlock(&ip_globals.netifs_lock);
+		phone = ip_prepare_icmp_and_get_phone(error, packet, NULL);
+		if(phone >= 0){
 			// unreachable ICMP if no routing
-			icmp_destination_unreachable_msg( phone, ICMP_NET_UNREACH, 0, packet );
+			icmp_destination_unreachable_msg(phone, ICMP_NET_UNREACH, 0, packet);
 		}
 		return ENOENT;
 	}
-	if( error ){
+	if(error){
 		// do not send for broadcast, anycast packets or network broadcast
-		if(( ! dest->s_addr )
-		|| ( !( ~ dest->s_addr ))
-		|| ( !( ~(( dest->s_addr & ( ~ route->netmask.s_addr )) | route->netmask.s_addr )))
-		|| ( !( dest->s_addr & ( ~ route->netmask.s_addr )))){
-			return ip_release_and_return( packet, EINVAL );
-		}
-	}
-	if( route->address.s_addr == dest->s_addr ){
+		if((! dest->s_addr)
+			|| (!(~ dest->s_addr))
+			|| (!(~((dest->s_addr &(~ route->netmask.s_addr)) | route->netmask.s_addr)))
+			|| (!(dest->s_addr &(~ route->netmask.s_addr)))){
+			return ip_release_and_return(packet, EINVAL);
+		}
+	}
+	if(route->address.s_addr == dest->s_addr){
 		// find the loopback device to deliver
 		dest->s_addr = IPV4_LOCALHOST_ADDRESS;
-		route = ip_find_route( * dest );
+		route = ip_find_route(*dest);
 		netif = route ? route->netif : NULL;
-		if( !( netif && route )){
-			fibril_rwlock_read_unlock( & ip_globals.netifs_lock );
-			phone = ip_prepare_icmp_and_get_phone( error, packet, NULL );
-			if( phone >= 0 ){
+		if(!(netif && route)){
+			fibril_rwlock_read_unlock(&ip_globals.netifs_lock);
+			phone = ip_prepare_icmp_and_get_phone(error, packet, NULL);
+			if(phone >= 0){
 				// unreachable ICMP if no routing
-				icmp_destination_unreachable_msg( phone, ICMP_HOST_UNREACH, 0, packet );
+				icmp_destination_unreachable_msg(phone, ICMP_HOST_UNREACH, 0, packet);
 			}
 			return ENOENT;
 		}
 	}
-	src = ip_netif_address( netif );
-	if( ! src ){
-		fibril_rwlock_read_unlock( & ip_globals.netifs_lock );
-		return ip_release_and_return( packet, ENOENT );
-	}
-	ERROR_CODE = ip_send_route( packet, netif, route, src, * dest, error );
-	fibril_rwlock_read_unlock( & ip_globals.netifs_lock );
+	src = ip_netif_address(netif);
+	if(! src){
+		fibril_rwlock_read_unlock(&ip_globals.netifs_lock);
+		return ip_release_and_return(packet, ENOENT);
+	}
+	ERROR_CODE = ip_send_route(packet, netif, route, src, * dest, error);
+	fibril_rwlock_read_unlock(&ip_globals.netifs_lock);
 	return ERROR_CODE;
 }
 
-in_addr_t * ip_netif_address( ip_netif_ref netif ){
-	ip_route_ref	route;
-
-	route = ip_routes_get_index( & netif->routes, 0 );
-	return route ? & route->address : NULL;
-}
-
-int ip_send_route( packet_t packet, ip_netif_ref netif, ip_route_ref route, in_addr_t * src, in_addr_t dest, services_t error ){
+in_addr_t * ip_netif_address(ip_netif_ref netif){
+	ip_route_ref route;
+
+	route = ip_routes_get_index(&netif->routes, 0);
+	return route ? &route->address : NULL;
+}
+
+int ip_send_route(packet_t packet, ip_netif_ref netif, ip_route_ref route, in_addr_t * src, in_addr_t dest, services_t error){
 	ERROR_DECLARE;
 
-	measured_string_t	destination;
-	measured_string_ref	translation;
-	char *				data;
-	int					phone;
+	measured_string_t destination;
+	measured_string_ref translation;
+	char * data;
+	int phone;
 
 	// get destination hardware address
-	if( netif->arp && ( route->address.s_addr != dest.s_addr )){
-		destination.value = route->gateway.s_addr ? ( char * ) & route->gateway.s_addr : ( char * ) & dest.s_addr;
-		destination.length = CONVERT_SIZE( dest.s_addr, char, 1 );
-		if( ERROR_OCCURRED( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & destination, & translation, & data ))){
-//			sleep( 1 );
-//			ERROR_PROPAGATE( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & destination, & translation, & data ));
-			pq_release( ip_globals.net_phone, packet_get_id( packet ));
+	if(netif->arp && (route->address.s_addr != dest.s_addr)){
+		destination.value = route->gateway.s_addr ? (char *) &route->gateway.s_addr : (char *) &dest.s_addr;
+		destination.length = CONVERT_SIZE(dest.s_addr, char, 1);
+		if(ERROR_OCCURRED(arp_translate_req(netif->arp->phone, netif->device_id, SERVICE_IP, &destination, &translation, &data))){
+//			sleep(1);
+//			ERROR_PROPAGATE(arp_translate_req(netif->arp->phone, netif->device_id, SERVICE_IP, &destination, &translation, &data));
+			pq_release(ip_globals.net_phone, packet_get_id(packet));
 			return ERROR_CODE;
 		}
-		if( !( translation && translation->value )){
-			if( translation ){
-				free( translation );
-				free( data );
-			}
-			phone = ip_prepare_icmp_and_get_phone( error, packet, NULL );
-			if( phone >= 0 ){
+		if(!(translation && translation->value)){
+			if(translation){
+				free(translation);
+				free(data);
+			}
+			phone = ip_prepare_icmp_and_get_phone(error, packet, NULL);
+			if(phone >= 0){
 				// unreachable ICMP if no routing
-				icmp_destination_unreachable_msg( phone, ICMP_HOST_UNREACH, 0, packet );
+				icmp_destination_unreachable_msg(phone, ICMP_HOST_UNREACH, 0, packet);
 			}
 			return EINVAL;
 		}
 	}else translation = NULL;
-	if( ERROR_OCCURRED( ip_prepare_packet( src, dest, packet, translation ))){
-		pq_release( ip_globals.net_phone, packet_get_id( packet ));
+	if(ERROR_OCCURRED(ip_prepare_packet(src, dest, packet, translation))){
+		pq_release(ip_globals.net_phone, packet_get_id(packet));
 	}else{
-		packet = ip_split_packet( packet, netif->packet_dimension.prefix, netif->packet_dimension.content, netif->packet_dimension.suffix, netif->packet_dimension.addr_len, error );
-		if( packet ){
-			nil_send_msg( netif->phone, netif->device_id, packet, SERVICE_IP );
-		}
-	}
-	if( translation ){
-		free( translation );
-		free( data );
+		packet = ip_split_packet(packet, netif->packet_dimension.prefix, netif->packet_dimension.content, netif->packet_dimension.suffix, netif->packet_dimension.addr_len, error);
+		if(packet){
+			nil_send_msg(netif->phone, netif->device_id, packet, SERVICE_IP);
+		}
+	}
+	if(translation){
+		free(translation);
+		free(data);
 	}
 	return ERROR_CODE;
 }
 
-int ip_prepare_packet( in_addr_t * source, in_addr_t dest, packet_t packet, measured_string_ref destination ){
+int ip_prepare_packet(in_addr_t * source, in_addr_t dest, packet_t packet, measured_string_ref destination){
 	ERROR_DECLARE;
 
-	size_t				length;
-	ip_header_ref		header;
-	ip_header_ref		last_header;
-	ip_header_ref		middle_header;
-	packet_t			next;
-
-	length = packet_get_data_length( packet );
-	if(( length < sizeof( ip_header_t )) || ( length > IP_MAX_CONTENT )) return EINVAL;
-	header = ( ip_header_ref ) packet_get_data( packet );
-	if( destination ){
-		ERROR_PROPAGATE( packet_set_addr( packet, NULL, ( uint8_t * ) destination->value, CONVERT_SIZE( char, uint8_t, destination->length )));
+	size_t length;
+	ip_header_ref header;
+	ip_header_ref last_header;
+	ip_header_ref middle_header;
+	packet_t next;
+
+	length = packet_get_data_length(packet);
+	if((length < sizeof(ip_header_t)) || (length > IP_MAX_CONTENT)){
+		return EINVAL;
+	}
+	header = (ip_header_ref) packet_get_data(packet);
+	if(destination){
+		ERROR_PROPAGATE(packet_set_addr(packet, NULL, (uint8_t *) destination->value, CONVERT_SIZE(char, uint8_t, destination->length)));
 	}else{
-		ERROR_PROPAGATE( packet_set_addr( packet, NULL, NULL, 0 ));
+		ERROR_PROPAGATE(packet_set_addr(packet, NULL, NULL, 0));
 	}
 	header->version = IPV4;
@@ -813,157 +827,175 @@
 	header->fragment_offset_low = 0;
 	header->header_checksum = 0;
-	if( source ) header->source_address = source->s_addr;
+	if(source){
+		header->source_address = source->s_addr;
+	}
 	header->destination_address = dest.s_addr;
-	fibril_rwlock_write_lock( & ip_globals.lock );
+	fibril_rwlock_write_lock(&ip_globals.lock);
 	++ ip_globals.packet_counter;
-	header->identification = htons( ip_globals.packet_counter );
-	fibril_rwlock_write_unlock( & ip_globals.lock );
-//	length = packet_get_data_length( packet );
-	if( pq_next( packet )){
-		last_header = ( ip_header_ref ) malloc( IP_HEADER_LENGTH( header ));
-		if( ! last_header ) return ENOMEM;
-		ip_create_last_header( last_header, header );
-		next = pq_next( packet );
-		while( pq_next( next )){
-			middle_header = ( ip_header_ref ) packet_prefix( next, IP_HEADER_LENGTH( last_header ));
-			if( ! middle_header ) return ENOMEM;
-			memcpy( middle_header, last_header, IP_HEADER_LENGTH( last_header ));
+	header->identification = htons(ip_globals.packet_counter);
+	fibril_rwlock_write_unlock(&ip_globals.lock);
+//	length = packet_get_data_length(packet);
+	if(pq_next(packet)){
+		last_header = (ip_header_ref) malloc(IP_HEADER_LENGTH(header));
+		if(! last_header){
+			return ENOMEM;
+		}
+		ip_create_last_header(last_header, header);
+		next = pq_next(packet);
+		while(pq_next(next)){
+			middle_header = (ip_header_ref) packet_prefix(next, IP_HEADER_LENGTH(last_header));
+			if(! middle_header){
+				return ENOMEM;
+			}
+			memcpy(middle_header, last_header, IP_HEADER_LENGTH(last_header));
 			header->flags |= IPFLAG_MORE_FRAGMENTS;
-			middle_header->total_length = htons( packet_get_data_length( next ));
-			middle_header->fragment_offset_high = IP_COMPUTE_FRAGMENT_OFFSET_HIGH( length );
-			middle_header->fragment_offset_low = IP_COMPUTE_FRAGMENT_OFFSET_LOW( length );
-			middle_header->header_checksum = IP_HEADER_CHECKSUM( middle_header );
-			if( destination ){
-				ERROR_PROPAGATE( packet_set_addr( next, NULL, ( uint8_t * ) destination->value, CONVERT_SIZE( char, uint8_t, destination->length )));
-			}
-			length += packet_get_data_length( next );
-			next = pq_next( next );
-		}
-		middle_header = ( ip_header_ref ) packet_prefix( next, IP_HEADER_LENGTH( last_header ));
-		if( ! middle_header ) return ENOMEM;
-		memcpy( middle_header, last_header, IP_HEADER_LENGTH( last_header ));
-		middle_header->total_length = htons( packet_get_data_length( next ));
-		middle_header->fragment_offset_high = IP_COMPUTE_FRAGMENT_OFFSET_HIGH( length );
-		middle_header->fragment_offset_low = IP_COMPUTE_FRAGMENT_OFFSET_LOW( length );
-		middle_header->header_checksum = IP_HEADER_CHECKSUM( middle_header );
-		if( destination ){
-			ERROR_PROPAGATE( packet_set_addr( next, NULL, ( uint8_t * ) destination->value, CONVERT_SIZE( char, uint8_t, destination->length )));
-		}
-		length += packet_get_data_length( next );
-		free( last_header );
+			middle_header->total_length = htons(packet_get_data_length(next));
+			middle_header->fragment_offset_high = IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length);
+			middle_header->fragment_offset_low = IP_COMPUTE_FRAGMENT_OFFSET_LOW(length);
+			middle_header->header_checksum = IP_HEADER_CHECKSUM(middle_header);
+			if(destination){
+				ERROR_PROPAGATE(packet_set_addr(next, NULL, (uint8_t *) destination->value, CONVERT_SIZE(char, uint8_t, destination->length)));
+			}
+			length += packet_get_data_length(next);
+			next = pq_next(next);
+		}
+		middle_header = (ip_header_ref) packet_prefix(next, IP_HEADER_LENGTH(last_header));
+		if(! middle_header){
+			return ENOMEM;
+		}
+		memcpy(middle_header, last_header, IP_HEADER_LENGTH(last_header));
+		middle_header->total_length = htons(packet_get_data_length(next));
+		middle_header->fragment_offset_high = IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length);
+		middle_header->fragment_offset_low = IP_COMPUTE_FRAGMENT_OFFSET_LOW(length);
+		middle_header->header_checksum = IP_HEADER_CHECKSUM(middle_header);
+		if(destination){
+			ERROR_PROPAGATE(packet_set_addr(next, NULL, (uint8_t *) destination->value, CONVERT_SIZE(char, uint8_t, destination->length)));
+		}
+		length += packet_get_data_length(next);
+		free(last_header);
 		header->flags |= IPFLAG_MORE_FRAGMENTS;
 	}
-	header->total_length = htons( length );
+	header->total_length = htons(length);
 	// unnecessary for all protocols
-	header->header_checksum = IP_HEADER_CHECKSUM( header );
+	header->header_checksum = IP_HEADER_CHECKSUM(header);
 	return EOK;
 }
 
-int ip_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+int ip_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
-	packet_t				packet;
-	struct sockaddr *		addr;
-	size_t					addrlen;
-	ip_pseudo_header_ref	header;
-	size_t					headerlen;
-
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+	packet_t packet;
+	struct sockaddr * addr;
+	size_t addrlen;
+	ip_pseudo_header_ref header;
+	size_t headerlen;
+
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_IL_DEVICE:
-			return ip_device_req( 0, IPC_GET_DEVICE( call ), IPC_GET_SERVICE( call ));
+			return ip_device_req(0, IPC_GET_DEVICE(call), IPC_GET_SERVICE(call));
 		case IPC_M_CONNECT_TO_ME:
-			return ip_register( IL_GET_PROTO( call ), IL_GET_SERVICE( call ), IPC_GET_PHONE( call ), NULL );
+			return ip_register(IL_GET_PROTO(call), IL_GET_SERVICE(call), IPC_GET_PHONE(call), NULL);
 		case NET_IL_SEND:
-			ERROR_PROPAGATE( packet_translate( ip_globals.net_phone, & packet, IPC_GET_PACKET( call )));
-			return ip_send_msg( 0, IPC_GET_DEVICE( call ), packet, 0, IPC_GET_ERROR( call ));
+			ERROR_PROPAGATE(packet_translate(ip_globals.net_phone, &packet, IPC_GET_PACKET(call)));
+			return ip_send_msg(0, IPC_GET_DEVICE(call), packet, 0, IPC_GET_ERROR(call));
 		case NET_IL_DEVICE_STATE:
-			return ip_device_state_message( IPC_GET_DEVICE( call ), IPC_GET_STATE( call ));
+			return ip_device_state_message(IPC_GET_DEVICE(call), IPC_GET_STATE(call));
 		case NET_IL_RECEIVED:
-			ERROR_PROPAGATE( packet_translate( ip_globals.net_phone, & packet, IPC_GET_PACKET( call )));
-			return ip_receive_message( IPC_GET_DEVICE( call ), packet );
+			ERROR_PROPAGATE(packet_translate(ip_globals.net_phone, &packet, IPC_GET_PACKET(call)));
+			return ip_receive_message(IPC_GET_DEVICE(call), packet);
 		case NET_IP_RECEIVED_ERROR:
-			ERROR_PROPAGATE( packet_translate( ip_globals.net_phone, & packet, IPC_GET_PACKET( call )));
-			return ip_received_error_msg( 0, IPC_GET_DEVICE( call ), packet, IPC_GET_TARGET( call ), IPC_GET_ERROR( call ));
+			ERROR_PROPAGATE(packet_translate(ip_globals.net_phone, &packet, IPC_GET_PACKET(call)));
+			return ip_received_error_msg(0, IPC_GET_DEVICE(call), packet, IPC_GET_TARGET(call), IPC_GET_ERROR(call));
 		case NET_IP_ADD_ROUTE:
-			return ip_add_route_req( 0, IPC_GET_DEVICE( call ), IP_GET_ADDRESS( call ), IP_GET_NETMASK( call ), IP_GET_GATEWAY( call ));
+			return ip_add_route_req(0, IPC_GET_DEVICE(call), IP_GET_ADDRESS(call), IP_GET_NETMASK(call), IP_GET_GATEWAY(call));
 		case NET_IP_SET_GATEWAY:
-			return ip_set_gateway_req( 0, IPC_GET_DEVICE( call ), IP_GET_GATEWAY( call ));
+			return ip_set_gateway_req(0, IPC_GET_DEVICE(call), IP_GET_GATEWAY(call));
 		case NET_IP_GET_ROUTE:
-			ERROR_PROPAGATE( data_receive(( void ** ) & addr, & addrlen ));
-			ERROR_PROPAGATE( ip_get_route_req( 0, IP_GET_PROTOCOL( call ), addr, ( socklen_t ) addrlen, IPC_SET_DEVICE( answer ), & header, & headerlen ));
-			* IP_SET_HEADERLEN( answer ) = headerlen;
-			* answer_count = 2;
-			if( ! ERROR_OCCURRED( data_reply( & headerlen, sizeof( headerlen )))){
-				ERROR_CODE = data_reply( header, headerlen );
-			}
-			free( header );
+			ERROR_PROPAGATE(data_receive((void **) &addr, &addrlen));
+			ERROR_PROPAGATE(ip_get_route_req(0, IP_GET_PROTOCOL(call), addr, (socklen_t) addrlen, IPC_SET_DEVICE(answer), &header, &headerlen));
+			*IP_SET_HEADERLEN(answer) = headerlen;
+			*answer_count = 2;
+			if(! ERROR_OCCURRED(data_reply(&headerlen, sizeof(headerlen)))){
+				ERROR_CODE = data_reply(header, headerlen);
+			}
+			free(header);
 			return ERROR_CODE;
 		case NET_IL_PACKET_SPACE:
-			ERROR_PROPAGATE( ip_packet_size_message( IPC_GET_DEVICE( call ), IPC_SET_ADDR( answer ), IPC_SET_PREFIX( answer ), IPC_SET_CONTENT( answer ), IPC_SET_SUFFIX( answer )));
-			* answer_count = 3;
+			ERROR_PROPAGATE(ip_packet_size_message(IPC_GET_DEVICE(call), IPC_SET_ADDR(answer), IPC_SET_PREFIX(answer), IPC_SET_CONTENT(answer), IPC_SET_SUFFIX(answer)));
+			*answer_count = 3;
 			return EOK;
 		case NET_IL_MTU_CHANGED:
-			return ip_mtu_changed_message( IPC_GET_DEVICE( call ), IPC_GET_MTU( call ));
+			return ip_mtu_changed_message(IPC_GET_DEVICE(call), IPC_GET_MTU(call));
 	}
 	return ENOTSUP;
 }
 
-int ip_packet_size_req( int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension ){
-	if( ! packet_dimension ) return EBADMEM;
-	return ip_packet_size_message( device_id, & packet_dimension->addr_len, & packet_dimension->prefix, & packet_dimension->content, & packet_dimension->suffix );
-}
-
-int ip_packet_size_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ){
-	ip_netif_ref	netif;
-	int				index;
-
-	if( !( addr_len && prefix && content && suffix )) return EBADMEM;
-	* content = IP_MAX_CONTENT - IP_PREFIX;
-	fibril_rwlock_read_lock( & ip_globals.netifs_lock );
-	if( device_id < 0 ){
-		* addr_len = IP_ADDR;
-		* prefix = 0;
-		* suffix = 0;
-		for( index = ip_netifs_count( & ip_globals.netifs ) - 1; index >= 0; -- index ){
-			netif = ip_netifs_get_index( & ip_globals.netifs, index );
-			if( netif ){
-				if( netif->packet_dimension.addr_len > * addr_len ) * addr_len = netif->packet_dimension.addr_len;
-				if( netif->packet_dimension.prefix > * prefix ) * prefix = netif->packet_dimension.prefix;
-				if( netif->packet_dimension.suffix > * suffix ) * suffix = netif->packet_dimension.suffix;
-			}
-		}
-		* prefix = * prefix + IP_PREFIX;
-		* suffix = * suffix + IP_SUFFIX;
+int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension){
+	if(! packet_dimension){
+		return EBADMEM;
+	}
+	return ip_packet_size_message(device_id, &packet_dimension->addr_len, &packet_dimension->prefix, &packet_dimension->content, &packet_dimension->suffix);
+}
+
+int ip_packet_size_message(device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix){
+	ip_netif_ref netif;
+	int index;
+
+	if(!(addr_len && prefix && content && suffix)){
+		return EBADMEM;
+	}
+	*content = IP_MAX_CONTENT - IP_PREFIX;
+	fibril_rwlock_read_lock(&ip_globals.netifs_lock);
+	if(device_id < 0){
+		*addr_len = IP_ADDR;
+		*prefix = 0;
+		*suffix = 0;
+		for(index = ip_netifs_count(&ip_globals.netifs) - 1; index >= 0; -- index){
+			netif = ip_netifs_get_index(&ip_globals.netifs, index);
+			if(netif){
+				if(netif->packet_dimension.addr_len > * addr_len){
+					*addr_len = netif->packet_dimension.addr_len;
+				}
+				if(netif->packet_dimension.prefix > * prefix){
+					*prefix = netif->packet_dimension.prefix;
+				}
+				if(netif->packet_dimension.suffix > * suffix){
+					*suffix = netif->packet_dimension.suffix;
+				}
+			}
+		}
+		*prefix = * prefix + IP_PREFIX;
+		*suffix = * suffix + IP_SUFFIX;
 	}else{
-		netif = ip_netifs_find( & ip_globals.netifs, device_id );
-		if( ! netif ){
-			fibril_rwlock_read_unlock( & ip_globals.netifs_lock );
+		netif = ip_netifs_find(&ip_globals.netifs, device_id);
+		if(! netif){
+			fibril_rwlock_read_unlock(&ip_globals.netifs_lock);
 			return ENOENT;
 		}
-		* addr_len = ( netif->packet_dimension.addr_len > IP_ADDR ) ? netif->packet_dimension.addr_len : IP_ADDR;
-		* prefix = netif->packet_dimension.prefix + IP_PREFIX;
-		* suffix = netif->packet_dimension.suffix + IP_SUFFIX;
-	}
-	fibril_rwlock_read_unlock( & ip_globals.netifs_lock );
+		*addr_len = (netif->packet_dimension.addr_len > IP_ADDR) ? netif->packet_dimension.addr_len : IP_ADDR;
+		*prefix = netif->packet_dimension.prefix + IP_PREFIX;
+		*suffix = netif->packet_dimension.suffix + IP_SUFFIX;
+	}
+	fibril_rwlock_read_unlock(&ip_globals.netifs_lock);
 	return EOK;
 }
 
-int ip_add_route_req( int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway ){
-	ip_route_ref	route;
-	ip_netif_ref	netif;
-	int				index;
-
-	fibril_rwlock_write_lock( & ip_globals.netifs_lock );
-	netif = ip_netifs_find( & ip_globals.netifs, device_id );
-	if( ! netif ){
-		fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway){
+	ip_route_ref route;
+	ip_netif_ref netif;
+	int index;
+
+	fibril_rwlock_write_lock(&ip_globals.netifs_lock);
+	netif = ip_netifs_find(&ip_globals.netifs, device_id);
+	if(! netif){
+		fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 		return ENOENT;
 	}
-	route = ( ip_route_ref ) malloc( sizeof( ip_route_t ));
-	if( ! route ){
-		fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+	route = (ip_route_ref) malloc(sizeof(ip_route_t));
+	if(! route){
+		fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 		return ENOMEM;
 	}
@@ -972,37 +1004,41 @@
 	route->gateway.s_addr = gateway.s_addr;
 	route->netif = netif;
-	index = ip_routes_add( & netif->routes, route );
-	if( index < 0 ) free( route );
-	fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+	index = ip_routes_add(&netif->routes, route);
+	if(index < 0){
+		free(route);
+	}
+	fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 	return index;
 }
 
-ip_route_ref ip_find_route( in_addr_t destination ){
-	int				index;
-	ip_route_ref	route;
-	ip_netif_ref	netif;
+ip_route_ref ip_find_route(in_addr_t destination){
+	int index;
+	ip_route_ref route;
+	ip_netif_ref netif;
 
 	// start with the last netif - the newest one
-	index = ip_netifs_count( & ip_globals.netifs ) - 1;
-	while( index >= 0 ){
-		netif = ip_netifs_get_index( & ip_globals.netifs, index );
-		if( netif && ( netif->state == NETIF_ACTIVE )){
-			route = ip_netif_find_route( netif, destination );
-			if( route ) return route;
+	index = ip_netifs_count(&ip_globals.netifs) - 1;
+	while(index >= 0){
+		netif = ip_netifs_get_index(&ip_globals.netifs, index);
+		if(netif && (netif->state == NETIF_ACTIVE)){
+			route = ip_netif_find_route(netif, destination);
+			if(route){
+				return route;
+			}
 		}
 		-- index;
 	}
-	return & ip_globals.gateway;
-}
-
-ip_route_ref ip_netif_find_route( ip_netif_ref netif, in_addr_t destination ){
-	int				index;
-	ip_route_ref	route;
-
-	if( netif ){
+	return &ip_globals.gateway;
+}
+
+ip_route_ref ip_netif_find_route(ip_netif_ref netif, in_addr_t destination){
+	int index;
+	ip_route_ref route;
+
+	if(netif){
 		// start with the first one - the direct route
-		for( index = 0; index < ip_routes_count( & netif->routes ); ++ index ){
-			route = ip_routes_get_index( & netif->routes, index );
-			if( route && (( route->address.s_addr & route->netmask.s_addr ) == ( destination.s_addr & route->netmask.s_addr ))){
+		for(index = 0; index < ip_routes_count(&netif->routes); ++ index){
+			route = ip_routes_get_index(&netif->routes, index);
+			if(route && ((route->address.s_addr &route->netmask.s_addr) == (destination.s_addr &route->netmask.s_addr))){
 				return route;
 			}
@@ -1012,11 +1048,11 @@
 }
 
-int ip_set_gateway_req( int ip_phone, device_id_t device_id, in_addr_t gateway ){
-	ip_netif_ref	netif;
-
-	fibril_rwlock_write_lock( & ip_globals.netifs_lock );
-	netif = ip_netifs_find( & ip_globals.netifs, device_id );
-	if( ! netif ){
-		fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway){
+	ip_netif_ref netif;
+
+	fibril_rwlock_write_lock(&ip_globals.netifs_lock);
+	netif = ip_netifs_find(&ip_globals.netifs, device_id);
+	if(! netif){
+		fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 		return ENOENT;
 	}
@@ -1025,37 +1061,37 @@
 	ip_globals.gateway.gateway.s_addr = gateway.s_addr;
 	ip_globals.gateway.netif = netif;
-	fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
+	fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 	return EOK;
 }
 
-packet_t ip_split_packet( packet_t packet, size_t prefix, size_t content, size_t suffix, socklen_t addr_len, services_t error ){
-	size_t			length;
-	packet_t		next;
-	packet_t		new_packet;
-	int				result;
-	int				phone;
+packet_t ip_split_packet(packet_t packet, size_t prefix, size_t content, size_t suffix, socklen_t addr_len, services_t error){
+	size_t length;
+	packet_t next;
+	packet_t new_packet;
+	int result;
+	int phone;
 
 	next = packet;
 	// check all packets
-	while( next ){
-		length = packet_get_data_length( next );
+	while(next){
+		length = packet_get_data_length(next);
 		// too long?
-		if( length > content ){
-			result = ip_fragment_packet( next, content, prefix, suffix, addr_len );
-			if( result != EOK ){
-				new_packet = pq_detach( next );
-				if( next == packet ){
+		if(length > content){
+			result = ip_fragment_packet(next, content, prefix, suffix, addr_len);
+			if(result != EOK){
+				new_packet = pq_detach(next);
+				if(next == packet){
 					// the new first packet of the queue
 					packet = new_packet;
 				}
 				// fragmentation needed?
-				if( result == EPERM ){
-					phone = ip_prepare_icmp_and_get_phone( error, next, NULL );
-					if( phone >= 0 ){
+				if(result == EPERM){
+					phone = ip_prepare_icmp_and_get_phone(error, next, NULL);
+					if(phone >= 0){
 						// fragmentation necessary ICMP
-						icmp_destination_unreachable_msg( phone, ICMP_FRAG_NEEDED, content, next );
+						icmp_destination_unreachable_msg(phone, ICMP_FRAG_NEEDED, content, next);
 					}
 				}else{
-					pq_release( ip_globals.net_phone, packet_get_id( next ));
+					pq_release(ip_globals.net_phone, packet_get_id(next));
 				}
 				next = new_packet;
@@ -1063,119 +1099,133 @@
 			}
 		}
-		next = pq_next( next );
+		next = pq_next(next);
 	}
 	return packet;
 }
 
-int ip_fragment_packet( packet_t packet, size_t length, size_t prefix, size_t suffix, socklen_t addr_len ){
+int ip_fragment_packet(packet_t packet, size_t length, size_t prefix, size_t suffix, socklen_t addr_len){
 	ERROR_DECLARE;
 
-	packet_t		new_packet;
-	ip_header_ref	header;
-	ip_header_ref	middle_header;
-	ip_header_ref	last_header;
-	struct sockaddr *		src;
-	struct sockaddr *		dest;
-	socklen_t		addrlen;
-	int				result;
-
-	result = packet_get_addr( packet, ( uint8_t ** ) & src, ( uint8_t ** ) & dest );
-	if( result <= 0 ) return EINVAL;
-	addrlen = ( socklen_t ) result;
-	if( packet_get_data_length( packet ) <= sizeof( ip_header_t )) return ENOMEM;
+	packet_t new_packet;
+	ip_header_ref header;
+	ip_header_ref middle_header;
+	ip_header_ref last_header;
+	struct sockaddr * src;
+	struct sockaddr * dest;
+	socklen_t addrlen;
+	int result;
+
+	result = packet_get_addr(packet, (uint8_t **) &src, (uint8_t **) &dest);
+	if(result <= 0){
+		return EINVAL;
+	}
+	addrlen = (socklen_t) result;
+	if(packet_get_data_length(packet) <= sizeof(ip_header_t)){
+		return ENOMEM;
+	}
 	// get header
-	header = ( ip_header_ref ) packet_get_data( packet );
-	if( ! header ) return EINVAL;
+	header = (ip_header_ref) packet_get_data(packet);
+	if(! header){
+		return EINVAL;
+	}
 	// fragmentation forbidden?
-	if( header->flags & IPFLAG_DONT_FRAGMENT ){
+	if(header->flags &IPFLAG_DONT_FRAGMENT){
 		return EPERM;
 	}
 	// create the last fragment
-	new_packet = packet_get_4( ip_globals.net_phone, prefix, length, suffix, (( addrlen > addr_len ) ? addrlen : addr_len ));
-	if( ! new_packet ) return ENOMEM;
+	new_packet = packet_get_4(ip_globals.net_phone, prefix, length, suffix, ((addrlen > addr_len) ? addrlen : addr_len));
+	if(! new_packet){
+		return ENOMEM;
+	}
 	// allocate as much as originally
-	last_header = ( ip_header_ref ) packet_suffix( new_packet, IP_HEADER_LENGTH( header ));
-	if( ! last_header ){
-		return ip_release_and_return( packet, ENOMEM );
-	}
-	ip_create_last_header( last_header, header );
+	last_header = (ip_header_ref) packet_suffix(new_packet, IP_HEADER_LENGTH(header));
+	if(! last_header){
+		return ip_release_and_return(packet, ENOMEM);
+	}
+	ip_create_last_header(last_header, header);
 	// trim the unused space
-	if( ERROR_OCCURRED( packet_trim( new_packet, 0, IP_HEADER_LENGTH( header ) - IP_HEADER_LENGTH( last_header )))){
-		return ip_release_and_return( packet, ERROR_CODE );
+	if(ERROR_OCCURRED(packet_trim(new_packet, 0, IP_HEADER_LENGTH(header) - IP_HEADER_LENGTH(last_header)))){
+		return ip_release_and_return(packet, ERROR_CODE);
 	}
 	// biggest multiple of 8 lower than content
 	// TODO even fragmentation?
-	length = length & ( ~ 0x7 );// ( content / 8 ) * 8
-	if( ERROR_OCCURRED( ip_fragment_packet_data( packet, new_packet, header, last_header, (( IP_HEADER_DATA_LENGTH( header ) - (( length - IP_HEADER_LENGTH( header )) & ( ~ 0x7 ))) % (( length - IP_HEADER_LENGTH( last_header )) & ( ~ 0x7 ))), src, dest, addrlen ))){
-		return ip_release_and_return( packet, ERROR_CODE );
+	length = length &(~ 0x7);// (content / 8) * 8
+	if(ERROR_OCCURRED(ip_fragment_packet_data(packet, new_packet, header, last_header, ((IP_HEADER_DATA_LENGTH(header) - ((length - IP_HEADER_LENGTH(header)) &(~ 0x7))) % ((length - IP_HEADER_LENGTH(last_header)) &(~ 0x7))), src, dest, addrlen))){
+		return ip_release_and_return(packet, ERROR_CODE);
 	}
 	// mark the first as fragmented
 	header->flags |= IPFLAG_MORE_FRAGMENTS;
 	// create middle framgents
-	while( IP_TOTAL_LENGTH( header ) > length ){
-		new_packet = packet_get_4( ip_globals.net_phone, prefix, length, suffix, (( addrlen >= addr_len ) ? addrlen : addr_len ));
-		if( ! new_packet ) return ENOMEM;
-		middle_header = ip_create_middle_header( new_packet, last_header );
-		if( ! middle_header ){
-			return ip_release_and_return( packet, ENOMEM );
-		}
-		if( ERROR_OCCURRED( ip_fragment_packet_data( packet, new_packet, header, middle_header, ( length - IP_HEADER_LENGTH( middle_header )) & ( ~ 0x7 ), src, dest, addrlen ))){
-			return ip_release_and_return( packet, ERROR_CODE );
+	while(IP_TOTAL_LENGTH(header) > length){
+		new_packet = packet_get_4(ip_globals.net_phone, prefix, length, suffix, ((addrlen >= addr_len) ? addrlen : addr_len));
+		if(! new_packet){
+			return ENOMEM;
+		}
+		middle_header = ip_create_middle_header(new_packet, last_header);
+		if(! middle_header){
+			return ip_release_and_return(packet, ENOMEM);
+		}
+		if(ERROR_OCCURRED(ip_fragment_packet_data(packet, new_packet, header, middle_header, (length - IP_HEADER_LENGTH(middle_header)) &(~ 0x7), src, dest, addrlen))){
+			return ip_release_and_return(packet, ERROR_CODE);
 		}
 	}
 	// finish the first fragment
-	header->header_checksum = IP_HEADER_CHECKSUM( header );
+	header->header_checksum = IP_HEADER_CHECKSUM(header);
 	return EOK;
 }
 
-int ip_fragment_packet_data( packet_t packet, packet_t new_packet, ip_header_ref header, ip_header_ref new_header, size_t length, const struct sockaddr * src, const struct sockaddr * dest, socklen_t addrlen ){
+int ip_fragment_packet_data(packet_t packet, packet_t new_packet, ip_header_ref header, ip_header_ref new_header, size_t length, const struct sockaddr * src, const struct sockaddr * dest, socklen_t addrlen){
 	ERROR_DECLARE;
 
-	void *			data;
-	size_t			offset;
-
-	data = packet_suffix( new_packet, length );
-	if( ! data ) return ENOMEM;
-	memcpy( data, (( void * ) header ) + IP_TOTAL_LENGTH( header ) - length, length );
-	ERROR_PROPAGATE( packet_trim( packet, 0, length ));
-	header->total_length = htons( IP_TOTAL_LENGTH( header ) - length );
-	new_header->total_length = htons( IP_HEADER_LENGTH( new_header ) + length );
-	offset = IP_FRAGMENT_OFFSET( header ) + IP_HEADER_DATA_LENGTH( header );
-	new_header->fragment_offset_high = IP_COMPUTE_FRAGMENT_OFFSET_HIGH( offset );
-	new_header->fragment_offset_low = IP_COMPUTE_FRAGMENT_OFFSET_LOW( offset );
-	new_header->header_checksum = IP_HEADER_CHECKSUM( new_header );
-	ERROR_PROPAGATE( packet_set_addr( new_packet, ( const uint8_t * ) src, ( const uint8_t * ) dest, addrlen ));
-	return pq_insert_after( packet, new_packet );
-}
-
-ip_header_ref ip_create_middle_header( packet_t packet, ip_header_ref last ){
-	ip_header_ref	middle;
-
-	middle = ( ip_header_ref ) packet_suffix( packet, IP_HEADER_LENGTH( last ));
-	if( ! middle ) return NULL;
-	memcpy( middle, last, IP_HEADER_LENGTH( last ));
+	void * data;
+	size_t offset;
+
+	data = packet_suffix(new_packet, length);
+	if(! data){
+		return ENOMEM;
+	}
+	memcpy(data, ((void *) header) + IP_TOTAL_LENGTH(header) - length, length);
+	ERROR_PROPAGATE(packet_trim(packet, 0, length));
+	header->total_length = htons(IP_TOTAL_LENGTH(header) - length);
+	new_header->total_length = htons(IP_HEADER_LENGTH(new_header) + length);
+	offset = IP_FRAGMENT_OFFSET(header) + IP_HEADER_DATA_LENGTH(header);
+	new_header->fragment_offset_high = IP_COMPUTE_FRAGMENT_OFFSET_HIGH(offset);
+	new_header->fragment_offset_low = IP_COMPUTE_FRAGMENT_OFFSET_LOW(offset);
+	new_header->header_checksum = IP_HEADER_CHECKSUM(new_header);
+	ERROR_PROPAGATE(packet_set_addr(new_packet, (const uint8_t *) src, (const uint8_t *) dest, addrlen));
+	return pq_insert_after(packet, new_packet);
+}
+
+ip_header_ref ip_create_middle_header(packet_t packet, ip_header_ref last){
+	ip_header_ref middle;
+
+	middle = (ip_header_ref) packet_suffix(packet, IP_HEADER_LENGTH(last));
+	if(! middle){
+		return NULL;
+	}
+	memcpy(middle, last, IP_HEADER_LENGTH(last));
 	middle->flags |= IPFLAG_MORE_FRAGMENTS;
 	return middle;
 }
 
-void ip_create_last_header( ip_header_ref last, ip_header_ref first ){
-	ip_option_ref	option;
-	size_t			next;
-	size_t			length;
+void ip_create_last_header(ip_header_ref last, ip_header_ref first){
+	ip_option_ref option;
+	size_t next;
+	size_t length;
 
 	// copy first itself
-	memcpy( last, first, sizeof( ip_header_t ));
-	length = sizeof( ip_header_t );
-	next = sizeof( ip_header_t );
+	memcpy(last, first, sizeof(ip_header_t));
+	length = sizeof(ip_header_t);
+	next = sizeof(ip_header_t);
 	// process all ip options
-	while( next < first->header_length ){
-		option = ( ip_option_ref ) ((( uint8_t * ) first ) + next );
+	while(next < first->header_length){
+		option = (ip_option_ref) (((uint8_t *) first) + next);
 		// skip end or noop
-		if(( option->type == IPOPT_END ) || ( option->type == IPOPT_NOOP )){
+		if((option->type == IPOPT_END) || (option->type == IPOPT_NOOP)){
 			++ next;
 		}else{
 			// copy if said so or skip
-			if( IPOPT_COPIED( option->type )){
-				memcpy((( uint8_t * ) last ) + length, (( uint8_t * ) first ) + next, option->length );
+			if(IPOPT_COPIED(option->type)){
+				memcpy(((uint8_t *) last) + length, ((uint8_t *) first) + next, option->length);
 				length += option->length;
 			}
@@ -1185,6 +1235,6 @@
 	}
 	// align 4 byte boundary
-	if( length % 4 ){
-		bzero((( uint8_t * ) last ) + length, 4 - ( length % 4 ));
+	if(length % 4){
+		bzero(((uint8_t *) last) + length, 4 - (length % 4));
 		last->header_length = length / 4 + 1;
 	}else{
@@ -1194,92 +1244,92 @@
 }
 
-int ip_receive_message( device_id_t device_id, packet_t packet ){
-	packet_t		next;
+int ip_receive_message(device_id_t device_id, packet_t packet){
+	packet_t next;
 
 	do{
-		next = pq_detach( packet );
-		ip_process_packet( device_id, packet );
+		next = pq_detach(packet);
+		ip_process_packet(device_id, packet);
 		packet = next;
-	}while( packet );
+	}while(packet);
 	return EOK;
 }
 
-int ip_process_packet( device_id_t device_id, packet_t packet ){
+int ip_process_packet(device_id_t device_id, packet_t packet){
 	ERROR_DECLARE;
 
-	ip_header_ref	header;
-	in_addr_t		dest;
-	ip_route_ref	route;
-	int				phone;
-	struct sockaddr *	addr;
-	struct sockaddr_in	addr_in;
+	ip_header_ref header;
+	in_addr_t dest;
+	ip_route_ref route;
+	int phone;
+	struct sockaddr * addr;
+	struct sockaddr_in addr_in;
 //	struct sockaddr_in	addr_in6;
-	socklen_t		addrlen;
-
-	header = ( ip_header_ref ) packet_get_data( packet );
-	if( ! header ){
-		return ip_release_and_return( packet, ENOMEM );
+	socklen_t addrlen;
+
+	header = (ip_header_ref) packet_get_data(packet);
+	if(! header){
+		return ip_release_and_return(packet, ENOMEM);
 	}
 	// checksum
-	if(( header->header_checksum ) && ( IP_HEADER_CHECKSUM( header ) != IP_CHECKSUM_ZERO )){
-		phone = ip_prepare_icmp_and_get_phone( 0, packet, header );
-		if( phone >= 0 ){
+	if((header->header_checksum) && (IP_HEADER_CHECKSUM(header) != IP_CHECKSUM_ZERO)){
+		phone = ip_prepare_icmp_and_get_phone(0, packet, header);
+		if(phone >= 0){
 			// checksum error ICMP
-			icmp_parameter_problem_msg( phone, ICMP_PARAM_POINTER, (( size_t ) (( void * ) & header->header_checksum )) - (( size_t ) (( void * ) header )), packet );
+			icmp_parameter_problem_msg(phone, ICMP_PARAM_POINTER, ((size_t) ((void *) &header->header_checksum)) - ((size_t) ((void *) header)), packet);
 		}
 		return EINVAL;
 	}
-	if( header->ttl <= 1 ){
-		phone = ip_prepare_icmp_and_get_phone( 0, packet, header );
-		if( phone >= 0 ){
+	if(header->ttl <= 1){
+		phone = ip_prepare_icmp_and_get_phone(0, packet, header);
+		if(phone >= 0){
 			// ttl oxceeded ICMP
-			icmp_time_exceeded_msg( phone, ICMP_EXC_TTL, packet );
+			icmp_time_exceeded_msg(phone, ICMP_EXC_TTL, packet);
 		}
 		return EINVAL;
 	}
 	// process ipopt and get destination
-	dest = ip_get_destination( header );
+	dest = ip_get_destination(header);
 	// set the addrination address
-	switch( header->version ){
+	switch(header->version){
 		case IPVERSION:
-			addrlen = sizeof( addr_in );
-			bzero( & addr_in, addrlen );
+			addrlen = sizeof(addr_in);
+			bzero(&addr_in, addrlen);
 			addr_in.sin_family = AF_INET;
-			memcpy( & addr_in.sin_addr.s_addr, & dest, sizeof( dest ));
-			addr = ( struct sockaddr * ) & addr_in;
+			memcpy(&addr_in.sin_addr.s_addr, &dest, sizeof(dest));
+			addr = (struct sockaddr *) &addr_in;
 			break;
 /*		case IPv6VERSION:
-			addrlen = sizeof( dest_in6 );
-			bzero( & dest_in6, addrlen );
+			addrlen = sizeof(dest_in6);
+			bzero(&dest_in6, addrlen);
 			dest_in6.sin6_family = AF_INET6;
-			memcpy( & dest_in6.sin6_addr.s6_addr, );
-			dest = ( struct sockaddr * ) & dest_in;
+			memcpy(&dest_in6.sin6_addr.s6_addr,);
+			dest = (struct sockaddr *) &dest_in;
 			break;
 */		default:
-			return ip_release_and_return( packet, EAFNOSUPPORT );
-	}
-	ERROR_PROPAGATE( packet_set_addr( packet, NULL, ( uint8_t * ) & addr, addrlen ));
-	route = ip_find_route( dest );
-	if( ! route ){
-		phone = ip_prepare_icmp_and_get_phone( 0, packet, header );
-		if( phone >= 0 ){
+			return ip_release_and_return(packet, EAFNOSUPPORT);
+	}
+	ERROR_PROPAGATE(packet_set_addr(packet, NULL, (uint8_t *) &addr, addrlen));
+	route = ip_find_route(dest);
+	if(! route){
+		phone = ip_prepare_icmp_and_get_phone(0, packet, header);
+		if(phone >= 0){
 			// unreachable ICMP
-			icmp_destination_unreachable_msg( phone, ICMP_HOST_UNREACH, 0, packet );
+			icmp_destination_unreachable_msg(phone, ICMP_HOST_UNREACH, 0, packet);
 		}
 		return ENOENT;
 	}
-	if( route->address.s_addr == dest.s_addr ){
+	if(route->address.s_addr == dest.s_addr){
 		// local delivery
-		return ip_deliver_local( device_id, packet, header, 0 );
+		return ip_deliver_local(device_id, packet, header, 0);
 	}else{
 		// only if routing enabled
-		if( route->netif->routing ){
+		if(route->netif->routing){
 			-- header->ttl;
-			return ip_send_route( packet, route->netif, route, NULL, dest, 0 );
+			return ip_send_route(packet, route->netif, route, NULL, dest, 0);
 		}else{
-			phone = ip_prepare_icmp_and_get_phone( 0, packet, header );
-			if( phone >= 0 ){
+			phone = ip_prepare_icmp_and_get_phone(0, packet, header);
+			if(phone >= 0){
 				// unreachable ICMP if no routing
-				icmp_destination_unreachable_msg( phone, ICMP_HOST_UNREACH, 0, packet );
+				icmp_destination_unreachable_msg(phone, ICMP_HOST_UNREACH, 0, packet);
 			}
 			return ENOENT;
@@ -1288,116 +1338,116 @@
 }
 
-int ip_received_error_msg( int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error ){
-	uint8_t *			data;
-	int					offset;
-	icmp_type_t			type;
-	icmp_code_t			code;
-	ip_netif_ref		netif;
-	measured_string_t	address;
-	ip_route_ref		route;
-	ip_header_ref		header;
-
-	switch( error ){
+int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
+	uint8_t * data;
+	int offset;
+	icmp_type_t type;
+	icmp_code_t code;
+	ip_netif_ref netif;
+	measured_string_t address;
+	ip_route_ref route;
+	ip_header_ref header;
+
+	switch(error){
 		case SERVICE_ICMP:
-			offset = icmp_client_process_packet( packet, & type, & code, NULL, NULL );
-			if( offset < 0 ){
-				return ip_release_and_return( packet, ENOMEM );
-			}
-			data = packet_get_data( packet );
-			header = ( ip_header_ref )( data + offset );
+			offset = icmp_client_process_packet(packet, &type, &code, NULL, NULL);
+			if(offset < 0){
+				return ip_release_and_return(packet, ENOMEM);
+			}
+			data = packet_get_data(packet);
+			header = (ip_header_ref)(data + offset);
 			// destination host unreachable?
-			if(( type == ICMP_DEST_UNREACH ) && ( code == ICMP_HOST_UNREACH )){
-				fibril_rwlock_read_lock( & ip_globals.netifs_lock );
-				netif = ip_netifs_find( & ip_globals.netifs, device_id );
-				if( netif && netif->arp ){
-					route = ip_routes_get_index( & netif->routes, 0 );
+			if((type == ICMP_DEST_UNREACH) && (code == ICMP_HOST_UNREACH)){
+				fibril_rwlock_read_lock(&ip_globals.netifs_lock);
+				netif = ip_netifs_find(&ip_globals.netifs, device_id);
+				if(netif && netif->arp){
+					route = ip_routes_get_index(&netif->routes, 0);
 					// from the same network?
-					if( route && (( route->address.s_addr & route->netmask.s_addr ) == ( header->destination_address & route->netmask.s_addr ))){
+					if(route && ((route->address.s_addr &route->netmask.s_addr) == (header->destination_address &route->netmask.s_addr))){
 						// clear the ARP mapping if any
-						address.value = ( char * ) & header->destination_address;
-						address.length = CONVERT_SIZE( uint8_t, char, sizeof( header->destination_address ));
-						arp_clear_address_req( netif->arp->phone, netif->device_id, SERVICE_IP, & address );
+						address.value = (char *) &header->destination_address;
+						address.length = CONVERT_SIZE(uint8_t, char, sizeof(header->destination_address));
+						arp_clear_address_req(netif->arp->phone, netif->device_id, SERVICE_IP, &address);
 					}
 				}
-				fibril_rwlock_read_unlock( & ip_globals.netifs_lock );
+				fibril_rwlock_read_unlock(&ip_globals.netifs_lock);
 			}
 			break;
 		default:
-			return ip_release_and_return( packet, ENOTSUP );
-	}
-	return ip_deliver_local( device_id, packet, header, error );
-}
-
-int ip_deliver_local( device_id_t device_id, packet_t packet, ip_header_ref header, services_t error ){
+			return ip_release_and_return(packet, ENOTSUP);
+	}
+	return ip_deliver_local(device_id, packet, header, error);
+}
+
+int ip_deliver_local(device_id_t device_id, packet_t packet, ip_header_ref header, services_t error){
 	ERROR_DECLARE;
 
-	ip_proto_ref	proto;
-	int				phone;
-	services_t		service;
-	tl_received_msg_t	received_msg;
-	struct sockaddr *	src;
-	struct sockaddr *	dest;
-	struct sockaddr_in	src_in;
-	struct sockaddr_in	dest_in;
+	ip_proto_ref proto;
+	int phone;
+	services_t service;
+	tl_received_msg_t received_msg;
+	struct sockaddr * src;
+	struct sockaddr * dest;
+	struct sockaddr_in src_in;
+	struct sockaddr_in dest_in;
 //	struct sockaddr_in	src_in6;
 //	struct sockaddr_in	dest_in6;
-	socklen_t		addrlen;
-
-	if(( header->flags & IPFLAG_MORE_FRAGMENTS ) || IP_FRAGMENT_OFFSET( header )){
+	socklen_t addrlen;
+
+	if((header->flags &IPFLAG_MORE_FRAGMENTS) || IP_FRAGMENT_OFFSET(header)){
 		// TODO fragmented
 		return ENOTSUP;
 	}else{
-		switch( header->version ){
+		switch(header->version){
 			case IPVERSION:
-				addrlen = sizeof( src_in );
-				bzero( & src_in, addrlen );
+				addrlen = sizeof(src_in);
+				bzero(&src_in, addrlen);
 				src_in.sin_family = AF_INET;
-				memcpy( & dest_in, & src_in, addrlen );
-				memcpy( & src_in.sin_addr.s_addr, & header->source_address, sizeof( header->source_address ));
-				memcpy( & dest_in.sin_addr.s_addr, & header->destination_address, sizeof( header->destination_address ));
-				src = ( struct sockaddr * ) & src_in;
-				dest = ( struct sockaddr * ) & dest_in;
+				memcpy(&dest_in, &src_in, addrlen);
+				memcpy(&src_in.sin_addr.s_addr, &header->source_address, sizeof(header->source_address));
+				memcpy(&dest_in.sin_addr.s_addr, &header->destination_address, sizeof(header->destination_address));
+				src = (struct sockaddr *) &src_in;
+				dest = (struct sockaddr *) &dest_in;
 				break;
 /*			case IPv6VERSION:
-				addrlen = sizeof( src_in6 );
-				bzero( & src_in6, addrlen );
+				addrlen = sizeof(src_in6);
+				bzero(&src_in6, addrlen);
 				src_in6.sin6_family = AF_INET6;
-				memcpy( & dest_in6, & src_in6, addrlen );
-				memcpy( & src_in6.sin6_addr.s6_addr, );
-				memcpy( & dest_in6.sin6_addr.s6_addr, );
-				src = ( struct sockaddr * ) & src_in;
-				dest = ( struct sockaddr * ) & dest_in;
+				memcpy(&dest_in6, &src_in6, addrlen);
+				memcpy(&src_in6.sin6_addr.s6_addr,);
+				memcpy(&dest_in6.sin6_addr.s6_addr,);
+				src = (struct sockaddr *) &src_in;
+				dest = (struct sockaddr *) &dest_in;
 				break;
 */			default:
-				return ip_release_and_return( packet, EAFNOSUPPORT );
-		}
-		if( ERROR_OCCURRED( packet_set_addr( packet, ( uint8_t * ) src, ( uint8_t * ) dest, addrlen ))){
-			return ip_release_and_return( packet, ERROR_CODE );
+				return ip_release_and_return(packet, EAFNOSUPPORT);
+		}
+		if(ERROR_OCCURRED(packet_set_addr(packet, (uint8_t *) src, (uint8_t *) dest, addrlen))){
+			return ip_release_and_return(packet, ERROR_CODE);
 		}
 		// trim padding if present
-		if(( ! error ) && ( IP_TOTAL_LENGTH( header ) < packet_get_data_length( packet ))){
-			if( ERROR_OCCURRED( packet_trim( packet, 0, packet_get_data_length( packet ) - IP_TOTAL_LENGTH( header )))){
-				return ip_release_and_return( packet, ERROR_CODE );
-			}
-		}
-		fibril_rwlock_read_lock( & ip_globals.protos_lock );
-		proto = ip_protos_find( & ip_globals.protos, header->protocol );
-		if( ! proto ){
-			fibril_rwlock_read_unlock( & ip_globals.protos_lock );
-			phone = ip_prepare_icmp_and_get_phone( error, packet, header );
-			if( phone >= 0 ){
+		if((! error) && (IP_TOTAL_LENGTH(header) < packet_get_data_length(packet))){
+			if(ERROR_OCCURRED(packet_trim(packet, 0, packet_get_data_length(packet) - IP_TOTAL_LENGTH(header)))){
+				return ip_release_and_return(packet, ERROR_CODE);
+			}
+		}
+		fibril_rwlock_read_lock(&ip_globals.protos_lock);
+		proto = ip_protos_find(&ip_globals.protos, header->protocol);
+		if(! proto){
+			fibril_rwlock_read_unlock(&ip_globals.protos_lock);
+			phone = ip_prepare_icmp_and_get_phone(error, packet, header);
+			if(phone >= 0){
 				// unreachable ICMP
-				icmp_destination_unreachable_msg( phone, ICMP_PROT_UNREACH, 0, packet );
+				icmp_destination_unreachable_msg(phone, ICMP_PROT_UNREACH, 0, packet);
 			}
 			return ENOENT;
 		}
-		if( proto->received_msg ){
+		if(proto->received_msg){
 			service = proto->service;
 			received_msg = proto->received_msg;
-			fibril_rwlock_read_unlock( & ip_globals.protos_lock );
-			ERROR_CODE = received_msg( device_id, packet, service, error );
+			fibril_rwlock_read_unlock(&ip_globals.protos_lock);
+			ERROR_CODE = received_msg(device_id, packet, service, error);
 		}else{
-			ERROR_CODE = tl_received_msg( proto->phone, device_id, packet, proto->service, error );
-			fibril_rwlock_read_unlock( & ip_globals.protos_lock );
+			ERROR_CODE = tl_received_msg(proto->phone, device_id, packet, proto->service, error);
+			fibril_rwlock_read_unlock(&ip_globals.protos_lock);
 		}
 		return ERROR_CODE;
@@ -1405,6 +1455,6 @@
 }
 
-in_addr_t ip_get_destination( ip_header_ref header ){
-	in_addr_t	destination;
+in_addr_t ip_get_destination(ip_header_ref header){
+	in_addr_t destination;
 
 	// TODO search set ipopt route?
@@ -1413,97 +1463,107 @@
 }
 
-int ip_prepare_icmp( packet_t packet, ip_header_ref header ){
-	packet_t	next;
-	struct sockaddr *	dest;
-	struct sockaddr_in	dest_in;
+int ip_prepare_icmp(packet_t packet, ip_header_ref header){
+	packet_t next;
+	struct sockaddr * dest;
+	struct sockaddr_in dest_in;
 //	struct sockaddr_in	dest_in6;
-	socklen_t		addrlen;
+	socklen_t addrlen;
 
 	// detach the first packet and release the others
-	next = pq_detach( packet );
-	if( next ){
-		pq_release( ip_globals.net_phone, packet_get_id( next ));
-	}
-	if( ! header ){
-		if( packet_get_data_length( packet ) <= sizeof( ip_header_t )) return ENOMEM;
+	next = pq_detach(packet);
+	if(next){
+		pq_release(ip_globals.net_phone, packet_get_id(next));
+	}
+	if(! header){
+		if(packet_get_data_length(packet) <= sizeof(ip_header_t)){
+			return ENOMEM;
+		}
 		// get header
-		header = ( ip_header_ref ) packet_get_data( packet );
-		if( ! header ) return EINVAL;
+		header = (ip_header_ref) packet_get_data(packet);
+		if(! header){
+			return EINVAL;
+		}
 	}
 	// only for the first fragment
-	if( IP_FRAGMENT_OFFSET( header )) return EINVAL;
+	if(IP_FRAGMENT_OFFSET(header)){
+		return EINVAL;
+	}
 	// not for the ICMP protocol
-	if( header->protocol == IPPROTO_ICMP ){
+	if(header->protocol == IPPROTO_ICMP){
 		return EPERM;
 	}
 	// set the destination address
-	switch( header->version ){
+	switch(header->version){
 		case IPVERSION:
-			addrlen = sizeof( dest_in );
-			bzero( & dest_in, addrlen );
+			addrlen = sizeof(dest_in);
+			bzero(&dest_in, addrlen);
 			dest_in.sin_family = AF_INET;
-			memcpy( & dest_in.sin_addr.s_addr, & header->source_address, sizeof( header->source_address ));
-			dest = ( struct sockaddr * ) & dest_in;
+			memcpy(&dest_in.sin_addr.s_addr, &header->source_address, sizeof(header->source_address));
+			dest = (struct sockaddr *) &dest_in;
 			break;
 /*		case IPv6VERSION:
-			addrlen = sizeof( dest_in6 );
-			bzero( & dest_in6, addrlen );
+			addrlen = sizeof(dest_in6);
+			bzero(&dest_in6, addrlen);
 			dest_in6.sin6_family = AF_INET6;
-			memcpy( & dest_in6.sin6_addr.s6_addr, );
-			dest = ( struct sockaddr * ) & dest_in;
+			memcpy(&dest_in6.sin6_addr.s6_addr,);
+			dest = (struct sockaddr *) &dest_in;
 			break;
 */		default:
 			return EAFNOSUPPORT;
 	}
-	return packet_set_addr( packet, NULL, ( uint8_t * ) dest, addrlen );
-}
-
-int ip_get_icmp_phone( void ){
-	ip_proto_ref	proto;
-	int				phone;
-
-	fibril_rwlock_read_lock( & ip_globals.protos_lock );
-	proto = ip_protos_find( & ip_globals.protos, IPPROTO_ICMP );
+	return packet_set_addr(packet, NULL, (uint8_t *) dest, addrlen);
+}
+
+int ip_get_icmp_phone(void){
+	ip_proto_ref proto;
+	int phone;
+
+	fibril_rwlock_read_lock(&ip_globals.protos_lock);
+	proto = ip_protos_find(&ip_globals.protos, IPPROTO_ICMP);
 	phone = proto ? proto->phone : ENOENT;
-	fibril_rwlock_read_unlock( & ip_globals.protos_lock );
+	fibril_rwlock_read_unlock(&ip_globals.protos_lock);
 	return phone;
 }
 
-int ip_prepare_icmp_and_get_phone( services_t error, packet_t packet, ip_header_ref header ){
-	int	phone;
+int ip_prepare_icmp_and_get_phone(services_t error, packet_t packet, ip_header_ref header){
+	int phone;
 
 	phone = ip_get_icmp_phone();
-	if( error || ( phone < 0 ) || ip_prepare_icmp( packet, header )){
-		return ip_release_and_return( packet, EINVAL );
+	if(error || (phone < 0) || ip_prepare_icmp(packet, header)){
+		return ip_release_and_return(packet, EINVAL);
 	}
 	return phone;
 }
 
-int	ip_release_and_return( packet_t packet, int result ){
-	pq_release( ip_globals.net_phone, packet_get_id( packet ));
+int ip_release_and_return(packet_t packet, int result){
+	pq_release(ip_globals.net_phone, packet_get_id(packet));
 	return result;
 }
 
-int ip_get_route_req( int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen ){
-	struct sockaddr_in *	address_in;
+int ip_get_route_req(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen){
+	struct sockaddr_in * address_in;
 //	struct sockaddr_in6 *	address_in6;
-	in_addr_t *				dest;
-	in_addr_t *				src;
-	ip_route_ref			route;
-	ipv4_pseudo_header_ref	header_in;
-
-	if( !( destination && ( addrlen > 0 ))) return EINVAL;
-	if( !( device_id && header && headerlen )) return EBADMEM;
-	if(( size_t ) addrlen < sizeof( struct sockaddr )){
+	in_addr_t * dest;
+	in_addr_t * src;
+	ip_route_ref route;
+	ipv4_pseudo_header_ref header_in;
+
+	if(!(destination && (addrlen > 0))){
 		return EINVAL;
 	}
-	switch( destination->sa_family ){
+	if(!(device_id && header && headerlen)){
+		return EBADMEM;
+	}
+	if((size_t) addrlen < sizeof(struct sockaddr)){
+		return EINVAL;
+	}
+	switch(destination->sa_family){
 		case AF_INET:
-			if( addrlen != sizeof( struct sockaddr_in )){
+			if(addrlen != sizeof(struct sockaddr_in)){
 				return EINVAL;
 			}
-			address_in = ( struct sockaddr_in * ) destination;
-			dest = & address_in->sin_addr;
-			if( ! dest->s_addr ){
+			address_in = (struct sockaddr_in *) destination;
+			dest = &address_in->sin_addr;
+			if(! dest->s_addr){
 				dest->s_addr = IPV4_LOCALHOST_ADDRESS;
 			}
@@ -1511,28 +1571,32 @@
 		// TODO IPv6
 /*		case AF_INET6:
-			if( addrlen != sizeof( struct sockaddr_in6 )) return EINVAL;
-			address_in6 = ( struct sockaddr_in6 * ) dest;
+			if(addrlen != sizeof(struct sockaddr_in6)){
+				return EINVAL;
+			}
+			address_in6 = (struct sockaddr_in6 *) dest;
 			address_in6.sin6_addr.s6_addr;
 */		default:
 			return EAFNOSUPPORT;
 	}
-	fibril_rwlock_read_lock( & ip_globals.lock );
-	route = ip_find_route( * dest );
-	if( !( route && route->netif )){
-		fibril_rwlock_read_unlock( & ip_globals.lock );
+	fibril_rwlock_read_lock(&ip_globals.lock);
+	route = ip_find_route(*dest);
+	if(!(route && route->netif)){
+		fibril_rwlock_read_unlock(&ip_globals.lock);
 		return ENOENT;
 	}
-	* device_id = route->netif->device_id;
-	src = ip_netif_address( route->netif );
-	fibril_rwlock_read_unlock( & ip_globals.lock );
-	* headerlen = sizeof( * header_in );
-	header_in = ( ipv4_pseudo_header_ref ) malloc( * headerlen );
-	if( ! header_in ) return ENOMEM;
-	bzero( header_in, * headerlen );
+	*device_id = route->netif->device_id;
+	src = ip_netif_address(route->netif);
+	fibril_rwlock_read_unlock(&ip_globals.lock);
+	*headerlen = sizeof(*header_in);
+	header_in = (ipv4_pseudo_header_ref) malloc(*headerlen);
+	if(! header_in){
+		return ENOMEM;
+	}
+	bzero(header_in, * headerlen);
 	header_in->destination_address = dest->s_addr;
 	header_in->source_address = src->s_addr;
 	header_in->protocol = protocol;
 	header_in->data_length = 0;
-	* header = ( ip_pseudo_header_ref ) header_in;
+	*header = (ip_pseudo_header_ref) header_in;
 	return EOK;
 }
Index: uspace/srv/net/il/ip/ip.h
===================================================================
--- uspace/srv/net/il/ip/ip.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/ip/ip.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -90,5 +90,5 @@
  *  @see device.h
  */
-DEVICE_MAP_DECLARE( ip_netifs, ip_netif_t )
+DEVICE_MAP_DECLARE(ip_netifs, ip_netif_t)
 
 /** IP registered protocols.
@@ -96,10 +96,10 @@
  *  @see int_map.h
  */
-INT_MAP_DECLARE( ip_protos, ip_proto_t )
+INT_MAP_DECLARE(ip_protos, ip_proto_t)
 
 /** IP routing table.
  *  @see generic_field.h
  */
-GENERIC_FIELD_DECLARE( ip_routes, ip_route_t )
+GENERIC_FIELD_DECLARE(ip_routes, ip_route_t)
 
 /** IP network interface specific data.
@@ -108,36 +108,36 @@
 	/** Device identifier.
 	 */
-	device_id_t	device_id;
+	device_id_t device_id;
 	/** Netif module service.
 	 */
-	services_t	service;
+	services_t service;
 	/** Netif module phone.
 	 */
-	int			phone;
+	int phone;
 	/** ARP module.
 	 *  Assigned if using ARP.
 	 */
-	module_ref	arp;
+	module_ref arp;
 	/** IP version.
 	 */
-	int			ipv;
+	int ipv;
 	/** Indicates whether using DHCP.
 	 */
-	int			dhcp;
+	int dhcp;
 	/** Indicates whether IP routing is enabled.
 	 */
-	int			routing;
+	int routing;
 	/** Device state.
 	 */
-	device_state_t	state;
+	device_state_t state;
 	/** Broadcast address.
 	 */
-	in_addr_t	broadcast;
+	in_addr_t broadcast;
 	/** Routing table.
 	 */
-	ip_routes_t	routes;
+	ip_routes_t routes;
 	/** Packet dimension.
 	 */
-	packet_dimension_t	packet_dimension;
+	packet_dimension_t packet_dimension;
 };
 
@@ -147,5 +147,5 @@
 	/** Protocol number.
 	 */
-	int	protocol;
+	int protocol;
 	/** Protocol module service.
 	 */
@@ -153,5 +153,5 @@
 	/** Protocol module phone.
 	 */
-	int	phone;
+	int phone;
 	/** Protocol packet receiving function.
 	 */
@@ -164,14 +164,14 @@
 	/** Target address.
 	 */
-	in_addr_t		address;
+	in_addr_t address;
 	/** Target network mask.
 	 */
-	in_addr_t		netmask;
+	in_addr_t netmask;
 	/** Gateway.
 	 */
-	in_addr_t		gateway;
+	in_addr_t gateway;
 	/** Parent netif.
 	 */
-	ip_netif_ref	netif;
+	ip_netif_ref netif;
 };
 
@@ -181,23 +181,23 @@
 	/** Networking module phone.
 	 */
-	int			net_phone;
+	int net_phone;
 	/** Registered network interfaces.
 	 */
-	ip_netifs_t	netifs;
+	ip_netifs_t netifs;
 	/** Netifs safeyt lock.
 	 */
-	fibril_rwlock_t	netifs_lock;
+	fibril_rwlock_t netifs_lock;
 	/** Registered protocols.
 	 */
-	ip_protos_t	protos;
+	ip_protos_t protos;
 	/** Protocols safety lock.
 	 */
-	fibril_rwlock_t	protos_lock;
+	fibril_rwlock_t protos_lock;
 	/** Default gateway.
 	 */
-	ip_route_t	gateway;
+	ip_route_t gateway;
 	/** Known support modules.
 	 */
-	modules_t	modules;
+	modules_t modules;
 	/** Default client connection function for support modules.
 	 */
@@ -205,8 +205,8 @@
 	/** Packet counter.
 	 */
-	uint16_t	packet_counter;
+	uint16_t packet_counter;
 	/** Safety lock.
 	 */
-	fibril_rwlock_t	lock;
+	fibril_rwlock_t lock;
 };
 
Index: uspace/srv/net/il/ip/ip_client.c
===================================================================
--- uspace/srv/net/il/ip/ip_client.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/ip/ip_client.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -48,64 +48,80 @@
 #include "ip_header.h"
 
-int ip_client_prepare_packet( packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length ){
-	ip_header_ref	header;
-	uint8_t *		data;
-	size_t			padding;
+int ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length){
+	ip_header_ref header;
+	uint8_t * data;
+	size_t padding;
 
 	padding =  ipopt_length % 4;
-	if( padding ){
+	if(padding){
 		padding = 4 - padding;
 		ipopt_length += padding;
 	}
-	data = ( uint8_t * ) packet_prefix( packet, sizeof( ip_header_t ) + padding );
-	if( ! data ) return ENOMEM;
-	while( padding -- ) data[ sizeof( ip_header_t ) + padding ] = IPOPT_NOOP;
-	header = ( ip_header_ref ) data;
-	header->header_length = IP_COMPUTE_HEADER_LENGTH( sizeof( ip_header_t ) + ipopt_length );
-	header->ttl = ( ttl ? ttl : IPDEFTTL ); //((( ttl ) <= MAXTTL ) ? ttl : MAXTTL ) : IPDEFTTL;
+	data = (uint8_t *) packet_prefix(packet, sizeof(ip_header_t) + padding);
+	if(! data){
+		return ENOMEM;
+	}
+	while(padding --){
+		data[sizeof(ip_header_t) + padding] = IPOPT_NOOP;
+	}
+	header = (ip_header_ref) data;
+	header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) + ipopt_length);
+	header->ttl = (ttl ? ttl : IPDEFTTL); //(((ttl) <= MAXTTL) ? ttl : MAXTTL) : IPDEFTTL;
 	header->tos = tos;
 	header->protocol = protocol;
-	if( dont_fragment ) header->flags = IPFLAG_DONT_FRAGMENT;
+	if(dont_fragment){
+		header->flags = IPFLAG_DONT_FRAGMENT;
+	}
 	return EOK;
 }
 
-int ip_client_process_packet( packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length ){
-	ip_header_ref	header;
+int ip_client_process_packet(packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length){
+	ip_header_ref header;
 
-	header = ( ip_header_ref ) packet_get_data( packet );
-	if(( ! header )
-	|| ( packet_get_data_length( packet ) < sizeof( ip_header_t ))){
+	header = (ip_header_ref) packet_get_data(packet);
+	if((! header)
+		|| (packet_get_data_length(packet) < sizeof(ip_header_t))){
 		return ENOMEM;
 	}
-	if( protocol ) * protocol = header->protocol;
-	if( ttl ) * ttl = header->ttl;
-	if( tos ) * tos = header->tos;
-	if( dont_fragment ) * dont_fragment = header->flags & IPFLAG_DONT_FRAGMENT;
-	if( ipopt_length ){
-		* ipopt_length = IP_HEADER_LENGTH( header ) - sizeof( ip_header_t );
-		return sizeof( ip_header_t );
+	if(protocol){
+		*protocol = header->protocol;
+	}
+	if(ttl){
+		*ttl = header->ttl;
+	}
+	if(tos){
+		*tos = header->tos;
+	}
+	if(dont_fragment){
+		*dont_fragment = header->flags &IPFLAG_DONT_FRAGMENT;
+	}
+	if(ipopt_length){
+		*ipopt_length = IP_HEADER_LENGTH(header) - sizeof(ip_header_t);
+		return sizeof(ip_header_t);
 	}else{
-		return IP_HEADER_LENGTH( header );
+		return IP_HEADER_LENGTH(header);
 	}
 }
 
-size_t ip_client_header_length( packet_t packet ){
-	ip_header_ref	header;
+size_t ip_client_header_length(packet_t packet){
+	ip_header_ref header;
 
-	header = ( ip_header_ref ) packet_get_data( packet );
-	if(( ! header )
-	|| ( packet_get_data_length( packet ) < sizeof( ip_header_t ))){
+	header = (ip_header_ref) packet_get_data(packet);
+	if((! header)
+		|| (packet_get_data_length(packet) < sizeof(ip_header_t))){
 		return 0;
 	}
-	return IP_HEADER_LENGTH( header );
+	return IP_HEADER_LENGTH(header);
 }
 
-int ip_client_set_pseudo_header_data_length( ip_pseudo_header_ref header, size_t headerlen, size_t data_length ){
-	ipv4_pseudo_header_ref	header_in;
+int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length){
+	ipv4_pseudo_header_ref header_in;
 
-	if( ! header ) return EBADMEM;
-	if( headerlen == sizeof( ipv4_pseudo_header_t )){
-		header_in = ( ipv4_pseudo_header_ref ) header;
-		header_in->data_length = htons( data_length );
+	if(! header){
+		return EBADMEM;
+	}
+	if(headerlen == sizeof(ipv4_pseudo_header_t)){
+		header_in = (ipv4_pseudo_header_ref) header;
+		header_in->data_length = htons(data_length);
 		return EOK;
 	}else{
@@ -114,29 +130,39 @@
 }
 
-int ip_client_get_pseudo_header( ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen ){
-	ipv4_pseudo_header_ref	header_in;
-	struct sockaddr_in *	address_in;
+int ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen){
+	ipv4_pseudo_header_ref header_in;
+	struct sockaddr_in * address_in;
 
-	if( !( header && headerlen )) return EBADMEM;
-	if( !( src && dest && ( srclen > 0 ) && (( size_t ) srclen >= sizeof( struct sockaddr )) && ( srclen == destlen ) && ( src->sa_family == dest->sa_family ))) return EINVAL;
-	switch( src->sa_family ){
+	if(!(header && headerlen)){
+		return EBADMEM;
+	}
+	if(!(src && dest && (srclen > 0) && ((size_t) srclen >= sizeof(struct sockaddr)) && (srclen == destlen) && (src->sa_family == dest->sa_family))){
+		return EINVAL;
+	}
+	switch(src->sa_family){
 		case AF_INET:
-			if( srclen != sizeof( struct sockaddr_in )) return EINVAL;
-			* headerlen = sizeof( * header_in );
-			header_in = ( ipv4_pseudo_header_ref ) malloc( * headerlen );
-			if( ! header_in ) return ENOMEM;
-			bzero( header_in, * headerlen );
-			address_in = ( struct sockaddr_in * ) dest;
+			if(srclen != sizeof(struct sockaddr_in)){
+				return EINVAL;
+			}
+			*headerlen = sizeof(*header_in);
+			header_in = (ipv4_pseudo_header_ref) malloc(*headerlen);
+			if(! header_in){
+				return ENOMEM;
+			}
+			bzero(header_in, * headerlen);
+			address_in = (struct sockaddr_in *) dest;
 			header_in->destination_address = address_in->sin_addr.s_addr;
-			address_in = ( struct sockaddr_in * ) src;
+			address_in = (struct sockaddr_in *) src;
 			header_in->source_address = address_in->sin_addr.s_addr;
 			header_in->protocol = protocol;
-			header_in->data_length = htons( data_length );
-			* header = ( ip_pseudo_header_ref ) header_in;
+			header_in->data_length = htons(data_length);
+			*header = (ip_pseudo_header_ref) header_in;
 			return EOK;
 		// TODO IPv6
 /*		case AF_INET6:
-			if( addrlen != sizeof( struct sockaddr_in6 )) return EINVAL;
-			address_in6 = ( struct sockaddr_in6 * ) addr;
+			if(addrlen != sizeof(struct sockaddr_in6)){
+				return EINVAL;
+			}
+			address_in6 = (struct sockaddr_in6 *) addr;
 			return EOK;
 */		default:
Index: uspace/srv/net/il/ip/ip_header.h
===================================================================
--- uspace/srv/net/il/ip/ip_header.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/ip/ip_header.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -45,40 +45,40 @@
  *  @param[in] header The IP packet header.
  */
-#define IP_HEADER_LENGTH( header )		(( header )->header_length * 4u )
+#define IP_HEADER_LENGTH(header)		((header)->header_length * 4u)
 
 /** Returns the IP header length.
  *  @param[in] length The IP header length in bytes.
  */
-#define IP_COMPUTE_HEADER_LENGTH( length )		(( uint8_t ) (( length ) / 4u ))
+#define IP_COMPUTE_HEADER_LENGTH(length)		((uint8_t) ((length) / 4u))
 
 /** Returns the actual IP packet total length.
  *  @param[in] header The IP packet header.
  */
-#define IP_TOTAL_LENGTH( header )		ntohs(( header )->total_length )
+#define IP_TOTAL_LENGTH(header)		ntohs((header)->total_length)
 
 /** Returns the actual IP packet data length.
  *  @param[in] header The IP packet header.
  */
-#define IP_HEADER_DATA_LENGTH( header )	( IP_TOTAL_LENGTH( header ) - IP_HEADER_LENGTH( header ))
+#define IP_HEADER_DATA_LENGTH(header)	(IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
 
 /** Returns the IP packet header checksum.
  *  @param[in] header The IP packet header.
  */
-#define IP_HEADER_CHECKSUM( header )	( htons( ip_checksum(( uint8_t * )( header ), IP_HEADER_LENGTH( header ))))
+#define IP_HEADER_CHECKSUM(header)	(htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header))))
 
 /** Returns the fragment offest.
  *  @param[in] header The IP packet header.
  */
-#define IP_FRAGMENT_OFFSET( header ) (((( header )->fragment_offset_high << 8 ) + ( header )->fragment_offset_low ) * 8u )
+#define IP_FRAGMENT_OFFSET(header) ((((header)->fragment_offset_high << 8) + (header)->fragment_offset_low) * 8u)
 
 /** Returns the fragment offest high bits.
  *  @param[in] length The prefixed data total length.
  */
-#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH( length ) (((( length ) / 8u ) & 0x1F00 ) >> 8 )
+#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length) ((((length) / 8u) &0x1F00) >> 8)
 
 /** Returns the fragment offest low bits.
  *  @param[in] length The prefixed data total length.
  */
-#define IP_COMPUTE_FRAGMENT_OFFSET_LOW( length ) ((( length ) / 8u ) & 0xFF )
+#define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) (((length) / 8u) &0xFF)
 
 /** Type definition of the internet header.
@@ -99,17 +99,17 @@
 	/** The Version field indicates the format of the internet header.
 	 */
-	uint8_t		version:4;
+	uint8_t version:4;
 	/** Internet Header Length is the length of the internet header in 32~bit words, and thus points to the beginning of the data.
 	 *  Note that the minimum value for a~correct header is~5.
 	 */
-	uint8_t		header_length:4;
+	uint8_t header_length:4;
 #else
 	/** Internet Header Length is the length of the internet header in 32~bit words, and thus points to the beginning of the data.
 	 *  Note that the minimum value for a~correct header is~5.
 	 */
-	uint8_t		header_length:4;
+	uint8_t header_length:4;
 	/** The Version field indicates the format of the internet header.
 	 */
-	uint8_t		version:4;
+	uint8_t version:4;
 #endif
 	/** The Type of Service provides an indication of the abstract parameters of the quality of service desired.
@@ -118,33 +118,33 @@
 	 *  The major choice is a~three way tradeoff between low-delay, high-reliability, and high-throughput.
 	 */
-	uint8_t		tos;
+	uint8_t tos;
 	/** Total Length is the length of the datagram, measured in octets, including internet header and data.
 	 *  This field allows the length of a~datagram to be up to 65,535~octets.
 	 */
-	uint16_t	total_length;
+	uint16_t total_length;
 	/** An identifying value assigned by the sender to aid in assembling the fragments of a~datagram.
 	 */
-	uint16_t	identification;
+	uint16_t identification;
 #ifdef ARCH_IS_BIG_ENDIAN
 	/** Various control flags.
 	 */
-	uint8_t	flags:3;
+	uint8_t flags:3;
 	/** This field indicates where in the datagram this fragment belongs.
 	 *  High bits.
 	 */
-	uint8_t	fragment_offset_high:5;
+	uint8_t fragment_offset_high:5;
 #else
 	/** This field indicates where in the datagram this fragment belongs.
 	 *  High bits.
 	 */
-	uint8_t	fragment_offset_high:5;
+	uint8_t fragment_offset_high:5;
 	/** Various control flags.
 	 */
-	uint8_t	flags:3;
+	uint8_t flags:3;
 #endif
 	/** This field indicates where in the datagram this fragment belongs.
 	 *  Low bits.
 	 */
-	uint8_t	fragment_offset_low;
+	uint8_t fragment_offset_low;
 	/** This field indicates the maximum time the datagram is allowed to remain in the internet system.
 	 *  If this field contains the value zero, then the datagram must be destroyed.
@@ -153,8 +153,8 @@
 	 *  The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum datagram lifetime.
 	 */
-	uint8_t		ttl;
+	uint8_t ttl;
 	/** This field indicates the next level protocol used in the data portion of the internet datagram.
 	 */
-	uint8_t		protocol;
+	uint8_t protocol;
 	/** A checksum of the header only.
 	 *  Since some header fields change (e.g., time to live), this is recomputed and verified at each point that the internet header is processed.
@@ -162,11 +162,11 @@
 	 *  For purposes of computing the checksum, the value of the checksum field is zero.
 	 */
-	uint16_t	header_checksum;
+	uint16_t header_checksum;
 	/** The source address.
 	 */
-	uint32_t	source_address;
+	uint32_t source_address;
 	/** The destination address.
 	 */
-	uint32_t	destination_address;
+	uint32_t destination_address;
 } __attribute__ ((packed));
 
@@ -188,25 +188,25 @@
 	/** A single octet of option-type.
 	 */
-	uint8_t		type;
+	uint8_t type;
 	/** An option length octet.
 	 */
-	uint8_t		length;
+	uint8_t length;
 	/** A~pointer.
 	 */
-	uint8_t		pointer;
+	uint8_t pointer;
 #ifdef ARCH_IS_BIG_ENDIAN
 	/** The number of IP modules that cannot register timestamps due to lack of space.
 	 */
-	uint8_t	overflow:4;
+	uint8_t overflow:4;
 	/** Various internet timestamp control flags.
 	 */
-	uint8_t	flags:4;
+	uint8_t flags:4;
 #else
 	/** Various internet timestamp control flags.
 	 */
-	uint8_t	flags:4;
+	uint8_t flags:4;
 	/** The number of IP modules that cannot register timestamps due to lack of space.
 	 */
-	uint8_t	overflow:4;
+	uint8_t overflow:4;
 #endif
 } __attribute__ ((packed));
@@ -227,20 +227,20 @@
  *  Allows the packet fragmentation.
  */
-#define IPFLAG_MAY_FRAGMENT			( 0x0 << IPFLAG_FRAGMENT_SHIFT )
+#define IPFLAG_MAY_FRAGMENT			(0x0 << IPFLAG_FRAGMENT_SHIFT)
 
 /** Don't fragment flag value.
  *  Permits the packet fragmentation.
  */
-#define IPFLAG_DONT_FRAGMENT		( 0x1 << IPFLAG_FRAGMENT_SHIFT )
+#define IPFLAG_DONT_FRAGMENT		(0x1 << IPFLAG_FRAGMENT_SHIFT)
 
 /** Last fragment flag value.
  *  Indicates the last packet fragment.
  */
-#define IPFLAG_LAST_FRAGMENT		( 0x0 << IPFLAG_FRAGMENTED_SHIFT )
+#define IPFLAG_LAST_FRAGMENT		(0x0 << IPFLAG_FRAGMENTED_SHIFT)
 
 /** More fragments flag value.
  *  Indicates that more packet fragments follow.
  */
-#define IPFLAG_MORE_FRAGMENTS		( 0x1 << IPFLAG_FRAGMENTED_SHIFT )
+#define IPFLAG_MORE_FRAGMENTS		(0x1 << IPFLAG_FRAGMENTED_SHIFT)
 
 /*@}*/
@@ -261,18 +261,18 @@
 	/** The source address.
 	 */
-	uint32_t	source_address;
+	uint32_t source_address;
 	/** The destination address.
 	 */
-	uint32_t	destination_address;
+	uint32_t destination_address;
 	/** Reserved byte.
 	 *  Must be zero.
 	 */
-	uint8_t		reserved;
+	uint8_t reserved;
 	/** This field indicates the next level protocol used in the data portion of the internet datagram.
 	 */
-	uint8_t		protocol;
+	uint8_t protocol;
 	/** Data length is the length of the datagram, measured in octets.
 	 */
-	uint16_t	data_length;
+	uint16_t data_length;
 } __attribute__ ((packed));
 
Index: uspace/srv/net/il/ip/ip_messages.h
===================================================================
--- uspace/srv/net/il/ip/ip_messages.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/ip/ip_messages.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -72,25 +72,25 @@
  *  @param[in] call The message call structure.
  */
-#define IP_GET_GATEWAY( call )		({ in_addr_t addr; addr.s_addr = IPC_GET_ARG2( * call ); addr; })
+#define IP_GET_GATEWAY(call)		({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;})
 
 /** Returns the address message parameter.
  *  @param[in] call The message call structure.
  */
-#define IP_GET_ADDRESS( call )		({ in_addr_t addr; addr.s_addr = IPC_GET_ARG3( * call ); addr; })
+#define IP_GET_ADDRESS(call)		({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
 
 /** Returns the network mask message parameter.
  *  @param[in] call The message call structure.
  */
-#define IP_GET_NETMASK( call )		({ in_addr_t addr; addr.s_addr = IPC_GET_ARG4( * call ); addr; })
+#define IP_GET_NETMASK(call)		({in_addr_t addr; addr.s_addr = IPC_GET_ARG4(*call); addr;})
 
 /** Returns the protocol message parameter.
  *  @param[in] call The message call structure.
  */
-#define IP_GET_PROTOCOL( call )		(( ip_protocol_t ) IPC_GET_ARG1( * call ))
+#define IP_GET_PROTOCOL(call)		((ip_protocol_t) IPC_GET_ARG1(*call))
 
 /** Sets the header length in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define IP_SET_HEADERLEN( answer )	(( size_t * ) & IPC_GET_ARG2( * answer ))
+#define IP_SET_HEADERLEN(answer)	((size_t *) &IPC_GET_ARG2(*answer))
 
 /*@}*/
Index: uspace/srv/net/il/ip/ip_module.c
===================================================================
--- uspace/srv/net/il/ip/ip_module.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/ip/ip_module.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -61,5 +61,5 @@
  *  @see NAME
  */
-void	module_print_name( void );
+void module_print_name(void);
 
 /** Starts the IP module.
@@ -70,5 +70,5 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int	module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
 /** Processes the IP message.
@@ -80,5 +80,5 @@
  *  @returns Other error codes as defined for the ip_message() function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** IP module global data.
@@ -86,18 +86,18 @@
 extern ip_globals_t	ip_globals;
 
-void module_print_name( void ){
-	printf( "%s", NAME );
+void module_print_name(void){
+	printf("%s", NAME);
 }
 
-int module_start( async_client_conn_t client_connection ){
+int module_start(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ipcarg_t	phonehash;
+	ipcarg_t phonehash;
 
-	async_set_client_connection( client_connection );
-	ip_globals.net_phone = net_connect_module( SERVICE_NETWORKING );
-	ERROR_PROPAGATE( pm_init());
-	if( ERROR_OCCURRED( ip_initialize( client_connection ))
-	|| ERROR_OCCURRED( REGISTER_ME( SERVICE_IP, & phonehash ))){
+	async_set_client_connection(client_connection);
+	ip_globals.net_phone = net_connect_module(SERVICE_NETWORKING);
+	ERROR_PROPAGATE(pm_init());
+	if(ERROR_OCCURRED(ip_initialize(client_connection))
+		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_IP, &phonehash))){
 		pm_destroy();
 		return ERROR_CODE;
@@ -110,6 +110,6 @@
 }
 
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	return ip_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return ip_message(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/il/ip/ip_module.h
===================================================================
--- uspace/srv/net/il/ip/ip_module.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/ip/ip_module.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -46,5 +46,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	ip_initialize( async_client_conn_t client_connection );
+int ip_initialize(async_client_conn_t client_connection);
 
 /** Processes the IP message.
@@ -59,5 +59,5 @@
  *  @see IS_NET_IP_MESSAGE()
  */
-int	ip_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int ip_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/il/ip/ip_remote.c
===================================================================
--- uspace/srv/net/il/ip/ip_remote.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/il/ip/ip_remote.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -52,62 +52,66 @@
 #include "ip_messages.h"
 
-int ip_device_req( int ip_phone, device_id_t device_id, services_t service ){
-	return generic_device_req( ip_phone, NET_IL_DEVICE, device_id, 0, service );
+int ip_device_req(int ip_phone, device_id_t device_id, services_t service){
+	return generic_device_req(ip_phone, NET_IL_DEVICE, device_id, 0, service);
 }
 
-int ip_send_msg( int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error ){
-	return generic_send_msg( ip_phone, NET_IL_SEND, device_id, packet_get_id( packet ), sender, error );
+int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error){
+	return generic_send_msg(ip_phone, NET_IL_SEND, device_id, packet_get_id(packet), sender, error);
 }
 
-int ip_connect_module( services_t service ){
-	return connect_to_service( SERVICE_IP );
+int ip_connect_module(services_t service){
+	return connect_to_service(SERVICE_IP);
 }
 
-int ip_add_route_req( int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway ){
-	return ( int ) async_req_4_0( ip_phone, NET_IP_ADD_ROUTE, ( ipcarg_t ) device_id, ( ipcarg_t ) gateway.s_addr, ( ipcarg_t ) address.s_addr, ( ipcarg_t ) netmask.s_addr );
+int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway){
+	return (int) async_req_4_0(ip_phone, NET_IP_ADD_ROUTE, (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr, (ipcarg_t) address.s_addr, (ipcarg_t) netmask.s_addr);
 }
 
-int ip_set_gateway_req( int ip_phone, device_id_t device_id, in_addr_t gateway ){
-	return ( int ) async_req_2_0( ip_phone, NET_IP_SET_GATEWAY, ( ipcarg_t ) device_id, ( ipcarg_t ) gateway.s_addr );
+int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway){
+	return (int) async_req_2_0(ip_phone, NET_IP_SET_GATEWAY, (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr);
 }
 
-int ip_packet_size_req( int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension ){
-	return generic_packet_size_req( ip_phone, NET_IL_PACKET_SPACE, device_id, packet_dimension );
+int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension){
+	return generic_packet_size_req(ip_phone, NET_IL_PACKET_SPACE, device_id, packet_dimension);
 }
 
-int ip_bind_service( services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg ){
-	return ( int ) bind_service( service, ( ipcarg_t ) protocol, me, service, receiver );
+int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg){
+	return (int) bind_service(service, (ipcarg_t) protocol, me, service, receiver);
 }
 
-int ip_received_error_msg( int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error ){
-	return generic_received_msg( ip_phone, NET_IP_RECEIVED_ERROR, device_id, packet_get_id( packet ), target, error );
+int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
+	return generic_received_msg(ip_phone, NET_IP_RECEIVED_ERROR, device_id, packet_get_id(packet), target, error);
 }
 
-int ip_get_route_req( int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen ){
-	aid_t			message_id;
-	ipcarg_t		result;
-	ipc_call_t		answer;
+int ip_get_route_req(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen){
+	aid_t message_id;
+	ipcarg_t result;
+	ipc_call_t answer;
 
-	if( !( destination && ( addrlen > 0 ))) return EINVAL;
-	if( !( device_id && header && headerlen )) return EBADMEM;
-	* header = NULL;
-	message_id = async_send_1( ip_phone, NET_IP_GET_ROUTE, ( ipcarg_t ) protocol, & answer );
-	if(( async_data_write_start( ip_phone, destination, addrlen ) == EOK )
-	&& ( async_data_read_start( ip_phone, headerlen, sizeof( * headerlen )) == EOK )
-	&& ( * headerlen > 0 )){
-		* header = ( ip_pseudo_header_ref ) malloc( * headerlen );
-		if( * header ){
-			if( async_data_read_start( ip_phone, * header, * headerlen ) != EOK ){
-				free( * header );
+	if(!(destination && (addrlen > 0))){
+		return EINVAL;
+	}
+	if(!(device_id && header && headerlen)){
+		return EBADMEM;
+	}
+	*header = NULL;
+	message_id = async_send_1(ip_phone, NET_IP_GET_ROUTE, (ipcarg_t) protocol, &answer);
+	if((async_data_write_start(ip_phone, destination, addrlen) == EOK)
+		&& (async_data_read_start(ip_phone, headerlen, sizeof(*headerlen)) == EOK)
+		&& (*headerlen > 0)){
+		*header = (ip_pseudo_header_ref) malloc(*headerlen);
+		if(*header){
+			if(async_data_read_start(ip_phone, * header, * headerlen) != EOK){
+				free(*header);
 			}
 		}
 	}
-	async_wait_for( message_id, & result );
-	if(( result != EOK ) && ( * header )){
-		free( * header );
+	async_wait_for(message_id, &result);
+	if((result != EOK) && (*header)){
+		free(*header);
 	}else{
-		* device_id = IPC_GET_DEVICE( & answer );
+		*device_id = IPC_GET_DEVICE(&answer);
 	}
-	return ( int ) result;
+	return (int) result;
 }
 
Index: uspace/srv/net/include/arp_interface.h
===================================================================
--- uspace/srv/net/include/arp_interface.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/arp_interface.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -67,5 +67,5 @@
  *  @returns Other error codes as defined for the nil_get_broadcast_addr() function.
  */
-int	arp_device_req( int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address );
+int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address);
 
 /** Translates the given protocol address to the network interface address.
@@ -83,5 +83,5 @@
  *  @returns ENOENT if the mapping is not found.
  */
-int	arp_translate_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data );
+int arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data);
 
 /** Clears the device cache.
@@ -91,5 +91,5 @@
  *  @returns ENOENT if the device is not found.
  */
-int	arp_clear_device_req( int arp_phone, device_id_t device_id );
+int arp_clear_device_req(int arp_phone, device_id_t device_id);
 
 /** Clears the given protocol address from the cache.
@@ -101,5 +101,5 @@
  *  @returns ENOENT if the mapping is not found.
  */
-int	arp_clear_address_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address );
+int arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address);
 
 /** Cleans the cache.
@@ -107,5 +107,5 @@
  *  @returns EOK on success.
  */
-int	arp_clean_cache_req( int arp_phone );
+int arp_clean_cache_req(int arp_phone);
 
 /** Connects to the ARP module.
@@ -114,5 +114,5 @@
  *  @returns 0 if called by the bundle module.
  */
-int	arp_connect_module( services_t service );
+int arp_connect_module(services_t service);
 
 /** Returns the ARP task identifier.
@@ -120,5 +120,5 @@
  *  @returns 0 if called by the remote module.
  */
-task_id_t	arp_task_get_id( void );
+task_id_t arp_task_get_id(void);
 
 /*@}*/
Index: uspace/srv/net/include/byteorder.h
===================================================================
--- uspace/srv/net/include/byteorder.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/byteorder.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -42,27 +42,27 @@
 
 
-/** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ).
+/** Converts the given short number (16 bit) from the host byte order to the network byte order (big endian).
  *  @param[in] number The number in the host byte order to be converted.
  *  @returns The number in the network byte order.
  */
-#define htons( number )		host2uint16_t_be( number )
+#define htons(number)		host2uint16_t_be(number)
 
-/** Converts the given long number ( 32 bit ) from the host byte order to the network byte order ( big endian ).
+/** Converts the given long number (32 bit) from the host byte order to the network byte order (big endian).
  *  @param[in] number The number in the host byte order to be converted.
  *  @returns The number in the network byte order.
  */
-#define htonl( number )		host2uint32_t_be( number )
+#define htonl(number)		host2uint32_t_be(number)
 
-/** Converts the given short number ( 16 bit ) from the network byte order ( big endian ) to the host byte order.
+/** Converts the given short number (16 bit) from the network byte order (big endian) to the host byte order.
  *  @param[in] number The number in the network byte order to be converted.
  *  @returns The number in the host byte order.
  */
-#define ntohs( number ) 	uint16_t_be2host( number )
+#define ntohs(number) 	uint16_t_be2host(number)
 
-/** Converts the given long number ( 32 bit ) from the network byte order ( big endian ) to the host byte order.
+/** Converts the given long number (32 bit) from the network byte order (big endian) to the host byte order.
  *  @param[in] number The number in the network byte order to be converted.
  *  @returns The number in the host byte order.
  */
-#define ntohl( number )		uint32_t_be2host( number )
+#define ntohl(number)		uint32_t_be2host(number)
 
 #endif
Index: uspace/srv/net/include/checksum.h
===================================================================
--- uspace/srv/net/include/checksum.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/checksum.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -54,7 +54,7 @@
  */
 #ifdef ARCH_IS_BIG_ENDIAN
-	#define compute_crc32( seed, data, length )	compute_crc32_be( seed, ( uint8_t * ) data, length )
+	#define compute_crc32(seed, data, length)	compute_crc32_be(seed, (uint8_t *) data, length)
 #else
-	#define compute_crc32( seed, data, length )	compute_crc32_le( seed, ( uint8_t * ) data, length )
+	#define compute_crc32(seed, data, length)	compute_crc32_le(seed, (uint8_t *) data, length)
 #endif
 
@@ -65,5 +65,5 @@
  *  @returns The computed CRC32 of the length bits of the data.
  */
-uint32_t	compute_crc32_le( uint32_t seed, uint8_t * data, size_t length );
+uint32_t compute_crc32_le(uint32_t seed, uint8_t * data, size_t length);
 
 /**	Computes CRC32 value in the big-endian environment.
@@ -73,5 +73,5 @@
  *  @returns The computed CRC32 of the length bits of the data.
  */
-uint32_t	compute_crc32_be( uint32_t seed, uint8_t * data, size_t length );
+uint32_t compute_crc32_be(uint32_t seed, uint8_t * data, size_t length);
 
 /** Computes sum of the 2 byte fields.
@@ -82,5 +82,5 @@
  *  @returns The computed checksum of the length bytes of the data.
  */
-uint32_t	compute_checksum( uint32_t seed, uint8_t * data, size_t length );
+uint32_t compute_checksum(uint32_t seed, uint8_t * data, size_t length);
 
 /** Compacts the computed checksum to the 16 bit number adding the carries.
@@ -88,5 +88,5 @@
  *  @returns Compacted computed checksum to the 16 bits.
  */
-uint16_t	compact_checksum( uint32_t sum );
+uint16_t compact_checksum(uint32_t sum);
 
 /** Returns or flips the checksum if zero.
@@ -95,5 +95,5 @@
  *  @returns 0xFFFF if the computed checksum is zero.
  */
-uint16_t	flip_checksum( uint16_t checksum );
+uint16_t flip_checksum(uint16_t checksum);
 
 /** Computes the ip header checksum.
@@ -106,5 +106,5 @@
  *  @returns 0xFFFF if the computed checksum is zero.
  */
-uint16_t ip_checksum( uint8_t * data, size_t length );
+uint16_t ip_checksum(uint8_t * data, size_t length);
 
 #endif
Index: uspace/srv/net/include/device.h
===================================================================
--- uspace/srv/net/include/device.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/device.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -50,5 +50,5 @@
 /** Invalid device identifier.
  */
-#define DEVICE_INVALID_ID		( -1 )
+#define DEVICE_INVALID_ID		(-1)
 
 /** Device identifier type.
@@ -92,77 +92,77 @@
 	/** Total packets received.
 	 */
-	unsigned long	receive_packets;
+	unsigned long receive_packets;
 	/** Total packets transmitted.
 	 */
-	unsigned long	send_packets;
+	unsigned long send_packets;
 	/** Total bytes received.
 	 */
-	unsigned long	receive_bytes;
+	unsigned long receive_bytes;
 	/** Total bytes transmitted.
 	 */
-	unsigned long	send_bytes;
+	unsigned long send_bytes;
 	/** Bad packets received counter.
 	 */
-	unsigned long	receive_errors;
+	unsigned long receive_errors;
 	/** Packet transmition problems counter.
 	 */
-	unsigned long	send_errors;
+	unsigned long send_errors;
 	/** No space in buffers counter.
 	 */
-	unsigned long	receive_dropped;
+	unsigned long receive_dropped;
 	/** No space available counter.
 	 */
-	unsigned long	send_dropped;
+	unsigned long send_dropped;
 	/** Total multicast packets received.
 	 */
-	unsigned long	multicast;
+	unsigned long multicast;
 	/** The number of collisions due to congestion on the medium.
 	 */
-	unsigned long	collisions;
+	unsigned long collisions;
 
 	/* detailed receive_errors: */
 	/** Received packet length error counter.
 	 */
-	unsigned long	receive_length_errors;
+	unsigned long receive_length_errors;
 	/** Receiver buffer overflow counter.
 	 */
-	unsigned long	receive_over_errors;
+	unsigned long receive_over_errors;
 	/** Received packet with crc error counter.
 	 */
-	unsigned long	receive_crc_errors;
+	unsigned long receive_crc_errors;
 	/** Received frame alignment error counter.
 	 */
-	unsigned long	receive_frame_errors;
+	unsigned long receive_frame_errors;
 	/** Receiver fifo overrun counter.
 	 */
-	unsigned long	receive_fifo_errors;
+	unsigned long receive_fifo_errors;
 	/** Receiver missed packet counter.
 	 */
-	unsigned long	receive_missed_errors;
+	unsigned long receive_missed_errors;
 
 	/* detailed send_errors */
 	/** Transmitter aborted counter.
 	 */
-	unsigned long	send_aborted_errors;
+	unsigned long send_aborted_errors;
 	/** Transmitter carrier errors counter.
 	 */
-	unsigned long	send_carrier_errors;
+	unsigned long send_carrier_errors;
 	/** Transmitter fifo overrun counter.
 	 */
-	unsigned long	send_fifo_errors;
+	unsigned long send_fifo_errors;
 	/** Transmitter carrier errors counter.
 	 */
-	unsigned long	send_heartbeat_errors;
+	unsigned long send_heartbeat_errors;
 	/** Transmitter window errors counter.
 	 */
-	unsigned long	send_window_errors;
+	unsigned long send_window_errors;
 
 	/* for cslip etc */
 	/** Total compressed packets received.
 	 */
-	unsigned long	receive_compressed;
+	unsigned long receive_compressed;
 	/** Total compressed packet transmitted.
 	 */
-	unsigned long	send_compressed;
+	unsigned long send_compressed;
 };
 
Index: uspace/srv/net/include/ethernet_lsap.h
===================================================================
--- uspace/srv/net/include/ethernet_lsap.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/ethernet_lsap.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -72,5 +72,5 @@
  */
 #define ETH_LSAP_SNA2	0x0C
-/** PROWAY (IEC955) Network Management & Initialization LSAP identifier.
+/** PROWAY (IEC955) Network Management &Initialization LSAP identifier.
  */
 #define ETH_LSAP_PROWAY_NMI	0x0E
Index: uspace/srv/net/include/ethernet_protocols.h
===================================================================
--- uspace/srv/net/include/ethernet_protocols.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/ethernet_protocols.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -373,5 +373,5 @@
 #define ETH_P_Stanford_V_Kernel_prod		0x805C
 
-/** Evans & Sutherland ethernet protocol type.
+/** Evans &Sutherland ethernet protocol type.
  */
 #define ETH_P_Evans_Sutherland		0x805D
@@ -873,9 +873,9 @@
 #define ETH_P_Taurus_Controls_MAX		0x82AB
 
-/** Walker Richer & Quinn ethernet protocol type.
+/** Walker Richer &Quinn ethernet protocol type.
  */
 #define ETH_P_Walker_Richer_Quinn_MIN		0x82AC
 
-/** Walker Richer & Quinn ethernet protocol type.
+/** Walker Richer &Quinn ethernet protocol type.
  */
 #define ETH_P_Walker_Richer_Quinn_MAX		0x8693
@@ -921,9 +921,9 @@
 #define ETH_P_ATOMIC		0x86DF
 
-/** Landis & Gyr Powers ethernet protocol type.
+/** Landis &Gyr Powers ethernet protocol type.
  */
 #define ETH_P_Landis_Gyr_Powers_MIN		0x86E0
 
-/** Landis & Gyr Powers ethernet protocol type.
+/** Landis &Gyr Powers ethernet protocol type.
  */
 #define ETH_P_Landis_Gyr_Powers_MAX		0x86EF
Index: uspace/srv/net/include/icmp_api.h
===================================================================
--- uspace/srv/net/include/icmp_api.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/icmp_api.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -79,5 +79,5 @@
  *  @returns EPARTY if there was an internal error.
  */
-int	icmp_echo_msg( int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen );
+int icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen);
 
 /*@}*/
Index: uspace/srv/net/include/icmp_client.h
===================================================================
--- uspace/srv/net/include/icmp_client.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/icmp_client.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -50,5 +50,5 @@
  *  @returns Zero (0) if the packet contains no data.
  */
-int	icmp_client_process_packet( packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu );
+int icmp_client_process_packet(packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu);
 
 /** Returns the ICMP header length.
@@ -56,5 +56,5 @@
  *  @returns The ICMP header length in bytes.
  */
-size_t	icmp_client_header_length( packet_t packet );
+size_t icmp_client_header_length(packet_t packet);
 
 #endif
Index: uspace/srv/net/include/icmp_common.h
===================================================================
--- uspace/srv/net/include/icmp_common.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/icmp_common.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -44,5 +44,5 @@
 /** Default timeout for incoming connections in microseconds.
  */
-#define ICMP_CONNECT_TIMEOUT	( 1 * 1000 * 1000 )
+#define ICMP_CONNECT_TIMEOUT	(1 * 1000 * 1000)
 
 /** Connects to the ICMP module.
@@ -53,5 +53,5 @@
  *  @returns ETIMEOUT if the connection timeouted.
  */
-int	icmp_connect_module( services_t service, suseconds_t timeout );
+int icmp_connect_module(services_t service, suseconds_t timeout);
 
 #endif
Index: uspace/srv/net/include/icmp_interface.h
===================================================================
--- uspace/srv/net/include/icmp_interface.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/icmp_interface.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -71,5 +71,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int icmp_destination_unreachable_msg( int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet );
+int icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet);
 
 /** Sends the Source Quench error notification packet.
@@ -82,5 +82,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int icmp_source_quench_msg( int icmp_phone, packet_t packet );
+int icmp_source_quench_msg(int icmp_phone, packet_t packet);
 
 /** Sends the Time Exceeded error notification packet.
@@ -94,5 +94,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int icmp_time_exceeded_msg( int icmp_phone, icmp_code_t code, packet_t packet );
+int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet);
 
 /** Sends the Parameter Problem error notification packet.
@@ -107,5 +107,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int icmp_parameter_problem_msg( int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet );
+int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet);
 
 /*@}*/
Index: uspace/srv/net/include/il_interface.h
===================================================================
--- uspace/srv/net/include/il_interface.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/il_interface.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -64,6 +64,6 @@
  *  @returns EOK on success.
  */
-static inline int	il_device_state_msg( int il_phone, device_id_t device_id, device_state_t state, services_t target ){
-	return generic_device_state_msg( il_phone, NET_IL_DEVICE_STATE, device_id, state, target );
+static inline int il_device_state_msg(int il_phone, device_id_t device_id, device_state_t state, services_t target){
+	return generic_device_state_msg(il_phone, NET_IL_DEVICE_STATE, device_id, state, target);
 }
 
@@ -75,6 +75,6 @@
  *  @returns EOK on success.
  */
-inline static int	il_received_msg( int il_phone, device_id_t device_id, packet_t packet, services_t target ){
-	return generic_received_msg( il_phone, NET_IL_RECEIVED, device_id, packet_get_id( packet ), target, 0 );
+inline static int il_received_msg(int il_phone, device_id_t device_id, packet_t packet, services_t target){
+	return generic_received_msg(il_phone, NET_IL_RECEIVED, device_id, packet_get_id(packet), target, 0);
 }
 
@@ -86,6 +86,6 @@
  *  @returns EOK on success.
  */
-inline static int	il_mtu_changed_msg( int il_phone, device_id_t device_id, size_t mtu, services_t target ){
-	return generic_device_state_msg( il_phone, NET_IL_MTU_CHANGED, device_id, ( int ) mtu, target );
+inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id, size_t mtu, services_t target){
+	return generic_device_state_msg(il_phone, NET_IL_MTU_CHANGED, device_id, (int) mtu, target);
 }
 
Index: uspace/srv/net/include/in.h
===================================================================
--- uspace/srv/net/include/in.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/in.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -45,5 +45,5 @@
 /** INET string address maximum length.
  */
-#define INET_ADDRSTRLEN		( 4 * 3 + 3 + 1 )
+#define INET_ADDRSTRLEN		(4 * 3 + 3 + 1)
 
 /** Type definition of the INET address.
@@ -62,5 +62,5 @@
 	/** 4 byte IP address.
 	 */
-	uint32_t		s_addr;
+	uint32_t s_addr;
 };
 
@@ -72,14 +72,14 @@
 	 *  Should be AF_INET.
 	 */
-	uint16_t		sin_family;
+	uint16_t sin_family;
 	/** Port number.
 	 */
-	uint16_t		sin_port;
+	uint16_t sin_port;
 	/** Internet address.
 	 */
-	struct in_addr	sin_addr;
+	struct in_addr sin_addr;
 	/** Padding to meet the sockaddr size.
 	 */
-	uint8_t			sin_zero[ 8 ];
+	uint8_t sin_zero[8];
 };
 
Index: uspace/srv/net/include/in6.h
===================================================================
--- uspace/srv/net/include/in6.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/in6.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -45,5 +45,5 @@
 /** INET6 string address maximum length.
  */
-#define INET6_ADDRSTRLEN	( 8 * 4 + 7 + 1 )
+#define INET6_ADDRSTRLEN	(8 * 4 + 7 + 1)
 
 /** Type definition of the INET6 address.
@@ -62,5 +62,5 @@
 	/** 16 byte IPv6 address.
 	 */
-	unsigned char	s6_addr[ 16 ];
+	unsigned char s6_addr[16];
 };
 
@@ -72,17 +72,17 @@
 	 *  Should be AF_INET6.
 	 */
-	uint16_t		sin6_family;
+	uint16_t sin6_family;
 	/** Port number.
 	 */
-	uint16_t		sin6_port;
+	uint16_t sin6_port;
 	/** IPv6 flow information.
 	 */
-	uint32_t		sin6_flowinfo;
+	uint32_t sin6_flowinfo;
 	/** IPv6 address.
 	 */
-	struct in6_addr	sin6_addr;
+	struct in6_addr sin6_addr;
 	/** Scope identifier.
 	 */
-	uint32_t		sin6_scope_id;
+	uint32_t sin6_scope_id;
 };
 
Index: uspace/srv/net/include/inet.h
===================================================================
--- uspace/srv/net/include/inet.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/inet.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -62,5 +62,5 @@
  *  @returns ENOTSUP if the address family is not supported.
  */
-int	inet_ntop( uint16_t family, const uint8_t * data, char * address, size_t length );
+int inet_ntop(uint16_t family, const uint8_t * data, char * address, size_t length);
 
 /** Parses the character string into the address.
@@ -74,5 +74,5 @@
  *  @returns ENOTSUP if the address family is not supported.
  */
-int	inet_pton( uint16_t family, const char * address, uint8_t * data );
+int inet_pton(uint16_t family, const char * address, uint8_t * data);
 
 /** Socket address.
@@ -82,8 +82,8 @@
 	 *  @see socket.h
 	 */
-	uint16_t		sa_family;
+	uint16_t sa_family;
 	/** 14 byte protocol address.
 	 */
-	uint8_t			sa_data[ 14 ];
+	uint8_t sa_data[14];
 };
 
Index: uspace/srv/net/include/ip_client.h
===================================================================
--- uspace/srv/net/include/ip_client.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/ip_client.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -57,5 +57,5 @@
  *  @returns ENOMEM if there is not enough memory left in the packet.
  */
-int	ip_client_prepare_packet( packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length );
+int ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length);
 
 /** Processes the received IP packet.
@@ -71,5 +71,5 @@
  *  @returns ENOMEM if the packet is too short to contain the IP header.
  */
-int	ip_client_process_packet( packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length );
+int ip_client_process_packet(packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length);
 
 /** Returns the IP header length.
@@ -78,5 +78,5 @@
  *  @returns Zero (0) if there is no IP header.
  */
-size_t	ip_client_header_length( packet_t packet );
+size_t ip_client_header_length(packet_t packet);
 
 /** Updates the IPv4 pseudo header data length field.
@@ -88,5 +88,5 @@
  *  @returns EINVAL if the headerlen parameter is not IPv4 pseudo header length.
  */
-int	ip_client_set_pseudo_header_data_length( ip_pseudo_header_ref header, size_t headerlen, size_t data_length );
+int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length);
 
 /** Constructs the IPv4 pseudo header.
@@ -108,5 +108,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	ip_client_get_pseudo_header( ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen );
+int ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen);
 
 // TODO ipopt manipulation
Index: uspace/srv/net/include/ip_codes.h
===================================================================
--- uspace/srv/net/include/ip_codes.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/ip_codes.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -94,33 +94,33 @@
 /** Normal delay.
  */
-#define IPTOS_NORMALDELAY			( 0x0 << IPTOS_DELAY_SHIFT )
+#define IPTOS_NORMALDELAY			(0x0 << IPTOS_DELAY_SHIFT)
 
 /** Low delay.
  */
-#define IPTOS_LOWDELAY				( 0x1 << IPTOS_DELAY_SHIFT )
+#define IPTOS_LOWDELAY				(0x1 << IPTOS_DELAY_SHIFT)
 
 /** Normal throughput.
  */
-#define IPTOS_NORMALTHROUGHPUT		( 0x0 << IPTOS_THROUGHPUT_SHIFT )
+#define IPTOS_NORMALTHROUGHPUT		(0x0 << IPTOS_THROUGHPUT_SHIFT)
 
 /** Throughput.
  */
-#define IPTOS_THROUGHPUT			( 0x1 << IPTOS_THROUGHPUT_SHIFT )
+#define IPTOS_THROUGHPUT			(0x1 << IPTOS_THROUGHPUT_SHIFT)
 
 /** Normal reliability.
  */
-#define IPTOS_NORMALRELIABILITY		( 0x0 << IPTOS_RELIABILITY_SHIFT )
+#define IPTOS_NORMALRELIABILITY		(0x0 << IPTOS_RELIABILITY_SHIFT)
 
 /** Reliability.
  */
-#define IPTOS_RELIABILITY			( 0x1 << IPTOS_RELIABILITY_SHIFT )
+#define IPTOS_RELIABILITY			(0x1 << IPTOS_RELIABILITY_SHIFT)
 
 /** Normal cost.
  */
-#define IPTOS_NORMALCOST			( 0x0 << IPTOS_COST_SHIFT )
+#define IPTOS_NORMALCOST			(0x0 << IPTOS_COST_SHIFT)
 
 /** Minimum cost.
  */
-#define IPTOS_MICNCOST				( 0x1 << IPTOS_COST_SHIFT )
+#define IPTOS_MICNCOST				(0x1 << IPTOS_COST_SHIFT)
 
 /*@}*/
@@ -137,33 +137,33 @@
 /** Routine precedence.
  */
-#define IPTOS_PREC_ROUTINE			( 0x0 << IPTOS_PRECEDENCE_SHIFT )
+#define IPTOS_PREC_ROUTINE			(0x0 << IPTOS_PRECEDENCE_SHIFT)
 
 /** Priority precedence.
  */
-#define IPTOS_PREC_PRIORITY			( 0x1 << IPTOS_PRECEDENCE_SHIFT )
+#define IPTOS_PREC_PRIORITY			(0x1 << IPTOS_PRECEDENCE_SHIFT)
 
 /** Immediate precedence.
  */
-#define IPTOS_PREC_IMMEDIATE		( 0x2 << IPTOS_PRECEDENCE_SHIFT )
+#define IPTOS_PREC_IMMEDIATE		(0x2 << IPTOS_PRECEDENCE_SHIFT)
 
 /** Flash precedence.
  */
-#define IPTOS_PREC_FLASH			( 0x3 << IPTOS_PRECEDENCE_SHIFT )
+#define IPTOS_PREC_FLASH			(0x3 << IPTOS_PRECEDENCE_SHIFT)
 
 /** Flash override precedence.
  */
-#define IPTOS_PREC_FLASHOVERRIDE	( 0x4 << IPTOS_PRECEDENCE_SHIFT )
+#define IPTOS_PREC_FLASHOVERRIDE	(0x4 << IPTOS_PRECEDENCE_SHIFT)
 
 /** Critical precedence.
  */
-#define IPTOS_PREC_CRITIC_ECP		( 0x5 << IPTOS_PRECEDENCE_SHIFT )
+#define IPTOS_PREC_CRITIC_ECP		(0x5 << IPTOS_PRECEDENCE_SHIFT)
 
 /** Inter-network control precedence.
  */
-#define IPTOS_PREC_INTERNETCONTROL	( 0x6 << IPTOS_PRECEDENCE_SHIFT )
+#define IPTOS_PREC_INTERNETCONTROL	(0x6 << IPTOS_PRECEDENCE_SHIFT)
 
 /** Network control precedence.
  */
-#define IPTOS_PREC_NETCONTROL		( 0x7 << IPTOS_PRECEDENCE_SHIFT )
+#define IPTOS_PREC_NETCONTROL		(0x7 << IPTOS_PRECEDENCE_SHIFT)
 
 /*@}*/
@@ -195,5 +195,5 @@
 /** Copy flag.
  */
-#define IPOPT_COPY					( 1 << IPOPT_COPY_SHIFT )
+#define IPOPT_COPY					(1 << IPOPT_COPY_SHIFT)
 
 /** Returns IP option type.
@@ -202,20 +202,20 @@
  *  @param[in] number The IP option number.
  */
-#define IPOPT_TYPE( copy, class, number )	((( copy ) & IPOPT_COPY ) | (( class ) & IPOPT_CLASS_MASK ) | (( number << IPOPT_NUMBER_SHIFT ) & IPOPT_NUMBER_MASK ))
+#define IPOPT_TYPE(copy, class, number)	(((copy) &IPOPT_COPY) | ((class) &IPOPT_CLASS_MASK) | ((number << IPOPT_NUMBER_SHIFT) &IPOPT_NUMBER_MASK))
 
 /** Returns a value indicating whether the IP option should be copied.
  *  @param[in] o The IP option.
  */
-#define	IPOPT_COPIED( o )			(( o ) & IPOPT_COPY )
+#define	IPOPT_COPIED(o)			((o) &IPOPT_COPY)
 
 /** Returns an IP option class.
  *  @param[in] o The IP option.
  */
-#define	IPOPT_CLASS( o )			(( o ) & IPOPT_CLASS_MASK )
+#define	IPOPT_CLASS(o)			((o) &IPOPT_CLASS_MASK)
 
 /** Returns an IP option number.
  *  @param[in] o The IP option.
  */
-#define	IPOPT_NUMBER( o )			(( o ) & IPOPT_NUMBER_MASK )
+#define	IPOPT_NUMBER(o)			((o) &IPOPT_NUMBER_MASK)
 
 /*@}*/
@@ -227,17 +227,17 @@
 /** Control class.
  */
-#define	IPOPT_CONTROL				( 0 << IPOPT_CLASS_SHIFT )
+#define	IPOPT_CONTROL				(0 << IPOPT_CLASS_SHIFT)
 
 /** Reserved class 1.
  */
-#define	IPOPT_RESERVED1				( 1 << IPOPT_CLASS_SHIFT )
+#define	IPOPT_RESERVED1				(1 << IPOPT_CLASS_SHIFT)
 
 /** Measurement class.
  */
-#define	IPOPT_MEASUREMENT			( 2 << IPOPT_CLASS_SHIFT )
+#define	IPOPT_MEASUREMENT			(2 << IPOPT_CLASS_SHIFT)
 
 /** Reserved class 2.
  */
-#define	IPOPT_RESERVED2				( 3 << IPOPT_CLASS_SHIFT )
+#define	IPOPT_RESERVED2				(3 << IPOPT_CLASS_SHIFT)
 
 /*@}*/
@@ -250,35 +250,35 @@
  */
 //#define IPOPT_END_OF_LIST			0x0
-#define IPOPT_END					IPOPT_TYPE( 0, IPOPT_CONTROL, 0 )
+#define IPOPT_END					IPOPT_TYPE(0, IPOPT_CONTROL, 0)
 
 /** No operation.
  */
 //#define IPOPT_NO_OPERATION		0x1
-#define IPOPT_NOOP					IPOPT_TYPE( 0, IPOPT_CONTROL, 1 )
+#define IPOPT_NOOP					IPOPT_TYPE(0, IPOPT_CONTROL, 1)
 
 /** Security.
  */
 //#define IPOPT_SECURITY			0x82
-#define IPOPT_SEC					IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 2 )
+#define IPOPT_SEC					IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 2)
 
 /** Loose source.
  */
 //#define IPOPT_LOOSE_SOURCE		0x83
-#define IPOPT_LSRR					IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 3 )
+#define IPOPT_LSRR					IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 3)
 
 /** Strict route.
  */
 //#define IPOPT_STRICT_SOURCE		0x89
-#define IPOPT_SSRR					IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 9 )
+#define IPOPT_SSRR					IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 9)
 
 /** Record route.
  */
 //#define IPOPT_RECORD_ROUTE		0x07
-#define IPOPT_RR					IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 7 )
+#define IPOPT_RR					IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 7)
 
 /** Stream identifier.
  */
 //#define IPOPT_STREAM_IDENTIFIER	0x88
-#define IPOPT_SID					IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 8 )
+#define IPOPT_SID					IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 8)
 
 /** Stream identifier length.
@@ -289,9 +289,9 @@
  */
 //#define IPOPT_INTERNET_TIMESTAMP	0x44
-#define IPOPT_TIMESTAMP				IPOPT_TYPE( IPOPT_COPY, IPOPT_MEASUREMENT, 4 )
+#define IPOPT_TIMESTAMP				IPOPT_TYPE(IPOPT_COPY, IPOPT_MEASUREMENT, 4)
 
 /** Commercial IP security option.
  */
-#define IPOPT_CIPSO					IPOPT_TYPE( IPOPT_COPY, IPOPT_CONTROL, 5 )
+#define IPOPT_CIPSO					IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 5)
 
 /** No operation variant.
Index: uspace/srv/net/include/ip_interface.h
===================================================================
--- uspace/srv/net/include/ip_interface.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/ip_interface.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -70,5 +70,5 @@
  *  @returns EOK on success.
  */
-typedef int	( * tl_received_msg_t )( device_id_t device_id, packet_t packet, services_t receiver, services_t error );
+typedef int	(*tl_received_msg_t)(device_id_t device_id, packet_t packet, services_t receiver, services_t error);
 
 /** Creates bidirectional connection with the ip module service and registers the message receiver.
@@ -82,5 +82,5 @@
  *  @returns Other error codes as defined for the bind_service() function.
  */
-int	ip_bind_service( services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg );
+int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg);
 
 /** Registers the new device.
@@ -98,5 +98,5 @@
  *  @returns Other error codes as defined for the arp_device_req() function.
  */
-int	ip_device_req( int ip_phone, device_id_t device_id, services_t netif );
+int ip_device_req(int ip_phone, device_id_t device_id, services_t netif);
 
 /** Sends the packet queue.
@@ -110,5 +110,5 @@
  *  @returns Other error codes as defined for the generic_send_msg() function.
  */
-int	ip_send_msg( int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error );
+int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error);
 
 /** Connects to the IP module.
@@ -117,5 +117,5 @@
  *  @returns 0 if called by the bundle module.
  */
-int	ip_connect_module( services_t service );
+int ip_connect_module(services_t service);
 
 /** Adds a route to the device routing table.
@@ -127,5 +127,5 @@
  *  @param[in] gateway The target network gateway. Not used if zero.
  */
-int	ip_add_route_req( int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway );
+int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway);
 
 /** Sets the default gateway.
@@ -135,5 +135,5 @@
  *  @param[in] gateway The default gateway.
  */
-int	ip_set_gateway_req( int ip_phone, device_id_t device_id, in_addr_t gateway );
+int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway);
 
 /** Returns the device packet dimension for sending.
@@ -145,5 +145,5 @@
  *  @returns Other error codes as defined for the generic_packet_size_req() function.
  */
-int	ip_packet_size_req( int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension );
+int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension);
 
 /** Notifies the IP module about the received error notification packet.
@@ -155,5 +155,5 @@
  *  @returns EOK on success.
  */
-int	ip_received_error_msg( int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error );
+int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error);
 
 /** Returns the device identifier and the IP pseudo header based on the destination address.
@@ -166,5 +166,5 @@
  *  @param[out] headerlen The IP pseudo header length.
  */
-int	ip_get_route_req( int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen );
+int ip_get_route_req(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen);
 
 /*@}*/
Index: uspace/srv/net/include/ip_protocols.h
===================================================================
--- uspace/srv/net/include/ip_protocols.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/ip_protocols.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -610,5 +610,5 @@
 /** Maximum internet protocol number.
  */
-#define IPPROTO_MAX		( IPPROTO_RAW + 1 )
+#define IPPROTO_MAX		(IPPROTO_RAW + 1)
 
 /*@}*/
Index: uspace/srv/net/include/net_interface.h
===================================================================
--- uspace/srv/net/include/net_interface.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/net_interface.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -66,5 +66,5 @@
  *  @returns Other error codes as defined for the generic_translate_req() function.
  */
-int	net_get_device_conf_req( int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data );
+int net_get_device_conf_req(int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data);
 
 /** Returns the global configuration.
@@ -80,5 +80,5 @@
  *  @returns Other error codes as defined for the generic_translate_req() function.
  */
-int	net_get_conf_req( int net_phone, measured_string_ref * configuration, size_t count, char ** data );
+int net_get_conf_req(int net_phone, measured_string_ref * configuration, size_t count, char ** data);
 
 /** Frees the received settings.
@@ -88,5 +88,5 @@
  *  @see net_get_conf_req()
  */
-void	net_free_settings( measured_string_ref settings, char * data );
+void net_free_settings(measured_string_ref settings, char * data);
 
 /** Connects to the networking module.
@@ -95,5 +95,5 @@
  *  @returns 0 if called by the bundle module.
  */
-int	net_connect_module( services_t service );
+int net_connect_module(services_t service);
 
 /*@}*/
Index: uspace/srv/net/include/netdb.h
===================================================================
--- uspace/srv/net/include/netdb.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/netdb.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -46,5 +46,5 @@
 	/** Official host name.
 	 */
-	char *	h_name;
+	char * h_name;
 	/** Alias list.
 	 */
@@ -52,8 +52,8 @@
 	/** Host address type.
 	 */
-	int		h_addrtype;
+	int h_addrtype;
 	/** Address length.
 	 */
-	int		h_length;
+	int h_length;
 	/** List of addresses from name server.
 	 */
@@ -61,5 +61,5 @@
 	/** Address, for backward compatiblity.
 	 */
-#define	h_addr	h_addr_list[ 0 ]
+#define	h_addr	h_addr_list[0]
 };
 
@@ -96,5 +96,5 @@
  *  @returns Host entry information.
  */
-//struct hostent *	gethostbyaddr( const void * address, int len, int type );
+//struct hostent *	gethostbyaddr(const void * address, int len, int type);
 
 /** Returns host entry by the host name.
@@ -102,5 +102,5 @@
  *  @returns Host entry information.
  */
-//struct hostent *	gethostbyname( const char * name );
+//struct hostent *	gethostbyname(const char * name);
 
 #endif
Index: uspace/srv/net/include/netif_interface.h
===================================================================
--- uspace/srv/net/include/netif_interface.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/netif_interface.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -65,5 +65,5 @@
  *  @returns Other error codes as defined for the netif_get_addr_message() function.
  */
-int	netif_get_addr_req( int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data );
+int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data);
 
 /** Probes the existence of the device.
@@ -75,5 +75,5 @@
  *  @returns Other errro codes as defined for the netif_probe_message().
  */
-int	netif_probe_req( int netif_phone, device_id_t device_id, int irq, int io );
+int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io);
 
 /** Sends the packet queue.
@@ -85,5 +85,5 @@
  *  @returns Other error codes as defined for the generic_send_msg() function.
  */
-int	netif_send_msg( int netif_phone, device_id_t device_id, packet_t packet, services_t sender );
+int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender);
 
 /** Starts the device.
@@ -94,5 +94,5 @@
  *  @returns Other error codes as defined for the netif_start_message() function.
  */
-int	netif_start_req( int netif_phone, device_id_t device_id );
+int netif_start_req(int netif_phone, device_id_t device_id);
 
 /** Stops the device.
@@ -103,5 +103,5 @@
  *  @returns Other error codes as defined for the netif_stop_message() function.
  */
-int	netif_stop_req( int netif_phone, device_id_t device_id );
+int netif_stop_req(int netif_phone, device_id_t device_id);
 
 /** Returns the device usage statistics.
@@ -111,5 +111,5 @@
  *  @returns EOK on success.
  */
-int	netif_stats_req( int netif_phone, device_id_t device_id, device_stats_ref stats );
+int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats);
 
 /** Creates bidirectional connection with the network interface module and registers the message receiver.
@@ -122,5 +122,5 @@
  *  @returns Other error codes as defined for the bind_service() function.
  */
-int	netif_bind_service( services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver );
+int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver);
 
 /*@}*/
Index: uspace/srv/net/include/nil_interface.h
===================================================================
--- uspace/srv/net/include/nil_interface.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/nil_interface.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -71,6 +71,6 @@
  *  @returns Other error codes as defined for the generic_get_addr_req() function.
  */
-#define nil_get_addr_req( nil_phone, device_id, address, data )	\
-	generic_get_addr_req( nil_phone, NET_NIL_ADDR, device_id, address, data )
+#define nil_get_addr_req(nil_phone, device_id, address, data)	\
+	generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data)
 
 /** Returns the device broadcast hardware address.
@@ -84,6 +84,6 @@
  *  @returns Other error codes as defined for the generic_get_addr_req() function.
  */
-#define nil_get_broadcast_addr_req( nil_phone, device_id, address, data )	\
-	generic_get_addr_req( nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data )
+#define nil_get_broadcast_addr_req(nil_phone, device_id, address, data)	\
+	generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data)
 
 /** Sends the packet queue.
@@ -95,6 +95,6 @@
  *  @returns Other error codes as defined for the generic_send_msg() function.
  */
-#define nil_send_msg( nil_phone, device_id, packet, sender )	\
-	generic_send_msg( nil_phone, NET_NIL_SEND, device_id, packet_get_id( packet ), sender, 0 )
+#define nil_send_msg(nil_phone, device_id, packet, sender)	\
+	generic_send_msg(nil_phone, NET_NIL_SEND, device_id, packet_get_id(packet), sender, 0)
 
 /** Returns the device packet dimension for sending.
@@ -106,6 +106,6 @@
  *  @returns Other error codes as defined for the generic_packet_size_req() function.
  */
-#define nil_packet_size_req( nil_phone, device_id, packet_dimension )	\
-	generic_packet_size_req( nil_phone, NET_NIL_PACKET_SPACE, device_id, packet_dimension )
+#define nil_packet_size_req(nil_phone, device_id, packet_dimension)	\
+	generic_packet_size_req(nil_phone, NET_NIL_PACKET_SPACE, device_id, packet_dimension)
 
 /** Registers new device or updates the MTU of an existing one.
@@ -119,6 +119,6 @@
  *  @returns Other error codes as defined for the generic_device_req() function.
  */
-#define nil_device_req( nil_phone, device_id, mtu, netif_service )	\
-	generic_device_req( nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service )
+#define nil_device_req(nil_phone, device_id, mtu, netif_service)	\
+	generic_device_req(nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service)
 
 /** Notifies the network interface layer about the device state change.
@@ -129,5 +129,5 @@
  *  @returns Other error codes as defined for each specific module device state function.
  */
-int nil_device_state_msg( int nil_phone, device_id_t device_id, int state );
+int nil_device_state_msg(int nil_phone, device_id_t device_id, int state);
 
 /** Passes the packet queue to the network interface layer.
@@ -140,5 +140,5 @@
  *  @returns Other error codes as defined for each specific module received function.
  */
-int nil_received_msg( int nil_phone, device_id_t device_id, packet_t packet, services_t target );
+int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target);
 
 /** Creates bidirectional connection with the network interface layer module and registers the message receiver.
@@ -151,6 +151,6 @@
  *  @returns Other error codes as defined for the bind_service() function.
  */
-#define	nil_bind_service( service, device_id, me, receiver )	\
-	bind_service( service, device_id, me, 0, receiver );
+#define	nil_bind_service(service, device_id, me, receiver)	\
+	bind_service(service, device_id, me, 0, receiver);
 /*@}*/
 
Index: uspace/srv/net/include/protocol_map.h
===================================================================
--- uspace/srv/net/include/protocol_map.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/protocol_map.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -50,9 +50,9 @@
  *  @returns 0 if mapping is not found.
  */
-static inline eth_type_t protocol_map( services_t nil, services_t il ){
-	switch( nil ){
+static inline eth_type_t protocol_map(services_t nil, services_t il){
+	switch(nil){
 		case SERVICE_ETHERNET:
 		case SERVICE_DP8390:
-			switch( il ){
+			switch(il){
 				case SERVICE_IP:
 					return ETH_P_IP;
@@ -73,9 +73,9 @@
  *  @returns 0 if mapping is not found.
  */
-static inline services_t protocol_unmap( services_t nil, int protocol ){
-	switch( nil ){
+static inline services_t protocol_unmap(services_t nil, int protocol){
+	switch(nil){
 		case SERVICE_ETHERNET:
 		case SERVICE_DP8390:
-			switch( protocol ){
+			switch(protocol){
 				case ETH_P_IP:
 					return SERVICE_IP;
@@ -95,6 +95,6 @@
  *  @returns ETH_LSAP_NULL if mapping is not found.
  */
-static inline eth_type_t lsap_map( eth_lsap_t lsap ){
-	switch( lsap ){
+static inline eth_type_t lsap_map(eth_lsap_t lsap){
+	switch(lsap){
 		case ETH_LSAP_IP:
 			return ETH_P_IP;
@@ -111,6 +111,6 @@
  *  @returns 0 if mapping is not found.
  */
-static inline eth_lsap_t lsap_unmap( eth_type_t ethertype ){
-	switch( ethertype ){
+static inline eth_lsap_t lsap_unmap(eth_type_t ethertype){
+	switch(ethertype){
 		case ETH_P_IP:
 			return ETH_LSAP_IP;
@@ -127,6 +127,6 @@
  *  @returns 0 if mapping is not found.
  */
-static inline hw_type_t hardware_map( services_t nil ){
-	switch( nil ){
+static inline hw_type_t hardware_map(services_t nil){
+	switch(nil){
 		case SERVICE_ETHERNET:
 		case SERVICE_DP8390:
Index: uspace/srv/net/include/socket.h
===================================================================
--- uspace/srv/net/include/socket.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/socket.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -61,8 +61,9 @@
  *  @returns EPROTONOSUPPORT if the protocol is not supported.
  *  @returns ENOMEM if there is not enough memory left.
+ *  @returns ELIMIT if there was not a free socket identifier found this time.
  *  @returns Other error codes as defined for the NET_SOCKET message.
  *  @returns Other error codes as defined for the bind_service_timeout() function.
  */
-int	socket( int domain, int type, int protocol );
+int socket(int domain, int type, int protocol);
 
 /** Binds the socket to a port address.
@@ -76,5 +77,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_BIND message.
  */
-int	bind( int socket_id, const struct sockaddr * my_addr, socklen_t addrlen );
+int bind(int socket_id, const struct sockaddr * my_addr, socklen_t addrlen);
 
 /** Sets the number of connections waiting to be accepted.
@@ -86,5 +87,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_LISTEN message.
  */
-int	listen( int socket_id, int backlog );
+int listen(int socket_id, int backlog);
 
 /** Accepts waiting socket.
@@ -99,5 +100,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_ACCEPT message.
  */
-int	accept( int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen );
+int accept(int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen);
 
 /** Connects socket to the remote server.
@@ -111,5 +112,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_CONNECT message.
  */
-int	connect( int socket_id, const struct sockaddr * serv_addr, socklen_t addrlen );
+int connect(int socket_id, const struct sockaddr * serv_addr, socklen_t addrlen);
 
 /** Closes the socket.
@@ -120,5 +121,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_CLOSE message.
  */
-int	closesocket( int socket_id );
+int closesocket(int socket_id);
 
 /** Sends data via the socket.
@@ -133,5 +134,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_SEND message.
  */
-int send( int socket_id, void * data, size_t datalength, int flags );
+int send(int socket_id, void * data, size_t datalength, int flags);
 
 /** Sends data via the socket to the remote address.
@@ -149,5 +150,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_SENDTO message.
  */
-int sendto( int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen );
+int sendto(int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen);
 
 /** Receives data via the socket.
@@ -162,5 +163,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_RECV message.
  */
-int recv( int socket_id, void * data, size_t datalength, int flags );
+int recv(int socket_id, void * data, size_t datalength, int flags);
 
 /** Receives data via the socket.
@@ -177,5 +178,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_RECVFROM message.
  */
-int recvfrom( int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen );
+int recvfrom(int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen);
 
 /** Gets socket option.
@@ -191,5 +192,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_GETSOCKOPT message.
  */
-int	getsockopt( int socket_id, int level, int optname, void * value, size_t * optlen );
+int getsockopt(int socket_id, int level, int optname, void * value, size_t * optlen);
 
 /** Sets socket option.
@@ -205,5 +206,5 @@
  *  @returns Other error codes as defined for the NET_SOCKET_SETSOCKOPT message.
  */
-int	setsockopt( int socket_id, int level, int optname, const void * value, size_t optlen );
+int setsockopt(int socket_id, int level, int optname, const void * value, size_t optlen);
 
 /*@}*/
Index: uspace/srv/net/include/socket_codes.h
===================================================================
--- uspace/srv/net/include/socket_codes.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/socket_codes.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -442,11 +442,11 @@
 	/** Stream (connection oriented) socket.
 	 */
-	SOCK_STREAM	= 1,
+	SOCK_STREAM = 1,
 	/** Datagram (connectionless oriented) socket.
 	 */
-	SOCK_DGRAM	= 2,
+	SOCK_DGRAM = 2,
 	/** Raw socket.
 	 */
-	SOCK_RAW	= 3
+	SOCK_RAW = 3
 } sock_type_t;
 
Index: uspace/srv/net/include/tl_interface.h
===================================================================
--- uspace/srv/net/include/tl_interface.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/include/tl_interface.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -64,6 +64,6 @@
  *  @returns EOK on success.
  */
-inline static int	tl_received_msg( int tl_phone, device_id_t device_id, packet_t packet, services_t target, services_t error ){
-	return generic_received_msg( tl_phone, NET_TL_RECEIVED, device_id, packet_get_id( packet ), target, error );
+inline static int tl_received_msg(int tl_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
+	return generic_received_msg(tl_phone, NET_TL_RECEIVED, device_id, packet_get_id(packet), target, error);
 }
 
Index: uspace/srv/net/inet.c
===================================================================
--- uspace/srv/net/inet.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/inet.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -45,16 +45,18 @@
 #include "include/socket_codes.h"
 
-int inet_pton( uint16_t family, const char * address, uint8_t * data ){
-	const char *	next;
-	char *			last;
-	int				index;
-	int				count;
-	int				base;
-	size_t			bytes;
-	size_t			shift;
-	unsigned long	value;
+int inet_pton(uint16_t family, const char * address, uint8_t * data){
+	const char * next;
+	char * last;
+	int index;
+	int count;
+	int base;
+	size_t bytes;
+	size_t shift;
+	unsigned long value;
 
-	if( ! data ) return EINVAL;
-	switch( family ){
+	if(! data){
+		return EINVAL;
+	}
+	switch(family){
 		case AF_INET:
 			count = 4;
@@ -70,6 +72,6 @@
 			return ENOTSUP;
 	}
-	if( ! address ){
-		bzero( data, count );
+	if(! address){
+		bzero(data, count);
 		return ENOENT;
 	}
@@ -77,33 +79,44 @@
 	index = 0;
 	do{
-		if( next && ( * next )){
-			if( index ) ++ next;
-			value = strtoul( next, & last, base );
+		if(next && (*next)){
+			if(index){
+				++ next;
+			}
+			value = strtoul(next, &last, base);
 			next = last;
 			shift = bytes - 1;
 			do{
 				// like little endian
-				data[ index + shift ] = value;
+				data[index + shift] = value;
 				value >>= 8;
-			}while( shift -- );
+			}while(shift --);
 			index += bytes;
 		}else{
-			bzero( data + index, count - index );
+			bzero(data + index, count - index);
 			return EOK;
 		}
-	}while( index < count );
+	}while(index < count);
 	return EOK;
 }
 
-int inet_ntop( uint16_t family, const uint8_t * data, char * address, size_t length ){
-	if(( ! data ) || ( ! address ))	return EINVAL;
-	switch( family ){
-		case AF_INET:	if( length < INET_ADDRSTRLEN ) return ENOMEM;
-						snprintf( address, length, "%hhu.%hhu.%hhu.%hhu", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ] );
-						return EOK;
-		case AF_INET6:	if( length < INET6_ADDRSTRLEN ) return ENOMEM;
-						snprintf( address, length, "%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ], data[ 8 ], data[ 9 ], data[ 10 ], data[ 11 ], data[ 12 ], data[ 13 ], data[ 14 ], data[ 15 ] );
-						return EOK;
-		default:		return ENOTSUP;
+int inet_ntop(uint16_t family, const uint8_t * data, char * address, size_t length){
+	if((! data) || (! address)){
+		return EINVAL;
+	}
+	switch(family){
+		case AF_INET:
+			if(length < INET_ADDRSTRLEN){
+				return ENOMEM;
+			}
+			snprintf(address, length, "%hhu.%hhu.%hhu.%hhu", data[0], data[1], data[2], data[3]);
+			return EOK;
+		case AF_INET6:
+			if(length < INET6_ADDRSTRLEN){
+				return ENOMEM;
+			}
+			snprintf(address, length, "%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15]);
+			return EOK;
+		default:
+			return ENOTSUP;
 	}
 }
Index: uspace/srv/net/messages.h
===================================================================
--- uspace/srv/net/messages.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/messages.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -120,101 +120,101 @@
 /** The last network interface layer message.
  */
-#define NET_NETIF_LAST		( NET_NETIF_FIRST + NET_NETIF_COUNT )
+#define NET_NETIF_LAST		(NET_NETIF_FIRST + NET_NETIF_COUNT)
 
 /** The first general networking message.
  */
-#define NET_NET_FIRST		( NET_NETIF_LAST + 0 )
+#define NET_NET_FIRST		(NET_NETIF_LAST + 0)
 
 /** The last general networking message.
  */
-#define NET_NET_LAST		( NET_NET_FIRST + NET_NET_COUNT )
+#define NET_NET_LAST		(NET_NET_FIRST + NET_NET_COUNT)
 
 /** The first network interface layer message.
  */
-#define NET_NIL_FIRST		( NET_NET_LAST + 0 )
+#define NET_NIL_FIRST		(NET_NET_LAST + 0)
 
 /** The last network interface layer message.
  */
-#define NET_NIL_LAST		( NET_NIL_FIRST + NET_NIL_COUNT )
+#define NET_NIL_LAST		(NET_NIL_FIRST + NET_NIL_COUNT)
 
 /** The first Ethernet message.
  */
-#define NET_ETH_FIRST		( NET_NIL_LAST + 0 )
+#define NET_ETH_FIRST		(NET_NIL_LAST + 0)
 
 /** The last Ethernet message.
  */
-#define NET_ETH_LAST		( NET_ETH_FIRST + NET_ETH_COUNT )
+#define NET_ETH_LAST		(NET_ETH_FIRST + NET_ETH_COUNT)
 
 /** The first inter-network message.
  */
-#define NET_IL_FIRST		( NET_ETH_LAST + 0 )
+#define NET_IL_FIRST		(NET_ETH_LAST + 0)
 
 /** The last inter-network message.
  */
-#define NET_IL_LAST			( NET_IL_FIRST + NET_IL_COUNT )
+#define NET_IL_LAST			(NET_IL_FIRST + NET_IL_COUNT)
 
 /** The first IP message.
  */
-#define NET_IP_FIRST		( NET_IL_LAST + 0 )
+#define NET_IP_FIRST		(NET_IL_LAST + 0)
 
 /** The last IP message.
  */
-#define NET_IP_LAST			( NET_IP_FIRST + NET_IP_COUNT )
+#define NET_IP_LAST			(NET_IP_FIRST + NET_IP_COUNT)
 
 /** The first ARP message.
  */
-#define NET_ARP_FIRST		( NET_IP_LAST + 0 )
+#define NET_ARP_FIRST		(NET_IP_LAST + 0)
 
 /** The last ARP message.
  */
-#define NET_ARP_LAST		( NET_ARP_FIRST + NET_ARP_COUNT )
+#define NET_ARP_LAST		(NET_ARP_FIRST + NET_ARP_COUNT)
 
 /** The first ICMP message.
  */
-#define NET_ICMP_FIRST		( NET_ARP_LAST + 0 )
+#define NET_ICMP_FIRST		(NET_ARP_LAST + 0)
 
 /** The last ICMP message.
  */
-#define NET_ICMP_LAST		( NET_ICMP_FIRST + NET_ICMP_COUNT )
+#define NET_ICMP_LAST		(NET_ICMP_FIRST + NET_ICMP_COUNT)
 
 /** The first ICMP message.
  */
-#define NET_TL_FIRST		( NET_ICMP_LAST + 0 )
+#define NET_TL_FIRST		(NET_ICMP_LAST + 0)
 
 /** The last ICMP message.
  */
-#define NET_TL_LAST			( NET_TL_FIRST + NET_TL_COUNT )
+#define NET_TL_LAST			(NET_TL_FIRST + NET_TL_COUNT)
 
 /** The first UDP message.
  */
-#define NET_UDP_FIRST		( NET_TL_LAST + 0 )
+#define NET_UDP_FIRST		(NET_TL_LAST + 0)
 
 /** The last UDP message.
  */
-#define NET_UDP_LAST		( NET_UDP_FIRST + NET_UDP_COUNT )
+#define NET_UDP_LAST		(NET_UDP_FIRST + NET_UDP_COUNT)
 
 /** The first TCP message.
  */
-#define NET_TCP_FIRST		( NET_UDP_LAST + 0 )
+#define NET_TCP_FIRST		(NET_UDP_LAST + 0)
 
 /** The last TCP message.
  */
-#define NET_TCP_LAST		( NET_TCP_FIRST + NET_TCP_COUNT )
+#define NET_TCP_LAST		(NET_TCP_FIRST + NET_TCP_COUNT)
 
 /** The first socket message.
  */
-#define NET_SOCKET_FIRST	( NET_TCP_LAST + 0 )
+#define NET_SOCKET_FIRST	(NET_TCP_LAST + 0)
 
 /** The last socket message.
  */
-#define NET_SOCKET_LAST		( NET_SOCKET_FIRST + NET_SOCKET_COUNT )
+#define NET_SOCKET_LAST		(NET_SOCKET_FIRST + NET_SOCKET_COUNT)
 
 /** The first packet management system message.
  */
-#define NET_PACKET_FIRST	( NET_SOCKET_LAST + 0 )
+#define NET_PACKET_FIRST	(NET_SOCKET_LAST + 0)
 
 /** The last packet management system message.
  */
-#define NET_PACKET_LAST		( NET_PACKET_FIRST + NET_PACKET_COUNT )
+#define NET_PACKET_LAST		(NET_PACKET_FIRST + NET_PACKET_COUNT)
 
 /** The last networking message.
@@ -224,5 +224,5 @@
 /** The number of networking messages.
  */
-#define NET_COUNT			( NET_LAST - NET_FIRST )
+#define NET_COUNT			(NET_LAST - NET_FIRST)
 
 /** Returns a value indicating whether the value is in the interval.
@@ -231,70 +231,70 @@
  *  @param[in] last_exclusive The first value after the interval.
  */
-#define IS_IN_INTERVAL( item, first_inclusive, last_exclusive )	((( item ) >= ( first_inclusive )) && (( item ) < ( last_exclusive )))
+#define IS_IN_INTERVAL(item, first_inclusive, last_exclusive)	(((item) >= (first_inclusive)) && ((item) < (last_exclusive)))
 
 /** Returns a value indicating whether the IPC call is a generic networking message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_MESSAGE( call )			IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_FIRST, NET_LAST )
+#define IS_NET_MESSAGE(call)			IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_FIRST, NET_LAST)
 
 /** Returns a value indicating whether the IPC call is a generic networking message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_NET_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NET_FIRST, NET_NET_LAST )
+#define IS_NET_NET_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NET_FIRST, NET_NET_LAST)
 
 /** Returns a value indicating whether the IPC call is a network interface layer message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_NIL_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_NIL_FIRST, NET_NIL_LAST )
+#define IS_NET_NIL_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)
 
 /** Returns a value indicating whether the IPC call is an Ethernet message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_ETH_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ETH_FIRST, NET_ETH_LAST )
+#define IS_NET_ETH_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)
 
 /** Returns a value indicating whether the IPC call is an inter-network layer message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_IL_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IL_FIRST, NET_IL_LAST )
+#define IS_NET_IL_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IL_FIRST, NET_IL_LAST)
 
 /** Returns a value indicating whether the IPC call is an IP message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_IP_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_IP_FIRST, NET_IP_LAST )
+#define IS_NET_IP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IP_FIRST, NET_IP_LAST)
 
 /** Returns a value indicating whether the IPC call is an ARP message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_ARP_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ARP_FIRST, NET_ARP_LAST )
+#define IS_NET_ARP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)
 
 /** Returns a value indicating whether the IPC call is an ICMP message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_ICMP_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_ICMP_FIRST, NET_ICMP_LAST )
+#define IS_NET_ICMP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)
 
 /** Returns a value indicating whether the IPC call is a transport layer message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_TL_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_TL_FIRST, NET_TL_LAST )
+#define IS_NET_TL_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TL_FIRST, NET_TL_LAST)
 
 /** Returns a value indicating whether the IPC call is a UDP message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_UDP_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_UDP_FIRST, NET_UDP_LAST )
+#define IS_NET_UDP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)
 
 /** Returns a value indicating whether the IPC call is a TCP message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_TCP_MESSAGE( call )		IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_TCP_FIRST, NET_TCP_LAST )
+#define IS_NET_TCP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)
 
 /** Returns a value indicating whether the IPC call is a socket message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_SOCKET_MESSAGE( call )	IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_SOCKET_FIRST, NET_SOCKET_LAST )
+#define IS_NET_SOCKET_MESSAGE(call)	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
 
 /** Returns a value indicating whether the IPC call is a packet manaagement system message.
  *  @param[in] call The IPC call to be checked.
  */
-#define IS_NET_PACKET_MESSAGE( call )	IS_IN_INTERVAL( IPC_GET_METHOD( * call ), NET_PACKET_FIRST, NET_PACKET_LAST )
+#define IS_NET_PACKET_MESSAGE(call)	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)
 
 /*@}*/
@@ -307,75 +307,75 @@
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_DEVICE( call )		( device_id_t ) IPC_GET_ARG1( * call )
+#define IPC_GET_DEVICE(call)		(device_id_t) IPC_GET_ARG1(*call)
 
 /** Returns the packet identifier message parameter.
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_PACKET( call )		( packet_id_t ) IPC_GET_ARG2( * call )
+#define IPC_GET_PACKET(call)		(packet_id_t) IPC_GET_ARG2(*call)
 
 /** Returns the count message parameter.
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_COUNT( call )		( size_t ) IPC_GET_ARG2( * call )
+#define IPC_GET_COUNT(call)		(size_t) IPC_GET_ARG2(*call)
 
 /** Returns the device state message parameter.
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_STATE( call )		( device_state_t ) IPC_GET_ARG2( * call )
+#define IPC_GET_STATE(call)		(device_state_t) IPC_GET_ARG2(*call)
 
 /** Returns the maximum transmission unit message parameter.
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_MTU( call )			( size_t ) IPC_GET_ARG2( * call )
+#define IPC_GET_MTU(call)			(size_t) IPC_GET_ARG2(*call)
 
 /** Returns the device driver service message parameter.
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_SERVICE( call )		( services_t ) IPC_GET_ARG3( * call )
+#define IPC_GET_SERVICE(call)		(services_t) IPC_GET_ARG3(*call)
 
 /** Returns the target service message parameter.
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_TARGET( call )		( services_t ) IPC_GET_ARG3( * call )
+#define IPC_GET_TARGET(call)		(services_t) IPC_GET_ARG3(*call)
 
 /** Returns the sender service message parameter.
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_SENDER( call )		( services_t ) IPC_GET_ARG3( * call )
+#define IPC_GET_SENDER(call)		(services_t) IPC_GET_ARG3(*call)
 
 /** Returns the error service message parameter.
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_ERROR( call )		( services_t ) IPC_GET_ARG4( * call )
+#define IPC_GET_ERROR(call)		(services_t) IPC_GET_ARG4(*call)
 
 /** Returns the phone message parameter.
  *  @param[in] call The message call structure.
  */
-#define IPC_GET_PHONE( call )		( int ) IPC_GET_ARG5( * call )
+#define IPC_GET_PHONE(call)		(int) IPC_GET_ARG5(*call)
 
 /** Sets the device identifier in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define IPC_SET_DEVICE( answer )	(( device_id_t * ) & IPC_GET_ARG1( * answer ))
+#define IPC_SET_DEVICE(answer)	((device_id_t *) &IPC_GET_ARG1(*answer))
 
 /** Sets the minimum address length in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define IPC_SET_ADDR( answer )		(( size_t * ) & IPC_GET_ARG1( * answer ))
+#define IPC_SET_ADDR(answer)		((size_t *) &IPC_GET_ARG1(*answer))
 
 /** Sets the minimum prefix size in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define IPC_SET_PREFIX( answer )	(( size_t * ) & IPC_GET_ARG2( * answer ))
+#define IPC_SET_PREFIX(answer)	((size_t *) &IPC_GET_ARG2(*answer))
 
 /** Sets the maximum content size in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define IPC_SET_CONTENT( answer )	(( size_t * ) & IPC_GET_ARG3( * answer ))
+#define IPC_SET_CONTENT(answer)	((size_t *) &IPC_GET_ARG3(*answer))
 
 /** Sets the minimum suffix size in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define IPC_SET_SUFFIX( answer )	(( size_t * ) & IPC_GET_ARG4( * answer ))
+#define IPC_SET_SUFFIX(answer)	((size_t *) &IPC_GET_ARG4(*answer))
 
 /*@}*/
@@ -391,18 +391,20 @@
  *  @returns Other error codes as defined for the specific service message.
  */
-static inline int generic_get_addr_req( int phone, int message, device_id_t device_id, measured_string_ref * address, char ** data ){
-	aid_t			message_id;
-	ipcarg_t		result;
-	int				string;
-
-	if( !( address && data )) return EBADMEM;
-	message_id = async_send_1( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, NULL );
-	string = measured_strings_return( phone, address, data, 1 );
-	async_wait_for( message_id, & result );
-	if(( string == EOK ) && ( result != EOK )){
-		free( * address );
-		free( * data );
-	}
-	return ( int ) result;
+static inline int generic_get_addr_req(int phone, int message, device_id_t device_id, measured_string_ref * address, char ** data){
+	aid_t message_id;
+	ipcarg_t result;
+	int string;
+
+	if(!(address && data)){
+		return EBADMEM;
+	}
+	message_id = async_send_1(phone, (ipcarg_t) message, (ipcarg_t) device_id, NULL);
+	string = measured_strings_return(phone, address, data, 1);
+	async_wait_for(message_id, &result);
+	if((string == EOK) && (result != EOK)){
+		free(*address);
+		free(*data);
+	}
+	return (int) result;
 }
 
@@ -423,20 +425,24 @@
  *  @returns Other error codes as defined for the specific service message.
  */
-static inline int	generic_translate_req( int phone, int message, device_id_t device_id, services_t service, measured_string_ref configuration, size_t count, measured_string_ref * translation, char ** data ){
-	aid_t			message_id;
-	ipcarg_t		result;
-	int				string;
-
-	if( !( configuration && ( count > 0 ))) return EINVAL;
-	if( !( translation && data )) return EBADMEM;
-	message_id = async_send_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) count, ( ipcarg_t ) service, NULL );
-	measured_strings_send( phone, configuration, count );
-	string = measured_strings_return( phone, translation, data, count );
-	async_wait_for( message_id, & result );
-	if(( string == EOK ) && ( result != EOK )){
-		free( * translation );
-		free( * data );
-	}
-	return ( int ) result;
+static inline int generic_translate_req(int phone, int message, device_id_t device_id, services_t service, measured_string_ref configuration, size_t count, measured_string_ref * translation, char ** data){
+	aid_t message_id;
+	ipcarg_t result;
+	int string;
+
+	if(!(configuration && (count > 0))){
+		return EINVAL;
+	}
+	if(!(translation && data)){
+		return EBADMEM;
+	}
+	message_id = async_send_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) count, (ipcarg_t) service, NULL);
+	measured_strings_send(phone, configuration, count);
+	string = measured_strings_return(phone, translation, data, count);
+	async_wait_for(message_id, &result);
+	if((string == EOK) && (result != EOK)){
+		free(*translation);
+		free(*data);
+	}
+	return (int) result;
 }
 
@@ -450,9 +456,9 @@
  *  @returns EOK on success.
  */
-static inline int	generic_send_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender, services_t error ){
-	if( error ){
-		async_msg_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) sender, ( ipcarg_t ) error );
+static inline int generic_send_msg(int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender, services_t error){
+	if(error){
+		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error);
 	}else{
-		async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) sender );
+		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) sender);
 	}
 	return EOK;
@@ -468,18 +474,20 @@
  *  @returns Other error codes as defined for the specific service message.
  */
-static inline int	generic_packet_size_req( int phone, int message, device_id_t device_id, packet_dimension_ref packet_dimension ){
-	ipcarg_t	result;
-	ipcarg_t	prefix;
-	ipcarg_t	content;
-	ipcarg_t	suffix;
-	ipcarg_t	addr_len;
-
-	if( ! packet_dimension ) return EBADMEM;
-	result = async_req_1_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, & addr_len, & prefix, & content, & suffix );
-	packet_dimension->prefix = ( size_t ) prefix;
-	packet_dimension->content = ( size_t ) content;
-	packet_dimension->suffix = ( size_t ) suffix;
-	packet_dimension->addr_len = ( size_t ) addr_len;
-	return ( int ) result;
+static inline int generic_packet_size_req(int phone, int message, device_id_t device_id, packet_dimension_ref packet_dimension){
+	ipcarg_t result;
+	ipcarg_t prefix;
+	ipcarg_t content;
+	ipcarg_t suffix;
+	ipcarg_t addr_len;
+
+	if(! packet_dimension){
+		return EBADMEM;
+	}
+	result = async_req_1_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix);
+	packet_dimension->prefix = (size_t) prefix;
+	packet_dimension->content = (size_t) content;
+	packet_dimension->suffix = (size_t) suffix;
+	packet_dimension->addr_len = (size_t) addr_len;
+	return (int) result;
 }
 
@@ -492,6 +500,6 @@
  *  @returns EOK on success.
  */
-static inline int	generic_device_state_msg( int phone, int message, device_id_t device_id, int state, services_t target ){
-	async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) state, target );
+static inline int generic_device_state_msg(int phone, int message, device_id_t device_id, int state, services_t target){
+	async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) state, target);
 	return EOK;
 }
@@ -506,9 +514,9 @@
  *  @returns EOK on success.
  */
-static inline int	generic_received_msg( int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target, services_t error ){
-	if( error ){
-		async_msg_4( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) target, ( ipcarg_t ) error );
+static inline int generic_received_msg(int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target, services_t error){
+	if(error){
+		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error);
 	}else{
-		async_msg_3( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) packet_id, ( ipcarg_t ) target );
+		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) target);
 	}
 	return EOK;
@@ -524,6 +532,6 @@
  *  @returns Other error codes as defined for the specific service message.
  */
-static inline int	generic_device_req( int phone, int message, device_id_t device_id, int arg2, services_t service ){
-	return ( int ) async_req_3_0( phone, ( ipcarg_t ) message, ( ipcarg_t ) device_id, ( ipcarg_t ) arg2, ( ipcarg_t ) service );
+static inline int generic_device_req(int phone, int message, device_id_t device_id, int arg2, services_t service){
+	return (int) async_req_3_0(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) arg2, (ipcarg_t) service);
 }
 
Index: uspace/srv/net/module.c
===================================================================
--- uspace/srv/net/module.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/module.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -60,5 +60,5 @@
  *  @returns Other error codes as defined for each specific module message function.
  */
-extern int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+extern int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** External function to print the module name.
@@ -66,5 +66,5 @@
  *  The function has to be defined in each module.
  */
-extern void	module_print_name( void );
+extern void module_print_name(void);
 
 /** External module startup function.
@@ -73,5 +73,5 @@
  *  @param[in] client_connection The client connection function to be registered.
  */
-extern int	module_start( async_client_conn_t client_connection );
+extern int module_start(async_client_conn_t client_connection);
 
 /*@}*/
@@ -81,5 +81,5 @@
  *  @param[in] icall The initial message call structure.
  */
-void	client_connection( ipc_callid_t iid, ipc_call_t * icall );
+void client_connection(ipc_callid_t iid, ipc_call_t * icall);
 
 /**	Starts the module.
@@ -89,12 +89,12 @@
  *  @returns Other error codes as defined for each specific module start function.
  */
-int	main( int argc, char * argv[] );
+int main(int argc, char * argv[]);
 
-void client_connection( ipc_callid_t iid, ipc_call_t * icall ){
-	ipc_callid_t	callid;
-	ipc_call_t		call;
-	ipc_call_t		answer;
-	int				answer_count;
-	int				res;
+void client_connection(ipc_callid_t iid, ipc_call_t * icall){
+	ipc_callid_t callid;
+	ipc_call_t call;
+	ipc_call_t answer;
+	int answer_count;
+	int res;
 
 	/*
@@ -102,26 +102,28 @@
 	 *  - Answer the first IPC_M_CONNECT_ME_TO call.
 	 */
-	ipc_answer_0( iid, EOK );
+	ipc_answer_0(iid, EOK);
 
-	while( true ){
-		refresh_answer( & answer, & answer_count );
+	while(true){
+		refresh_answer(&answer, &answer_count);
 
-		callid = async_get_call( & call );
-		res = module_message( callid, & call, & answer, & answer_count );
+		callid = async_get_call(&call);
+		res = module_message(callid, &call, &answer, &answer_count);
 
-		if( IPC_GET_METHOD( call ) == IPC_M_PHONE_HUNGUP ) return;
+		if((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP)){
+			return;
+		}
 
-		answer_call( callid, res, & answer, answer_count );
+		answer_call(callid, res, &answer, answer_count);
 	}
 }
 
-int main( int argc, char * argv[] ){
+int main(int argc, char * argv[]){
 	ERROR_DECLARE;
 
 	printf("Task %d - ", task_get_id());
 	module_print_name();
-	printf( "\n" );
-	if( ERROR_OCCURRED( module_start( client_connection ))){
-		printf( " - ERROR %i\n", ERROR_CODE );
+	printf("\n");
+	if(ERROR_OCCURRED(module_start(client_connection))){
+		printf(" - ERROR %i\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
Index: uspace/srv/net/modules.c
===================================================================
--- uspace/srv/net/modules.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/modules.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -48,70 +48,27 @@
 /** The time between connect requests in microseconds.
  */
-#define MODULE_WAIT_TIME	( 10 * 1000 )
+#define MODULE_WAIT_TIME	(10 * 1000)
 
-int connect_to_service( services_t need ){
-	return connect_to_service_timeout( need, 0 );
-}
-
-int connect_to_service_timeout( services_t need, suseconds_t timeout ){
-	if (timeout <= 0)
-		return async_connect_me_to_blocking( PHONE_NS, need, 0, 0);
-	
-	while( true ){
-		int phone;
-
-		phone = async_connect_me_to( PHONE_NS, need, 0, 0);
-		if( (phone >= 0) || (phone != ENOENT) )
-			return phone;
-	
-		timeout -= MODULE_WAIT_TIME;
-		if( timeout <= 0 ) return ETIMEOUT;
-
-		usleep( MODULE_WAIT_TIME );
-	}
-}
-
-int bind_service( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver ){
-	return bind_service_timeout( need, arg1, arg2, arg3, client_receiver, 0 );
-}
-
-int bind_service_timeout( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout ){
-	ERROR_DECLARE;
-
-	int			phone;
-	ipcarg_t	phonehash;
-
-	phone = connect_to_service_timeout( need, timeout );
-	if( phone >= 0 ){
-		if( ERROR_OCCURRED( ipc_connect_to_me( phone, arg1, arg2, arg3, & phonehash ))){
-			ipc_hangup( phone );
-			return ERROR_CODE;
-		}
-		async_new_connection( phonehash, 0, NULL, client_receiver );
-	}
-	return phone;
-}
-
-void answer_call( ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count ){
-	if( answer || ( ! answer_count )){
-		switch( answer_count ){
+void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count){
+	if(answer || (! answer_count)){
+		switch(answer_count){
 			case 0:
-				ipc_answer_0( callid, ( ipcarg_t ) result );
+				ipc_answer_0(callid, (ipcarg_t) result);
 				break;
 			case 1:
-				ipc_answer_1( callid, ( ipcarg_t ) result, IPC_GET_ARG1( * answer ));
+				ipc_answer_1(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer));
 				break;
 			case 2:
-				ipc_answer_2( callid, ( ipcarg_t ) result, IPC_GET_ARG1( * answer ), IPC_GET_ARG2( * answer ));
+				ipc_answer_2(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer));
 				break;
 			case 3:
-				ipc_answer_3( callid, ( ipcarg_t ) result, IPC_GET_ARG1( * answer ), IPC_GET_ARG2( * answer ), IPC_GET_ARG3( * answer ));
+				ipc_answer_3(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer));
 				break;
 			case 4:
-				ipc_answer_4( callid, ( ipcarg_t ) result, IPC_GET_ARG1( * answer ), IPC_GET_ARG2( * answer ), IPC_GET_ARG3( * answer ), IPC_GET_ARG4( * answer ));
+				ipc_answer_4(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer));
 				break;
 			case 5:
 			default:
-				ipc_answer_5( callid, ( ipcarg_t ) result, IPC_GET_ARG1( * answer ), IPC_GET_ARG2( * answer ), IPC_GET_ARG3( * answer ), IPC_GET_ARG4( * answer ), IPC_GET_ARG5( * answer ));
+				ipc_answer_5(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
 				break;
 		}
@@ -119,31 +76,66 @@
 }
 
-void refresh_answer( ipc_call_t * answer, int * answer_count ){
-	if( answer_count ){
-		* answer_count = 0;
+int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver){
+	return bind_service_timeout(need, arg1, arg2, arg3, client_receiver, 0);
+}
+
+int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout){
+	ERROR_DECLARE;
+
+	int phone;
+	ipcarg_t phonehash;
+
+	phone = connect_to_service_timeout(need, timeout);
+	if(phone >= 0){
+		if(ERROR_OCCURRED(ipc_connect_to_me(phone, arg1, arg2, arg3, &phonehash))){
+			ipc_hangup(phone);
+			return ERROR_CODE;
+		}
+		async_new_connection(phonehash, 0, NULL, client_receiver);
 	}
-	if( answer ){
-		IPC_SET_RETVAL( * answer, 0 );
-		// just to be precize
-		IPC_SET_METHOD( * answer, 0 );
-		IPC_SET_ARG1( * answer, 0 );
-		IPC_SET_ARG2( * answer, 0 );
-		IPC_SET_ARG3( * answer, 0 );
-		IPC_SET_ARG4( * answer, 0 );
-		IPC_SET_ARG5( * answer, 0 );
+	return phone;
+}
+
+int connect_to_service(services_t need){
+	return connect_to_service_timeout(need, 0);
+}
+
+int connect_to_service_timeout(services_t need, suseconds_t timeout){
+	if (timeout <= 0)
+		return async_connect_me_to_blocking(PHONE_NS, need, 0, 0);
+	
+	while(true){
+		int phone;
+
+		phone = async_connect_me_to(PHONE_NS, need, 0, 0);
+		if((phone >= 0) || (phone != ENOENT))
+			return phone;
+	
+		timeout -= MODULE_WAIT_TIME;
+		if(timeout <= 0){
+			return ETIMEOUT;
+		}
+
+		usleep(MODULE_WAIT_TIME);
 	}
 }
 
-int data_receive( void ** data, size_t * length ){
+int data_receive(void ** data, size_t * length){
 	ERROR_DECLARE;
 
-	ipc_callid_t	callid;
+	ipc_callid_t callid;
 
-	if( !( data && length )) return EBADMEM;
-	if( ! async_data_write_receive( & callid, length )) return EINVAL;
-	* data = malloc( * length );
-	if( !( * data )) return ENOMEM;
-	if( ERROR_OCCURRED( async_data_write_finalize( callid, * data, * length ))){
-		free( data );
+	if(!(data && length)){
+		return EBADMEM;
+	}
+	if(! async_data_write_receive(&callid, length)){
+		return EINVAL;
+	}
+	*data = malloc(*length);
+	if(!(*data)){
+		return ENOMEM;
+	}
+	if(ERROR_OCCURRED(async_data_write_finalize(callid, * data, * length))){
+		free(data);
 		return ERROR_CODE;
 	}
@@ -151,16 +143,32 @@
 }
 
-int data_reply( void * data, size_t data_length ){
-	size_t			length;
-	ipc_callid_t	callid;
+int data_reply(void * data, size_t data_length){
+	size_t length;
+	ipc_callid_t callid;
 
-	if( ! async_data_read_receive( & callid, & length )){
+	if(! async_data_read_receive(&callid, &length)){
 		return EINVAL;
 	}
-	if( length < data_length ){
-		async_data_read_finalize( callid, data, length );
+	if(length < data_length){
+		async_data_read_finalize(callid, data, length);
 		return EOVERFLOW;
 	}
-	return async_data_read_finalize( callid, data, data_length );
+	return async_data_read_finalize(callid, data, data_length);
+}
+
+void refresh_answer(ipc_call_t * answer, int * answer_count){
+	if(answer_count){
+		*answer_count = 0;
+	}
+	if(answer){
+		IPC_SET_RETVAL(*answer, 0);
+		// just to be precize
+		IPC_SET_METHOD(*answer, 0);
+		IPC_SET_ARG1(*answer, 0);
+		IPC_SET_ARG2(*answer, 0);
+		IPC_SET_ARG3(*answer, 0);
+		IPC_SET_ARG4(*answer, 0);
+		IPC_SET_ARG5(*answer, 0);
+	}
 }
 
Index: uspace/srv/net/modules.h
===================================================================
--- uspace/srv/net/modules.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/modules.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -50,5 +50,5 @@
  *  @param[in] count The number units of the source type size.
  */
-#define CONVERT_SIZE( type_from, type_to, count )	(( sizeof( type_from ) / sizeof( type_to )) * ( count ))
+#define CONVERT_SIZE(type_from, type_to, count)	((sizeof(type_from) / sizeof(type_to)) * (count))
 
 /** Registers the module service at the name server.
@@ -56,5 +56,5 @@
  *  @param[out] phonehash The created phone hash.
  */
-#define REGISTER_ME( me, phonehash )	ipc_connect_to_me( PHONE_NS, ( me ), 0, 0, ( phonehash ))
+#define REGISTER_ME(me, phonehash)	ipc_connect_to_me(PHONE_NS, (me), 0, 0, (phonehash))
 
 /** Connect to the needed module function type definition.
@@ -62,19 +62,13 @@
  *  @returns The phone of the needed service.
  */
-typedef int connect_module_t( services_t need );
+typedef int connect_module_t(services_t need);
 
-/** Connects to the needed module.
- *  @param[in] need The needed module service.
- *  @returns The phone of the needed service.
+/** Answers the call.
+ *  @param[in] callid The call identifier.
+ *  @param[in] result The message processing result.
+ *  @param[in] answer The message processing answer.
+ *  @param[in] answer_count The number of answer parameters.
  */
-int connect_to_service( services_t need );
-
-/** Connects to the needed module.
- *  @param[in] need The needed module service.
- *  @param[in] timeout The connection timeout in microseconds. No timeout if set to zero (0).
- *  @returns The phone of the needed service.
- *  @returns ETIMEOUT if the connection timeouted.
- */
-int connect_to_service_timeout( services_t need, suseconds_t timeout );
+void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count);
 
 /** Creates bidirectional connection with the needed module service and registers the message receiver.
@@ -87,5 +81,5 @@
  *  @returns Other error codes as defined for the ipc_connect_to_me() function.
  */
-int	bind_service( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver );
+int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver);
 
 /** Creates bidirectional connection with the needed module service and registers the message receiver.
@@ -100,20 +94,19 @@
  *  @returns Other error codes as defined for the ipc_connect_to_me() function.
  */
-int	bind_service_timeout( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout );
+int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout);
 
-/** Answers the call.
- *  @param[in] callid The call identifier.
- *  @param[in] result The message processing result.
- *  @param[in] answer The message processing answer.
- *  @param[in] answer_count The number of answer parameters.
+/** Connects to the needed module.
+ *  @param[in] need The needed module service.
+ *  @returns The phone of the needed service.
  */
-void	answer_call( ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count );
+int connect_to_service(services_t need);
 
-/** Refreshes answer structure and parameters count.
- *  Erases all attributes.
- *  @param[in,out] answer The message processing answer structure.
- *  @param[in,out] answer_count The number of answer parameters.
+/** Connects to the needed module.
+ *  @param[in] need The needed module service.
+ *  @param[in] timeout The connection timeout in microseconds. No timeout if set to zero (0).
+ *  @returns The phone of the needed service.
+ *  @returns ETIMEOUT if the connection timeouted.
  */
-void	refresh_answer( ipc_call_t * answer, int * answer_count );
+int connect_to_service_timeout(services_t need, suseconds_t timeout);
 
 /** Receives data from the other party.
@@ -127,5 +120,5 @@
  *  @returns Other error codes as defined for the async_data_write_finalize() function.
  */
-int data_receive( void ** data, size_t * length );
+int data_receive(void ** data, size_t * length);
 
 /** Replies the data to the other party.
@@ -137,5 +130,12 @@
  *  @returns Other error codes as defined for the async_data_read_finalize() function.
  */
-int data_reply( void * data, size_t data_length );
+int data_reply(void * data, size_t data_length);
+
+/** Refreshes answer structure and parameters count.
+ *  Erases all attributes.
+ *  @param[in,out] answer The message processing answer structure.
+ *  @param[in,out] answer_count The number of answer parameters.
+ */
+void refresh_answer(ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/net/net.c
===================================================================
--- uspace/srv/net/net/net.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/net/net.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -77,5 +77,5 @@
  *  @see NAME
  */
-void	module_print_name( void );
+void module_print_name(void);
 
 /** Starts the networking module.
@@ -86,13 +86,13 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
 /** \todo
  */
-int	read_configuration_file( const char * directory, const char * filename, measured_strings_ref configuration );
+int read_configuration_file(const char * directory, const char * filename, measured_strings_ref configuration);
 
 /** \todo
  */
-int	parse_line( measured_strings_ref configuration, char * line );
+int parse_line(measured_strings_ref configuration, char * line);
 
 /** Reads the networking subsystem global configuration.
@@ -100,5 +100,5 @@
  *  @returns Other error codes as defined for the add_configuration() function.
  */
-int		read_configuration( void );
+int read_configuration(void);
 
 /** Starts the network interface according to its configuration.
@@ -113,5 +113,5 @@
  *  @returns Other error codes as defined for the needed internet layer registering function.
  */
-int		start_device( netif_ref netif );
+int start_device(netif_ref netif);
 
 /** Reads the configuration and starts all network interfaces.
@@ -124,10 +124,10 @@
  *  @returns Other error codes as defined for the start_device() function.
  */
-int		startup( void );
+int startup(void);
 
 /** Generates new system-unique device identifier.
  *  @returns The system-unique devic identifier.
  */
-device_id_t	generate_new_device_id( void );
+device_id_t generate_new_device_id(void);
 
 /** Returns the configured values.
@@ -139,5 +139,5 @@
  *  @returns EOK.
  */
-int	net_get_conf( measured_strings_ref netif_conf, measured_string_ref configuration, size_t count, char ** data );
+int net_get_conf(measured_strings_ref netif_conf, measured_string_ref configuration, size_t count, char ** data);
 
 /** Initializes the networking module.
@@ -146,5 +146,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	net_initialize( async_client_conn_t client_connection );
+int net_initialize(async_client_conn_t client_connection);
 
 /** Reads the network interface specific configuration.
@@ -154,5 +154,5 @@
  *  @returns Other error codes as defined for the add_configuration() function.
  */
-int	read_netif_configuration( const char * name, netif_ref netif );
+int read_netif_configuration(const char * name, netif_ref netif);
 
 /** Networking module global data.
@@ -160,21 +160,21 @@
 net_globals_t	net_globals;
 
-DEVICE_MAP_IMPLEMENT( netifs, netif_t )
-
-GENERIC_CHAR_MAP_IMPLEMENT( measured_strings, measured_string_t )
-
-void module_print_name( void ){
-	printf( "%s", NAME );
-}
-
-int module_start( async_client_conn_t client_connection ){
-	ERROR_DECLARE;
-
-	ipcarg_t	phonehash;
-
-	async_set_client_connection( client_connection );
-	ERROR_PROPAGATE( pm_init());
-	if( ERROR_OCCURRED( net_initialize( client_connection ))
-	|| ERROR_OCCURRED( REGISTER_ME( SERVICE_NETWORKING, & phonehash ))){
+DEVICE_MAP_IMPLEMENT(netifs, netif_t)
+
+GENERIC_CHAR_MAP_IMPLEMENT(measured_strings, measured_string_t)
+
+void module_print_name(void){
+	printf("%s", NAME);
+}
+
+int module_start(async_client_conn_t client_connection){
+	ERROR_DECLARE;
+
+	ipcarg_t phonehash;
+
+	async_set_client_connection(client_connection);
+	ERROR_PROPAGATE(pm_init());
+	if(ERROR_OCCURRED(net_initialize(client_connection))
+		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_NETWORKING, &phonehash))){
 		pm_destroy();
 		return ERROR_CODE;
@@ -187,94 +187,100 @@
 }
 
-int net_initialize( async_client_conn_t client_connection ){
-	ERROR_DECLARE;
-
-	netifs_initialize( & net_globals.netifs );
-	char_map_initialize( & net_globals.netif_names );
-	modules_initialize( & net_globals.modules );
-	measured_strings_initialize( & net_globals.configuration );
+int net_initialize(async_client_conn_t client_connection){
+	ERROR_DECLARE;
+
+	netifs_initialize(&net_globals.netifs);
+	char_map_initialize(&net_globals.netif_names);
+	modules_initialize(&net_globals.modules);
+	measured_strings_initialize(&net_globals.configuration);
 
 	// TODO dynamic configuration
-	ERROR_PROPAGATE( read_configuration());
-
-	ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service ));
-	ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service ));
-	ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service ));
-	ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service ));
+	ERROR_PROPAGATE(read_configuration());
+
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service));
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service));
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service));
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service));
 
 	// build specific initialization
-	return net_initialize_build( client_connection );
-}
-
-int	net_get_device_conf_req( int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data ){
-	netif_ref	netif;
-
-	if( !( configuration && ( count > 0 ))) return EINVAL;
-	netif = netifs_find( & net_globals.netifs, device_id );
-	if( netif ){
-		return net_get_conf( & netif->configuration, * configuration, count, data );
+	return net_initialize_build(client_connection);
+}
+
+int net_get_device_conf_req(int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data){
+	netif_ref netif;
+
+	if(!(configuration && (count > 0))){
+		return EINVAL;
+	}
+	netif = netifs_find(&net_globals.netifs, device_id);
+	if(netif){
+		return net_get_conf(&netif->configuration, * configuration, count, data);
 	}else{
-		return net_get_conf( NULL, * configuration, count, data );
-	}
-}
-
-int	net_get_conf_req( int net_phone, measured_string_ref * configuration, size_t count, char ** data ){
-	if( !( configuration && ( count > 0 ))) return EINVAL;
-	return net_get_conf( NULL, * configuration, count, data );
-}
-
-int	net_get_conf( measured_strings_ref netif_conf, measured_string_ref configuration, size_t count, char ** data ){
-	measured_string_ref	setting;
-	size_t				index;
-
-	if( data ) * data = NULL;
-	for( index = 0; index < count; ++ index ){
-		setting = measured_strings_find( netif_conf, configuration[ index ].value, 0 );
-		if( ! setting ){
-			setting = measured_strings_find( & net_globals.configuration, configuration[ index ].value, 0 );
-		}
-		if( setting ){
-			configuration[ index ].length = setting->length;
-			configuration[ index ].value = setting->value;
+		return net_get_conf(NULL, * configuration, count, data);
+	}
+}
+
+int net_get_conf_req(int net_phone, measured_string_ref * configuration, size_t count, char ** data){
+	if(!(configuration && (count > 0))){
+		return EINVAL;
+	}
+	return net_get_conf(NULL, * configuration, count, data);
+}
+
+int net_get_conf(measured_strings_ref netif_conf, measured_string_ref configuration, size_t count, char ** data){
+	measured_string_ref setting;
+	size_t index;
+
+	if(data){
+		*data = NULL;
+	}
+	for(index = 0; index < count; ++ index){
+		setting = measured_strings_find(netif_conf, configuration[index].value, 0);
+		if(! setting){
+			setting = measured_strings_find(&net_globals.configuration, configuration[index].value, 0);
+		}
+		if(setting){
+			configuration[index].length = setting->length;
+			configuration[index].value = setting->value;
 		}else{
-			configuration[ index ].length = 0;
-			configuration[ index ].value = NULL;
-		}
-	}
-	return EOK;
-}
-
-void net_free_settings( measured_string_ref settings, char * data ){
-}
-
-int net_connect_module( services_t service ){
-	return EOK;
-}
-
-int net_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	ERROR_DECLARE;
-
-	measured_string_ref	strings;
-	char *				data;
-
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+			configuration[index].length = 0;
+			configuration[index].value = NULL;
+		}
+	}
+	return EOK;
+}
+
+void net_free_settings(measured_string_ref settings, char * data){
+}
+
+int net_connect_module(services_t service){
+	return EOK;
+}
+
+int net_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	ERROR_DECLARE;
+
+	measured_string_ref strings;
+	char * data;
+
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_NET_GET_DEVICE_CONF:
-			ERROR_PROPAGATE( measured_strings_receive( & strings, & data, IPC_GET_COUNT( call )));
-			net_get_device_conf_req( 0, IPC_GET_DEVICE( call ), & strings, IPC_GET_COUNT( call ), NULL );
+			ERROR_PROPAGATE(measured_strings_receive(&strings, &data, IPC_GET_COUNT(call)));
+			net_get_device_conf_req(0, IPC_GET_DEVICE(call), &strings, IPC_GET_COUNT(call), NULL);
 			// strings should not contain received data anymore
-			free( data );
-			ERROR_CODE = measured_strings_reply( strings, IPC_GET_COUNT( call ));
-			free( strings );
+			free(data);
+			ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call));
+			free(strings);
 			return ERROR_CODE;
 		case NET_NET_GET_CONF:
-			ERROR_PROPAGATE( measured_strings_receive( & strings, & data, IPC_GET_COUNT( call )));
-			net_get_conf_req( 0, & strings, IPC_GET_COUNT( call ), NULL );
+			ERROR_PROPAGATE(measured_strings_receive(&strings, &data, IPC_GET_COUNT(call)));
+			net_get_conf_req(0, &strings, IPC_GET_COUNT(call), NULL);
 			// strings should not contain received data anymore
-			free( data );
-			ERROR_CODE = measured_strings_reply( strings, IPC_GET_COUNT( call ));
-			free( strings );
+			free(data);
+			ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call));
+			free(strings);
 			return ERROR_CODE;
 		case NET_NET_STARTUP:
@@ -284,21 +290,21 @@
 }
 
-int read_configuration_file( const char * directory, const char * filename, measured_strings_ref configuration ){
-	ERROR_DECLARE;
-
-	size_t	index = 0;
-	char	line[ BUFFER_SIZE ];
-	FILE *	cfg;
-	int		read;
-	int		line_number = 0;
+int read_configuration_file(const char * directory, const char * filename, measured_strings_ref configuration){
+	ERROR_DECLARE;
+
+	size_t index = 0;
+	char line[BUFFER_SIZE];
+	FILE * cfg;
+	int read;
+	int line_number = 0;
 
 	// construct the full filename
-	printf( "Reading file %s/%s\n", directory, filename );
-	if( snprintf( line, BUFFER_SIZE, "%s/%s", directory, filename ) > BUFFER_SIZE ){
+	printf("Reading file %s/%s\n", directory, filename);
+	if(snprintf(line, BUFFER_SIZE, "%s/%s", directory, filename) > BUFFER_SIZE){
 		return EOVERFLOW;
 	}
 	// open the file
-	cfg = fopen( line, "r" );
-	if( ! cfg ){
+	cfg = fopen(line, "r");
+	if(! cfg){
 		return ENOENT;
 	}
@@ -306,24 +312,24 @@
 	// read the configuration line by line
 	// until an error or the end of file
-	while(( ! ferror( cfg )) && ( ! feof( cfg ))){
-		read = fgetc( cfg );
-		if(( read > 0 ) && ( read != '\n' ) && ( read != '\r' )){
-			if( index >= BUFFER_SIZE ){
-				line[ BUFFER_SIZE - 1 ] = '\0';
-				printf( "line %d too long: %s\n", line_number, line );
+	while((! ferror(cfg)) && (! feof(cfg))){
+		read = fgetc(cfg);
+		if((read > 0) && (read != '\n') && (read != '\r')){
+			if(index >= BUFFER_SIZE){
+				line[BUFFER_SIZE - 1] = '\0';
+				printf("line %d too long: %s\n", line_number, line);
 				// no space left in the line buffer
 				return EOVERFLOW;
 			}else{
 				// append the character
-				line[ index ] = (char) read;
+				line[index] = (char) read;
 				++ index;
 			}
 		}else{
 			// on error or new line
-			line[ index ] = '\0';
+			line[index] = '\0';
 			++ line_number;
-			if( ERROR_OCCURRED( parse_line( configuration, line ))){
-				printf( "error on line %d: %s\n", line_number, line );
-				//fclose( cfg );
+			if(ERROR_OCCURRED(parse_line(configuration, line))){
+				printf("error on line %d: %s\n", line_number, line);
+				//fclose(cfg);
 				//return ERROR_CODE;
 			}
@@ -331,14 +337,14 @@
 		}
 	}
-	fclose( cfg );
-	return EOK;
-}
-
-int parse_line( measured_strings_ref configuration, char * line ){
-	ERROR_DECLARE;
-
-	measured_string_ref	setting;
-	char *				name;
-	char *				value;
+	fclose(cfg);
+	return EOK;
+}
+
+int parse_line(measured_strings_ref configuration, char * line){
+	ERROR_DECLARE;
+
+	measured_string_ref setting;
+	char * name;
+	char * value;
 
 	// from the beginning
@@ -346,42 +352,52 @@
 
 	// skip comments and blank lines
-	if(( * name == '#' ) || ( * name == '\0' )){
+	if((*name == '#') || (*name == '\0')){
 		return EOK;
 	}
 	// skip spaces
-	while( isspace( * name )) ++ name;
+	while(isspace(*name)){
+		++ name;
+	}
 
 	// remember the name start
 	value = name;
 	// skip the name
-	while( isalnum( * value ) || ( * value == '_' )){
+	while(isalnum(*value) || (*value == '_')){
 		// make uppercase
-//		* value = toupper( * value );
+//		*value = toupper(*value);
 		++ value;
 	}
 
-	if( * value == '=' ){
+	if(*value == '='){
 		// terminate the name
-		* value = '\0';
+		*value = '\0';
 	}else{
 		// terminate the name
-		* value = '\0';
+		*value = '\0';
 		// skip until '='
 		++ value;
-		while(( * value ) && ( * value != '=' )) ++ value;
+		while((*value) && (*value != '=')){
+			++ value;
+		}
 		// not found?
-		if( * value != '=' ) return EINVAL;
+		if(*value != '='){
+			return EINVAL;
+		}
 	}
 
 	++ value;
 	// skip spaces
-	while( isspace( * value )) ++ value;
+	while(isspace(*value)){
+		++ value;
+	}
 	// create a bulk measured string till the end
-	setting = measured_string_create_bulk( value, 0 );
-	if( ! setting ) return ENOMEM;
+	setting = measured_string_create_bulk(value, 0);
+	if(! setting){
+		return ENOMEM;
+	}
 
 	// add the configuration setting
-	if( ERROR_OCCURRED( measured_strings_add( configuration, name, 0, setting ))){
-		free( setting );
+	if(ERROR_OCCURRED(measured_strings_add(configuration, name, 0, setting))){
+		free(setting);
 		return ERROR_CODE;
 	}
@@ -389,14 +405,16 @@
 }
 
-int add_configuration( measured_strings_ref configuration, const char * name, const char * value ){
-	ERROR_DECLARE;
-
-	measured_string_ref	setting;
-
-	setting = measured_string_create_bulk( value, 0 );
-	if( ! setting ) return ENOMEM;
+int add_configuration(measured_strings_ref configuration, const char * name, const char * value){
+	ERROR_DECLARE;
+
+	measured_string_ref setting;
+
+	setting = measured_string_create_bulk(value, 0);
+	if(! setting){
+		return ENOMEM;
+	}
 	// add the configuration setting
-	if( ERROR_OCCURRED( measured_strings_add( configuration, name, 0, setting ))){
-		free( setting );
+	if(ERROR_OCCURRED(measured_strings_add(configuration, name, 0, setting))){
+		free(setting);
 		return ERROR_CODE;
 	}
@@ -404,40 +422,40 @@
 }
 
-device_id_t generate_new_device_id( void ){
+device_id_t generate_new_device_id(void){
 	return device_assign_devno();
 }
 
-int read_configuration( void ){
+int read_configuration(void){
 	// read the general configuration file
-	return read_configuration_file( CONF_DIR, CONF_GENERAL_FILE, & net_globals.configuration );
-}
-
-int read_netif_configuration( const char * name, netif_ref netif ){
+	return read_configuration_file(CONF_DIR, CONF_GENERAL_FILE, &net_globals.configuration);
+}
+
+int read_netif_configuration(const char * name, netif_ref netif){
 	// read the netif configuration file
-	return read_configuration_file( CONF_DIR, name, & netif->configuration );
-}
-
-int start_device( netif_ref netif ){
-	ERROR_DECLARE;
-
-	measured_string_ref	setting;
-	services_t			internet_service;
-	int					irq;
-	int					io;
-	int					mtu;
+	return read_configuration_file(CONF_DIR, name, &netif->configuration);
+}
+
+int start_device(netif_ref netif){
+	ERROR_DECLARE;
+
+	measured_string_ref setting;
+	services_t internet_service;
+	int irq;
+	int io;
+	int mtu;
 
 	// mandatory netif
-	setting = measured_strings_find( & netif->configuration, CONF_NETIF, 0 );
-	netif->driver = get_running_module( & net_globals.modules, setting->value );
-	if( ! netif->driver ){
-		printf( "Failed to start the network interface driver %s\n", setting->value );
+	setting = measured_strings_find(&netif->configuration, CONF_NETIF, 0);
+	netif->driver = get_running_module(&net_globals.modules, setting->value);
+	if(! netif->driver){
+		printf("Failed to start the network interface driver %s\n", setting->value);
 		return EINVAL;
 	}
 	// optional network interface layer
-	setting = measured_strings_find( & netif->configuration, CONF_NIL, 0 );
-	if( setting ){
-		netif->nil = get_running_module( & net_globals.modules, setting->value );
-		if( ! netif->nil ){
-			printf( "Failed to start the network interface layer %s\n", setting->value );
+	setting = measured_strings_find(&netif->configuration, CONF_NIL, 0);
+	if(setting){
+		netif->nil = get_running_module(&net_globals.modules, setting->value);
+		if(! netif->nil){
+			printf("Failed to start the network interface layer %s\n", setting->value);
 			return EINVAL;
 		}
@@ -446,96 +464,102 @@
 	}
 	// mandatory internet layer
-	setting = measured_strings_find( & netif->configuration, CONF_IL, 0 );
-	netif->il = get_running_module( & net_globals.modules, setting->value );
-	if( ! netif->il ){
-		printf( "Failed to start the internet layer %s\n", setting->value );
+	setting = measured_strings_find(&netif->configuration, CONF_IL, 0);
+	netif->il = get_running_module(&net_globals.modules, setting->value);
+	if(! netif->il){
+		printf("Failed to start the internet layer %s\n", setting->value);
 		return EINVAL;
 	}
 	// end of the static loopback initialization
 	// startup the loopback interface
-	setting = measured_strings_find( & netif->configuration, CONF_IRQ, 0 );
-	irq = setting ? strtol( setting->value, NULL, 10 ) : 0;
-	setting = measured_strings_find( & netif->configuration, CONF_IO, 0 );
-	io = setting ? strtol( setting->value, NULL, 16 ) : 0;
-	ERROR_PROPAGATE( netif_probe_req( netif->driver->phone, netif->id, irq, io ));
-	if( netif->nil ){
-		setting = measured_strings_find( & netif->configuration, CONF_MTU, 0 );
-		if( ! setting ){
-			setting = measured_strings_find( & net_globals.configuration, CONF_MTU, 0 );
-		}
-		mtu = setting ? strtol( setting->value, NULL, 10 ) : 0;
-		ERROR_PROPAGATE( nil_device_req( netif->nil->phone, netif->id, mtu, netif->driver->service ));
+	setting = measured_strings_find(&netif->configuration, CONF_IRQ, 0);
+	irq = setting ? strtol(setting->value, NULL, 10) : 0;
+	setting = measured_strings_find(&netif->configuration, CONF_IO, 0);
+	io = setting ? strtol(setting->value, NULL, 16) : 0;
+	ERROR_PROPAGATE(netif_probe_req(netif->driver->phone, netif->id, irq, io));
+	if(netif->nil){
+		setting = measured_strings_find(&netif->configuration, CONF_MTU, 0);
+		if(! setting){
+			setting = measured_strings_find(&net_globals.configuration, CONF_MTU, 0);
+		}
+		mtu = setting ? strtol(setting->value, NULL, 10) : 0;
+		ERROR_PROPAGATE(nil_device_req(netif->nil->phone, netif->id, mtu, netif->driver->service));
 		internet_service = netif->nil->service;
 	}else{
 		internet_service = netif->driver->service;
 	}
-	switch( netif->il->service ){
+	switch(netif->il->service){
 		case SERVICE_IP:
-			ERROR_PROPAGATE( ip_device_req( netif->il->phone, netif->id, internet_service ));
+			ERROR_PROPAGATE(ip_device_req(netif->il->phone, netif->id, internet_service));
 			break;
 		default:
 			return ENOENT;
 	}
-	ERROR_PROPAGATE( netif_start_req( netif->driver->phone, netif->id ));
-	return EOK;
-}
-
-int startup( void ){
+	ERROR_PROPAGATE(netif_start_req(netif->driver->phone, netif->id));
+	return EOK;
+}
+
+int startup(void){
 	ERROR_DECLARE;
 
 #ifdef CONFIG_NETIF_DP8390
-	const char *		conf_files[] = { "lo", "ne2k" };
+	const char * conf_files[] = {"lo", "ne2k"};
 #else
-	const char *		conf_files[] = { "lo" };
+	const char * conf_files[] = {"lo"};
 #endif
 
-	int			count = sizeof( conf_files ) / sizeof( char * );
-	int			index;
-	netif_ref	netif;
-	int			i;
-	measured_string_ref	setting;
-
-	for( i = 0; i < count; ++ i ){
-		netif = ( netif_ref ) malloc( sizeof( netif_t ));
-		if( ! netif ) return ENOMEM;
+	int count = sizeof(conf_files) / sizeof(char *);
+	int index;
+	netif_ref netif;
+	int i;
+	measured_string_ref setting;
+
+	for(i = 0; i < count; ++ i){
+		netif = (netif_ref) malloc(sizeof(netif_t));
+		if(! netif){
+			return ENOMEM;
+		}
 
 		netif->id = generate_new_device_id();
-		if( ! netif->id ) return EXDEV;
-		ERROR_PROPAGATE( measured_strings_initialize( & netif->configuration ));
+		if(! netif->id){
+			return EXDEV;
+		}
+		ERROR_PROPAGATE(measured_strings_initialize(&netif->configuration));
 		// read configuration files
-		if( ERROR_OCCURRED( read_netif_configuration( conf_files[ i ], netif ))){
-			measured_strings_destroy( & netif->configuration );
-			free( netif );
+		if(ERROR_OCCURRED(read_netif_configuration(conf_files[i], netif))){
+			measured_strings_destroy(&netif->configuration);
+			free(netif);
 			return ERROR_CODE;
 		}
 		// mandatory name
-		setting = measured_strings_find( & netif->configuration, CONF_NAME, 0 );
-		if( ! setting ){
-			printf( "The name is missing\n" );
-			measured_strings_destroy( & netif->configuration );
-			free( netif );
+		setting = measured_strings_find(&netif->configuration, CONF_NAME, 0);
+		if(! setting){
+			printf("The name is missing\n");
+			measured_strings_destroy(&netif->configuration);
+			free(netif);
 			return EINVAL;
 		}
 		netif->name = setting->value;
 		// add to the netifs map
-		index = netifs_add( & net_globals.netifs, netif->id, netif );
-		if( index < 0 ){
-			measured_strings_destroy( & netif->configuration );
-			free( netif );
+		index = netifs_add(&net_globals.netifs, netif->id, netif);
+		if(index < 0){
+			measured_strings_destroy(&netif->configuration);
+			free(netif);
 			return index;
 		}
 		// add to the netif names map
-		if( ERROR_OCCURRED( char_map_add( & net_globals.netif_names, netif->name, 0, index ))
+		if(ERROR_OCCURRED(char_map_add(&net_globals.netif_names, netif->name, 0, index))
 		// start network interfaces and needed modules
-		|| ERROR_OCCURRED( start_device( netif ))){
-			measured_strings_destroy( & netif->configuration );
-			netifs_exclude_index( & net_globals.netifs, index );
+			|| ERROR_OCCURRED(start_device(netif))){
+			measured_strings_destroy(&netif->configuration);
+			netifs_exclude_index(&net_globals.netifs, index);
 			return ERROR_CODE;
 		}
 		// increment modules' usage
 		++ netif->driver->usage;
-		if( netif->nil ) ++ netif->nil->usage;
+		if(netif->nil){
+			++ netif->nil->usage;
+		}
 		++ netif->il->usage;
-		printf( "New network interface started:\n\tname\t= %s\n\tid\t= %d\n\tdriver\t= %s\n\tnil\t= %s\n\til\t= %s\n", netif->name, netif->id, netif->driver->name, netif->nil ? netif->nil->name : NULL, netif->il->name );
+		printf("New network interface started:\n\tname\t= %s\n\tid\t= %d\n\tdriver\t= %s\n\tnil\t= %s\n\til\t= %s\n", netif->name, netif->id, netif->driver->name, netif->nil ? netif->nil->name : NULL, netif->il->name);
 	}
 	return EOK;
Index: uspace/srv/net/net/net.h
===================================================================
--- uspace/srv/net/net/net.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/net/net.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -155,5 +155,5 @@
  *  @see device.h
  */
-DEVICE_MAP_DECLARE( netifs, netif_t )
+DEVICE_MAP_DECLARE(netifs, netif_t)
 
 /** Configuration settings.
@@ -161,5 +161,5 @@
  *  @see generic_char_map.h
  */
-GENERIC_CHAR_MAP_DECLARE( measured_strings, measured_string_t )
+GENERIC_CHAR_MAP_DECLARE(measured_strings, measured_string_t)
 
 /** Present network interface device.
@@ -168,20 +168,20 @@
 	/** System-unique network interface identifier.
 	 */
-	device_id_t		id;
+	device_id_t id;
 	/** Serving network interface driver module index.
 	 */
-	module_ref		driver;
+	module_ref driver;
 	/** Serving link layer module index.
 	 */
-	module_ref		nil;
+	module_ref nil;
 	/** Serving internet layer module index.
 	 */
-	module_ref		il;
+	module_ref il;
 	/** System-unique network interface name.
 	 */
-	char *			name;
+	char * name;
 	/** Configuration.
 	 */
-	measured_strings_t	configuration;
+	measured_strings_t configuration;
 };
 
@@ -191,14 +191,14 @@
 	/** Present network interfaces.
 	 */
-	netifs_t		netifs;
+	netifs_t netifs;
 	/** Network interface structure indices by names.
 	 */
-	char_map_t		netif_names;
+	char_map_t netif_names;
 	/** Available modules.
 	 */
-	modules_t		modules;
+	modules_t modules;
 	/** Global configuration.
 	 */
-	measured_strings_t	configuration;
+	measured_strings_t configuration;
 };
 
@@ -210,5 +210,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	add_configuration( measured_strings_ref configuration, const char * name, const char * value );
+int add_configuration(measured_strings_ref configuration, const char * name, const char * value);
 
 /** Processes the networking message.
@@ -222,5 +222,5 @@
  *  @see IS_NET_NET_MESSAGE()
  */
-int net_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int net_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** Initializes the networking module for the chosen subsystem build type.
@@ -229,5 +229,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	net_initialize_build( async_client_conn_t client_connection );
+int net_initialize_build(async_client_conn_t client_connection);
 
 /** Processes the module message.
@@ -241,5 +241,5 @@
  *  @returns Other error codes as defined for each bundled module message function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/net/net_bundle.c
===================================================================
--- uspace/srv/net/net/net_bundle.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/net/net_bundle.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -60,58 +60,58 @@
 extern net_globals_t	net_globals;
 
-int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	if(( IPC_GET_METHOD( * call ) == IPC_M_CONNECT_TO_ME )
-	|| IS_NET_IL_MESSAGE( call )
-	|| IS_NET_TL_MESSAGE( call )
-	|| IS_NET_SOCKET_MESSAGE( call )){
-		switch( IPC_GET_TARGET( call )){
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	if((IPC_GET_METHOD(*call) == IPC_M_CONNECT_TO_ME)
+		|| IS_NET_IL_MESSAGE(call)
+		|| IS_NET_TL_MESSAGE(call)
+		|| IS_NET_SOCKET_MESSAGE(call)){
+		switch(IPC_GET_TARGET(call)){
 			case SERVICE_IP:
-				return ip_message( callid, call, answer, answer_count );
+				return ip_message(callid, call, answer, answer_count);
 			case SERVICE_ARP:
-				return arp_message( callid, call, answer, answer_count );
+				return arp_message(callid, call, answer, answer_count);
 			case SERVICE_ICMP:
-				return icmp_message( callid, call, answer, answer_count );
+				return icmp_message(callid, call, answer, answer_count);
 			case SERVICE_UDP:
-				return udp_message( callid, call, answer, answer_count );
+				return udp_message(callid, call, answer, answer_count);
 			case SERVICE_TCP:
-				return tcp_message( callid, call, answer, answer_count );
+				return tcp_message(callid, call, answer, answer_count);
 			default:
 				return EINVAL;
 		}
-	}else if( IS_NET_IP_MESSAGE( call )){
-		return ip_message( callid, call, answer, answer_count );
-	}else if( IS_NET_ARP_MESSAGE( call )){
-		return arp_message( callid, call, answer, answer_count );
-	}else if( IS_NET_ICMP_MESSAGE( call )){
-		return icmp_message( callid, call, answer, answer_count );
-	}else if( IS_NET_UDP_MESSAGE( call )){
-		return udp_message( callid, call, answer, answer_count );
-	}else if( IS_NET_TCP_MESSAGE( call )){
-		return tcp_message( callid, call, answer, answer_count );
+	}else if(IS_NET_IP_MESSAGE(call)){
+		return ip_message(callid, call, answer, answer_count);
+	}else if(IS_NET_ARP_MESSAGE(call)){
+		return arp_message(callid, call, answer, answer_count);
+	}else if(IS_NET_ICMP_MESSAGE(call)){
+		return icmp_message(callid, call, answer, answer_count);
+	}else if(IS_NET_UDP_MESSAGE(call)){
+		return udp_message(callid, call, answer, answer_count);
+	}else if(IS_NET_TCP_MESSAGE(call)){
+		return tcp_message(callid, call, answer, answer_count);
 	}else{
-		if( IS_NET_PACKET_MESSAGE( call )){
-			return packet_server_message( callid, call, answer, answer_count );
+		if(IS_NET_PACKET_MESSAGE(call)){
+			return packet_server_message(callid, call, answer, answer_count);
 		}else{
-			return net_message( callid, call, answer, answer_count );
+			return net_message(callid, call, answer, answer_count);
 		}
 	}
 }
 
-int net_initialize_build( async_client_conn_t client_connection ){
+int net_initialize_build(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ipcarg_t	phonehash;
+	ipcarg_t phonehash;
 
-	ERROR_PROPAGATE( REGISTER_ME( SERVICE_IP, & phonehash ));
-	ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_get_id(), ip_connect_module ));
-	ERROR_PROPAGATE( ip_initialize( client_connection ));
-	ERROR_PROPAGATE( REGISTER_ME( SERVICE_ARP, & phonehash ));
-	ERROR_PROPAGATE( arp_initialize( client_connection ));
-	ERROR_PROPAGATE( REGISTER_ME( SERVICE_ICMP, & phonehash ));
-	ERROR_PROPAGATE( icmp_initialize( client_connection ));
-	ERROR_PROPAGATE( REGISTER_ME( SERVICE_UDP, & phonehash ));
-	ERROR_PROPAGATE( udp_initialize( client_connection ));
-	ERROR_PROPAGATE( REGISTER_ME( SERVICE_TCP, & phonehash ));
-	ERROR_PROPAGATE( tcp_initialize( client_connection ));
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_IP, &phonehash));
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_get_id(), ip_connect_module));
+	ERROR_PROPAGATE(ip_initialize(client_connection));
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_ARP, &phonehash));
+	ERROR_PROPAGATE(arp_initialize(client_connection));
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_ICMP, &phonehash));
+	ERROR_PROPAGATE(icmp_initialize(client_connection));
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_UDP, &phonehash));
+	ERROR_PROPAGATE(udp_initialize(client_connection));
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_TCP, &phonehash));
+	ERROR_PROPAGATE(tcp_initialize(client_connection));
 	return EOK;
 }
Index: uspace/srv/net/net/net_remote.c
===================================================================
--- uspace/srv/net/net/net_remote.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/net/net_remote.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -50,19 +50,23 @@
 #include "net_messages.h"
 
-int	net_get_device_conf_req( int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data ){
-	return generic_translate_req( net_phone, NET_NET_GET_DEVICE_CONF, device_id, 0, * configuration, count, configuration, data );
+int net_get_device_conf_req(int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data){
+	return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, device_id, 0, * configuration, count, configuration, data);
 }
 
-int	net_get_conf_req( int net_phone, measured_string_ref * configuration, size_t count, char ** data ){
-	return generic_translate_req( net_phone, NET_NET_GET_DEVICE_CONF, 0, 0, * configuration, count, configuration, data );
+int net_get_conf_req(int net_phone, measured_string_ref * configuration, size_t count, char ** data){
+	return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, 0, 0, * configuration, count, configuration, data);
 }
 
-void net_free_settings( measured_string_ref settings, char * data ){
-	if( settings ) free( settings );
-	if( data ) free( data );
+void net_free_settings(measured_string_ref settings, char * data){
+	if(settings){
+		free(settings);
+	}
+	if(data){
+		free(data);
+	}
 }
 
-int net_connect_module( services_t service ){
-	return connect_to_service( SERVICE_NETWORKING );
+int net_connect_module(services_t service){
+	return connect_to_service(SERVICE_NETWORKING);
 }
 
Index: uspace/srv/net/net/net_standalone.c
===================================================================
--- uspace/srv/net/net/net_standalone.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/net/net_standalone.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -53,23 +53,31 @@
 extern net_globals_t	net_globals;
 
-int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	if( IS_NET_PACKET_MESSAGE( call )){
-		return packet_server_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	if(IS_NET_PACKET_MESSAGE(call)){
+		return packet_server_message(callid, call, answer, answer_count);
 	}else{
-		return net_message( callid, call, answer, answer_count );
+		return net_message(callid, call, answer, answer_count);
 	}
 }
 
-int net_initialize_build( async_client_conn_t client_connection ){
+int net_initialize_build(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	task_id_t	task_id;
+	task_id_t task_id;
 
-	task_id = spawn( "/srv/ip" );
-	if( ! task_id ) return EINVAL;
-	ERROR_PROPAGATE( add_module( NULL, & net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_id, ip_connect_module ));
-	if( ! spawn( "/srv/icmp" )) return EINVAL;
-	if( ! spawn( "/srv/udp" )) return EINVAL;
-	if( ! spawn( "/srv/tcp" )) return EINVAL;
+	task_id = spawn("/srv/ip");
+	if(! task_id){
+		return EINVAL;
+	}
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_id, ip_connect_module));
+	if(! spawn("/srv/icmp")){
+		return EINVAL;
+	}
+	if(! spawn("/srv/udp")){
+		return EINVAL;
+	}
+	if(! spawn("/srv/tcp")){
+		return EINVAL;
+	}
 	return EOK;
 }
Index: uspace/srv/net/net/start/netstart.c
===================================================================
--- uspace/srv/net/net/start/netstart.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/net/start/netstart.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -62,5 +62,5 @@
  *  @returns Other error codes as defined for the NET_NET_STARTUP message.
  */
-int		main( int argc, char * argv[] );
+int main(int argc, char * argv[]);
 
 /** Starts the module.
@@ -69,27 +69,27 @@
  *  @returns Other error codes as defined for the task_spawn() function.
  */
-task_id_t	spawn( const char * fname );
+task_id_t spawn(const char * fname);
 
-int main( int argc, char * argv[] ){
+int main(int argc, char * argv[]){
 	ERROR_DECLARE;
 
-	int		net_phone;
+	int net_phone;
 
-	printf( "Task %d - ", task_get_id());
-	printf( "%s\n", NAME );
+	printf("Task %d - ", task_get_id());
+	printf("%s\n", NAME);
 	// run self tests
-	ERROR_PROPAGATE( self_test());
+	ERROR_PROPAGATE(self_test());
 	// start net service
-	if( ! spawn( "/srv/net" )){
-		fprintf( stderr, "Could not spawn net\n" );
+	if(! spawn("/srv/net")){
+		fprintf(stderr, "Could not spawn net\n");
 		return EINVAL;
 	}
 	// start net
-	net_phone = connect_to_service( SERVICE_NETWORKING );
-	if( ERROR_OCCURRED( ipc_call_sync_0_0( net_phone, NET_NET_STARTUP ))){
-		printf( "ERROR %d\n", ERROR_CODE );
+	net_phone = connect_to_service(SERVICE_NETWORKING);
+	if(ERROR_OCCURRED(ipc_call_sync_0_0(net_phone, NET_NET_STARTUP))){
+		printf("ERROR %d\n", ERROR_CODE);
 		return ERROR_CODE;
 	}else{
-		printf( "OK\n" );
+		printf("OK\n");
 	}
 
@@ -97,11 +97,11 @@
 }
 
-task_id_t spawn( const char * fname ){
-	const char *	argv[ 2 ];
-	task_id_t	res;
+task_id_t spawn(const char * fname){
+	const char * argv[2];
+	task_id_t res;
 
-	argv[ 0 ] = fname;
-	argv[ 1 ] = NULL;
-	res = task_spawn( fname, argv );
+	argv[0] = fname;
+	argv[1] = NULL;
+	res = task_spawn(fname, argv);
 	
 	return res;
Index: uspace/srv/net/netif/dp8390/dp8390.c
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/dp8390/dp8390.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -67,5 +67,5 @@
  *  @returns EINVAL 
  */
-int	queue_packet( dpeth_t * dep, packet_t packet );
+int queue_packet(dpeth_t * dep, packet_t packet);
 
 /** Reads a memory block byte by byte.
@@ -74,5 +74,5 @@
  *  @param[in] size The memory block size in bytes.
  */
-static void outsb( port_t port, void * buf, size_t size );
+static void outsb(port_t port, void * buf, size_t size);
 
 /** Reads a memory block word by word.
@@ -81,5 +81,5 @@
  *  @param[in] size The memory block size in bytes.
  */
-static void outsw( port_t port, void * buf, size_t size );
+static void outsw(port_t port, void * buf, size_t size);
 
 //static u16_t eth_ign_proto;
@@ -98,7 +98,7 @@
 //{
 	/* I/O port, IRQ,  Buffer address,  Env. var. */
-/*	{  0x280,     3,    0xD0000,        "DPETH0"	},
-	{  0x300,     5,    0xC8000,        "DPETH1"	},
-	{  0x380,    10,    0xD8000,        "DPETH2"	},
+/*	{ 0x280,     3,    0xD0000,        "DPETH0"	},
+	{ 0x300,     5,    0xC8000,        "DPETH1"	},
+	{ 0x380,    10,    0xD8000,        "DPETH2"	},
 };
 */
@@ -126,93 +126,93 @@
 
 //#if ENABLE_PCI
-//_PROTOTYPE( static void pci_conf, (void)				);
+//_PROTOTYPE(static void pci_conf, (void)				);
 //#endif
-//_PROTOTYPE( static void do_vwrite, (message *mp, int from_int,
+//_PROTOTYPE(static void do_vwrite, (message *mp, int from_int,
 //							int vectored)	);
-//_PROTOTYPE( static void do_vwrite_s, (message *mp, int from_int)	);
-//_PROTOTYPE( static void do_vread, (message *mp, int vectored)		);
-//_PROTOTYPE( static void do_vread_s, (message *mp)			);
-//_PROTOTYPE( static void do_init, (message *mp)				);
-//_PROTOTYPE( static void do_int, (dpeth_t *dep)				);
-//_PROTOTYPE( static void do_getstat, (message *mp)			);
-//_PROTOTYPE( static void do_getstat_s, (message *mp)			);
-//_PROTOTYPE( static void do_getname, (message *mp)			);
-//_PROTOTYPE( static void do_stop, (message *mp)				);
-_PROTOTYPE( static void dp_init, (dpeth_t *dep)				);
-//_PROTOTYPE( static void dp_confaddr, (dpeth_t *dep)			);
-_PROTOTYPE( static void dp_reinit, (dpeth_t *dep)			);
-_PROTOTYPE( static void dp_reset, (dpeth_t *dep)			);
-//_PROTOTYPE( static void dp_check_ints, (dpeth_t *dep)			);
-_PROTOTYPE( static void dp_recv, (dpeth_t *dep)				);
-_PROTOTYPE( static void dp_send, (dpeth_t *dep)				);
-//_PROTOTYPE( static void dp8390_stop, (void)				);
-_PROTOTYPE( static void dp_getblock, (dpeth_t *dep, int page,
+//_PROTOTYPE(static void do_vwrite_s, (message *mp, int from_int)	);
+//_PROTOTYPE(static void do_vread, (message *mp, int vectored)		);
+//_PROTOTYPE(static void do_vread_s, (message *mp)			);
+//_PROTOTYPE(static void do_init, (message *mp)				);
+//_PROTOTYPE(static void do_int, (dpeth_t *dep)				);
+//_PROTOTYPE(static void do_getstat, (message *mp)			);
+//_PROTOTYPE(static void do_getstat_s, (message *mp)			);
+//_PROTOTYPE(static void do_getname, (message *mp)			);
+//_PROTOTYPE(static void do_stop, (message *mp)				);
+_PROTOTYPE(static void dp_init, (dpeth_t *dep)				);
+//_PROTOTYPE(static void dp_confaddr, (dpeth_t *dep)			);
+_PROTOTYPE(static void dp_reinit, (dpeth_t *dep)			);
+_PROTOTYPE(static void dp_reset, (dpeth_t *dep)			);
+//_PROTOTYPE(static void dp_check_ints, (dpeth_t *dep)			);
+_PROTOTYPE(static void dp_recv, (dpeth_t *dep)				);
+_PROTOTYPE(static void dp_send, (dpeth_t *dep)				);
+//_PROTOTYPE(static void dp8390_stop, (void)				);
+_PROTOTYPE(static void dp_getblock, (dpeth_t *dep, int page,
 				size_t offset, size_t size, void *dst)	);
-_PROTOTYPE( static void dp_pio8_getblock, (dpeth_t *dep, int page,
+_PROTOTYPE(static void dp_pio8_getblock, (dpeth_t *dep, int page,
 				size_t offset, size_t size, void *dst)	);
-_PROTOTYPE( static void dp_pio16_getblock, (dpeth_t *dep, int page,
+_PROTOTYPE(static void dp_pio16_getblock, (dpeth_t *dep, int page,
 				size_t offset, size_t size, void *dst)	);
-_PROTOTYPE( static int dp_pkt2user, (dpeth_t *dep, int page,
-							int length)	);
-//_PROTOTYPE( static int dp_pkt2user_s, (dpeth_t *dep, int page,
+_PROTOTYPE(static int dp_pkt2user, (dpeth_t *dep, int page,
+							int length) );
+//_PROTOTYPE(static int dp_pkt2user_s, (dpeth_t *dep, int page,
 //							int length)	);
-_PROTOTYPE( static void dp_user2nic, (dpeth_t *dep, iovec_dat_t *iovp, 
-		vir_bytes offset, int nic_addr, vir_bytes count)	);
-//_PROTOTYPE( static void dp_user2nic_s, (dpeth_t *dep, iovec_dat_s_t *iovp, 
+_PROTOTYPE(static void dp_user2nic, (dpeth_t *dep, iovec_dat_t *iovp, 
+		vir_bytes offset, int nic_addr, vir_bytes count) );
+//_PROTOTYPE(static void dp_user2nic_s, (dpeth_t *dep, iovec_dat_s_t *iovp, 
 //		vir_bytes offset, int nic_addr, vir_bytes count)	);
-_PROTOTYPE( static void dp_pio8_user2nic, (dpeth_t *dep,
+_PROTOTYPE(static void dp_pio8_user2nic, (dpeth_t *dep,
 				iovec_dat_t *iovp, vir_bytes offset,
-				int nic_addr, vir_bytes count)		);
-//_PROTOTYPE( static void dp_pio8_user2nic_s, (dpeth_t *dep,
+				int nic_addr, vir_bytes count) );
+//_PROTOTYPE(static void dp_pio8_user2nic_s, (dpeth_t *dep,
 //				iovec_dat_s_t *iovp, vir_bytes offset,
 //				int nic_addr, vir_bytes count)		);
-_PROTOTYPE( static void dp_pio16_user2nic, (dpeth_t *dep,
+_PROTOTYPE(static void dp_pio16_user2nic, (dpeth_t *dep,
 				iovec_dat_t *iovp, vir_bytes offset,
-				int nic_addr, vir_bytes count)		);
-//_PROTOTYPE( static void dp_pio16_user2nic_s, (dpeth_t *dep,
+				int nic_addr, vir_bytes count) );
+//_PROTOTYPE(static void dp_pio16_user2nic_s, (dpeth_t *dep,
 //				iovec_dat_s_t *iovp, vir_bytes offset,
 //				int nic_addr, vir_bytes count)		);
-_PROTOTYPE( static void dp_nic2user, (dpeth_t *dep, int nic_addr, 
+_PROTOTYPE(static void dp_nic2user, (dpeth_t *dep, int nic_addr, 
 		iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)	);
-//_PROTOTYPE( static void dp_nic2user_s, (dpeth_t *dep, int nic_addr, 
+//_PROTOTYPE(static void dp_nic2user_s, (dpeth_t *dep, int nic_addr, 
 //		iovec_dat_s_t *iovp, vir_bytes offset, vir_bytes count)	);
-_PROTOTYPE( static void dp_pio8_nic2user, (dpeth_t *dep, int nic_addr, 
+_PROTOTYPE(static void dp_pio8_nic2user, (dpeth_t *dep, int nic_addr, 
 		iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)	);
-//_PROTOTYPE( static void dp_pio8_nic2user_s, (dpeth_t *dep, int nic_addr, 
+//_PROTOTYPE(static void dp_pio8_nic2user_s, (dpeth_t *dep, int nic_addr, 
 //		iovec_dat_s_t *iovp, vir_bytes offset, vir_bytes count)	);
-_PROTOTYPE( static void dp_pio16_nic2user, (dpeth_t *dep, int nic_addr, 
+_PROTOTYPE(static void dp_pio16_nic2user, (dpeth_t *dep, int nic_addr, 
 		iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)	);
-//_PROTOTYPE( static void dp_pio16_nic2user_s, (dpeth_t *dep, int nic_addr, 
+//_PROTOTYPE(static void dp_pio16_nic2user_s, (dpeth_t *dep, int nic_addr, 
 //		iovec_dat_s_t *iovp, vir_bytes offset, vir_bytes count)	);
-_PROTOTYPE( static void dp_next_iovec, (iovec_dat_t *iovp)		);
-//_PROTOTYPE( static void dp_next_iovec_s, (iovec_dat_s_t *iovp)		);
-_PROTOTYPE( static void conf_hw, (dpeth_t *dep)				);
-//_PROTOTYPE( static void update_conf, (dpeth_t *dep, dp_conf_t *dcp)	);
-_PROTOTYPE( static void map_hw_buffer, (dpeth_t *dep)			);
-//_PROTOTYPE( static int calc_iovec_size, (iovec_dat_t *iovp)		);
-//_PROTOTYPE( static int calc_iovec_size_s, (iovec_dat_s_t *iovp)		);
-_PROTOTYPE( static void reply, (dpeth_t *dep, int err, int may_block)	);
-//_PROTOTYPE( static void mess_reply, (message *req, message *reply)	);
-_PROTOTYPE( static void get_userdata, (int user_proc,
+_PROTOTYPE(static void dp_next_iovec, (iovec_dat_t *iovp)		);
+//_PROTOTYPE(static void dp_next_iovec_s, (iovec_dat_s_t *iovp)		);
+_PROTOTYPE(static void conf_hw, (dpeth_t *dep)				);
+//_PROTOTYPE(static void update_conf, (dpeth_t *dep, dp_conf_t *dcp)	);
+_PROTOTYPE(static void map_hw_buffer, (dpeth_t *dep)			);
+//_PROTOTYPE(static int calc_iovec_size, (iovec_dat_t *iovp)		);
+//_PROTOTYPE(static int calc_iovec_size_s, (iovec_dat_s_t *iovp)		);
+_PROTOTYPE(static void reply, (dpeth_t *dep, int err, int may_block)	);
+//_PROTOTYPE(static void mess_reply, (message *req, message *reply)	);
+_PROTOTYPE(static void get_userdata, (int user_proc,
 		vir_bytes user_addr, vir_bytes count, void *loc_addr)	);
-//_PROTOTYPE( static void get_userdata_s, (int user_proc,
+//_PROTOTYPE(static void get_userdata_s, (int user_proc,
 //		cp_grant_id_t grant, vir_bytes offset, vir_bytes count,
 //		void *loc_addr)	);
-//_PROTOTYPE( static void put_userdata, (int user_proc,
+//_PROTOTYPE(static void put_userdata, (int user_proc,
 //		vir_bytes user_addr, vir_bytes count, void *loc_addr)	);
-//_PROTOTYPE( static void put_userdata_s, (int user_proc,
+//_PROTOTYPE(static void put_userdata_s, (int user_proc,
 //		cp_grant_id_t grant, size_t count, void *loc_addr)	);
-_PROTOTYPE( static void insb, (port_t port, void *buf, size_t size)				);
-_PROTOTYPE( static void insw, (port_t port, void *buf, size_t size)				);
-//_PROTOTYPE( static void do_vir_insb, (port_t port, int proc,
+_PROTOTYPE(static void insb, (port_t port, void *buf, size_t size)				);
+_PROTOTYPE(static void insw, (port_t port, void *buf, size_t size)				);
+//_PROTOTYPE(static void do_vir_insb, (port_t port, int proc,
 //					vir_bytes buf, size_t size)	);
-//_PROTOTYPE( static void do_vir_insw, (port_t port, int proc,
+//_PROTOTYPE(static void do_vir_insw, (port_t port, int proc,
 //					vir_bytes buf, size_t size)	);
-//_PROTOTYPE( static void do_vir_outsb, (port_t port, int proc,
+//_PROTOTYPE(static void do_vir_outsb, (port_t port, int proc,
 //					vir_bytes buf, size_t size)	);
-//_PROTOTYPE( static void do_vir_outsw, (port_t port, int proc,
+//_PROTOTYPE(static void do_vir_outsw, (port_t port, int proc,
 //					vir_bytes buf, size_t size)	);
 
-int do_probe( dpeth_t * dep ){
+int do_probe(dpeth_t * dep){
 	/* This is the default, try to (re)locate the device. */
 	conf_hw(dep);
@@ -230,5 +230,5 @@
  *				dp8390_dump				     *
  *===========================================================================*/
-void dp8390_dump( dpeth_t * dep )
+void dp8390_dump(dpeth_t * dep)
 {
 //	dpeth_t *dep;
@@ -282,5 +282,5 @@
  *				do_init					     *
  *===========================================================================*/
-int do_init( dpeth_t * dep, int mode ){
+int do_init(dpeth_t * dep, int mode){
 	if (dep->de_mode == DEM_DISABLED)
 	{
@@ -303,13 +303,13 @@
 	}
 	assert(dep->de_mode == DEM_ENABLED);
-	assert(dep->de_flags & DEF_ENABLED);
+	assert(dep->de_flags &DEF_ENABLED);
 
 	dep->de_flags &= ~(DEF_PROMISC | DEF_MULTI | DEF_BROAD);
 
-	if (mode & DL_PROMISC_REQ)
+	if (mode &DL_PROMISC_REQ)
 		dep->de_flags |= DEF_PROMISC | DEF_MULTI | DEF_BROAD;
-	if (mode & DL_MULTI_REQ)
+	if (mode &DL_MULTI_REQ)
 		dep->de_flags |= DEF_MULTI;
-	if (mode & DL_BROAD_REQ)
+	if (mode &DL_BROAD_REQ)
 		dep->de_flags |= DEF_BROAD;
 
@@ -329,8 +329,8 @@
  *				do_stop					     *
  *===========================================================================*/
-void do_stop( dpeth_t * dep ){
-	if(( dep->de_mode != DEM_SINK ) && ( dep->de_mode == DEM_ENABLED ) && ( dep->de_flags & DEF_ENABLED )){
-		outb_reg0( dep, DP_CR, CR_STP | CR_DM_ABORT );
-		( dep->de_stopf )( dep );
+void do_stop(dpeth_t * dep){
+	if((dep->de_mode != DEM_SINK) && (dep->de_mode == DEM_ENABLED) && (dep->de_flags &DEF_ENABLED)){
+		outb_reg0(dep, DP_CR, CR_STP | CR_DM_ABORT);
+		(dep->de_stopf)(dep);
 
 		dep->de_flags = DEF_EMPTY;
@@ -338,20 +338,20 @@
 }
 
-int queue_packet( dpeth_t * dep, packet_t packet ){
-	packet_t	tmp;
-
-	if( dep->packet_count >= MAX_PACKETS ){
-		netif_pq_release( packet_get_id( packet ));
+int queue_packet(dpeth_t * dep, packet_t packet){
+	packet_t tmp;
+
+	if(dep->packet_count >= MAX_PACKETS){
+		netif_pq_release(packet_get_id(packet));
 		return ELIMIT;
 	}
 
 	tmp = dep->packet_queue;
-	while( pq_next( tmp )){
-		tmp = pq_next( tmp );
-	}
-	if( pq_add( & tmp, packet, 0, 0 ) != EOK ){
+	while(pq_next(tmp)){
+		tmp = pq_next(tmp);
+	}
+	if(pq_add(&tmp, packet, 0, 0) != EOK){
 		return EINVAL;
 	}
-	if( ! dep->packet_count ){
+	if(! dep->packet_count){
 		dep->packet_queue = packet;
 	}
@@ -363,5 +363,5 @@
  *			based on	do_vwrite				     *
  *===========================================================================*/
-int do_pwrite( dpeth_t * dep, packet_t packet, int from_int )
+int do_pwrite(dpeth_t * dep, packet_t packet, int from_int)
 {
 //	int port, count, size;
@@ -386,9 +386,9 @@
 	}
 	assert(dep->de_mode == DEM_ENABLED);
-	assert(dep->de_flags & DEF_ENABLED);
-	if( dep->packet_queue && ( ! from_int )){
-//	if (dep->de_flags & DEF_SEND_AVAIL){
+	assert(dep->de_flags &DEF_ENABLED);
+	if(dep->packet_queue && (! from_int)){
+//	if (dep->de_flags &DEF_SEND_AVAIL){
 //		panic("", "dp8390: send already in progress", NO_NUM);
-		return queue_packet( dep, packet );
+		return queue_packet(dep, packet);
 	}
 
@@ -402,7 +402,7 @@
 //		reply(dep, OK, FALSE);
 //		return;
-//		return queue_packet( dep, packet );
+//		return queue_packet(dep, packet);
 //	}
-//	assert(!(dep->de_flags & DEF_PACK_SEND));
+//	assert(!(dep->de_flags &DEF_PACK_SEND));
 
 /*	if (vectored)
@@ -419,5 +419,5 @@
 	}
 	else
-	{  
+	{ 
 		dep->de_write_iovec.iod_iovec[0].iov_addr =
 			(vir_bytes) mp->DL_ADDR;
@@ -430,6 +430,6 @@
 	}
 */
-	size = packet_get_data_length( packet );
-	dep->de_write_iovec.iod_iovec[0].iov_addr = ( vir_bytes ) packet_get_data( packet );
+	size = packet_get_data_length(packet);
+	dep->de_write_iovec.iod_iovec[0].iov_addr = (vir_bytes) packet_get_data(packet);
 	dep->de_write_iovec.iod_iovec[0].iov_size = size;
 	dep->de_write_iovec.iod_iovec_s = 1;
@@ -449,5 +449,5 @@
 		outb_reg0(dep, DP_TPSR, dep->de_sendq[sendq_head].sq_sendpage);
 		outb_reg0(dep, DP_TBCR1, size >> 8);
-		outb_reg0(dep, DP_TBCR0, size & 0xff);
+		outb_reg0(dep, DP_TBCR0, size &0xff);
 		outb_reg0(dep, DP_CR, CR_TXP | CR_EXTRA);/* there it goes.. */
 	}
@@ -470,5 +470,5 @@
 
 	assert(dep->de_mode == DEM_ENABLED);
-	assert(dep->de_flags & DEF_ENABLED);
+	assert(dep->de_flags &DEF_ENABLED);
 	return EOK;
 }
@@ -516,9 +516,9 @@
 	/* Step 4: */
 	dp_rcr_reg = 0;
-	if (dep->de_flags & DEF_PROMISC)
+	if (dep->de_flags &DEF_PROMISC)
 		dp_rcr_reg |= RCR_AB | RCR_PRO | RCR_AM;
-	if (dep->de_flags & DEF_BROAD)
+	if (dep->de_flags &DEF_BROAD)
 		dp_rcr_reg |= RCR_AB;
-	if (dep->de_flags & DEF_MULTI)
+	if (dep->de_flags &DEF_MULTI)
 		dp_rcr_reg |= RCR_AM;
 	outb_reg0(dep, DP_RCR, dp_rcr_reg);
@@ -621,9 +621,9 @@
 
 	dp_rcr_reg = 0;
-	if (dep->de_flags & DEF_PROMISC)
+	if (dep->de_flags &DEF_PROMISC)
 		dp_rcr_reg |= RCR_AB | RCR_PRO | RCR_AM;
-	if (dep->de_flags & DEF_BROAD)
+	if (dep->de_flags &DEF_BROAD)
 		dp_rcr_reg |= RCR_AB;
-	if (dep->de_flags & DEF_MULTI)
+	if (dep->de_flags &DEF_MULTI)
 		dp_rcr_reg |= RCR_AM;
 	outb_reg0(dep, DP_RCR, dp_rcr_reg);
@@ -642,5 +642,5 @@
 	outb_reg0(dep, DP_RBCR0, 0);
 	outb_reg0(dep, DP_RBCR1, 0);
-	for (i= 0; i < 0x1000 && ((inb_reg0(dep, DP_ISR) & ISR_RST) == 0); i++)
+	for (i= 0; i < 0x1000 && ((inb_reg0(dep, DP_ISR) &ISR_RST) == 0); i++)
 		; /* Do nothing */
 	outb_reg0(dep, DP_TCR, TCR_1EXTERNAL|TCR_OFST);
@@ -649,7 +649,7 @@
 
 	/* Acknowledge the ISR_RDC (remote dma) interrupt. */
-	for (i= 0; i < 0x1000 && ((inb_reg0(dep, DP_ISR) & ISR_RDC) == 0); i++)
+	for (i= 0; i < 0x1000 && ((inb_reg0(dep, DP_ISR) &ISR_RDC) == 0); i++)
 		; /* Do nothing */
-	outb_reg0(dep, DP_ISR, inb_reg0(dep, DP_ISR) & ~ISR_RDC);
+	outb_reg0(dep, DP_ISR, inb_reg0(dep, DP_ISR) &~ISR_RDC);
 
 	/* Reset the transmit ring. If we were transmitting a packet, we
@@ -674,5 +674,5 @@
 	int size, sendq_tail;
 
-	if (!(dep->de_flags & DEF_ENABLED))
+	if (!(dep->de_flags &DEF_ENABLED))
 		panic("", "dp8390: got premature interrupt", NO_NUM);
 
@@ -683,10 +683,10 @@
 			break;
 		outb_reg0(dep, DP_ISR, isr);
-		if (isr & (ISR_PTX|ISR_TXE))
-		{
-			if (isr & ISR_TXE)
+		if (isr &(ISR_PTX|ISR_TXE))
+		{
+			if (isr &ISR_TXE)
 			{
 #if DEBUG
- { printf("%s: got send Error\n", dep->de_name); }
+ {printf("%s: got send Error\n", dep->de_name);}
 #endif
 				dep->de_stat.ets_sendErr++;
@@ -696,7 +696,7 @@
 				tsr = inb_reg0(dep, DP_TSR);
 
-				if (tsr & TSR_PTX) dep->de_stat.ets_packetT++;
+				if (tsr &TSR_PTX) dep->de_stat.ets_packetT++;
 #if 0	/* Reserved in later manuals, should be ignored */
-				if (!(tsr & TSR_DFR))
+				if (!(tsr &TSR_DFR))
 				{
 					/* In most (all?) implementations of
@@ -707,8 +707,8 @@
 				}
 #endif
-				if (tsr & TSR_COL) dep->de_stat.ets_collision++;
-				if (tsr & TSR_ABT) dep->de_stat.ets_transAb++;
-				if (tsr & TSR_CRS) dep->de_stat.ets_carrSense++;
-				if (tsr & TSR_FU
+				if (tsr &TSR_COL) dep->de_stat.ets_collision++;
+				if (tsr &TSR_ABT) dep->de_stat.ets_transAb++;
+				if (tsr &TSR_CRS) dep->de_stat.ets_carrSense++;
+				if (tsr &TSR_FU
 					&& ++dep->de_stat.ets_fifoUnder <= 10)
 				{
@@ -716,5 +716,5 @@
 						dep->de_name);
 				}
-				if (tsr & TSR_CDH
+				if (tsr &TSR_CDH
 					&& ++dep->de_stat.ets_CDheartbeat <= 10)
 				{
@@ -722,5 +722,5 @@
 						dep->de_name);
 				}
-				if (tsr & TSR_OWC) dep->de_stat.ets_OWC++;
+				if (tsr &TSR_OWC) dep->de_stat.ets_OWC++;
 			}
 			sendq_tail= dep->de_sendq_tail;
@@ -747,20 +747,20 @@
 					dep->de_sendq[sendq_tail].sq_sendpage);
 				outb_reg0(dep, DP_TBCR1, size >> 8);
-				outb_reg0(dep, DP_TBCR0, size & 0xff);
+				outb_reg0(dep, DP_TBCR0, size &0xff);
 				outb_reg0(dep, DP_CR, CR_TXP | CR_EXTRA);
 			}
-//			if (dep->de_flags & DEF_SEND_AVAIL)
+//			if (dep->de_flags &DEF_SEND_AVAIL)
 				dp_send(dep);
 		}
 
-		if (isr & ISR_PRX)
+		if (isr &ISR_PRX)
 		{
 			/* Only call dp_recv if there is a read request */
-//			if (dep->de_flags) & DEF_READING)
+//			if (dep->de_flags) &DEF_READING)
 				dp_recv(dep);
 		}
 		
-		if (isr & ISR_RXE) dep->de_stat.ets_recvErr++;
-		if (isr & ISR_CNT)
+		if (isr &ISR_RXE) dep->de_stat.ets_recvErr++;
+		if (isr &ISR_CNT)
 		{
 			dep->de_stat.ets_CRCerr += inb_reg0(dep, DP_CNTR0);
@@ -768,12 +768,12 @@
 			dep->de_stat.ets_missedP += inb_reg0(dep, DP_CNTR2);
 		}
-		if (isr & ISR_OVW)
+		if (isr &ISR_OVW)
 		{
 			dep->de_stat.ets_OVW++;
 #if 0
-			{ printW(); printf(
-				"%s: got overwrite warning\n", dep->de_name); }
+			{printW(); printf(
+				"%s: got overwrite warning\n", dep->de_name);}
 #endif
-/*			if (dep->de_flags & DEF_READING)
+/*			if (dep->de_flags &DEF_READING)
 			{
 				printf(
@@ -782,9 +782,9 @@
 			}
 */		}
-		if (isr & ISR_RDC)
+		if (isr &ISR_RDC)
 		{
 			/* Nothing to do */
 		}
-		if (isr & ISR_RST)
+		if (isr &ISR_RST)
 		{
 			/* this means we got an interrupt but the ethernet 
@@ -794,6 +794,6 @@
 			 */
 #if 0
-			 { printW(); printf(
-				"%s: NIC stopped\n", dep->de_name); }
+			 {printW(); printf(
+				"%s: NIC stopped\n", dep->de_name);}
 #endif
 			dep->de_flags |= DEF_STOPPED;
@@ -802,7 +802,7 @@
 		isr = inb_reg0(dep, DP_ISR);
 	}
-//	if ((dep->de_flags & (DEF_READING|DEF_STOPPED)) == 
+//	if ((dep->de_flags &(DEF_READING|DEF_STOPPED)) == 
 //						(DEF_READING|DEF_STOPPED))
-	if ((dep->de_flags & DEF_STOPPED) == DEF_STOPPED )
+	if ((dep->de_flags &DEF_STOPPED) == DEF_STOPPED)
 	{
 		/* The chip is stopped, and all arrived packets are 
@@ -874,5 +874,5 @@
 			dep->de_stat.ets_packetR++;
 		}
-*/		else if (header.dr_status & RSR_FO)
+*/		else if (header.dr_status &RSR_FO)
 		{
 			/* This is very serious, so we issue a warning and
@@ -883,6 +883,6 @@
 			next = curr;
 		}
-		else if ((header.dr_status & RSR_PRX) &&
-					   (dep->de_flags & DEF_ENABLED))
+		else if ((header.dr_status &RSR_PRX) && 
+					   (dep->de_flags &DEF_ENABLED))
 		{
 //			if (dep->de_safecopy_read)
@@ -914,15 +914,15 @@
 	packet_t packet;
 
-//	if (!(dep->de_flags & DEF_SEND_AVAIL))
+//	if (!(dep->de_flags &DEF_SEND_AVAIL))
 //		return;
 
-	if( dep->packet_queue ){
+	if(dep->packet_queue){
 		packet = dep->packet_queue;
-		dep->packet_queue = pq_detach( packet );
-		do_pwrite( dep, packet, TRUE );
-		netif_pq_release( packet_get_id( packet ));
+		dep->packet_queue = pq_detach(packet);
+		do_pwrite(dep, packet, TRUE);
+		netif_pq_release(packet_get_id(packet));
 		-- dep->packet_count;
 	}
-//	if( ! dep->packet_queue ){
+//	if(! dep->packet_queue){
 //		dep->de_flags &= ~DEF_SEND_AVAIL;
 //	}
@@ -967,7 +967,7 @@
 {
 	offset = page * DP_PAGESIZE + offset;
-	outb_reg0(dep, DP_RBCR0, size & 0xFF);
+	outb_reg0(dep, DP_RBCR0, size &0xFF);
 	outb_reg0(dep, DP_RBCR1, size >> 8);
-	outb_reg0(dep, DP_RSAR0, offset & 0xFF);
+	outb_reg0(dep, DP_RSAR0, offset &0xFF);
 	outb_reg0(dep, DP_RSAR1, offset >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
@@ -987,11 +987,11 @@
 {
 	offset = page * DP_PAGESIZE + offset;
-	outb_reg0(dep, DP_RBCR0, size & 0xFF);
+	outb_reg0(dep, DP_RBCR0, size &0xFF);
 	outb_reg0(dep, DP_RBCR1, size >> 8);
-	outb_reg0(dep, DP_RSAR0, offset & 0xFF);
+	outb_reg0(dep, DP_RSAR0, offset &0xFF);
 	outb_reg0(dep, DP_RSAR1, offset >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
 
-	assert (!(size & 1));
+	assert (!(size &1));
 	insw(dep->de_data_port, dst, size);
 }
@@ -1005,12 +1005,14 @@
 {
 	int last, count;
-	packet_t	packet;
-
-//	if (!(dep->de_flags & DEF_READING))
+	packet_t packet;
+
+//	if (!(dep->de_flags &DEF_READING))
 //		return EGENERIC;
 
-	packet = netif_packet_get_1( length );
-	if( ! packet ) return ENOMEM;
-	dep->de_read_iovec.iod_iovec[0].iov_addr = ( vir_bytes ) packet_suffix( packet, length );
+	packet = netif_packet_get_1(length);
+	if(! packet){
+		return ENOMEM;
+	}
+	dep->de_read_iovec.iod_iovec[0].iov_addr = (vir_bytes) packet_suffix(packet, length);
 	dep->de_read_iovec.iod_iovec[0].iov_size = length;
 	dep->de_read_iovec.iod_iovec_s = 1;
@@ -1028,5 +1030,5 @@
 			sizeof(dp_rcvhdr_t), &dep->de_tmp_iovec, 0, count);
 		(dep->de_nic2userf)(dep, dep->de_startpage * DP_PAGESIZE, 
-				&dep->de_read_iovec, count, length - count);
+			&dep->de_read_iovec, count, length - count);
 	}
 	else
@@ -1040,12 +1042,12 @@
 //	dep->de_flags &= ~DEF_READING;
 
-	if( dep->received_count >= MAX_PACKETS ){
-		netif_pq_release( packet_get_id( packet ));
+	if(dep->received_count >= MAX_PACKETS){
+		netif_pq_release(packet_get_id(packet));
 		return ELIMIT;
 	}else{
-		if( pq_add( & dep->received_queue, packet, 0, 0 ) == EOK ){
+		if(pq_add(&dep->received_queue, packet, 0, 0) == EOK){
 			++ dep->received_count;
 		}else{
-			netif_pq_release( packet_get_id( packet ));
+			netif_pq_release(packet_get_id(packet));
 		}
 	}
@@ -1119,7 +1121,7 @@
 	outb_reg0(dep, DP_ISR, ISR_RDC);
 
-	outb_reg0(dep, DP_RBCR0, count & 0xFF);
+	outb_reg0(dep, DP_RBCR0, count &0xFF);
 	outb_reg0(dep, DP_RBCR1, count >> 8);
-	outb_reg0(dep, DP_RSAR0, nic_addr & 0xFF);
+	outb_reg0(dep, DP_RSAR0, nic_addr &0xFF);
 	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
@@ -1154,5 +1156,5 @@
 	for (i= 0; i<100; i++)
 	{
-		if (inb_reg0(dep, DP_ISR) & ISR_RDC)
+		if (inb_reg0(dep, DP_ISR) &ISR_RDC)
 			break;
 	}
@@ -1181,11 +1183,11 @@
 	int odd_byte;
 
-	ecount= (count+1) & ~1;
+	ecount= (count+1) &~1;
 	odd_byte= 0;
 
 	outb_reg0(dep, DP_ISR, ISR_RDC);
-	outb_reg0(dep, DP_RBCR0, ecount & 0xFF);
+	outb_reg0(dep, DP_RBCR0, ecount &0xFF);
 	outb_reg0(dep, DP_RBCR1, ecount >> 8);
-	outb_reg0(dep, DP_RSAR0, nic_addr & 0xFF);
+	outb_reg0(dep, DP_RSAR0, nic_addr &0xFF);
 	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
@@ -1234,5 +1236,5 @@
 				continue;
 		}
-		ecount= bytes & ~1;
+		ecount= bytes &~1;
 		if (ecount != 0)
 		{
@@ -1271,5 +1273,5 @@
 	for (i= 0; i<100; i++)
 	{
-		if (inb_reg0(dep, DP_ISR) & ISR_RDC)
+		if (inb_reg0(dep, DP_ISR) &ISR_RDC)
 			break;
 	}
@@ -1343,7 +1345,7 @@
 	vir_bytes bytes;
 
-	outb_reg0(dep, DP_RBCR0, count & 0xFF);
+	outb_reg0(dep, DP_RBCR0, count &0xFF);
 	outb_reg0(dep, DP_RBCR1, count >> 8);
-	outb_reg0(dep, DP_RSAR0, nic_addr & 0xFF);
+	outb_reg0(dep, DP_RSAR0, nic_addr &0xFF);
 	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
@@ -1395,10 +1397,10 @@
 	int odd_byte;
 
-	ecount= (count+1) & ~1;
+	ecount= (count+1) &~1;
 	odd_byte= 0;
 
-	outb_reg0(dep, DP_RBCR0, ecount & 0xFF);
+	outb_reg0(dep, DP_RBCR0, ecount &0xFF);
 	outb_reg0(dep, DP_RBCR1, ecount >> 8);
-	outb_reg0(dep, DP_RSAR0, nic_addr & 0xFF);
+	outb_reg0(dep, DP_RSAR0, nic_addr &0xFF);
 	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
@@ -1445,5 +1447,5 @@
 				continue;
 		}
-		ecount= bytes & ~1;
+		ecount= bytes &~1;
 		if (ecount != 0)
 		{
@@ -1502,5 +1504,5 @@
 dpeth_t *dep;
 {
-//	static eth_stat_t empty_stat = {0, 0, 0, 0, 0, 0 	/* ,... */ };
+//	static eth_stat_t empty_stat = {0, 0, 0, 0, 0, 0 	/* ,... */};
 
 //	int ifnr;
@@ -1551,5 +1553,5 @@
 		return;
 	}else{
-		printf( "map_hw_buffer: no buffer!\n" );
+		printf("map_hw_buffer: no buffer!\n");
 	}
 
@@ -1584,7 +1586,7 @@
 
 	status = 0;
-	if (dep->de_flags & DEF_PACK_SEND)
+	if (dep->de_flags &DEF_PACK_SEND)
 		status |= DL_PACK_SEND;
-	if (dep->de_flags & DEF_PACK_RECV)
+	if (dep->de_flags &DEF_PACK_RECV)
 		status |= DL_PACK_RECV;
 
@@ -1633,6 +1635,6 @@
 	size_t i;
 
-	for( i = 0; i < size; ++ i ){
-		*(( uint8_t * ) buf + i ) = inb( port );
+	for(i = 0; i < size; ++ i){
+		*((uint8_t *) buf + i) = inb(port);
 	}
 }
@@ -1642,6 +1644,6 @@
 	size_t i;
 
-	for( i = 0; i * 2 < size; ++ i ){
-		*(( uint16_t * ) buf + i ) = inw( port );
+	for(i = 0; i * 2 < size; ++ i){
+		*((uint16_t *) buf + i) = inw(port);
 	}
 }
@@ -1651,6 +1653,6 @@
 	size_t i;
 
-	for( i = 0; i < size; ++ i ){
-		outb( port, *(( uint8_t * ) buf + i ));
+	for(i = 0; i < size; ++ i){
+		outb(port, *((uint8_t *) buf + i));
 	}
 }
@@ -1660,6 +1662,6 @@
 	size_t i;
 
-	for( i = 0; i * 2 < size; ++ i ){
-		outw( port, *(( uint16_t * ) buf + i ));
+	for(i = 0; i * 2 < size; ++ i){
+		outw(port, *((uint16_t *) buf + i));
 	}
 }
Index: uspace/srv/net/netif/dp8390/dp8390.h
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/dp8390/dp8390.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -255,23 +255,23 @@
 struct iovec_dat;
 //struct iovec_dat_s;
-_PROTOTYPE( typedef void (*dp_initf_t), (struct dpeth *dep)		);
-_PROTOTYPE( typedef void (*dp_stopf_t), (struct dpeth *dep)		);
-_PROTOTYPE( typedef void (*dp_user2nicf_t), (struct dpeth *dep,
+_PROTOTYPE(typedef void (*dp_initf_t), (struct dpeth *dep)		);
+_PROTOTYPE(typedef void (*dp_stopf_t), (struct dpeth *dep)		);
+_PROTOTYPE(typedef void (*dp_user2nicf_t), (struct dpeth *dep,
 			struct iovec_dat *iovp, vir_bytes offset,
-			int nic_addr, vir_bytes count)			);
-//_PROTOTYPE( typedef void (*dp_user2nicf_s_t), (struct dpeth *dep,
+			int nic_addr, vir_bytes count) );
+//_PROTOTYPE(typedef void (*dp_user2nicf_s_t), (struct dpeth *dep,
 //			struct iovec_dat_s *iovp, vir_bytes offset,
 //			int nic_addr, vir_bytes count)			);
-_PROTOTYPE( typedef void (*dp_nic2userf_t), (struct dpeth *dep,
+_PROTOTYPE(typedef void (*dp_nic2userf_t), (struct dpeth *dep,
 			int nic_addr, struct iovec_dat *iovp,
-			vir_bytes offset, vir_bytes count)		);
-//_PROTOTYPE( typedef void (*dp_nic2userf_s_t), (struct dpeth *dep,
+			vir_bytes offset, vir_bytes count) );
+//_PROTOTYPE(typedef void (*dp_nic2userf_s_t), (struct dpeth *dep,
 //			int nic_addr, struct iovec_dat_s *iovp,
 //			vir_bytes offset, vir_bytes count)		);
 //#if 0
-//_PROTOTYPE( typedef void (*dp_getheaderf_t), (struct dpeth *dep,
+//_PROTOTYPE(typedef void (*dp_getheaderf_t), (struct dpeth *dep,
 //			int page, struct dp_rcvhdr *h, u16_t *eth_type)	);
 //#endif
-_PROTOTYPE( typedef void (*dp_getblock_t), (struct dpeth *dep,
+_PROTOTYPE(typedef void (*dp_getblock_t), (struct dpeth *dep,
 		int page, size_t offset, size_t size, void *dst)	);
 
@@ -313,15 +313,15 @@
 	/** Outgoing packets queue.
 	 */
-	packet_t	packet_queue;
+	packet_t packet_queue;
 	/** Outgoing packets count.
 	 */
-	int			packet_count;
+	int packet_count;
 
 	/** Received packets queue.
 	 */
-	packet_t	received_queue;
+	packet_t received_queue;
 	/** Received packets count.
 	 */
-	int			received_count;
+	int received_count;
 
 	/* The de_base_port field is the starting point of the probe.
Index: uspace/srv/net/netif/dp8390/dp8390_drv.h
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390_drv.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/dp8390/dp8390_drv.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -64,5 +64,5 @@
  *  @returns EXDEV if the network interface was not recognized.
  */
-int	do_probe( dpeth_t * dep );
+int do_probe(dpeth_t * dep);
 
 /** Sends a packet.
@@ -72,10 +72,10 @@
  *  @returns 
  */
-int	do_pwrite( dpeth_t * dep, packet_t packet, int from_int );
+int do_pwrite(dpeth_t * dep, packet_t packet, int from_int);
 
 /** Prints out network interface information.
  *  @param[in] dep The network interface structure.
  */
-void	dp8390_dump( dpeth_t * dep );
+void dp8390_dump(dpeth_t * dep);
 
 #endif
Index: uspace/srv/net/netif/dp8390/dp8390_module.c
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390_module.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/dp8390/dp8390_module.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -68,15 +68,15 @@
  *  @param[in] call The interrupt call.
  */
-#define IRQ_GET_DEVICE( call )			( device_id_t ) IPC_GET_METHOD( * call )
+#define IRQ_GET_DEVICE(call)			(device_id_t) IPC_GET_METHOD(*call)
 
 /** Returns the interrupt status register from the interrupt call.
  *  @param[in] call The interrupt call.
  */
-#define IPC_GET_ISR( call )				( int ) IPC_GET_ARG2( * call )
+#define IPC_GET_ISR(call)				(int) IPC_GET_ARG2(*call)
 
 /** DP8390 kernel interrupt command sequence.
  */
 static irq_cmd_t	dp8390_cmds[] = {
-	{ 	.cmd = CMD_PIO_READ_8,
+	{	.cmd = CMD_PIO_READ_8,
 		.addr = NULL,
 		.dstarg = 2
@@ -95,5 +95,5 @@
  */
 static irq_code_t	dp8390_code = {
-	sizeof( dp8390_cmds ) / sizeof( irq_cmd_t ),
+	sizeof(dp8390_cmds) / sizeof(irq_cmd_t),
 	dp8390_cmds
 };
@@ -106,5 +106,5 @@
  *  @see NAME
  */
-void	module_print_name( void );
+void module_print_name(void);
 
 /** Handles the interrupt messages.
@@ -113,5 +113,5 @@
  *  @param[in] call The interrupt message.
  */
-void	irq_handler( ipc_callid_t iid, ipc_call_t * call );
+void irq_handler(ipc_callid_t iid, ipc_call_t * call);
 
 /** Changes the network interface state.
@@ -120,20 +120,22 @@
  *  @returns The new state.
  */
-int	change_state( device_ref device, device_state_t state );
-
-int netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+int change_state(device_ref device, device_state_t state);
+
+int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	return ENOTSUP;
 }
 
-int netif_get_device_stats( device_id_t device_id, device_stats_ref stats ){
-	ERROR_DECLARE;
-
-	device_ref		device;
-	eth_stat_t *	de_stat;
-
-	if( ! stats ) return EBADMEM;
-	ERROR_PROPAGATE( find_device( device_id, & device ));
-	de_stat = & (( dpeth_t * ) device->specific )->de_stat;
-	null_device_stats( stats );
+int netif_get_device_stats(device_id_t device_id, device_stats_ref stats){
+	ERROR_DECLARE;
+
+	device_ref device;
+	eth_stat_t * de_stat;
+
+	if(! stats){
+		return EBADMEM;
+	}
+	ERROR_PROPAGATE(find_device(device_id, &device));
+	de_stat = &((dpeth_t *) device->specific)->de_stat;
+	null_device_stats(stats);
 	stats->receive_errors = de_stat->ets_recvErr;
 	stats->send_errors = de_stat->ets_sendErr;
@@ -151,92 +153,96 @@
 }
 
-void module_print_name( void ){
-	printf( "%s", NAME );
-}
-
-int netif_get_addr_message( device_id_t device_id, measured_string_ref address ){
-	ERROR_DECLARE;
-
-	device_ref	device;
-
-	if( ! address ) return EBADMEM;
-	ERROR_PROPAGATE( find_device( device_id, & device ));
-	address->value = ( char * ) ( & (( dpeth_t * ) device->specific )->de_address );
-	address->length = CONVERT_SIZE( ether_addr_t, char, 1 );
-	return EOK;
-}
-
-void irq_handler( ipc_callid_t iid, ipc_call_t * call )
+void module_print_name(void){
+	printf("%s", NAME);
+}
+
+int netif_get_addr_message(device_id_t device_id, measured_string_ref address){
+	ERROR_DECLARE;
+
+	device_ref device;
+
+	if(! address){
+		return EBADMEM;
+	}
+	ERROR_PROPAGATE(find_device(device_id, &device));
+	address->value = (char *) (&((dpeth_t *) device->specific)->de_address);
+	address->length = CONVERT_SIZE(ether_addr_t, char, 1);
+	return EOK;
+}
+
+void irq_handler(ipc_callid_t iid, ipc_call_t * call)
 {
-	device_ref	device;
-	dpeth_t *	dep;
-	packet_t	received;
-	device_id_t	device_id;
-	int			phone;
-
-	device_id = IRQ_GET_DEVICE( call );
-	fibril_rwlock_write_lock( & netif_globals.lock );
-	if( find_device( device_id, & device ) != EOK ){
-		fibril_rwlock_write_unlock( & netif_globals.lock );
+	device_ref device;
+	dpeth_t * dep;
+	packet_t received;
+	device_id_t device_id;
+	int phone;
+
+	device_id = IRQ_GET_DEVICE(call);
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	if(find_device(device_id, &device) != EOK){
+		fibril_rwlock_write_unlock(&netif_globals.lock);
 		return;
 	}
-	dep = ( dpeth_t * ) device->specific;
-	if ( dep->de_mode != DEM_ENABLED){
-		fibril_rwlock_write_unlock( & netif_globals.lock );
+	dep = (dpeth_t *) device->specific;
+	if (dep->de_mode != DEM_ENABLED){
+		fibril_rwlock_write_unlock(&netif_globals.lock);
 		return;
 	}
-	assert( dep->de_flags & DEF_ENABLED);
+	assert(dep->de_flags &DEF_ENABLED);
 	dep->de_int_pending = 0;
 //	remove debug print:
-	printf( "I%d: 0x%x\n", device_id, IPC_GET_ISR( call ));
-	dp_check_ints( dep, IPC_GET_ISR( call ));
-	if( dep->received_queue ){
+	printf("I%d: 0x%x\n", device_id, IPC_GET_ISR(call));
+	dp_check_ints(dep, IPC_GET_ISR(call));
+	if(dep->received_queue){
 		received = dep->received_queue;
 		phone = device->nil_phone;
 		dep->received_queue = NULL;
 		dep->received_count = 0;
-		fibril_rwlock_write_unlock( & netif_globals.lock );
+		fibril_rwlock_write_unlock(&netif_globals.lock);
 //	remove debug dump:
-	uint8_t *	data;
-	data = packet_get_data( received );
-	printf( "Receiving packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id( received ), packet_get_data_length( received ), data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ], data[ 8 ], data[ 9 ], data[ 10 ], data[ 11 ], data[ 12 ], data[ 13 ], data[ 14 ], data[ 15 ], data[ 16 ], data[ 17 ], data[ 18 ], data[ 19 ], data[ 20 ], data[ 21 ], data[ 22 ], data[ 23 ], data[ 24 ], data[ 25 ], data[ 26 ], data[ 27 ], data[ 28 ], data[ 29 ], data[ 30 ], data[ 31 ], data[ 32 ], data[ 33 ], data[ 34 ], data[ 35 ], data[ 36 ], data[ 37 ], data[ 38 ], data[ 39 ], data[ 40 ], data[ 41 ], data[ 42 ], data[ 43 ], data[ 44 ], data[ 45 ], data[ 46 ], data[ 47 ], data[ 48 ], data[ 49 ], data[ 50 ], data[ 51 ], data[ 52 ], data[ 53 ], data[ 54 ], data[ 55 ], data[ 56 ], data[ 57 ], data[ 58 ], data[ 59 ] );
-		nil_received_msg( phone, device_id, received, NULL );
+	uint8_t * data;
+	data = packet_get_data(received);
+	printf("Receiving packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id(received), packet_get_data_length(received), data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35], data[36], data[37], data[38], data[39], data[40], data[41], data[42], data[43], data[44], data[45], data[46], data[47], data[48], data[49], data[50], data[51], data[52], data[53], data[54], data[55], data[56], data[57], data[58], data[59]);
+		nil_received_msg(phone, device_id, received, NULL);
 	}else{
-		fibril_rwlock_write_unlock( & netif_globals.lock );
-	}
-	ipc_answer_0( iid, EOK );
-}
-
-int netif_probe_message( device_id_t device_id, int irq, uintptr_t io ){
-	ERROR_DECLARE;
-
-	device_ref	device;
-	dpeth_t *	dep;
-
-	device = ( device_ref ) malloc( sizeof( device_t ));
-	if( ! device ) return ENOMEM;
-	dep = ( dpeth_t * ) malloc( sizeof( dpeth_t ));
-	if( ! dep ){
-		free( device );
+		fibril_rwlock_write_unlock(&netif_globals.lock);
+	}
+	ipc_answer_0(iid, EOK);
+}
+
+int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){
+	ERROR_DECLARE;
+
+	device_ref device;
+	dpeth_t * dep;
+
+	device = (device_ref) malloc(sizeof(device_t));
+	if(! device){
 		return ENOMEM;
 	}
-	bzero( device, sizeof( device_t ));
-	bzero( dep, sizeof( dpeth_t ));
+	dep = (dpeth_t *) malloc(sizeof(dpeth_t));
+	if(! dep){
+		free(device);
+		return ENOMEM;
+	}
+	bzero(device, sizeof(device_t));
+	bzero(dep, sizeof(dpeth_t));
 	device->device_id = device_id;
 	device->nil_phone = -1;
-	device->specific = ( void * ) dep;
+	device->specific = (void *) dep;
 	device->state = NETIF_STOPPED;
 	dep->de_irq = irq;
 	dep->de_mode = DEM_DISABLED;
 	//TODO address?
-	if( ERROR_OCCURRED( pio_enable(( void * ) io, DP8390_IO_SIZE, ( void ** ) & dep->de_base_port ))
-	|| ERROR_OCCURRED( do_probe( dep ))){
-		free( dep );
-		free( device );
+	if(ERROR_OCCURRED(pio_enable((void *) io, DP8390_IO_SIZE, (void **) &dep->de_base_port))
+		|| ERROR_OCCURRED(do_probe(dep))){
+		free(dep);
+		free(device);
 		return ERROR_CODE;
 	}
-	if( ERROR_OCCURRED( device_map_add( & netif_globals.device_map, device->device_id, device ))){
-		free( dep );
-		free( device );
+	if(ERROR_OCCURRED(device_map_add(&netif_globals.device_map, device->device_id, device))){
+		free(dep);
+		free(device);
 		return ERROR_CODE;
 	}
@@ -244,76 +250,76 @@
 }
 
-int netif_send_message( device_id_t device_id, packet_t packet, services_t sender ){
-	ERROR_DECLARE;
-
-	device_ref	device;
-	dpeth_t *	dep;
-	packet_t	next;
-
-	ERROR_PROPAGATE( find_device( device_id, & device ));
-	if( device->state != NETIF_ACTIVE ){
-		netif_pq_release( packet_get_id( packet ));
+int netif_send_message(device_id_t device_id, packet_t packet, services_t sender){
+	ERROR_DECLARE;
+
+	device_ref device;
+	dpeth_t * dep;
+	packet_t next;
+
+	ERROR_PROPAGATE(find_device(device_id, &device));
+	if(device->state != NETIF_ACTIVE){
+		netif_pq_release(packet_get_id(packet));
 		return EFORWARD;
 	}
-	dep = ( dpeth_t * ) device->specific;
+	dep = (dpeth_t *) device->specific;
 	// process packet queue
 	do{
-		next = pq_detach( packet );
+		next = pq_detach(packet);
 //		remove debug dump:
-		uint8_t *	data;
-		data = packet_get_data( packet );
-		printf( "Sending packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id( packet ), packet_get_data_length( packet ), data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ], data[ 8 ], data[ 9 ], data[ 10 ], data[ 11 ], data[ 12 ], data[ 13 ], data[ 14 ], data[ 15 ], data[ 16 ], data[ 17 ], data[ 18 ], data[ 19 ], data[ 20 ], data[ 21 ], data[ 22 ], data[ 23 ], data[ 24 ], data[ 25 ], data[ 26 ], data[ 27 ], data[ 28 ], data[ 29 ], data[ 30 ], data[ 31 ], data[ 32 ], data[ 33 ], data[ 34 ], data[ 35 ], data[ 36 ], data[ 37 ], data[ 38 ], data[ 39 ], data[ 40 ], data[ 41 ], data[ 42 ], data[ 43 ], data[ 44 ], data[ 45 ], data[ 46 ], data[ 47 ], data[ 48 ], data[ 49 ], data[ 50 ], data[ 51 ], data[ 52 ], data[ 53 ], data[ 54 ], data[ 55 ], data[ 56 ], data[ 57 ], data[ 58 ], data[ 59 ] );
-
-		if( do_pwrite( dep, packet, FALSE ) != EBUSY ){
-			netif_pq_release( packet_get_id( packet ));
+		uint8_t * data;
+		data = packet_get_data(packet);
+		printf("Sending packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id(packet), packet_get_data_length(packet), data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35], data[36], data[37], data[38], data[39], data[40], data[41], data[42], data[43], data[44], data[45], data[46], data[47], data[48], data[49], data[50], data[51], data[52], data[53], data[54], data[55], data[56], data[57], data[58], data[59]);
+
+		if(do_pwrite(dep, packet, FALSE) != EBUSY){
+			netif_pq_release(packet_get_id(packet));
 		}
 		packet = next;
-	}while( packet );
-	return EOK;
-}
-
-int	netif_start_message( device_ref device ){
-	ERROR_DECLARE;
-
-	dpeth_t *	dep;
-
-	if( device->state != NETIF_ACTIVE ){
-		dep = ( dpeth_t * ) device->specific;
-		dp8390_cmds[ 0 ].addr = ( void * ) ( uintptr_t ) ( dep->de_dp8390_port + DP_ISR );
-		dp8390_cmds[ 2 ].addr = dp8390_cmds[ 0 ].addr;
-		ERROR_PROPAGATE( ipc_register_irq( dep->de_irq, device->device_id, device->device_id, & dp8390_code ));
-		if( ERROR_OCCURRED( do_init( dep, DL_BROAD_REQ ))){
-			ipc_unregister_irq( dep->de_irq, device->device_id );
+	}while(packet);
+	return EOK;
+}
+
+int netif_start_message(device_ref device){
+	ERROR_DECLARE;
+
+	dpeth_t * dep;
+
+	if(device->state != NETIF_ACTIVE){
+		dep = (dpeth_t *) device->specific;
+		dp8390_cmds[0].addr = (void *) (uintptr_t) (dep->de_dp8390_port + DP_ISR);
+		dp8390_cmds[2].addr = dp8390_cmds[0].addr;
+		ERROR_PROPAGATE(ipc_register_irq(dep->de_irq, device->device_id, device->device_id, &dp8390_code));
+		if(ERROR_OCCURRED(do_init(dep, DL_BROAD_REQ))){
+			ipc_unregister_irq(dep->de_irq, device->device_id);
 			return ERROR_CODE;
 		}
-		return change_state( device, NETIF_ACTIVE );
-	}
-	return EOK;
-}
-
-int	netif_stop_message( device_ref device ){
-	dpeth_t *	dep;
-
-	if( device->state != NETIF_STOPPED ){
-		dep = ( dpeth_t * ) device->specific;
-		do_stop( dep );
-		ipc_unregister_irq( dep->de_irq, device->device_id );
-		return change_state( device, NETIF_STOPPED );
-	}
-	return EOK;
-}
-
-int change_state( device_ref device, device_state_t state ){
+		return change_state(device, NETIF_ACTIVE);
+	}
+	return EOK;
+}
+
+int netif_stop_message(device_ref device){
+	dpeth_t * dep;
+
+	if(device->state != NETIF_STOPPED){
+		dep = (dpeth_t *) device->specific;
+		do_stop(dep);
+		ipc_unregister_irq(dep->de_irq, device->device_id);
+		return change_state(device, NETIF_STOPPED);
+	}
+	return EOK;
+}
+
+int change_state(device_ref device, device_state_t state){
 	device->state = state;
-	printf( "State changed to %s\n", ( state == NETIF_ACTIVE ) ? "ACTIVE" : "STOPPED" );
+	printf("State changed to %s\n", (state == NETIF_ACTIVE) ? "ACTIVE" : "STOPPED");
 	return state;
 }
 
-int netif_initialize( void ){
-	ipcarg_t	phonehash;
-
-	async_set_interrupt_received( irq_handler );
-
-	return REGISTER_ME( SERVICE_DP8390, & phonehash );
+int netif_initialize(void){
+	ipcarg_t phonehash;
+
+	async_set_interrupt_received(irq_handler);
+
+	return REGISTER_ME(SERVICE_DP8390, &phonehash);
 }
 
Index: uspace/srv/net/netif/dp8390/dp8390_port.h
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390_port.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/dp8390/dp8390_port.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -48,5 +48,5 @@
  *  @param[in] params The function parameters definition.
  */
-#define _PROTOTYPE( function, params ) function params
+#define _PROTOTYPE(function, params) function params
 
 /** Success error code.
@@ -70,5 +70,5 @@
  *  @returns 1 if the second is greater than the first.
  */
-#define memcmp( first, second, size )	bcmp(( char * ) ( first ), ( char * ) ( second ), ( size ))
+#define memcmp(first, second, size)	bcmp((char *) (first), (char *) (second), (size))
 
 /** Reads 1 byte.
@@ -76,5 +76,5 @@
  *  @returns The read value.
  */
-#define inb( port )	pio_read_8(( ioport8_t * ) ( port ))
+#define inb(port)	pio_read_8((ioport8_t *) (port))
 
 /** Reads 1 word (2 bytes).
@@ -82,5 +82,5 @@
  *  @returns The read value.
  */
-#define inw( port )	pio_read_16(( ioport16_t * ) ( port ))
+#define inw(port)	pio_read_16((ioport16_t *) (port))
 
 /** Writes 1 byte.
@@ -88,5 +88,5 @@
  *  @param[in] value The value to be written.
  */
-#define outb( port, value )	pio_write_8(( ioport8_t * ) ( port ), ( value ))
+#define outb(port, value)	pio_write_8((ioport8_t *) (port), (value))
 
 /** Writes 1 word (2 bytes).
@@ -94,10 +94,10 @@
  *  @param[in] value The value to be written.
  */
-#define outw( port, value )	pio_write_16(( ioport16_t * ) ( port ), ( value ))
+#define outw(port, value)	pio_write_16((ioport16_t *) (port), (value))
 
 /** Prints out the driver critical error.
  *  Does not call the system panic().
  */
-#define panic( ... )	printf( "%s%s%d", __VA_ARGS__ )
+#define panic(...)	printf("%s%s%d", __VA_ARGS__)
 
 /** Copies a memory block.
@@ -111,5 +111,5 @@
  *  @returns EOK.
  */
-#define sys_vircopy( proc, src_s, src, me, dst_s, dst, bytes )	({ memcpy(( void * )( dst ), ( void * )( src ), ( bytes )); EOK; })
+#define sys_vircopy(proc, src_s, src, me, dst_s, dst, bytes)	({memcpy((void *)(dst), (void *)(src), (bytes)); EOK;})
 
 /** Reads a memory block byte by byte.
@@ -119,5 +119,5 @@
  *  @param[in] bytes The block size in bytes.
  */
-#define do_vir_insb( port, proc, dst, bytes )	insb(( port ), ( void * )( dst ), ( bytes ))
+#define do_vir_insb(port, proc, dst, bytes)	insb((port), (void *)(dst), (bytes))
 
 /** Reads a memory block word by word (2 bytes).
@@ -127,5 +127,5 @@
  *  @param[in] bytes The block size in bytes.
  */
-#define do_vir_insw( port, proc, dst, bytes )	insw(( port ), ( void * )( dst ), ( bytes ))
+#define do_vir_insw(port, proc, dst, bytes)	insw((port), (void *)(dst), (bytes))
 
 /** Writes a memory block byte by byte.
@@ -135,5 +135,5 @@
  *  @param[in] bytes The block size in bytes.
  */
-#define do_vir_outsb( port, proc, src, bytes )	outsb(( port ), ( void * )( src ), ( bytes ))
+#define do_vir_outsb(port, proc, src, bytes)	outsb((port), (void *)(src), (bytes))
 
 /** Writes a memory block word by word (2 bytes).
@@ -143,5 +143,5 @@
  *  @param[in] bytes The block size in bytes.
  */
-#define do_vir_outsw( port, proc, src, bytes )	outsw(( port ), ( void * )( src ), ( bytes ))
+#define do_vir_outsw(port, proc, src, bytes)	outsw((port), (void *)(src), (bytes))
 
 /* com.h */
Index: uspace/srv/net/netif/dp8390/local.h
===================================================================
--- uspace/srv/net/netif/dp8390/local.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/dp8390/local.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -66,5 +66,5 @@
  *  @returns 0 otherwise.
  */
-//_PROTOTYPE( int el2_probe, (struct dpeth* dep)				);
+//_PROTOTYPE(int el2_probe, (struct dpeth*dep)				);
 
 /* ne2000.c */
@@ -74,7 +74,7 @@
  *  @returns 0 otherwise.
  */
-int	ne_probe( struct dpeth * dep );
-//_PROTOTYPE( int ne_probe, (struct dpeth *dep)				);
-//_PROTOTYPE( void ne_init, (struct dpeth *dep)				);
+int ne_probe(struct dpeth * dep);
+//_PROTOTYPE(int ne_probe, (struct dpeth *dep)				);
+//_PROTOTYPE(void ne_init, (struct dpeth *dep)				);
 
 /* rtl8029.c */
@@ -84,5 +84,5 @@
  *  @returns 0 otherwise.
  */
-//_PROTOTYPE( int rtl_probe, (struct dpeth *dep)				);
+//_PROTOTYPE(int rtl_probe, (struct dpeth *dep)				);
 
 /* wdeth.c */
@@ -92,5 +92,5 @@
  *  @returns 0 otherwise.
  */
-//_PROTOTYPE( int wdeth_probe, (struct dpeth* dep)				);
+//_PROTOTYPE(int wdeth_probe, (struct dpeth*dep)				);
 
 #endif
Index: uspace/srv/net/netif/dp8390/ne2000.c
===================================================================
--- uspace/srv/net/netif/dp8390/ne2000.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/dp8390/ne2000.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -70,25 +70,25 @@
  *  @param[in] millis The number of milliseconds to sleep.
  */
-#define milli_delay( millis )	usleep(( millis ) * 1000 )
+#define milli_delay(millis)	usleep((millis) * 1000)
 
 /** Type definition of the testing function.
  */
-_PROTOTYPE( typedef int (*testf_t), (dpeth_t *dep, int pos, u8_t *pat)	);
+_PROTOTYPE(typedef int (*testf_t), (dpeth_t *dep, int pos, u8_t *pat)	);
 
 /** First data pattern.
  */
-u8_t	pat0[]= { 0x00, 0x00, 0x00, 0x00 };
+u8_t	pat0[]= {0x00, 0x00, 0x00, 0x00};
 
 /** Second data pattern.
  */
-u8_t	pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF };
+u8_t	pat1[]= {0xFF, 0xFF, 0xFF, 0xFF};
 
 /** Third data pattern.
  */
-u8_t	pat2[]= { 0xA5, 0x5A, 0x69, 0x96 };
+u8_t	pat2[]= {0xA5, 0x5A, 0x69, 0x96};
 
 /** Fourth data pattern.
  */
-u8_t	pat3[]= { 0x96, 0x69, 0x5A, 0xA5 };
+u8_t	pat3[]= {0x96, 0x69, 0x5A, 0xA5};
 
 /** Tests 8 bit NE2000 network interface.
@@ -114,5 +114,5 @@
  */
 static void ne_stop(dpeth_t *dep);
-//_PROTOTYPE( static void milli_delay, (unsigned long millis)		);
+//_PROTOTYPE(static void milli_delay, (unsigned long millis)		);
 
 /** Initializes the NE2000 network interface.
@@ -150,9 +150,9 @@
 		/* Reset the dp8390 */
 		outb_reg0(dep, DP_CR, CR_STP | CR_DM_ABORT);
-		for (i= 0; i < 0x1000 && ((inb_reg0(dep, DP_ISR) & ISR_RST) == 0); i++)
+		for (i= 0; i < 0x1000 && ((inb_reg0(dep, DP_ISR) &ISR_RST) == 0); i++)
 			; /* Do nothing */
 
 		/* Check if the dp8390 is really there */
-		if ((inb_reg0(dep, DP_CR) & (CR_STP|CR_DM_ABORT)) !=
+		if ((inb_reg0(dep, DP_CR) &(CR_STP|CR_DM_ABORT)) !=
 			(CR_STP|CR_DM_ABORT))
 		{
@@ -186,7 +186,7 @@
 			f= test_8;
 		}
-		if (f(dep, loc1, pat0) && f(dep, loc1, pat1) &&
-			f(dep, loc1, pat2) && f(dep, loc1, pat3) &&
-			f(dep, loc2, pat0) && f(dep, loc2, pat1) &&
+		if (f(dep, loc1, pat0) && f(dep, loc1, pat1) && 
+			f(dep, loc1, pat2) && f(dep, loc1, pat3) && 
+			f(dep, loc2, pat0) && f(dep, loc2, pat1) && 
 			f(dep, loc2, pat2) && f(dep, loc2, pat3))
 		{
@@ -297,5 +297,5 @@
 	outb_reg0(dep, DP_RBCR0, 4);
 	outb_reg0(dep, DP_RBCR1, 0);
-	outb_reg0(dep, DP_RSAR0, pos & 0xFF);
+	outb_reg0(dep, DP_RSAR0, pos &0xFF);
 	outb_reg0(dep, DP_RSAR1, pos >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
@@ -306,5 +306,5 @@
 	for (i= 0; i<N; i++)
 	{
-		if (inb_reg0(dep, DP_ISR) & ISR_RDC)
+		if (inb_reg0(dep, DP_ISR) &ISR_RDC)
 			break;
 	}
@@ -321,5 +321,5 @@
 	outb_reg0(dep, DP_RBCR0, 4);
 	outb_reg0(dep, DP_RBCR1, 0);
-	outb_reg0(dep, DP_RSAR0, pos & 0xFF);
+	outb_reg0(dep, DP_RSAR0, pos &0xFF);
 	outb_reg0(dep, DP_RSAR1, pos >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
@@ -349,5 +349,5 @@
 	outb_reg0(dep, DP_RBCR0, 4);
 	outb_reg0(dep, DP_RBCR1, 0);
-	outb_reg0(dep, DP_RSAR0, pos & 0xFF);
+	outb_reg0(dep, DP_RSAR0, pos &0xFF);
 	outb_reg0(dep, DP_RSAR1, pos >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
@@ -360,5 +360,5 @@
 	for (i= 0; i<N; i++)
 	{
-		if (inb_reg0(dep, DP_ISR) & ISR_RDC)
+		if (inb_reg0(dep, DP_ISR) &ISR_RDC)
 			break;
 	}
@@ -375,5 +375,5 @@
 	outb_reg0(dep, DP_RBCR0, 4);
 	outb_reg0(dep, DP_RBCR1, 0);
-	outb_reg0(dep, DP_RSAR0, pos & 0xFF);
+	outb_reg0(dep, DP_RSAR0, pos &0xFF);
 	outb_reg0(dep, DP_RSAR1, pos >> 8);
 	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
Index: uspace/srv/net/netif/lo/lo.c
===================================================================
--- uspace/srv/net/netif/lo/lo.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/lo/lo.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -64,5 +64,5 @@
 /** Default address length.
  */
-#define DEFAULT_ADDR_LEN	( sizeof( DEFAULT_ADDR ) / sizeof( char ))
+#define DEFAULT_ADDR_LEN	(sizeof(DEFAULT_ADDR) / sizeof(char))
 
 /** Loopback module name.
@@ -80,5 +80,5 @@
  *  @returns EOK otherwise.
  */
-int	change_state_message( device_ref device, device_state_t state );
+int change_state_message(device_ref device, device_state_t state);
 
 /** Creates and returns the loopback network interface structure.
@@ -89,17 +89,19 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	create( device_id_t device_id, device_ref * device );
+int create(device_id_t device_id, device_ref * device);
 
 /** Prints the module name.
  *  @see NAME
  */
-void	module_print_name( void );
-
-int netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+void module_print_name(void);
+
+int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	return ENOTSUP;
 }
 
-int netif_get_addr_message( device_id_t device_id, measured_string_ref address ){
-	if( ! address ) return EBADMEM;
+int netif_get_addr_message(device_id_t device_id, measured_string_ref address){
+	if(! address){
+		return EBADMEM;
+	}
 	address->value = str_dup(DEFAULT_ADDR);
 	address->length = DEFAULT_ADDR_LEN;
@@ -107,19 +109,21 @@
 }
 
-int netif_get_device_stats( device_id_t device_id, device_stats_ref stats ){
+int netif_get_device_stats(device_id_t device_id, device_stats_ref stats){
 	ERROR_DECLARE;
 
-	device_ref	device;
-
-	if( ! stats ) return EBADMEM;
-	ERROR_PROPAGATE( find_device( device_id, & device ));
-	memcpy( stats, ( device_stats_ref ) device->specific, sizeof( device_stats_t ));
-	return EOK;
-}
-
-int change_state_message( device_ref device, device_state_t state ){
-	if( device->state != state ){
+	device_ref device;
+
+	if(! stats){
+		return EBADMEM;
+	}
+	ERROR_PROPAGATE(find_device(device_id, &device));
+	memcpy(stats, (device_stats_ref) device->specific, sizeof(device_stats_t));
+	return EOK;
+}
+
+int change_state_message(device_ref device, device_state_t state){
+	if(device->state != state){
 		device->state = state;
-		printf( "State changed to %s\n", ( state == NETIF_ACTIVE ) ? "ACTIVE" : "STOPPED" );
+		printf("State changed to %s\n", (state == NETIF_ACTIVE) ? "ACTIVE" : "STOPPED");
 		return state;
 	}
@@ -127,26 +131,28 @@
 }
 
-int create( device_id_t device_id, device_ref * device ){
-	int	index;
-
-	if( device_map_count( & netif_globals.device_map ) > 0 ){
+int create(device_id_t device_id, device_ref * device){
+	int index;
+
+	if(device_map_count(&netif_globals.device_map) > 0){
 		return EXDEV;
 	}else{
-		* device = ( device_ref ) malloc( sizeof( device_t ));
-		if( !( * device )) return ENOMEM;
-		( ** device ).specific = malloc( sizeof( device_stats_t ));
-		if( ! ( ** device ).specific ){
-			free( * device );
+		*device = (device_ref) malloc(sizeof(device_t));
+		if(!(*device)){
 			return ENOMEM;
 		}
-		null_device_stats(( device_stats_ref )( ** device ).specific );
-		( ** device ).device_id = device_id;
-		( ** device ).nil_phone = -1;
-		( ** device ).state = NETIF_STOPPED;
-		index = device_map_add( & netif_globals.device_map, ( ** device ).device_id, * device );
-		if( index < 0 ){
-			free( * device );
-			free(( ** device ).specific );
-			* device = NULL;
+		(** device).specific = malloc(sizeof(device_stats_t));
+		if(! (** device).specific){
+			free(*device);
+			return ENOMEM;
+		}
+		null_device_stats((device_stats_ref)(** device).specific);
+		(** device).device_id = device_id;
+		(** device).nil_phone = -1;
+		(** device).state = NETIF_STOPPED;
+		index = device_map_add(&netif_globals.device_map, (** device).device_id, * device);
+		if(index < 0){
+			free(*device);
+			free((** device).specific);
+			*device = NULL;
 			return index;
 		}
@@ -155,61 +161,61 @@
 }
 
-int netif_initialize( void ){
-	ipcarg_t	phonehash;
-
-	return REGISTER_ME( SERVICE_LO, & phonehash );
-}
-
-void module_print_name( void ){
-	printf( "%s", NAME );
-}
-
-int netif_probe_message( device_id_t device_id, int irq, uintptr_t io ){
+int netif_initialize(void){
+	ipcarg_t phonehash;
+
+	return REGISTER_ME(SERVICE_LO, &phonehash);
+}
+
+void module_print_name(void){
+	printf("%s", NAME);
+}
+
+int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){
 	ERROR_DECLARE;
 
-	device_ref			device;
+	device_ref device;
 
 	// create a new device
-	ERROR_PROPAGATE( create( device_id, & device ));
+	ERROR_PROPAGATE(create(device_id, &device));
 	// print the settings
-	printf("New device created:\n\tid\t= %d\n", device->device_id );
-	return EOK;
-}
-
-int netif_send_message( device_id_t device_id, packet_t packet, services_t sender ){
+	printf("New device created:\n\tid\t= %d\n", device->device_id);
+	return EOK;
+}
+
+int netif_send_message(device_id_t device_id, packet_t packet, services_t sender){
 	ERROR_DECLARE;
 
-	device_ref	device;
-	size_t		length;
-	packet_t	next;
-	int			phone;
-
-	ERROR_PROPAGATE( find_device( device_id, & device ));
-	if( device->state != NETIF_ACTIVE ){
-		netif_pq_release( packet_get_id( packet ));
+	device_ref device;
+	size_t length;
+	packet_t next;
+	int phone;
+
+	ERROR_PROPAGATE(find_device(device_id, &device));
+	if(device->state != NETIF_ACTIVE){
+		netif_pq_release(packet_get_id(packet));
 		return EFORWARD;
 	}
 	next = packet;
 	do{
-		++ (( device_stats_ref ) device->specific )->send_packets;
-		++ (( device_stats_ref ) device->specific )->receive_packets;
-		length = packet_get_data_length( next );
-		(( device_stats_ref ) device->specific )->send_bytes += length;
-		(( device_stats_ref ) device->specific )->receive_bytes += length;
-		next = pq_next( next );
-	}while( next );
+		++ ((device_stats_ref) device->specific)->send_packets;
+		++ ((device_stats_ref) device->specific)->receive_packets;
+		length = packet_get_data_length(next);
+		((device_stats_ref) device->specific)->send_bytes += length;
+		((device_stats_ref) device->specific)->receive_bytes += length;
+		next = pq_next(next);
+	}while(next);
 	phone = device->nil_phone;
-	fibril_rwlock_write_unlock( & netif_globals.lock );
-	nil_received_msg( phone, device_id, packet, sender );
-	fibril_rwlock_write_lock( & netif_globals.lock );
-	return EOK;
-}
-
-int netif_start_message( device_ref device ){
-	return change_state_message( device, NETIF_ACTIVE );
-}
-
-int netif_stop_message( device_ref device ){
-	return change_state_message( device, NETIF_STOPPED );
+	fibril_rwlock_write_unlock(&netif_globals.lock);
+	nil_received_msg(phone, device_id, packet, sender);
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	return EOK;
+}
+
+int netif_start_message(device_ref device){
+	return change_state_message(device, NETIF_ACTIVE);
+}
+
+int netif_stop_message(device_ref device){
+	return change_state_message(device, NETIF_STOPPED);
 }
 
Index: uspace/srv/net/netif/netif.c
===================================================================
--- uspace/srv/net/netif/netif.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/netif.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -64,5 +64,5 @@
 extern netif_globals_t netif_globals;
 
-DEVICE_MAP_IMPLEMENT( device_map, device_t )
+DEVICE_MAP_IMPLEMENT(device_map, device_t)
 
 /** @name Message processing functions
@@ -77,187 +77,195 @@
  *  @returns ELIMIT if there is another module registered.
  */
-int	register_message( device_id_t device_id, int phone );
+int register_message(device_id_t device_id, int phone);
 
 /*@}*/
 
-int	netif_probe_req( int netif_phone, device_id_t device_id, int irq, int io ){
-	int	result;
-
-	fibril_rwlock_write_lock( & netif_globals.lock );
-	result = netif_probe_message( device_id, irq, io );
-	fibril_rwlock_write_unlock( & netif_globals.lock );
-	return result;
-}
-
-int	netif_send_msg( int netif_phone, device_id_t device_id, packet_t packet, services_t sender ){
-	int	result;
-
-	fibril_rwlock_write_lock( & netif_globals.lock );
-	result = netif_send_message( device_id, packet, sender );
-	fibril_rwlock_write_unlock( & netif_globals.lock );
-	return result;
-}
-
-int	netif_start_req( int netif_phone, device_id_t device_id ){
-	ERROR_DECLARE;
-
-	device_ref	device;
-	int	result;
-	int	phone;
-
-	fibril_rwlock_write_lock( & netif_globals.lock );
-	if( ERROR_OCCURRED( find_device( device_id, & device ))){
-		fibril_rwlock_write_unlock( & netif_globals.lock );
+int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io){
+	int result;
+
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	result = netif_probe_message(device_id, irq, io);
+	fibril_rwlock_write_unlock(&netif_globals.lock);
+	return result;
+}
+
+int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender){
+	int result;
+
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	result = netif_send_message(device_id, packet, sender);
+	fibril_rwlock_write_unlock(&netif_globals.lock);
+	return result;
+}
+
+int netif_start_req(int netif_phone, device_id_t device_id){
+	ERROR_DECLARE;
+
+	device_ref device;
+	int result;
+	int phone;
+
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	if(ERROR_OCCURRED(find_device(device_id, &device))){
+		fibril_rwlock_write_unlock(&netif_globals.lock);
 		return ERROR_CODE;
 	}
-	result = netif_start_message( device );
-	if( result > NETIF_NULL ){
+	result = netif_start_message(device);
+	if(result > NETIF_NULL){
 		phone = device->nil_phone;
-		fibril_rwlock_write_unlock( & netif_globals.lock );
-		nil_device_state_msg( phone, device_id, result );
+		fibril_rwlock_write_unlock(&netif_globals.lock);
+		nil_device_state_msg(phone, device_id, result);
 		return EOK;
 	}else{
-		fibril_rwlock_write_unlock( & netif_globals.lock );
-	}
-	return result;
-}
-
-int	netif_stop_req( int netif_phone, device_id_t device_id ){
-	ERROR_DECLARE;
-
-	device_ref	device;
-	int	result;
-	int	phone;
-
-	fibril_rwlock_write_lock( & netif_globals.lock );
-	if( ERROR_OCCURRED( find_device( device_id, & device ))){
-		fibril_rwlock_write_unlock( & netif_globals.lock );
+		fibril_rwlock_write_unlock(&netif_globals.lock);
+	}
+	return result;
+}
+
+int netif_stop_req(int netif_phone, device_id_t device_id){
+	ERROR_DECLARE;
+
+	device_ref device;
+	int result;
+	int phone;
+
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	if(ERROR_OCCURRED(find_device(device_id, &device))){
+		fibril_rwlock_write_unlock(&netif_globals.lock);
 		return ERROR_CODE;
 	}
-	result = netif_stop_message( device );
-	if( result > NETIF_NULL ){
+	result = netif_stop_message(device);
+	if(result > NETIF_NULL){
 		phone = device->nil_phone;
-		fibril_rwlock_write_unlock( & netif_globals.lock );
-		nil_device_state_msg( phone, device_id, result );
+		fibril_rwlock_write_unlock(&netif_globals.lock);
+		nil_device_state_msg(phone, device_id, result);
 		return EOK;
 	}else{
-		fibril_rwlock_write_unlock( & netif_globals.lock );
-	}
-	return result;
-}
-
-int	netif_stats_req( int netif_phone, device_id_t device_id, device_stats_ref stats ){
+		fibril_rwlock_write_unlock(&netif_globals.lock);
+	}
+	return result;
+}
+
+int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats){
 	int res;
 
-	fibril_rwlock_read_lock( & netif_globals.lock );
-	res = netif_get_device_stats( device_id, stats );
-	fibril_rwlock_read_unlock( & netif_globals.lock );
+	fibril_rwlock_read_lock(&netif_globals.lock);
+	res = netif_get_device_stats(device_id, stats);
+	fibril_rwlock_read_unlock(&netif_globals.lock);
 	return res;
 }
 
-int	netif_get_addr_req( int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data ){
-	ERROR_DECLARE;
-
-	measured_string_t	translation;
-
-	if( !( address && data )) return EBADMEM;
-	fibril_rwlock_read_lock( & netif_globals.lock );
-	if( ! ERROR_OCCURRED( netif_get_addr_message( device_id, & translation ))){
-		* address = measured_string_copy( & translation );
-		ERROR_CODE = ( * address ) ? EOK : ENOMEM;
-	}
-	fibril_rwlock_read_unlock( & netif_globals.lock );
-	* data = ( ** address ).value;
+int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data){
+	ERROR_DECLARE;
+
+	measured_string_t translation;
+
+	if(!(address && data)){
+		return EBADMEM;
+	}
+	fibril_rwlock_read_lock(&netif_globals.lock);
+	if(! ERROR_OCCURRED(netif_get_addr_message(device_id, &translation))){
+		*address = measured_string_copy(&translation);
+		ERROR_CODE = (*address) ? EOK : ENOMEM;
+	}
+	fibril_rwlock_read_unlock(&netif_globals.lock);
+	*data = (** address).value;
 	return ERROR_CODE;
 }
 
-int netif_bind_service( services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver ){
-	return EOK;
-}
-
-int find_device( device_id_t device_id, device_ref * device ){
-	if( ! device ) return EBADMEM;
-	* device = device_map_find( & netif_globals.device_map, device_id );
-	if( ! * device ) return ENOENT;
-	if(( ** device ).state == NETIF_NULL ) return EPERM;
-	return EOK;
-}
-
-void null_device_stats( device_stats_ref stats ){
-	bzero( stats, sizeof( device_stats_t ));
-}
-
-int register_message( device_id_t device_id, int phone ){
-	ERROR_DECLARE;
-
-	device_ref	device;
-
-	ERROR_PROPAGATE( find_device( device_id, & device ));
-	if( device->nil_phone > 0 ) return ELIMIT;
+int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver){
+	return EOK;
+}
+
+int find_device(device_id_t device_id, device_ref * device){
+	if(! device){
+		return EBADMEM;
+	}
+	*device = device_map_find(&netif_globals.device_map, device_id);
+	if(! * device){
+		return ENOENT;
+	}
+	if((** device).state == NETIF_NULL) return EPERM;
+	return EOK;
+}
+
+void null_device_stats(device_stats_ref stats){
+	bzero(stats, sizeof(device_stats_t));
+}
+
+int register_message(device_id_t device_id, int phone){
+	ERROR_DECLARE;
+
+	device_ref device;
+
+	ERROR_PROPAGATE(find_device(device_id, &device));
+	if(device->nil_phone > 0){
+		return ELIMIT;
+	}
 	device->nil_phone = phone;
-	printf( "New receiver of the device %d registered:\n\tphone\t= %d\n", device->device_id, device->nil_phone );
-	return EOK;
-}
-
-int netif_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	ERROR_DECLARE;
-
-	size_t				length;
-	device_stats_t		stats;
-	packet_t			packet;
-	measured_string_t	address;
-
-//	printf( "message %d - %d\n", IPC_GET_METHOD( * call ), NET_NETIF_FIRST );
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+	printf("New receiver of the device %d registered:\n\tphone\t= %d\n", device->device_id, device->nil_phone);
+	return EOK;
+}
+
+int netif_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	ERROR_DECLARE;
+
+	size_t length;
+	device_stats_t stats;
+	packet_t packet;
+	measured_string_t address;
+
+//	printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_NETIF_FIRST);
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_NETIF_PROBE:
-			return netif_probe_req( 0, IPC_GET_DEVICE( call ), NETIF_GET_IRQ( call ), NETIF_GET_IO( call ));
+			return netif_probe_req(0, IPC_GET_DEVICE(call), NETIF_GET_IRQ(call), NETIF_GET_IO(call));
 		case IPC_M_CONNECT_TO_ME:
-			fibril_rwlock_write_lock( & netif_globals.lock );
-			ERROR_CODE = register_message( IPC_GET_DEVICE( call ), IPC_GET_PHONE( call ));
-			fibril_rwlock_write_unlock( & netif_globals.lock );
+			fibril_rwlock_write_lock(&netif_globals.lock);
+			ERROR_CODE = register_message(IPC_GET_DEVICE(call), IPC_GET_PHONE(call));
+			fibril_rwlock_write_unlock(&netif_globals.lock);
 			return ERROR_CODE;
 		case NET_NETIF_SEND:
-			ERROR_PROPAGATE( packet_translate( netif_globals.net_phone, & packet, IPC_GET_PACKET( call )));
-			return netif_send_msg( 0, IPC_GET_DEVICE( call ), packet, IPC_GET_SENDER( call ));
+			ERROR_PROPAGATE(packet_translate(netif_globals.net_phone, &packet, IPC_GET_PACKET(call)));
+			return netif_send_msg(0, IPC_GET_DEVICE(call), packet, IPC_GET_SENDER(call));
 		case NET_NETIF_START:
-			return netif_start_req( 0, IPC_GET_DEVICE( call ));
+			return netif_start_req(0, IPC_GET_DEVICE(call));
 		case NET_NETIF_STATS:
-			fibril_rwlock_read_lock( & netif_globals.lock );
-			if( ! ERROR_OCCURRED( async_data_read_receive( & callid, & length ))){
-				if( length < sizeof( device_stats_t )){
+			fibril_rwlock_read_lock(&netif_globals.lock);
+			if(! ERROR_OCCURRED(async_data_read_receive(&callid, &length))){
+				if(length < sizeof(device_stats_t)){
 					ERROR_CODE = EOVERFLOW;
 				}else{
-					if( ! ERROR_OCCURRED( netif_get_device_stats( IPC_GET_DEVICE( call ), & stats ))){
-						ERROR_CODE = async_data_read_finalize( callid, & stats, sizeof( device_stats_t ));
+					if(! ERROR_OCCURRED(netif_get_device_stats(IPC_GET_DEVICE(call), &stats))){
+						ERROR_CODE = async_data_read_finalize(callid, &stats, sizeof(device_stats_t));
 					}
 				}
 			}
-			fibril_rwlock_read_unlock( & netif_globals.lock );
+			fibril_rwlock_read_unlock(&netif_globals.lock);
 			return ERROR_CODE;
 		case NET_NETIF_STOP:
-			return netif_stop_req( 0, IPC_GET_DEVICE( call ));
+			return netif_stop_req(0, IPC_GET_DEVICE(call));
 		case NET_NETIF_GET_ADDR:
-			fibril_rwlock_read_lock( & netif_globals.lock );
-			if( ! ERROR_OCCURRED( netif_get_addr_message( IPC_GET_DEVICE( call ), & address ))){
-				ERROR_CODE = measured_strings_reply( & address, 1 );
+			fibril_rwlock_read_lock(&netif_globals.lock);
+			if(! ERROR_OCCURRED(netif_get_addr_message(IPC_GET_DEVICE(call), &address))){
+				ERROR_CODE = measured_strings_reply(&address, 1);
 			}
-			fibril_rwlock_read_unlock( & netif_globals.lock );
+			fibril_rwlock_read_unlock(&netif_globals.lock);
 			return ERROR_CODE;
 	}
-	return netif_specific_message( callid, call, answer, answer_count );
-}
-
-int netif_init_module( async_client_conn_t client_connection ){
-	ERROR_DECLARE;
-
-	async_set_client_connection( client_connection );
-	netif_globals.net_phone = connect_to_service( SERVICE_NETWORKING );
-	device_map_initialize( & netif_globals.device_map );
-	ERROR_PROPAGATE( pm_init());
-	fibril_rwlock_initialize( & netif_globals.lock );
-	if( ERROR_OCCURRED( netif_initialize())){
+	return netif_specific_message(callid, call, answer, answer_count);
+}
+
+int netif_init_module(async_client_conn_t client_connection){
+	ERROR_DECLARE;
+
+	async_set_client_connection(client_connection);
+	netif_globals.net_phone = connect_to_service(SERVICE_NETWORKING);
+	device_map_initialize(&netif_globals.device_map);
+	ERROR_PROPAGATE(pm_init());
+	fibril_rwlock_initialize(&netif_globals.lock);
+	if(ERROR_OCCURRED(netif_initialize())){
 		pm_destroy();
 		return ERROR_CODE;
@@ -266,5 +274,5 @@
 }
 
-int netif_run_module( void ){
+int netif_run_module(void){
 	async_manager();
 
@@ -273,10 +281,10 @@
 }
 
-void netif_pq_release( packet_id_t packet_id ){
-	pq_release( netif_globals.net_phone, packet_id );
-}
-
-packet_t netif_packet_get_1( size_t content ){
-	return packet_get_1( netif_globals.net_phone, content );
+void netif_pq_release(packet_id_t packet_id){
+	pq_release(netif_globals.net_phone, packet_id);
+}
+
+packet_t netif_packet_get_1(size_t content){
+	return packet_get_1(netif_globals.net_phone, content);
 }
 
Index: uspace/srv/net/netif/netif.h
===================================================================
--- uspace/srv/net/netif/netif.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/netif.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -69,5 +69,5 @@
  *  @see device.h
  */
-DEVICE_MAP_DECLARE( device_map, device_t );
+DEVICE_MAP_DECLARE(device_map, device_t);
 
 /** Network interface device specific data.
@@ -76,14 +76,14 @@
 	/** Device identifier.
 	 */
-	device_id_t	device_id;
+	device_id_t device_id;
 	/** Receiving network interface layer phone.
 	 */
-	int		nil_phone;
+	int nil_phone;
 	/** Actual device state.
 	 */
-	device_state_t	state;
+	device_state_t state;
 	/** Driver specific data.
 	 */
-	void *		specific;
+	void * specific;
 };
 
@@ -93,11 +93,11 @@
 	/** Networking module phone.
 	 */
-	int		net_phone;
+	int net_phone;
 	/**	Device map.
 	 */
-	device_map_t	device_map;
+	device_map_t device_map;
 	/** Safety lock.
 	 */
-	fibril_rwlock_t	lock;
+	fibril_rwlock_t lock;
 };
 
@@ -109,10 +109,10 @@
  *  @returns EPERM if the device is not initialized.
  */
-int	find_device( device_id_t device_id, device_ref * device );
+int find_device(device_id_t device_id, device_ref * device);
 
 /** Clears the usage statistics.
  *  @param[in] stats The usage statistics.
  */
-void	null_device_stats( device_stats_ref stats );
+void null_device_stats(device_stats_ref stats);
 
 // prepared for future optimalizations
@@ -120,5 +120,5 @@
  *  @param[in] packet_id The packet identifier.
  */
-void	netif_pq_release( packet_id_t packet_id );
+void netif_pq_release(packet_id_t packet_id);
 
 /** Allocates new packet to handle the given content size.
@@ -127,5 +127,5 @@
  *  @returns NULL if there is an error.
  */
-packet_t netif_packet_get_1( size_t content );
+packet_t netif_packet_get_1(size_t content);
 
 /** Processes the netif module messages.
@@ -140,5 +140,5 @@
  *  @see IS_NET_NETIF_MESSAGE()
  */
-int	netif_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int netif_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** Initializes the netif module.
@@ -148,10 +148,10 @@
  *  @returns Other error codes as defined for each specific module message function.
  */
-int	netif_init_module( async_client_conn_t client_connection );
+int netif_init_module(async_client_conn_t client_connection);
 
 /** Starts and maintains the netif module until terminated.
  *  @returns EOK after the module is terminated.
  */
-int netif_run_module( void );
+int netif_run_module(void);
 
 #endif
Index: uspace/srv/net/netif/netif_messages.h
===================================================================
--- uspace/srv/net/netif/netif_messages.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/netif_messages.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -79,10 +79,10 @@
  *  @param[in] call The message call structure.
  */
-#define NETIF_GET_IRQ( call )		( int )	IPC_GET_ARG2( * call )
+#define NETIF_GET_IRQ(call)		(int)	IPC_GET_ARG2(*call)
 
 /** Returns the input/output address message parameter.
  *  @param[in] call The message call structure.
  */
-#define NETIF_GET_IO( call )		( int )	IPC_GET_ARG3( * call )
+#define NETIF_GET_IO(call)		(int)	IPC_GET_ARG3(*call)
 
 /*@}*/
Index: uspace/srv/net/netif/netif_module.h
===================================================================
--- uspace/srv/net/netif/netif_module.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/netif_module.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -50,5 +50,5 @@
 /** Initializes the specific module.
  */
-int	netif_initialize( void );
+int netif_initialize(void);
 
 /** Probes the existence of the device.
@@ -60,5 +60,5 @@
  *  @returns Other error codes as defined for the specific module message implementation.
  */
-int	netif_probe_message( device_id_t device_id, int irq, uintptr_t io );
+int netif_probe_message(device_id_t device_id, int irq, uintptr_t io);
 
 /** Sends the packet queue.
@@ -71,5 +71,5 @@
  *  @returns Other error codes as defined for the specific module message implementation.
  */
-int	netif_send_message( device_id_t device_id, packet_t packet, services_t sender );
+int netif_send_message(device_id_t device_id, packet_t packet, services_t sender);
 
 /** Starts the device.
@@ -79,5 +79,5 @@
  *  @returns Other error codes as defined for the specific module message implementation.
  */
-int	netif_start_message( device_ref device );
+int netif_start_message(device_ref device);
 
 /** Stops the device.
@@ -87,5 +87,5 @@
  *  @returns Other error codes as defined for the specific module message implementation.
  */
-int	netif_stop_message( device_ref device );
+int netif_stop_message(device_ref device);
 
 /** Returns the device local hardware address.
@@ -98,5 +98,5 @@
  *  @returns Other error codes as defined for the specific module message implementation.
  */
-int	netif_get_addr_message( device_id_t device_id, measured_string_ref address );
+int netif_get_addr_message(device_id_t device_id, measured_string_ref address);
 
 /** Processes the netif driver specific message.
@@ -110,5 +110,5 @@
  *  @returns Other error codes as defined for the specific module message implementation.
  */
-int	netif_specific_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** Returns the device usage statistics.
@@ -119,5 +119,5 @@
  *  @returns Other error codes as defined for the specific module message implementation.
  */
-int	netif_get_device_stats( device_id_t device_id, device_stats_ref stats );
+int netif_get_device_stats(device_id_t device_id, device_stats_ref stats);
 
 #endif
Index: uspace/srv/net/netif/netif_nil_bundle.c
===================================================================
--- uspace/srv/net/netif/netif_nil_bundle.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/netif_nil_bundle.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -61,5 +61,5 @@
  *  @returns Other error codes as defined for each specific module message function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** Starts the bundle network interface module.
@@ -69,19 +69,19 @@
  *  @returns Other error codes as defined for each specific module message function.
  */
-int	module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	if( IS_NET_NIL_MESSAGE( call ) || ( IPC_GET_METHOD( * call ) == IPC_M_CONNECT_TO_ME )){
-		return nil_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	if(IS_NET_NIL_MESSAGE(call) || (IPC_GET_METHOD(*call) == IPC_M_CONNECT_TO_ME)){
+		return nil_message(callid, call, answer, answer_count);
 	}else{
-		return netif_message( callid, call, answer, answer_count );
+		return netif_message(callid, call, answer, answer_count);
 	}
 }
 
-int	module_start( async_client_conn_t client_connection ){
+int module_start(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ERROR_PROPAGATE( netif_init_module( client_connection ));
-	if( ERROR_OCCURRED( nil_initialize( netif_globals.net_phone ))){
+	ERROR_PROPAGATE(netif_init_module(client_connection));
+	if(ERROR_OCCURRED(nil_initialize(netif_globals.net_phone))){
 		pm_destroy();
 		return ERROR_CODE;
Index: uspace/srv/net/netif/netif_remote.c
===================================================================
--- uspace/srv/net/netif/netif_remote.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/netif_remote.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -49,37 +49,39 @@
 #include "netif_messages.h"
 
-int	netif_get_addr_req( int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data ){
-	return generic_get_addr_req( netif_phone, NET_NETIF_GET_ADDR, device_id, address, data );
+int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data){
+	return generic_get_addr_req(netif_phone, NET_NETIF_GET_ADDR, device_id, address, data);
 }
 
-int	netif_probe_req( int netif_phone, device_id_t device_id, int irq, int io ){
-	return async_req_3_0( netif_phone, NET_NETIF_PROBE, device_id, irq, io );
+int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io){
+	return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, io);
 }
 
-int	netif_send_msg( int netif_phone, device_id_t device_id, packet_t packet, services_t sender ){
-	return generic_send_msg( netif_phone, NET_NETIF_SEND, device_id, packet_get_id( packet ), sender, 0 );
+int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender){
+	return generic_send_msg(netif_phone, NET_NETIF_SEND, device_id, packet_get_id(packet), sender, 0);
 }
 
-int	netif_start_req( int netif_phone, device_id_t device_id ){
-	return async_req_1_0( netif_phone, NET_NETIF_START, device_id );
+int netif_start_req(int netif_phone, device_id_t device_id){
+	return async_req_1_0(netif_phone, NET_NETIF_START, device_id);
 }
 
-int	netif_stop_req( int netif_phone, device_id_t device_id ){
-	return async_req_1_0( netif_phone, NET_NETIF_STOP, device_id );
+int netif_stop_req(int netif_phone, device_id_t device_id){
+	return async_req_1_0(netif_phone, NET_NETIF_STOP, device_id);
 }
 
-int	netif_stats_req( int netif_phone, device_id_t device_id, device_stats_ref stats ){
-	aid_t		message_id;
-	ipcarg_t	result;
+int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats){
+	aid_t message_id;
+	ipcarg_t result;
 
-	if( ! stats ) return EBADMEM;
-	message_id = async_send_1( netif_phone, NET_NETIF_STATS, ( ipcarg_t ) device_id, NULL );
-	async_data_read_start( netif_phone, stats, sizeof( * stats ));
-	async_wait_for( message_id, & result );
-	return ( int ) result;
+	if(! stats){
+		return EBADMEM;
+	}
+	message_id = async_send_1(netif_phone, NET_NETIF_STATS, (ipcarg_t) device_id, NULL);
+	async_data_read_start(netif_phone, stats, sizeof(*stats));
+	async_wait_for(message_id, &result);
+	return (int) result;
 }
 
-int netif_bind_service( services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver ){
-	return bind_service( service, device_id, me, 0, receiver );
+int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver){
+	return bind_service(service, device_id, me, 0, receiver);
 }
 
Index: uspace/srv/net/netif/netif_standalone.c
===================================================================
--- uspace/srv/net/netif/netif_standalone.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/netif/netif_standalone.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -50,5 +50,5 @@
  *  @returns Other error codes as defined for each specific module message function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** Starts the network interface module.
@@ -58,14 +58,14 @@
  *  @returns Other error codes as defined for each specific module message function.
  */
-int	module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	return netif_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return netif_message(callid, call, answer, answer_count);
 }
 
-int	module_start( async_client_conn_t client_connection ){
+int module_start(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ERROR_PROPAGATE( netif_init_module( client_connection ));
+	ERROR_PROPAGATE(netif_init_module(client_connection));
 	return netif_run_module();
 }
Index: uspace/srv/net/nil/eth/eth.c
===================================================================
--- uspace/srv/net/nil/eth/eth.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/eth/eth.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -70,9 +70,9 @@
 /** Reserved packet prefix length.
  */
-#define ETH_PREFIX		( sizeof( eth_header_t ) + sizeof( eth_header_lsap_t ) + sizeof( eth_header_snap_t ))
+#define ETH_PREFIX		(sizeof(eth_header_t) + sizeof(eth_header_lsap_t) + sizeof(eth_header_snap_t))
 
 /** Reserved packet suffix length.
  */
-#define ETH_SUFFIX		sizeof( eth_fcs_t )
+#define ETH_SUFFIX		sizeof(eth_fcs_t)
 
 /** Maximum packet content length.
@@ -86,9 +86,9 @@
 /** Maximum tagged packet content length.
  */
-#define ETH_MAX_TAGGED_CONTENT( flags )	( ETH_MAX_CONTENT - (( IS_8023_2_LSAP( flags ) || IS_8023_2_SNAP( flags )) ? sizeof( eth_header_lsap_t ) : 0 ) - ( IS_8023_2_SNAP( flags ) ? sizeof( eth_header_snap_t ) : 0 ))
+#define ETH_MAX_TAGGED_CONTENT(flags)	(ETH_MAX_CONTENT - ((IS_8023_2_LSAP(flags) || IS_8023_2_SNAP(flags)) ? sizeof(eth_header_lsap_t) : 0) - (IS_8023_2_SNAP(flags) ? sizeof(eth_header_snap_t) : 0))
 
 /** Minimum tagged packet content length.
  */
-#define ETH_MIN_TAGGED_CONTENT( flags )	( ETH_MIN_CONTENT - (( IS_8023_2_LSAP( flags ) || IS_8023_2_SNAP( flags )) ? sizeof( eth_header_lsap_t ) : 0 ) - ( IS_8023_2_SNAP( flags ) ? sizeof( eth_header_snap_t ) : 0 ))
+#define ETH_MIN_TAGGED_CONTENT(flags)	(ETH_MIN_CONTENT - ((IS_8023_2_LSAP(flags) || IS_8023_2_SNAP(flags)) ? sizeof(eth_header_lsap_t) : 0) - (IS_8023_2_SNAP(flags) ? sizeof(eth_header_snap_t) : 0))
 
 /** Dummy flag shift value.
@@ -103,10 +103,10 @@
  *  Preamble and FCS are mandatory part of the packets.
  */
-#define ETH_DUMMY				( 1 << ETH_DUMMY_SHIFT )
+#define ETH_DUMMY				(1 << ETH_DUMMY_SHIFT)
 
 /** Returns the dummy flag.
  *  @see ETH_DUMMY
  */
-#define IS_DUMMY( flags )		(( flags ) & ETH_DUMMY )
+#define IS_DUMMY(flags)		((flags) &ETH_DUMMY)
 
 /** Device mode flags.
@@ -115,9 +115,9 @@
  *  @see ETH_8023_2_SNAP
  */
-#define ETH_MODE_MASK			( 3 << ETH_MODE_SHIFT )
+#define ETH_MODE_MASK			(3 << ETH_MODE_SHIFT)
 
 /** DIX Ethernet mode flag.
  */
-#define ETH_DIX					( 1 << ETH_MODE_SHIFT )
+#define ETH_DIX					(1 << ETH_MODE_SHIFT)
 
 /** Returns whether the DIX Ethernet mode flag is set.
@@ -125,9 +125,9 @@
  *  @see ETH_DIX
  */
-#define IS_DIX( flags )			((( flags ) & ETH_MODE_MASK ) == ETH_DIX )
+#define IS_DIX(flags)			(((flags) &ETH_MODE_MASK) == ETH_DIX)
 
 /** 802.3 + 802.2 + LSAP mode flag.
  */
-#define ETH_8023_2_LSAP			( 2 << ETH_MODE_SHIFT )
+#define ETH_8023_2_LSAP			(2 << ETH_MODE_SHIFT)
 
 /** Returns whether the 802.3 + 802.2 + LSAP mode flag is set.
@@ -135,9 +135,9 @@
  *  @see ETH_8023_2_LSAP
  */
-#define IS_8023_2_LSAP( flags )	((( flags ) & ETH_MODE_MASK ) == ETH_8023_2_LSAP )
+#define IS_8023_2_LSAP(flags)	(((flags) &ETH_MODE_MASK) == ETH_8023_2_LSAP)
 
 /** 802.3 + 802.2 + LSAP + SNAP mode flag.
  */
-#define ETH_8023_2_SNAP			( 3 << ETH_MODE_SHIFT )
+#define ETH_8023_2_SNAP			(3 << ETH_MODE_SHIFT)
 
 /** Returns whether the 802.3 + 802.2 + LSAP + SNAP mode flag is set.
@@ -145,5 +145,5 @@
  *  @see ETH_8023_2_SNAP
  */
-#define IS_8023_2_SNAP( flags )	((( flags ) & ETH_MODE_MASK ) == ETH_8023_2_SNAP )
+#define IS_8023_2_SNAP(flags)	(((flags) &ETH_MODE_MASK) == ETH_8023_2_SNAP)
 
 /** Type definition of the ethernet address type.
@@ -180,5 +180,5 @@
  *  @param[in,out] icall The message parameters.
  */
-void	eth_receiver( ipc_callid_t iid, ipc_call_t * icall );
+void eth_receiver(ipc_callid_t iid, ipc_call_t * icall);
 
 /** Registers new device or updates the MTU of an existing one.
@@ -194,5 +194,5 @@
  *  @returns Other error codes as defined for the netif_get_addr_req() function.
  */
-int	eth_device_message( device_id_t device_id, services_t service, size_t mtu );
+int eth_device_message(device_id_t device_id, services_t service, size_t mtu);
 
 /** Registers receiving module service.
@@ -204,5 +204,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	eth_register_message( services_t service, int phone );
+int eth_register_message(services_t service, int phone);
 
 /** Returns the device packet dimensions for sending.
@@ -216,5 +216,5 @@
  *  @returns ENOENT if there is no such device.
  */
-int	eth_packet_space_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix );
+int eth_packet_space_message(device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix);
 
 /** Returns the device hardware address.
@@ -226,5 +226,5 @@
  *  @returns ENOENT if there no such device.
  */
-int	eth_addr_message( device_id_t device_id, eth_addr_type_t type, measured_string_ref * address );
+int eth_addr_message(device_id_t device_id, eth_addr_type_t type, measured_string_ref * address);
 
 /** Sends the packet queue.
@@ -237,5 +237,5 @@
  *  @returns EINVAL if the service parameter is not known.
  */
-int	eth_send_message( device_id_t device_id, packet_t packet, services_t sender );
+int eth_send_message(device_id_t device_id, packet_t packet, services_t sender);
 
 /*@}*/
@@ -251,5 +251,5 @@
  *  @returns NULL if the packet address length is not big enough.
  */
-eth_proto_ref	eth_process_packet( int flags, packet_t packet );
+eth_proto_ref eth_process_packet(int flags, packet_t packet);
 
 /** Prepares the packet for sending.
@@ -264,184 +264,190 @@
  *  @returns ENOMEM if there is not enough memory in the packet.
  */
-int	eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype, size_t mtu );
-
-DEVICE_MAP_IMPLEMENT( eth_devices, eth_device_t )
-
-INT_MAP_IMPLEMENT( eth_protos, eth_proto_t )
-
-int	nil_device_state_msg( int nil_phone, device_id_t device_id, int state ){
-	int				index;
-	eth_proto_ref	proto;
-
-	fibril_rwlock_read_lock( & eth_globals.protos_lock );
-	for( index = eth_protos_count( & eth_globals.protos ) - 1; index >= 0; -- index ){
-		proto = eth_protos_get_index( & eth_globals.protos, index );
-		if( proto && proto->phone ) il_device_state_msg( proto->phone, device_id, state, proto->service );
-	}
-	fibril_rwlock_read_unlock( & eth_globals.protos_lock );
+int eth_prepare_packet(int flags, packet_t packet, uint8_t * src_addr, int ethertype, size_t mtu);
+
+DEVICE_MAP_IMPLEMENT(eth_devices, eth_device_t)
+
+INT_MAP_IMPLEMENT(eth_protos, eth_proto_t)
+
+int nil_device_state_msg(int nil_phone, device_id_t device_id, int state){
+	int index;
+	eth_proto_ref proto;
+
+	fibril_rwlock_read_lock(&eth_globals.protos_lock);
+	for(index = eth_protos_count(&eth_globals.protos) - 1; index >= 0; -- index){
+		proto = eth_protos_get_index(&eth_globals.protos, index);
+		if(proto && proto->phone){
+			il_device_state_msg(proto->phone, device_id, state, proto->service);
+		}
+	}
+	fibril_rwlock_read_unlock(&eth_globals.protos_lock);
 	return EOK;
 }
 
-int nil_initialize( int net_phone ){
+int nil_initialize(int net_phone){
 	ERROR_DECLARE;
 
-	fibril_rwlock_initialize( & eth_globals.devices_lock );
-	fibril_rwlock_initialize( & eth_globals.protos_lock );
-	fibril_rwlock_write_lock( & eth_globals.devices_lock );
-	fibril_rwlock_write_lock( & eth_globals.protos_lock );
+	fibril_rwlock_initialize(&eth_globals.devices_lock);
+	fibril_rwlock_initialize(&eth_globals.protos_lock);
+	fibril_rwlock_write_lock(&eth_globals.devices_lock);
+	fibril_rwlock_write_lock(&eth_globals.protos_lock);
 	eth_globals.net_phone = net_phone;
-	eth_globals.broadcast_addr = measured_string_create_bulk( "\xFF\xFF\xFF\xFF\xFF\xFF", CONVERT_SIZE( uint8_t, char, ETH_ADDR ));
-	if( ! eth_globals.broadcast_addr ) return ENOMEM;
-	ERROR_PROPAGATE( eth_devices_initialize( & eth_globals.devices ));
-	if( ERROR_OCCURRED( eth_protos_initialize( & eth_globals.protos ))){
-		eth_devices_destroy( & eth_globals.devices );
+	eth_globals.broadcast_addr = measured_string_create_bulk("\xFF\xFF\xFF\xFF\xFF\xFF", CONVERT_SIZE(uint8_t, char, ETH_ADDR));
+	if(! eth_globals.broadcast_addr){
+		return ENOMEM;
+	}
+	ERROR_PROPAGATE(eth_devices_initialize(&eth_globals.devices));
+	if(ERROR_OCCURRED(eth_protos_initialize(&eth_globals.protos))){
+		eth_devices_destroy(&eth_globals.devices);
 		return ERROR_CODE;
 	}
-	fibril_rwlock_write_unlock( & eth_globals.protos_lock );
-	fibril_rwlock_write_unlock( & eth_globals.devices_lock );
+	fibril_rwlock_write_unlock(&eth_globals.protos_lock);
+	fibril_rwlock_write_unlock(&eth_globals.devices_lock);
 	return EOK;
 }
 
-int eth_device_message( device_id_t device_id, services_t service, size_t mtu ){
+int eth_device_message(device_id_t device_id, services_t service, size_t mtu){
 	ERROR_DECLARE;
 
-	eth_device_ref	device;
-	int				index;
-	measured_string_t	names[ 2 ] = {{ str_dup("ETH_MODE"), 8 }, { str_dup("ETH_DUMMY"), 9 }};
-	measured_string_ref	configuration;
-	size_t				count = sizeof( names ) / sizeof( measured_string_t );
-	char *				data;
-	eth_proto_ref		proto;
-
-	fibril_rwlock_write_lock( & eth_globals.devices_lock );
+	eth_device_ref device;
+	int index;
+	measured_string_t names[2] = {{str_dup("ETH_MODE"), 8}, {str_dup("ETH_DUMMY"), 9}};
+	measured_string_ref configuration;
+	size_t count = sizeof(names) / sizeof(measured_string_t);
+	char * data;
+	eth_proto_ref proto;
+
+	fibril_rwlock_write_lock(&eth_globals.devices_lock);
 	// an existing device?
-	device = eth_devices_find( & eth_globals.devices, device_id );
-	if( device ){
-		if( device->service != service ){
-			printf( "Device %d already exists\n", device->device_id );
-			fibril_rwlock_write_unlock( & eth_globals.devices_lock );
+	device = eth_devices_find(&eth_globals.devices, device_id);
+	if(device){
+		if(device->service != service){
+			printf("Device %d already exists\n", device->device_id);
+			fibril_rwlock_write_unlock(&eth_globals.devices_lock);
 			return EEXIST;
 		}else{
 			// update mtu
-			if(( mtu > 0 ) && ( mtu <= ETH_MAX_TAGGED_CONTENT( device->flags ))){
+			if((mtu > 0) && (mtu <= ETH_MAX_TAGGED_CONTENT(device->flags))){
 				device->mtu = mtu;
 			}else{
-				 device->mtu = ETH_MAX_TAGGED_CONTENT( device->flags );
+				 device->mtu = ETH_MAX_TAGGED_CONTENT(device->flags);
 			}
-			printf( "Device %d already exists:\tMTU\t= %d\n", device->device_id, device->mtu );
-			fibril_rwlock_write_unlock( & eth_globals.devices_lock );
+			printf("Device %d already exists:\tMTU\t= %d\n", device->device_id, device->mtu);
+			fibril_rwlock_write_unlock(&eth_globals.devices_lock);
 			// notify all upper layer modules
-			fibril_rwlock_read_lock( & eth_globals.protos_lock );
-			for( index = 0; index < eth_protos_count( & eth_globals.protos ); ++ index ){
-				proto = eth_protos_get_index( & eth_globals.protos, index );
-				if ( proto->phone ){
-					il_mtu_changed_msg( proto->phone, device->device_id, device->mtu, proto->service );
+			fibril_rwlock_read_lock(&eth_globals.protos_lock);
+			for(index = 0; index < eth_protos_count(&eth_globals.protos); ++ index){
+				proto = eth_protos_get_index(&eth_globals.protos, index);
+				if (proto->phone){
+					il_mtu_changed_msg(proto->phone, device->device_id, device->mtu, proto->service);
 				}
 			}
-			fibril_rwlock_read_unlock( & eth_globals.protos_lock );
+			fibril_rwlock_read_unlock(&eth_globals.protos_lock);
 			return EOK;
 		}
 	}else{
 		// create a new device
-		device = ( eth_device_ref ) malloc( sizeof( eth_device_t ));
-		if( ! device ) return ENOMEM;
+		device = (eth_device_ref) malloc(sizeof(eth_device_t));
+		if(! device){
+			return ENOMEM;
+		}
 		device->device_id = device_id;
 		device->service = service;
 		device->flags = 0;
-		if(( mtu > 0 ) && ( mtu <= ETH_MAX_TAGGED_CONTENT( device->flags ))){
+		if((mtu > 0) && (mtu <= ETH_MAX_TAGGED_CONTENT(device->flags))){
 			device->mtu = mtu;
 		}else{
-			 device->mtu = ETH_MAX_TAGGED_CONTENT( device->flags );
-		}
-		configuration = & names[ 0 ];
-		if( ERROR_OCCURRED( net_get_device_conf_req( eth_globals.net_phone, device->device_id, & configuration, count, & data ))){
-			fibril_rwlock_write_unlock( & eth_globals.devices_lock );
-			free( device );
+			 device->mtu = ETH_MAX_TAGGED_CONTENT(device->flags);
+		}
+		configuration = &names[0];
+		if(ERROR_OCCURRED(net_get_device_conf_req(eth_globals.net_phone, device->device_id, &configuration, count, &data))){
+			fibril_rwlock_write_unlock(&eth_globals.devices_lock);
+			free(device);
 			return ERROR_CODE;
 		}
-		if( configuration ){
-			if( ! str_lcmp( configuration[ 0 ].value, "DIX", configuration[ 0 ].length )){
+		if(configuration){
+			if(! str_lcmp(configuration[0].value, "DIX", configuration[0].length)){
 				device->flags |= ETH_DIX;
-			}else if( ! str_lcmp( configuration[ 0 ].value, "8023_2_LSAP", configuration[ 0 ].length )){
+			}else if(! str_lcmp(configuration[0].value, "8023_2_LSAP", configuration[0].length)){
 				device->flags |= ETH_8023_2_LSAP;
 			}else device->flags |= ETH_8023_2_SNAP;
-			if(( configuration[ 1 ].value ) && ( configuration[ 1 ].value[ 0 ] == 'y' )){
+			if((configuration[1].value) && (configuration[1].value[0] == 'y')){
 				device->flags |= ETH_DUMMY;
 			}
-			net_free_settings( configuration, data );
+			net_free_settings(configuration, data);
 		}else{
 			device->flags |= ETH_8023_2_SNAP;
 		}
 		// bind the device driver
-		device->phone = netif_bind_service( device->service, device->device_id, SERVICE_ETHERNET, eth_receiver );
-		if( device->phone < 0 ){
-			fibril_rwlock_write_unlock( & eth_globals.devices_lock );
-			free( device );
+		device->phone = netif_bind_service(device->service, device->device_id, SERVICE_ETHERNET, eth_receiver);
+		if(device->phone < 0){
+			fibril_rwlock_write_unlock(&eth_globals.devices_lock);
+			free(device);
 			return device->phone;
 		}
 		// get hardware address
-		if( ERROR_OCCURRED( netif_get_addr_req( device->phone, device->device_id, & device->addr, & device->addr_data ))){
-			fibril_rwlock_write_unlock( & eth_globals.devices_lock );
-			free( device );
+		if(ERROR_OCCURRED(netif_get_addr_req(device->phone, device->device_id, &device->addr, &device->addr_data))){
+			fibril_rwlock_write_unlock(&eth_globals.devices_lock);
+			free(device);
 			return ERROR_CODE;
 		}
 		// add to the cache
-		index = eth_devices_add( & eth_globals.devices, device->device_id, device );
-		if( index < 0 ){
-			fibril_rwlock_write_unlock( & eth_globals.devices_lock );
-			free( device->addr );
-			free( device->addr_data );
-			free( device );
+		index = eth_devices_add(&eth_globals.devices, device->device_id, device);
+		if(index < 0){
+			fibril_rwlock_write_unlock(&eth_globals.devices_lock);
+			free(device->addr);
+			free(device->addr_data);
+			free(device);
 			return index;
 		}
-		printf( "New device registered:\n\tid\t= %d\n\tservice\t= %d\n\tMTU\t= %d\n\taddress\t= %X:%X:%X:%X:%X:%X\n\tflags\t= 0x%x\n", device->device_id, device->service, device->mtu, device->addr_data[ 0 ], device->addr_data[ 1 ], device->addr_data[ 2 ], device->addr_data[ 3 ], device->addr_data[ 4 ], device->addr_data[ 5 ], device->flags );
-	}
-	fibril_rwlock_write_unlock( & eth_globals.devices_lock );
+		printf("New device registered:\n\tid\t= %d\n\tservice\t= %d\n\tMTU\t= %d\n\taddress\t= %X:%X:%X:%X:%X:%X\n\tflags\t= 0x%x\n", device->device_id, device->service, device->mtu, device->addr_data[0], device->addr_data[1], device->addr_data[2], device->addr_data[3], device->addr_data[4], device->addr_data[5], device->flags);
+	}
+	fibril_rwlock_write_unlock(&eth_globals.devices_lock);
 	return EOK;
 }
 
-eth_proto_ref eth_process_packet( int flags, packet_t packet ){
+eth_proto_ref eth_process_packet(int flags, packet_t packet){
 	ERROR_DECLARE;
 
-	eth_header_snap_ref	header;
-	size_t				length;
-	eth_type_t			type;
-	size_t				prefix;
-	size_t				suffix;
-	eth_fcs_ref			fcs;
-	uint8_t *			data;
-
-	length = packet_get_data_length( packet );
-	if( IS_DUMMY( flags )){
-		packet_trim( packet, sizeof( eth_preamble_t ), 0 );
-	}
-	if( length < sizeof( eth_header_t ) + ETH_MIN_CONTENT + ( IS_DUMMY( flags ) ? ETH_SUFFIX : 0 )) return NULL;
-	data = packet_get_data( packet );
-	header = ( eth_header_snap_ref ) data;
-	type = ntohs( header->header.ethertype );
-	if( type >= ETH_MIN_PROTO ){
+	eth_header_snap_ref header;
+	size_t length;
+	eth_type_t type;
+	size_t prefix;
+	size_t suffix;
+	eth_fcs_ref fcs;
+	uint8_t * data;
+
+	length = packet_get_data_length(packet);
+	if(IS_DUMMY(flags)){
+		packet_trim(packet, sizeof(eth_preamble_t), 0);
+	}
+	if(length < sizeof(eth_header_t) + ETH_MIN_CONTENT + (IS_DUMMY(flags) ? ETH_SUFFIX : 0)) return NULL;
+	data = packet_get_data(packet);
+	header = (eth_header_snap_ref) data;
+	type = ntohs(header->header.ethertype);
+	if(type >= ETH_MIN_PROTO){
 		// DIX Ethernet
-		prefix = sizeof( eth_header_t );
+		prefix = sizeof(eth_header_t);
 		suffix = 0;
-		fcs = ( eth_fcs_ref ) data + length - sizeof( eth_fcs_t );
-		length -= sizeof( eth_fcs_t );
-	}else if( type <= ETH_MAX_CONTENT ){
+		fcs = (eth_fcs_ref) data + length - sizeof(eth_fcs_t);
+		length -= sizeof(eth_fcs_t);
+	}else if(type <= ETH_MAX_CONTENT){
 		// translate "LSAP" values
-		if(( header->lsap.dsap == ETH_LSAP_GLSAP ) && ( header->lsap.ssap == ETH_LSAP_GLSAP )){
+		if((header->lsap.dsap == ETH_LSAP_GLSAP) && (header->lsap.ssap == ETH_LSAP_GLSAP)){
 			// raw packet
 			// discard
 			return NULL;
-		}else if(( header->lsap.dsap == ETH_LSAP_SNAP ) && ( header->lsap.ssap == ETH_LSAP_SNAP )){
+		}else if((header->lsap.dsap == ETH_LSAP_SNAP) && (header->lsap.ssap == ETH_LSAP_SNAP)){
 			// IEEE 802.3 + 802.2 + LSAP + SNAP
 			// organization code not supported
-			type = ntohs( header->snap.ethertype );
-			prefix = sizeof( eth_header_t ) + sizeof( eth_header_lsap_t ) + sizeof( eth_header_snap_t );
+			type = ntohs(header->snap.ethertype);
+			prefix = sizeof(eth_header_t) + sizeof(eth_header_lsap_t) + sizeof(eth_header_snap_t);
 		}else{
 			// IEEE 802.3 + 802.2 LSAP
-			type = lsap_map( header->lsap.dsap );
-			prefix = sizeof( eth_header_t ) + sizeof( eth_header_lsap_t);
-		}
-		suffix = ( type < ETH_MIN_CONTENT ) ? ETH_MIN_CONTENT - type : 0u;
-		fcs = ( eth_fcs_ref ) data + prefix + type + suffix;
+			type = lsap_map(header->lsap.dsap);
+			prefix = sizeof(eth_header_t) + sizeof(eth_header_lsap_t);
+		}
+		suffix = (type < ETH_MIN_CONTENT) ? ETH_MIN_CONTENT - type : 0u;
+		fcs = (eth_fcs_ref) data + prefix + type + suffix;
 		suffix += length - prefix - type;
 		length = prefix + type + suffix;
@@ -450,101 +456,107 @@
 		return NULL;
 	}
-	if( IS_DUMMY( flags )){
-		if(( ~ compute_crc32( ~ 0u, data, length * 8 )) != ntohl( * fcs )){
+	if(IS_DUMMY(flags)){
+		if((~ compute_crc32(~ 0u, data, length * 8)) != ntohl(*fcs)){
 			return NULL;
 		}
-		suffix += sizeof( eth_fcs_t );
-	}
-	if( ERROR_OCCURRED( packet_set_addr( packet, header->header.source_address, header->header.destination_address, ETH_ADDR ))
-	|| ERROR_OCCURRED( packet_trim( packet, prefix, suffix ))){
+		suffix += sizeof(eth_fcs_t);
+	}
+	if(ERROR_OCCURRED(packet_set_addr(packet, header->header.source_address, header->header.destination_address, ETH_ADDR))
+		|| ERROR_OCCURRED(packet_trim(packet, prefix, suffix))){
 		return NULL;
 	}
-	return eth_protos_find( & eth_globals.protos, type );
-}
-
-int nil_received_msg( int nil_phone, device_id_t device_id, packet_t packet, services_t target ){
-	eth_proto_ref	proto;
-	packet_t		next;
-	eth_device_ref	device;
-	int				flags;
-
-	fibril_rwlock_read_lock( & eth_globals.devices_lock );
-	device = eth_devices_find( & eth_globals.devices, device_id );
-	if( ! device ){
-		fibril_rwlock_read_unlock( & eth_globals.devices_lock );
+	return eth_protos_find(&eth_globals.protos, type);
+}
+
+int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
+	eth_proto_ref proto;
+	packet_t next;
+	eth_device_ref device;
+	int flags;
+
+	fibril_rwlock_read_lock(&eth_globals.devices_lock);
+	device = eth_devices_find(&eth_globals.devices, device_id);
+	if(! device){
+		fibril_rwlock_read_unlock(&eth_globals.devices_lock);
 		return ENOENT;
 	}
 	flags = device->flags;
-	fibril_rwlock_read_unlock( & eth_globals.devices_lock );
-	fibril_rwlock_read_lock( & eth_globals.protos_lock );
+	fibril_rwlock_read_unlock(&eth_globals.devices_lock);
+	fibril_rwlock_read_lock(&eth_globals.protos_lock);
 	do{
-		next = pq_detach( packet );
-		proto = eth_process_packet( flags, packet );
-		if( proto ){
-			il_received_msg( proto->phone, device_id, packet, proto->service );
+		next = pq_detach(packet);
+		proto = eth_process_packet(flags, packet);
+		if(proto){
+			il_received_msg(proto->phone, device_id, packet, proto->service);
 		}else{
 			// drop invalid/unknown
-			pq_release( eth_globals.net_phone, packet_get_id( packet ));
+			pq_release(eth_globals.net_phone, packet_get_id(packet));
 		}
 		packet = next;
-	}while( packet );
-	fibril_rwlock_read_unlock( & eth_globals.protos_lock );
+	}while(packet);
+	fibril_rwlock_read_unlock(&eth_globals.protos_lock);
 	return EOK;
 }
 
-int eth_packet_space_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ){
-	eth_device_ref	device;
-
-	if( !( addr_len && prefix && content && suffix )) return EBADMEM;
-	fibril_rwlock_read_lock( & eth_globals.devices_lock );
-	device = eth_devices_find( & eth_globals.devices, device_id );
-	if( ! device ){
-		fibril_rwlock_read_unlock( & eth_globals.devices_lock );
+int eth_packet_space_message(device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix){
+	eth_device_ref device;
+
+	if(!(addr_len && prefix && content && suffix)){
+		return EBADMEM;
+	}
+	fibril_rwlock_read_lock(&eth_globals.devices_lock);
+	device = eth_devices_find(&eth_globals.devices, device_id);
+	if(! device){
+		fibril_rwlock_read_unlock(&eth_globals.devices_lock);
 		return ENOENT;
 	}
-	* content = device->mtu;
-	fibril_rwlock_read_unlock( & eth_globals.devices_lock );
-	* addr_len = ETH_ADDR;
-	* prefix = ETH_PREFIX;
-	* suffix = ETH_MIN_CONTENT + ETH_SUFFIX;
+	*content = device->mtu;
+	fibril_rwlock_read_unlock(&eth_globals.devices_lock);
+	*addr_len = ETH_ADDR;
+	*prefix = ETH_PREFIX;
+	*suffix = ETH_MIN_CONTENT + ETH_SUFFIX;
 	return EOK;
 }
 
-int eth_addr_message( device_id_t device_id, eth_addr_type_t type, measured_string_ref * address ){
-	eth_device_ref	device;
-
-	if( ! address ) return EBADMEM;
-	if( type == ETH_BROADCAST_ADDR ){
-		* address = eth_globals.broadcast_addr;
+int eth_addr_message(device_id_t device_id, eth_addr_type_t type, measured_string_ref * address){
+	eth_device_ref device;
+
+	if(! address){
+		return EBADMEM;
+	}
+	if(type == ETH_BROADCAST_ADDR){
+		*address = eth_globals.broadcast_addr;
 	}else{
-		fibril_rwlock_read_lock( & eth_globals.devices_lock );
-		device = eth_devices_find( & eth_globals.devices, device_id );
-		if( ! device ){
-			fibril_rwlock_read_unlock( & eth_globals.devices_lock );
+		fibril_rwlock_read_lock(&eth_globals.devices_lock);
+		device = eth_devices_find(&eth_globals.devices, device_id);
+		if(! device){
+			fibril_rwlock_read_unlock(&eth_globals.devices_lock);
 			return ENOENT;
 		}
-		* address = device->addr;
-		fibril_rwlock_read_unlock( & eth_globals.devices_lock );
-	}
-	return ( * address ) ? EOK : ENOENT;
-}
-
-int eth_register_message( services_t service, int phone ){
-	eth_proto_ref	proto;
-	int				protocol;
-	int				index;
-
-	protocol = protocol_map( SERVICE_ETHERNET, service );
-	if( ! protocol ) return ENOENT;
-	fibril_rwlock_write_lock( & eth_globals.protos_lock );
-	proto = eth_protos_find( & eth_globals.protos, protocol );
-	if( proto ){
+		*address = device->addr;
+		fibril_rwlock_read_unlock(&eth_globals.devices_lock);
+	}
+	return (*address) ? EOK : ENOENT;
+}
+
+int eth_register_message(services_t service, int phone){
+	eth_proto_ref proto;
+	int protocol;
+	int index;
+
+	protocol = protocol_map(SERVICE_ETHERNET, service);
+	if(! protocol){
+		return ENOENT;
+	}
+	fibril_rwlock_write_lock(&eth_globals.protos_lock);
+	proto = eth_protos_find(&eth_globals.protos, protocol);
+	if(proto){
 		proto->phone = phone;
-		fibril_rwlock_write_unlock( & eth_globals.protos_lock );
+		fibril_rwlock_write_unlock(&eth_globals.protos_lock);
 		return EOK;
 	}else{
-		proto = ( eth_proto_ref ) malloc( sizeof( eth_proto_t ));
-		if( ! proto ){
-			fibril_rwlock_write_unlock( & eth_globals.protos_lock );
+		proto = (eth_proto_ref) malloc(sizeof(eth_proto_t));
+		if(! proto){
+			fibril_rwlock_write_unlock(&eth_globals.protos_lock);
 			return ENOMEM;
 		}
@@ -552,97 +564,119 @@
 		proto->protocol = protocol;
 		proto->phone = phone;
-		index = eth_protos_add( & eth_globals.protos, protocol, proto );
-		if( index < 0 ){
-			fibril_rwlock_write_unlock( & eth_globals.protos_lock );
-			free( proto );
+		index = eth_protos_add(&eth_globals.protos, protocol, proto);
+		if(index < 0){
+			fibril_rwlock_write_unlock(&eth_globals.protos_lock);
+			free(proto);
 			return index;
 		}
 	}
-	printf( "New protocol registered:\n\tprotocol\t= 0x%x\n\tservice\t= %d\n\tphone\t= %d\n", proto->protocol, proto->service, proto->phone );
-	fibril_rwlock_write_unlock( & eth_globals.protos_lock );
+	printf("New protocol registered:\n\tprotocol\t= 0x%x\n\tservice\t= %d\n\tphone\t= %d\n", proto->protocol, proto->service, proto->phone);
+	fibril_rwlock_write_unlock(&eth_globals.protos_lock);
 	return EOK;
 }
 
-int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype, size_t mtu ){
-	eth_header_snap_ref	header;
-	eth_header_lsap_ref	header_lsap;
-	eth_header_ref		header_dix;
-	eth_fcs_ref			fcs;
-	uint8_t *			src;
-	uint8_t *			dest;
-	size_t				length;
-	int					i;
-	void *				padding;
-	eth_preamble_ref	preamble;
-
-	i = packet_get_addr( packet, & src, & dest );
-	if( i < 0 ) return i;
-	if( i != ETH_ADDR ) return EINVAL;
-	length = packet_get_data_length( packet );
-	if( length > mtu ) return EINVAL;
-	if( length < ETH_MIN_TAGGED_CONTENT( flags )){
-		padding = packet_suffix( packet, ETH_MIN_TAGGED_CONTENT( flags ) - length );
-		if( ! padding ) return ENOMEM;
-		bzero( padding, ETH_MIN_TAGGED_CONTENT( flags ) - length );
-	}
-	if( IS_DIX( flags )){
-		header_dix = PACKET_PREFIX( packet, eth_header_t );
-		if( ! header_dix ) return ENOMEM;
-		header_dix->ethertype = ( uint16_t ) ethertype;
-		memcpy( header_dix->source_address, src_addr, ETH_ADDR );
-		memcpy( header_dix->destination_address, dest, ETH_ADDR );
-		src = & header_dix->destination_address[ 0 ];
-	}else if( IS_8023_2_LSAP( flags )){
-		header_lsap = PACKET_PREFIX( packet, eth_header_lsap_t );
-		if( ! header_lsap ) return ENOMEM;
-		header_lsap->header.ethertype = htons( length + sizeof( eth_header_lsap_t ));
-		header_lsap->lsap.dsap = lsap_unmap( ntohs( ethertype ));
+int eth_prepare_packet(int flags, packet_t packet, uint8_t * src_addr, int ethertype, size_t mtu){
+	eth_header_snap_ref header;
+	eth_header_lsap_ref header_lsap;
+	eth_header_ref header_dix;
+	eth_fcs_ref fcs;
+	uint8_t * src;
+	uint8_t * dest;
+	size_t length;
+	int i;
+	void * padding;
+	eth_preamble_ref preamble;
+
+	i = packet_get_addr(packet, &src, &dest);
+	if(i < 0){
+		return i;
+	}
+	if(i != ETH_ADDR){
+		return EINVAL;
+	}
+	length = packet_get_data_length(packet);
+	if(length > mtu){
+		return EINVAL;
+	}
+	if(length < ETH_MIN_TAGGED_CONTENT(flags)){
+		padding = packet_suffix(packet, ETH_MIN_TAGGED_CONTENT(flags) - length);
+		if(! padding){
+			return ENOMEM;
+		}
+		bzero(padding, ETH_MIN_TAGGED_CONTENT(flags) - length);
+	}
+	if(IS_DIX(flags)){
+		header_dix = PACKET_PREFIX(packet, eth_header_t);
+		if(! header_dix){
+			return ENOMEM;
+		}
+		header_dix->ethertype = (uint16_t) ethertype;
+		memcpy(header_dix->source_address, src_addr, ETH_ADDR);
+		memcpy(header_dix->destination_address, dest, ETH_ADDR);
+		src = &header_dix->destination_address[0];
+	}else if(IS_8023_2_LSAP(flags)){
+		header_lsap = PACKET_PREFIX(packet, eth_header_lsap_t);
+		if(! header_lsap){
+			return ENOMEM;
+		}
+		header_lsap->header.ethertype = htons(length + sizeof(eth_header_lsap_t));
+		header_lsap->lsap.dsap = lsap_unmap(ntohs(ethertype));
 		header_lsap->lsap.ssap = header_lsap->lsap.dsap;
 		header_lsap->lsap.ctrl = IEEE_8023_2_UI;
-		memcpy( header_lsap->header.source_address, src_addr, ETH_ADDR );
-		memcpy( header_lsap->header.destination_address, dest, ETH_ADDR );
-		src = & header_lsap->header.destination_address[ 0 ];
-	}else if( IS_8023_2_SNAP( flags )){
-		header = PACKET_PREFIX( packet, eth_header_snap_t );
-		if( ! header ) return ENOMEM;
-		header->header.ethertype = htons( length + sizeof( eth_header_lsap_t ) + sizeof( eth_header_snap_t ));
-		header->lsap.dsap = ( uint16_t ) ETH_LSAP_SNAP;
+		memcpy(header_lsap->header.source_address, src_addr, ETH_ADDR);
+		memcpy(header_lsap->header.destination_address, dest, ETH_ADDR);
+		src = &header_lsap->header.destination_address[0];
+	}else if(IS_8023_2_SNAP(flags)){
+		header = PACKET_PREFIX(packet, eth_header_snap_t);
+		if(! header){
+			return ENOMEM;
+		}
+		header->header.ethertype = htons(length + sizeof(eth_header_lsap_t) + sizeof(eth_header_snap_t));
+		header->lsap.dsap = (uint16_t) ETH_LSAP_SNAP;
 		header->lsap.ssap = header->lsap.dsap;
 		header->lsap.ctrl = IEEE_8023_2_UI;
-		for( i = 0; i < 3; ++ i ) header->snap.protocol[ i ] = 0;
-		header->snap.ethertype = ( uint16_t ) ethertype;
-		memcpy( header->header.source_address, src_addr, ETH_ADDR );
-		memcpy( header->header.destination_address, dest, ETH_ADDR );
-		src = & header->header.destination_address[ 0 ];
-	}
-	if( IS_DUMMY( flags )){
-		preamble = PACKET_PREFIX( packet, eth_preamble_t );
-		if( ! preamble ) return ENOMEM;
-		for( i = 0; i < 7; ++ i ) preamble->preamble[ i ] = ETH_PREAMBLE;
+		for(i = 0; i < 3; ++ i){
+			header->snap.protocol[i] = 0;
+		}
+		header->snap.ethertype = (uint16_t) ethertype;
+		memcpy(header->header.source_address, src_addr, ETH_ADDR);
+		memcpy(header->header.destination_address, dest, ETH_ADDR);
+		src = &header->header.destination_address[0];
+	}
+	if(IS_DUMMY(flags)){
+		preamble = PACKET_PREFIX(packet, eth_preamble_t);
+		if(! preamble){
+			return ENOMEM;
+		}
+		for(i = 0; i < 7; ++ i){
+			preamble->preamble[i] = ETH_PREAMBLE;
+		}
 		preamble->sfd = ETH_SFD;
-		fcs = PACKET_SUFFIX( packet, eth_fcs_t );
-		if( ! fcs ) return ENOMEM;
-		* fcs = htonl( ~ compute_crc32( ~ 0u, src, length * 8 ));
+		fcs = PACKET_SUFFIX(packet, eth_fcs_t);
+		if(! fcs){
+			return ENOMEM;
+		}
+		*fcs = htonl(~ compute_crc32(~ 0u, src, length * 8));
 	}
 	return EOK;
 }
 
-int eth_send_message( device_id_t device_id, packet_t packet, services_t sender ){
+int eth_send_message(device_id_t device_id, packet_t packet, services_t sender){
 	ERROR_DECLARE;
 
-	eth_device_ref		device;
-	packet_t			next;
-	packet_t			tmp;
-	int					ethertype;
-
-	ethertype = htons( protocol_map( SERVICE_ETHERNET, sender ));
-	if( ! ethertype ){
-		pq_release( eth_globals.net_phone, packet_get_id( packet ));
+	eth_device_ref device;
+	packet_t next;
+	packet_t tmp;
+	int ethertype;
+
+	ethertype = htons(protocol_map(SERVICE_ETHERNET, sender));
+	if(! ethertype){
+		pq_release(eth_globals.net_phone, packet_get_id(packet));
 		return EINVAL;
 	}
-	fibril_rwlock_read_lock( & eth_globals.devices_lock );
-	device = eth_devices_find( & eth_globals.devices, device_id );
-	if( ! device ){
-		fibril_rwlock_read_unlock( & eth_globals.devices_lock );
+	fibril_rwlock_read_lock(&eth_globals.devices_lock);
+	device = eth_devices_find(&eth_globals.devices, device_id);
+	if(! device){
+		fibril_rwlock_read_unlock(&eth_globals.devices_lock);
 		return ENOENT;
 	}
@@ -650,76 +684,78 @@
 	next = packet;
 	do{
-		if( ERROR_OCCURRED( eth_prepare_packet( device->flags, next, ( uint8_t * ) device->addr->value, ethertype, device->mtu ))){
+		if(ERROR_OCCURRED(eth_prepare_packet(device->flags, next, (uint8_t *) device->addr->value, ethertype, device->mtu))){
 			// release invalid packet
-			tmp = pq_detach( next );
-			if( next == packet ) packet = tmp;
-			pq_release( eth_globals.net_phone, packet_get_id( next ));
+			tmp = pq_detach(next);
+			if(next == packet){
+				packet = tmp;
+			}
+			pq_release(eth_globals.net_phone, packet_get_id(next));
 			next = tmp;
 		}else{
-			next = pq_next( next );
-		}
-	}while( next );
+			next = pq_next(next);
+		}
+	}while(next);
 	// send packet queue
-	if( packet ){
-		netif_send_msg( device->phone, device_id, packet, SERVICE_ETHERNET );
-	}
-	fibril_rwlock_read_unlock( & eth_globals.devices_lock );
+	if(packet){
+		netif_send_msg(device->phone, device_id, packet, SERVICE_ETHERNET);
+	}
+	fibril_rwlock_read_unlock(&eth_globals.devices_lock);
 	return EOK;
 }
 
-int nil_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+int nil_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
-	measured_string_ref	address;
-	packet_t			packet;
-
-//	printf( "message %d - %d\n", IPC_GET_METHOD( * call ), NET_NIL_FIRST );
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+	measured_string_ref address;
+	packet_t packet;
+
+//	printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_NIL_FIRST);
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_NIL_DEVICE:
-			return eth_device_message( IPC_GET_DEVICE( call ), IPC_GET_SERVICE( call ), IPC_GET_MTU( call ));
+			return eth_device_message(IPC_GET_DEVICE(call), IPC_GET_SERVICE(call), IPC_GET_MTU(call));
 		case NET_NIL_SEND:
-			ERROR_PROPAGATE( packet_translate( eth_globals.net_phone, & packet, IPC_GET_PACKET( call )));
-			return eth_send_message( IPC_GET_DEVICE( call ), packet, IPC_GET_SERVICE( call ));
+			ERROR_PROPAGATE(packet_translate(eth_globals.net_phone, &packet, IPC_GET_PACKET(call)));
+			return eth_send_message(IPC_GET_DEVICE(call), packet, IPC_GET_SERVICE(call));
 		case NET_NIL_PACKET_SPACE:
-			ERROR_PROPAGATE( eth_packet_space_message( IPC_GET_DEVICE( call ), IPC_SET_ADDR( answer ), IPC_SET_PREFIX( answer ), IPC_SET_CONTENT( answer ), IPC_SET_SUFFIX( answer )));
-			* answer_count = 4;
+			ERROR_PROPAGATE(eth_packet_space_message(IPC_GET_DEVICE(call), IPC_SET_ADDR(answer), IPC_SET_PREFIX(answer), IPC_SET_CONTENT(answer), IPC_SET_SUFFIX(answer)));
+			*answer_count = 4;
 			return EOK;
 		case NET_NIL_ADDR:
-			ERROR_PROPAGATE( eth_addr_message( IPC_GET_DEVICE( call ), ETH_LOCAL_ADDR, & address ));
-			return measured_strings_reply( address, 1 );
+			ERROR_PROPAGATE(eth_addr_message(IPC_GET_DEVICE(call), ETH_LOCAL_ADDR, &address));
+			return measured_strings_reply(address, 1);
 		case NET_NIL_BROADCAST_ADDR:
-			ERROR_PROPAGATE( eth_addr_message( IPC_GET_DEVICE( call ), ETH_BROADCAST_ADDR, & address ));
-			return measured_strings_reply( address, 1 );
+			ERROR_PROPAGATE(eth_addr_message(IPC_GET_DEVICE(call), ETH_BROADCAST_ADDR, &address));
+			return measured_strings_reply(address, 1);
 		case IPC_M_CONNECT_TO_ME:
-			return eth_register_message( NIL_GET_PROTO( call ), IPC_GET_PHONE( call ));
+			return eth_register_message(NIL_GET_PROTO(call), IPC_GET_PHONE(call));
 	}
 	return ENOTSUP;
 }
 
-void eth_receiver( ipc_callid_t iid, ipc_call_t * icall ){
+void eth_receiver(ipc_callid_t iid, ipc_call_t * icall){
 	ERROR_DECLARE;
 
-	packet_t		packet;
-
-	while( true ){
-//		printf( "message %d - %d\n", IPC_GET_METHOD( * icall ), NET_NIL_FIRST );
-		switch( IPC_GET_METHOD( * icall )){
+	packet_t packet;
+
+	while(true){
+//		printf("message %d - %d\n", IPC_GET_METHOD(*icall), NET_NIL_FIRST);
+		switch(IPC_GET_METHOD(*icall)){
 			case NET_NIL_DEVICE_STATE:
-				nil_device_state_msg( 0, IPC_GET_DEVICE( icall ), IPC_GET_STATE( icall ));
-				ipc_answer_0( iid, EOK );
+				nil_device_state_msg(0, IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
+				ipc_answer_0(iid, EOK);
 				break;
 			case NET_NIL_RECEIVED:
-				if( ! ERROR_OCCURRED( packet_translate( eth_globals.net_phone, & packet, IPC_GET_PACKET( icall )))){
-					ERROR_CODE = nil_received_msg( 0, IPC_GET_DEVICE( icall ), packet, 0 );
+				if(! ERROR_OCCURRED(packet_translate(eth_globals.net_phone, &packet, IPC_GET_PACKET(icall)))){
+					ERROR_CODE = nil_received_msg(0, IPC_GET_DEVICE(icall), packet, 0);
 				}
-				ipc_answer_0( iid, ( ipcarg_t ) ERROR_CODE );
+				ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
 				break;
 			default:
-				ipc_answer_0( iid, ( ipcarg_t ) ENOTSUP );
-		}
-		iid = async_get_call( icall );
+				ipc_answer_0(iid, (ipcarg_t) ENOTSUP);
+		}
+		iid = async_get_call(icall);
 	}
 }
Index: uspace/srv/net/nil/eth/eth.h
===================================================================
--- uspace/srv/net/nil/eth/eth.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/eth/eth.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -73,5 +73,5 @@
  *  @see device.h
  */
-DEVICE_MAP_DECLARE( eth_devices, eth_device_t )
+DEVICE_MAP_DECLARE(eth_devices, eth_device_t)
 
 /** Ethernet protocol map.
@@ -79,5 +79,5 @@
  *  @see int_map.h
  */
-INT_MAP_DECLARE( eth_protos, eth_proto_t )
+INT_MAP_DECLARE(eth_protos, eth_proto_t)
 
 /** Ethernet device specific data.
@@ -86,25 +86,25 @@
 	/** Device identifier.
 	 */
-	device_id_t			device_id;
+	device_id_t device_id;
 	/** Device driver service.
 	 */
-	services_t			service;
+	services_t service;
 	/** Driver phone.
 	 */
-	int					phone;
+	int phone;
 	/** Maximal transmission unit.
 	 */
-	size_t				mtu;
+	size_t mtu;
 	/** Various device flags.
 	 *  @see ETH_DUMMY
 	 *  @see ETH_MODE_MASK
 	 */
-	int					flags;
+	int flags;
 	/** Actual device hardware address.
 	 */
-	measured_string_ref	addr;
+	measured_string_ref addr;
 	/** Actual device hardware address data.
 	 */
-	char *				addr_data;
+	char * addr_data;
 };
 
@@ -114,11 +114,11 @@
 	/** Protocol service.
 	 */
-	services_t	service;
+	services_t service;
 	/** Protocol identifier.
 	 */
-	int			protocol;
+	int protocol;
 	/** Protocol module phone.
 	 */
-	int			phone;
+	int phone;
 };
 
@@ -128,21 +128,21 @@
 	/** Networking module phone.
 	 */
-	int				net_phone;
+	int net_phone;
 	/** Safety lock for devices.
 	 */
-	fibril_rwlock_t		devices_lock;
+	fibril_rwlock_t devices_lock;
 	/** All known Ethernet devices.
 	 */
-	eth_devices_t	devices;
+	eth_devices_t devices;
 	/** Safety lock for protocols.
 	 */
-	fibril_rwlock_t		protos_lock;
+	fibril_rwlock_t protos_lock;
 	/** Protocol map.
 	 *  Service phone map for each protocol.
 	 */
-	eth_protos_t	protos;
+	eth_protos_t protos;
 	/** Broadcast device hardware address.
 	 */
-	measured_string_ref	broadcast_addr;
+	measured_string_ref broadcast_addr;
 };
 
Index: uspace/srv/net/nil/eth/eth_header.h
===================================================================
--- uspace/srv/net/nil/eth/eth_header.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/eth/eth_header.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -121,15 +121,15 @@
 struct eth_ieee_lsap{
 	/** Destination Service Access Point identifier.
-	 *	The possible values are assigned by an IEEE committee.
-	 */
-	uint8_t		dsap;
+	 * The possible values are assigned by an IEEE committee.
+	 */
+	uint8_t dsap;
 	/** Source Service Access Point identifier.
-	 *	The possible values are assigned by an IEEE committee.
-	 */
-	uint8_t		ssap;
+	 * The possible values are assigned by an IEEE committee.
+	 */
+	uint8_t ssap;
 	/** Control parameter.
-	 *	The possible values are assigned by an IEEE committee.
-	 */
-	uint8_t		ctrl;
+	 * The possible values are assigned by an IEEE committee.
+	 */
+	uint8_t ctrl;
 } __attribute__ ((packed));
 
@@ -139,9 +139,9 @@
 	/** Protocol identifier or organization code.
 	 */
-	uint8_t		protocol[ 3 ];
+	uint8_t protocol[3];
 	/** Ethernet protocol identifier in the network byte order (big endian).
 	 *  @see ethernet_protocols.h
 	 */
-	uint16_t	ethertype;
+	uint16_t ethertype;
 } __attribute__ ((packed));
 
@@ -153,9 +153,9 @@
 	 *  All should be set to ETH_PREAMBLE.
 	 */
-	uint8_t		preamble[ 7 ];
+	uint8_t preamble[7];
 	/** Start of Frame Delimiter used for the frame transmission synchronization.
 	 *  Should be set to ETH_SFD.
 	 */
-	uint8_t		sfd;
+	uint8_t sfd;
 } __attribute__ ((packed));
 
@@ -165,12 +165,12 @@
 	/** Destination host Ethernet address (MAC address).
 	 */
-	uint8_t		destination_address[ ETH_ADDR ];
+	uint8_t destination_address[ETH_ADDR];
 	/** Source host Ethernet address (MAC address).
 	 */
-	uint8_t		source_address[ ETH_ADDR ];
+	uint8_t source_address[ETH_ADDR];
 	/** Ethernet protocol identifier in the network byte order (big endian).
 	 *  @see ethernet_protocols.h
 	 */
-	uint16_t	ethertype;
+	uint16_t ethertype;
 } __attribute__ ((packed));
 
@@ -180,10 +180,10 @@
 	/** Ethernet header.
 	 */
-	eth_header_t		header;
+	eth_header_t header;
 	/** LSAP extension.
 	 *  If DSAP and SSAP are set to ETH_LSAP_SNAP the SNAP extension is being used.
 	 *  If DSAP and SSAP fields are equal to ETH_RAW the raw Ethernet packet without any extensions is being used and the frame content starts rigth after the two fields.
 	 */
-	eth_ieee_lsap_t		lsap;
+	eth_ieee_lsap_t lsap;
 } __attribute__ ((packed));
 
@@ -193,13 +193,13 @@
 	/** Ethernet header.
 	 */
-	eth_header_t		header;
+	eth_header_t header;
 	/** LSAP extension.
 	 *  If DSAP and SSAP are set to ETH_LSAP_SNAP the SNAP extension is being used.
 	 *  If DSAP and SSAP fields are equal to ETH_RAW the raw Ethernet packet without any extensions is being used and the frame content starts rigth after the two fields.
 	 */
-	eth_ieee_lsap_t		lsap;
+	eth_ieee_lsap_t lsap;
 	/** SNAP extension.
 	 */
-	eth_snap_t			snap;
+	eth_snap_t snap;
 } __attribute__ ((packed));
 
Index: uspace/srv/net/nil/eth/eth_module.c
===================================================================
--- uspace/srv/net/nil/eth/eth_module.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/eth/eth_module.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -59,5 +59,5 @@
 /** Prints the module name.
  */
-void	module_print_name( void );
+void module_print_name(void);
 
 /** Starts the Ethernet module.
@@ -69,5 +69,5 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int	module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
 /** Passes the parameters to the module specific nil_message() function.
@@ -80,21 +80,21 @@
  *  @returns Other error codes as defined for each specific module message function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
-void module_print_name( void ){
-	printf( "%s", NAME );
+void module_print_name(void){
+	printf("%s", NAME);
 }
 
-int module_start( async_client_conn_t client_connection ){
+int module_start(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ipcarg_t	phonehash;
-	int			net_phone;
+	ipcarg_t phonehash;
+	int net_phone;
 
-	async_set_client_connection( client_connection );
-	net_phone = net_connect_module( SERVICE_NETWORKING );
-	ERROR_PROPAGATE( pm_init());
-	if( ERROR_OCCURRED( nil_initialize( net_phone ))
-	|| ERROR_OCCURRED( REGISTER_ME( SERVICE_ETHERNET, & phonehash ))){
+	async_set_client_connection(client_connection);
+	net_phone = net_connect_module(SERVICE_NETWORKING);
+	ERROR_PROPAGATE(pm_init());
+	if(ERROR_OCCURRED(nil_initialize(net_phone))
+		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_ETHERNET, &phonehash))){
 		pm_destroy();
 		return ERROR_CODE;
@@ -107,6 +107,6 @@
 }
 
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	return nil_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return nil_message(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/nil/nil_messages.h
===================================================================
--- uspace/srv/net/nil/nil_messages.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/nil_messages.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -82,5 +82,5 @@
 /** Returns the protocol service message parameter.
  */
-#define NIL_GET_PROTO( call )		( services_t ) IPC_GET_ARG2( * call )
+#define NIL_GET_PROTO(call)		(services_t) IPC_GET_ARG2(*call)
 
 /*@}*/
Index: uspace/srv/net/nil/nil_module.h
===================================================================
--- uspace/srv/net/nil/nil_module.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/nil_module.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -47,5 +47,5 @@
  *  @returns Other error codes as defined for each specific module initialize function.
  */
-int	nil_initialize( int net_phone );
+int nil_initialize(int net_phone);
 
 /** Message processing function.
@@ -60,5 +60,5 @@
  *  @see IS_NET_NIL_MESSAGE()
  */
-int	nil_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int nil_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/nil/nil_remote.c
===================================================================
--- uspace/srv/net/nil/nil_remote.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/nil_remote.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -46,10 +46,10 @@
 #include "nil_messages.h"
 
-int nil_device_state_msg( int nil_phone, device_id_t device_id, int state ){
-	return generic_device_state_msg( nil_phone, NET_NIL_DEVICE_STATE, device_id, state, 0 );
+int nil_device_state_msg(int nil_phone, device_id_t device_id, int state){
+	return generic_device_state_msg(nil_phone, NET_NIL_DEVICE_STATE, device_id, state, 0);
 }
 
-int nil_received_msg( int nil_phone, device_id_t device_id, packet_t packet, services_t target ){
-	return generic_received_msg( nil_phone, NET_NIL_RECEIVED, device_id, packet_get_id( packet ), target, 0 );
+int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
+	return generic_received_msg(nil_phone, NET_NIL_RECEIVED, device_id, packet_get_id(packet), target, 0);
 }
 
Index: uspace/srv/net/nil/nildummy/nildummy.c
===================================================================
--- uspace/srv/net/nil/nildummy/nildummy.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/nildummy/nildummy.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -77,5 +77,5 @@
  *  @param[in,out] icall The message parameters.
  */
-void	nildummy_receiver( ipc_callid_t iid, ipc_call_t * icall );
+void nildummy_receiver(ipc_callid_t iid, ipc_call_t * icall);
 
 /** Registers new device or updates the MTU of an existing one.
@@ -90,5 +90,5 @@
  *  @returns Other error codes as defined for the netif_get_addr_req() function.
  */
-int	nildummy_device_message( device_id_t device_id, services_t service, size_t mtu );
+int nildummy_device_message(device_id_t device_id, services_t service, size_t mtu);
 
 /** Returns the device packet dimensions for sending.
@@ -102,5 +102,5 @@
  *  @returns ENOENT if there is no such device.
  */
-int	nildummy_packet_space_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix );
+int nildummy_packet_space_message(device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix);
 
 /** Registers receiving module service.
@@ -112,5 +112,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	nildummy_register_message( services_t service, int phone );
+int nildummy_register_message(services_t service, int phone);
 
 /** Sends the packet queue.
@@ -122,5 +122,5 @@
  *  @returns EINVAL if the service parameter is not known.
  */
-int	nildummy_send_message( device_id_t device_id, packet_t packet, services_t sender );
+int nildummy_send_message(device_id_t device_id, packet_t packet, services_t sender);
 
 /** Returns the device hardware address.
@@ -131,70 +131,74 @@
  *  @returns ENOENT if there no such device.
  */
-int	nildummy_addr_message( device_id_t device_id, measured_string_ref * address );
+int nildummy_addr_message(device_id_t device_id, measured_string_ref * address);
 
 /*@}*/
 
-DEVICE_MAP_IMPLEMENT( nildummy_devices, nildummy_device_t )
-
-int	nil_device_state_msg( int nil_phone, device_id_t device_id, int state ){
-	fibril_rwlock_read_lock( & nildummy_globals.protos_lock );
-	if( nildummy_globals.proto.phone ) il_device_state_msg( nildummy_globals.proto.phone, device_id, state, nildummy_globals.proto.service );
-	fibril_rwlock_read_unlock( & nildummy_globals.protos_lock );
-	return EOK;
-}
-
-int nil_initialize( int net_phone ){
+DEVICE_MAP_IMPLEMENT(nildummy_devices, nildummy_device_t)
+
+int nil_device_state_msg(int nil_phone, device_id_t device_id, int state){
+	fibril_rwlock_read_lock(&nildummy_globals.protos_lock);
+	if(nildummy_globals.proto.phone){
+		il_device_state_msg(nildummy_globals.proto.phone, device_id, state, nildummy_globals.proto.service);
+	}
+	fibril_rwlock_read_unlock(&nildummy_globals.protos_lock);
+	return EOK;
+}
+
+int nil_initialize(int net_phone){
 	ERROR_DECLARE;
 
-	fibril_rwlock_initialize( & nildummy_globals.devices_lock );
-	fibril_rwlock_initialize( & nildummy_globals.protos_lock );
-	fibril_rwlock_write_lock( & nildummy_globals.devices_lock );
-	fibril_rwlock_write_lock( & nildummy_globals.protos_lock );
+	fibril_rwlock_initialize(&nildummy_globals.devices_lock);
+	fibril_rwlock_initialize(&nildummy_globals.protos_lock);
+	fibril_rwlock_write_lock(&nildummy_globals.devices_lock);
+	fibril_rwlock_write_lock(&nildummy_globals.protos_lock);
 	nildummy_globals.net_phone = net_phone;
 	nildummy_globals.proto.phone = 0;
-	ERROR_PROPAGATE( nildummy_devices_initialize( & nildummy_globals.devices ));
-	fibril_rwlock_write_unlock( & nildummy_globals.protos_lock );
-	fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
-	return EOK;
-}
-
-int nildummy_device_message( device_id_t device_id, services_t service, size_t mtu ){
+	ERROR_PROPAGATE(nildummy_devices_initialize(&nildummy_globals.devices));
+	fibril_rwlock_write_unlock(&nildummy_globals.protos_lock);
+	fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
+	return EOK;
+}
+
+int nildummy_device_message(device_id_t device_id, services_t service, size_t mtu){
 	ERROR_DECLARE;
 
-	nildummy_device_ref	device;
-	int					index;
-
-	fibril_rwlock_write_lock( & nildummy_globals.devices_lock );
+	nildummy_device_ref device;
+	int index;
+
+	fibril_rwlock_write_lock(&nildummy_globals.devices_lock);
 	// an existing device?
-	device = nildummy_devices_find( & nildummy_globals.devices, device_id );
-	if( device ){
-		if( device->service != service ){
-			printf( "Device %d already exists\n", device->device_id );
-			fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
+	device = nildummy_devices_find(&nildummy_globals.devices, device_id);
+	if(device){
+		if(device->service != service){
+			printf("Device %d already exists\n", device->device_id);
+			fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
 			return EEXIST;
 		}else{
 			// update mtu
-			if( mtu > 0 ){
+			if(mtu > 0){
 				device->mtu = mtu;
 			}else{
 				device->mtu = NET_DEFAULT_MTU;
 			}
-			printf( "Device %d already exists:\tMTU\t= %d\n", device->device_id, device->mtu );
-			fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
+			printf("Device %d already exists:\tMTU\t= %d\n", device->device_id, device->mtu);
+			fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
 			// notify the upper layer module
-			fibril_rwlock_read_lock( & nildummy_globals.protos_lock );
-			if( nildummy_globals.proto.phone ){
-				il_mtu_changed_msg( nildummy_globals.proto.phone, device->device_id, device->mtu, nildummy_globals.proto.service );
+			fibril_rwlock_read_lock(&nildummy_globals.protos_lock);
+			if(nildummy_globals.proto.phone){
+				il_mtu_changed_msg(nildummy_globals.proto.phone, device->device_id, device->mtu, nildummy_globals.proto.service);
 			}
-			fibril_rwlock_read_unlock( & nildummy_globals.protos_lock );
+			fibril_rwlock_read_unlock(&nildummy_globals.protos_lock);
 			return EOK;
 		}
 	}else{
 		// create a new device
-		device = ( nildummy_device_ref ) malloc( sizeof( nildummy_device_t ));
-		if( ! device ) return ENOMEM;
+		device = (nildummy_device_ref) malloc(sizeof(nildummy_device_t));
+		if(! device){
+			return ENOMEM;
+		}
 		device->device_id = device_id;
 		device->service = service;
-		if( mtu > 0 ){
+		if(mtu > 0){
 			device->mtu = mtu;
 		}else{
@@ -202,156 +206,160 @@
 		}
 		// bind the device driver
-		device->phone = netif_bind_service( device->service, device->device_id, SERVICE_ETHERNET, nildummy_receiver );
-		if( device->phone < 0 ){
-			fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
-			free( device );
+		device->phone = netif_bind_service(device->service, device->device_id, SERVICE_ETHERNET, nildummy_receiver);
+		if(device->phone < 0){
+			fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
+			free(device);
 			return device->phone;
 		}
 		// get hardware address
-		if( ERROR_OCCURRED( netif_get_addr_req( device->phone, device->device_id, & device->addr, & device->addr_data ))){
-			fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
-			free( device );
+		if(ERROR_OCCURRED(netif_get_addr_req(device->phone, device->device_id, &device->addr, &device->addr_data))){
+			fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
+			free(device);
 			return ERROR_CODE;
 		}
 		// add to the cache
-		index = nildummy_devices_add( & nildummy_globals.devices, device->device_id, device );
-		if( index < 0 ){
-			fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
-			free( device->addr );
-			free( device->addr_data );
-			free( device );
+		index = nildummy_devices_add(&nildummy_globals.devices, device->device_id, device);
+		if(index < 0){
+			fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
+			free(device->addr);
+			free(device->addr_data);
+			free(device);
 			return index;
 		}
-		printf( "New device registered:\n\tid\t= %d\n\tservice\t= %d\n\tMTU\t= %d\n", device->device_id, device->service, device->mtu );
-	}
-	fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
-	return EOK;
-}
-
-int nildummy_addr_message( device_id_t device_id, measured_string_ref * address ){
-	nildummy_device_ref	device;
-
-	if( ! address ) return EBADMEM;
-	fibril_rwlock_read_lock( & nildummy_globals.devices_lock );
-	device = nildummy_devices_find( & nildummy_globals.devices, device_id );
-	if( ! device ){
-		fibril_rwlock_read_unlock( & nildummy_globals.devices_lock );
+		printf("New device registered:\n\tid\t= %d\n\tservice\t= %d\n\tMTU\t= %d\n", device->device_id, device->service, device->mtu);
+	}
+	fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
+	return EOK;
+}
+
+int nildummy_addr_message(device_id_t device_id, measured_string_ref * address){
+	nildummy_device_ref device;
+
+	if(! address){
+		return EBADMEM;
+	}
+	fibril_rwlock_read_lock(&nildummy_globals.devices_lock);
+	device = nildummy_devices_find(&nildummy_globals.devices, device_id);
+	if(! device){
+		fibril_rwlock_read_unlock(&nildummy_globals.devices_lock);
 		return ENOENT;
 	}
-	* address = device->addr;
-	fibril_rwlock_read_unlock( & nildummy_globals.devices_lock );
-	return ( * address ) ? EOK : ENOENT;
-}
-
-int nildummy_packet_space_message( device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix ){
-	nildummy_device_ref	device;
-
-	if( !( addr_len && prefix && content && suffix )) return EBADMEM;
-	fibril_rwlock_read_lock( & nildummy_globals.devices_lock );
-	device = nildummy_devices_find( & nildummy_globals.devices, device_id );
-	if( ! device ){
-		fibril_rwlock_read_unlock( & nildummy_globals.devices_lock );
+	*address = device->addr;
+	fibril_rwlock_read_unlock(&nildummy_globals.devices_lock);
+	return (*address) ? EOK : ENOENT;
+}
+
+int nildummy_packet_space_message(device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix){
+	nildummy_device_ref device;
+
+	if(!(addr_len && prefix && content && suffix)){
+		return EBADMEM;
+	}
+	fibril_rwlock_read_lock(&nildummy_globals.devices_lock);
+	device = nildummy_devices_find(&nildummy_globals.devices, device_id);
+	if(! device){
+		fibril_rwlock_read_unlock(&nildummy_globals.devices_lock);
 		return ENOENT;
 	}
-	* content = device->mtu;
-	fibril_rwlock_read_unlock( & nildummy_globals.devices_lock );
-	* addr_len = 0;
-	* prefix = 0;
-	* suffix = 0;
-	return EOK;
-}
-
-int nil_received_msg( int nil_phone, device_id_t device_id, packet_t packet, services_t target ){
-	packet_t		next;
-
-	fibril_rwlock_read_lock( & nildummy_globals.protos_lock );
-	if( nildummy_globals.proto.phone ){
+	*content = device->mtu;
+	fibril_rwlock_read_unlock(&nildummy_globals.devices_lock);
+	*addr_len = 0;
+	*prefix = 0;
+	*suffix = 0;
+	return EOK;
+}
+
+int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
+	packet_t next;
+
+	fibril_rwlock_read_lock(&nildummy_globals.protos_lock);
+	if(nildummy_globals.proto.phone){
 		do{
-			next = pq_detach( packet );
-			il_received_msg( nildummy_globals.proto.phone, device_id, packet, nildummy_globals.proto.service );
+			next = pq_detach(packet);
+			il_received_msg(nildummy_globals.proto.phone, device_id, packet, nildummy_globals.proto.service);
 			packet = next;
-		}while( packet );
-	}
-	fibril_rwlock_read_unlock( & nildummy_globals.protos_lock );
-	return EOK;
-}
-
-int nildummy_register_message( services_t service, int phone ){
-	fibril_rwlock_write_lock( & nildummy_globals.protos_lock );
+		}while(packet);
+	}
+	fibril_rwlock_read_unlock(&nildummy_globals.protos_lock);
+	return EOK;
+}
+
+int nildummy_register_message(services_t service, int phone){
+	fibril_rwlock_write_lock(&nildummy_globals.protos_lock);
 	nildummy_globals.proto.service = service;
 	nildummy_globals.proto.phone = phone;
-	printf( "New protocol registered:\n\tservice\t= %d\n\tphone\t= %d\n", nildummy_globals.proto.service, nildummy_globals.proto.phone );
-	fibril_rwlock_write_unlock( & nildummy_globals.protos_lock );
-	return EOK;
-}
-
-int nildummy_send_message( device_id_t device_id, packet_t packet, services_t sender ){
-	nildummy_device_ref		device;
-
-	fibril_rwlock_read_lock( & nildummy_globals.devices_lock );
-	device = nildummy_devices_find( & nildummy_globals.devices, device_id );
-	if( ! device ){
-		fibril_rwlock_read_unlock( & nildummy_globals.devices_lock );
+	printf("New protocol registered:\n\tservice\t= %d\n\tphone\t= %d\n", nildummy_globals.proto.service, nildummy_globals.proto.phone);
+	fibril_rwlock_write_unlock(&nildummy_globals.protos_lock);
+	return EOK;
+}
+
+int nildummy_send_message(device_id_t device_id, packet_t packet, services_t sender){
+	nildummy_device_ref device;
+
+	fibril_rwlock_read_lock(&nildummy_globals.devices_lock);
+	device = nildummy_devices_find(&nildummy_globals.devices, device_id);
+	if(! device){
+		fibril_rwlock_read_unlock(&nildummy_globals.devices_lock);
 		return ENOENT;
 	}
 	// send packet queue
-	if( packet ){
-		netif_send_msg( device->phone, device_id, packet, SERVICE_NILDUMMY );
-	}
-	fibril_rwlock_read_unlock( & nildummy_globals.devices_lock );
-	return EOK;
-}
-
-int nil_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+	if(packet){
+		netif_send_msg(device->phone, device_id, packet, SERVICE_NILDUMMY);
+	}
+	fibril_rwlock_read_unlock(&nildummy_globals.devices_lock);
+	return EOK;
+}
+
+int nil_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
-	measured_string_ref	address;
-	packet_t			packet;
-
-//	printf( "message %d - %d\n", IPC_GET_METHOD( * call ), NET_NIL_FIRST );
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+	measured_string_ref address;
+	packet_t packet;
+
+//	printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_NIL_FIRST);
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_NIL_DEVICE:
-			return nildummy_device_message( IPC_GET_DEVICE( call ), IPC_GET_SERVICE( call ), IPC_GET_MTU( call ));
+			return nildummy_device_message(IPC_GET_DEVICE(call), IPC_GET_SERVICE(call), IPC_GET_MTU(call));
 		case NET_NIL_SEND:
-			ERROR_PROPAGATE( packet_translate( nildummy_globals.net_phone, & packet, IPC_GET_PACKET( call )));
-			return nildummy_send_message( IPC_GET_DEVICE( call ), packet, IPC_GET_SERVICE( call ));
+			ERROR_PROPAGATE(packet_translate(nildummy_globals.net_phone, &packet, IPC_GET_PACKET(call)));
+			return nildummy_send_message(IPC_GET_DEVICE(call), packet, IPC_GET_SERVICE(call));
 		case NET_NIL_PACKET_SPACE:
-			ERROR_PROPAGATE( nildummy_packet_space_message( IPC_GET_DEVICE( call ), IPC_SET_ADDR( answer ), IPC_SET_PREFIX( answer ), IPC_SET_CONTENT( answer ), IPC_SET_SUFFIX( answer )));
-			* answer_count = 4;
+			ERROR_PROPAGATE(nildummy_packet_space_message(IPC_GET_DEVICE(call), IPC_SET_ADDR(answer), IPC_SET_PREFIX(answer), IPC_SET_CONTENT(answer), IPC_SET_SUFFIX(answer)));
+			*answer_count = 4;
 			return EOK;
 		case NET_NIL_ADDR:
-			ERROR_PROPAGATE( nildummy_addr_message( IPC_GET_DEVICE( call ), & address ));
-			return measured_strings_reply( address, 1 );
+			ERROR_PROPAGATE(nildummy_addr_message(IPC_GET_DEVICE(call), &address));
+			return measured_strings_reply(address, 1);
 		case IPC_M_CONNECT_TO_ME:
-			return nildummy_register_message( NIL_GET_PROTO( call ), IPC_GET_PHONE( call ));
+			return nildummy_register_message(NIL_GET_PROTO(call), IPC_GET_PHONE(call));
 	}
 	return ENOTSUP;
 }
 
-void nildummy_receiver( ipc_callid_t iid, ipc_call_t * icall ){
+void nildummy_receiver(ipc_callid_t iid, ipc_call_t * icall){
 	ERROR_DECLARE;
 
-	packet_t		packet;
-
-	while( true ){
-//		printf( "message %d - %d\n", IPC_GET_METHOD( * icall ), NET_NIL_FIRST );
-		switch( IPC_GET_METHOD( * icall )){
+	packet_t packet;
+
+	while(true){
+//		printf("message %d - %d\n", IPC_GET_METHOD(*icall), NET_NIL_FIRST);
+		switch(IPC_GET_METHOD(*icall)){
 			case NET_NIL_DEVICE_STATE:
-				ERROR_CODE = nil_device_state_msg( 0, IPC_GET_DEVICE( icall ), IPC_GET_STATE( icall ));
-				ipc_answer_0( iid, ( ipcarg_t ) ERROR_CODE );
+				ERROR_CODE = nil_device_state_msg(0, IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
+				ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
 				break;
 			case NET_NIL_RECEIVED:
-				if( ! ERROR_OCCURRED( packet_translate( nildummy_globals.net_phone, & packet, IPC_GET_PACKET( icall )))){
-					ERROR_CODE = nil_received_msg( 0, IPC_GET_DEVICE( icall ), packet, 0 );
+				if(! ERROR_OCCURRED(packet_translate(nildummy_globals.net_phone, &packet, IPC_GET_PACKET(icall)))){
+					ERROR_CODE = nil_received_msg(0, IPC_GET_DEVICE(icall), packet, 0);
 				}
-				ipc_answer_0( iid, ( ipcarg_t ) ERROR_CODE );
+				ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
 				break;
 			default:
-				ipc_answer_0( iid, ( ipcarg_t ) ENOTSUP );
-		}
-		iid = async_get_call( icall );
+				ipc_answer_0(iid, (ipcarg_t) ENOTSUP);
+		}
+		iid = async_get_call(icall);
 	}
 }
Index: uspace/srv/net/nil/nildummy/nildummy.h
===================================================================
--- uspace/srv/net/nil/nildummy/nildummy.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/nildummy/nildummy.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -73,5 +73,5 @@
  *  @see device.h
  */
-DEVICE_MAP_DECLARE( nildummy_devices, nildummy_device_t )
+DEVICE_MAP_DECLARE(nildummy_devices, nildummy_device_t)
 
 /** Dummy nil device specific data.
@@ -80,20 +80,20 @@
 	/** Device identifier.
 	 */
-	device_id_t			device_id;
+	device_id_t device_id;
 	/** Device driver service.
 	 */
-	services_t			service;
+	services_t service;
 	/** Driver phone.
 	 */
-	int					phone;
+	int phone;
 	/** Maximal transmission unit.
 	 */
-	size_t				mtu;
+	size_t mtu;
 	/** Actual device hardware address.
 	 */
-	measured_string_ref	addr;
+	measured_string_ref addr;
 	/** Actual device hardware address data.
 	 */
-	char *				addr_data;
+	char * addr_data;
 };
 
@@ -103,8 +103,8 @@
 	/** Protocol service.
 	 */
-	services_t	service;
+	services_t service;
 	/** Protocol module phone.
 	 */
-	int			phone;
+	int phone;
 };
 
@@ -114,17 +114,17 @@
 	/** Networking module phone.
 	 */
-	int				net_phone;
+	int net_phone;
 	/** Safety lock for devices.
 	 */
-	fibril_rwlock_t		devices_lock;
+	fibril_rwlock_t devices_lock;
 	/** All known Ethernet devices.
 	 */
-	nildummy_devices_t	devices;
+	nildummy_devices_t devices;
 	/** Safety lock for protocols.
 	 */
-	fibril_rwlock_t		protos_lock;
+	fibril_rwlock_t protos_lock;
 	/** Default protocol.
 	 */
-	nildummy_proto_t	proto;
+	nildummy_proto_t proto;
 };
 
Index: uspace/srv/net/nil/nildummy/nildummy_module.c
===================================================================
--- uspace/srv/net/nil/nildummy/nildummy_module.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/nil/nildummy/nildummy_module.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -59,5 +59,5 @@
 /** Prints the module name.
  */
-void	module_print_name( void );
+void module_print_name(void);
 
 /** Starts the dummy nil module.
@@ -69,5 +69,5 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int	module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
 /** Passes the parameters to the module specific nil_message() function.
@@ -80,21 +80,21 @@
  *  @returns Other error codes as defined for each specific module message function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
-void module_print_name( void ){
-	printf( "%s", NAME );
+void module_print_name(void){
+	printf("%s", NAME);
 }
 
-int module_start( async_client_conn_t client_connection ){
+int module_start(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ipcarg_t	phonehash;
-	int			net_phone;
+	ipcarg_t phonehash;
+	int net_phone;
 
-	async_set_client_connection( client_connection );
-	net_phone = net_connect_module( SERVICE_NETWORKING );
-	ERROR_PROPAGATE( pm_init());
-	if( ERROR_OCCURRED( nil_initialize( net_phone ))
-	|| ERROR_OCCURRED( REGISTER_ME( SERVICE_NILDUMMY, & phonehash ))){
+	async_set_client_connection(client_connection);
+	net_phone = net_connect_module(SERVICE_NETWORKING);
+	ERROR_PROPAGATE(pm_init());
+	if(ERROR_OCCURRED(nil_initialize(net_phone))
+		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_NILDUMMY, &phonehash))){
 		pm_destroy();
 		return ERROR_CODE;
@@ -107,6 +107,6 @@
 }
 
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	return nil_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return nil_message(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/self_test.c
===================================================================
--- uspace/srv/net/self_test.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/self_test.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -57,11 +57,11 @@
  *  @param[in] result The expected result.
  */
-#define TEST( name, function_call, result );	{	\
-	printf( "\n\t%s", ( name )); 					\
-	if(( function_call ) != ( result )){			\
-		printf( "\tERROR\n" );						\
+#define TEST(name, function_call, result);	{	\
+	printf("\n\t%s", (name)); 					\
+	if((function_call) != (result)){			\
+		printf("\tERROR\n");						\
 		error = 1;									\
 	}else{											\
-		printf( "\tOK\n" );							\
+		printf("\tOK\n");							\
 	}												\
 }
@@ -69,7 +69,7 @@
 #if NET_SELF_TEST_INT_MAP
 
-	INT_MAP_DECLARE( int_map, int );
-
-	INT_MAP_IMPLEMENT( int_map, int );
+	INT_MAP_DECLARE(int_map, int);
+
+	INT_MAP_IMPLEMENT(int_map, int);
 
 #endif
@@ -77,7 +77,7 @@
 #if NET_SELF_TEST_GENERIC_FIELD
 
-	GENERIC_FIELD_DECLARE( int_field, int )
-
-	GENERIC_FIELD_IMPLEMENT( int_field, int )
+	GENERIC_FIELD_DECLARE(int_field, int)
+
+	GENERIC_FIELD_IMPLEMENT(int_field, int)
 
 #endif
@@ -85,289 +85,308 @@
 #if NET_SELF_TEST_GENERIC_CHAR_MAP
 
-	GENERIC_CHAR_MAP_DECLARE( int_char_map, int )
-
-	GENERIC_CHAR_MAP_IMPLEMENT( int_char_map, int )
-
-#endif
-
-int self_test( void ){
-	int error = 0;
-	int * x, * y, * z, * u, * v, * w;
+	GENERIC_CHAR_MAP_DECLARE(int_char_map, int)
+
+	GENERIC_CHAR_MAP_IMPLEMENT(int_char_map, int)
+
+#endif
+
+int self_test(void){
+	int error;
+	int * x;
+	int * y;
+	int * z;
+	int * u;
+	int * v;
+	int * w;
+
+	error = 0;
 
 #if NET_SELF_TEST_MEASURED_STRINGS
-	measured_string_ref	string;
-
-	printf( "\nMeasured strings test" );
-	string = measured_string_create_bulk( "I am a measured string!", 0 );
-	printf( "\n%x, %s at %x of %d", string, string->value, string->value, string->length );
-	printf( "\nOK" );
+	measured_string_ref string;
+
+	printf("\nMeasured strings test");
+	string = measured_string_create_bulk("I am a measured string!", 0);
+	printf("\n%x, %s at %x of %d", string, string->value, string->value, string->length);
+	printf("\nOK");
 #endif
 
 #if NET_SELF_TEST_CHAR_MAP
-	char_map_t	cm;
-
-	printf( "\nChar map test" );
-	TEST( "update ucho 3 einval", char_map_update( & cm, "ucho", 0, 3 ), EINVAL );
-	TEST( "initialize", char_map_initialize( & cm ), EOK );
-	TEST( "exclude bla null", char_map_exclude( & cm, "bla", 0 ), CHAR_MAP_NULL );
-	TEST( "find bla null", char_map_find( & cm, "bla", 0 ), CHAR_MAP_NULL );
-	TEST( "add bla 1 eok", char_map_add( & cm, "bla", 0, 1 ), EOK );
-	TEST( "find bla 1", char_map_find( & cm, "bla", 0 ), 1 );
-	TEST( "add bla 10 eexists", char_map_add( & cm, "bla", 0, 10 ), EEXISTS );
-	TEST( "update bla 2 eok", char_map_update( & cm, "bla", 0, 2 ), EOK );
-	TEST( "find bla 2", char_map_find( & cm, "bla", 0 ), 2 );
-	TEST( "update ucho 2 eok", char_map_update( & cm, "ucho", 0, 2 ), EOK );
-	TEST( "exclude bla 2", char_map_exclude( & cm, "bla", 0 ), 2 );
-	TEST( "exclude bla null", char_map_exclude( & cm, "bla", 0 ), CHAR_MAP_NULL );
-	TEST( "find ucho 2", char_map_find( & cm, "ucho", 0 ), 2 );
-	TEST( "update ucho 3 eok", char_map_update( & cm, "ucho", 0, 3 ), EOK );
-	TEST( "find ucho 3", char_map_find( & cm, "ucho", 0 ), 3 );
-	TEST( "add blabla 5 eok", char_map_add( & cm, "blabla", 0, 5 ), EOK );
-	TEST( "find blabla 5", char_map_find( & cm, "blabla", 0 ), 5 );
-	TEST( "add bla 6 eok", char_map_add( & cm, "bla", 0, 6 ), EOK );
-	TEST( "find bla 6", char_map_find( & cm, "bla", 0 ), 6 );
-	TEST( "exclude bla 6", char_map_exclude( & cm, "bla", 0 ), 6 );
-	TEST( "find bla null", char_map_find( & cm, "bla", 0 ), CHAR_MAP_NULL );
-	TEST( "find blabla 5", char_map_find( & cm, "blabla", 0 ), 5 );
-	TEST( "add auto 7 eok", char_map_add( & cm, "auto", 0, 7 ), EOK );
-	TEST( "find auto 7", char_map_find( & cm, "auto", 0 ), 7 );
-	TEST( "add kara 8 eok", char_map_add( & cm, "kara", 0, 8 ), EOK );
-	TEST( "find kara 8", char_map_find( & cm, "kara", 0 ), 8 );
-	TEST( "add nic 9 eok", char_map_add( & cm, "nic", 0, 9 ), EOK );
-	TEST( "find nic 9", char_map_find( & cm, "nic", 0 ), 9 );
-	TEST( "find blabla 5", char_map_find( & cm, "blabla", 0 ), 5 );
-	TEST( "add micnicnic 5 9 eok", char_map_add( & cm, "micnicnic", 5, 9 ), EOK );
-	TEST( "find micni 9", char_map_find( & cm, "micni", 0 ), 9 );
-	TEST( "find micnicn 5 9", char_map_find( & cm, "micnicn", 5 ), 9 );
-	TEST( "add 10.0.2.2 4 15 eok", char_map_add( & cm, "\x10\x0\x2\x2", 4, 15 ), EOK );
-	TEST( "find 10.0.2.2 4 15", char_map_find( & cm, "\x10\x0\x2\x2", 4 ), 15 );
-	printf( "\n\tdestroy" );
-	char_map_destroy( & cm );
-	TEST( "update ucho 3 einval", char_map_update( & cm, "ucho", 0, 3 ), EINVAL );
-	printf( "\nOK" );
-
-	if( error ) return EINVAL;
+	char_map_t cm;
+
+	printf("\nChar map test");
+	TEST("update ucho 3 einval", char_map_update(&cm, "ucho", 0, 3), EINVAL);
+	TEST("initialize", char_map_initialize(&cm), EOK);
+	TEST("exclude bla null", char_map_exclude(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST("find bla null", char_map_find(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST("add bla 1 eok", char_map_add(&cm, "bla", 0, 1), EOK);
+	TEST("find bla 1", char_map_find(&cm, "bla", 0), 1);
+	TEST("add bla 10 eexists", char_map_add(&cm, "bla", 0, 10), EEXISTS);
+	TEST("update bla 2 eok", char_map_update(&cm, "bla", 0, 2), EOK);
+	TEST("find bla 2", char_map_find(&cm, "bla", 0), 2);
+	TEST("update ucho 2 eok", char_map_update(&cm, "ucho", 0, 2), EOK);
+	TEST("exclude bla 2", char_map_exclude(&cm, "bla", 0), 2);
+	TEST("exclude bla null", char_map_exclude(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST("find ucho 2", char_map_find(&cm, "ucho", 0), 2);
+	TEST("update ucho 3 eok", char_map_update(&cm, "ucho", 0, 3), EOK);
+	TEST("find ucho 3", char_map_find(&cm, "ucho", 0), 3);
+	TEST("add blabla 5 eok", char_map_add(&cm, "blabla", 0, 5), EOK);
+	TEST("find blabla 5", char_map_find(&cm, "blabla", 0), 5);
+	TEST("add bla 6 eok", char_map_add(&cm, "bla", 0, 6), EOK);
+	TEST("find bla 6", char_map_find(&cm, "bla", 0), 6);
+	TEST("exclude bla 6", char_map_exclude(&cm, "bla", 0), 6);
+	TEST("find bla null", char_map_find(&cm, "bla", 0), CHAR_MAP_NULL);
+	TEST("find blabla 5", char_map_find(&cm, "blabla", 0), 5);
+	TEST("add auto 7 eok", char_map_add(&cm, "auto", 0, 7), EOK);
+	TEST("find auto 7", char_map_find(&cm, "auto", 0), 7);
+	TEST("add kara 8 eok", char_map_add(&cm, "kara", 0, 8), EOK);
+	TEST("find kara 8", char_map_find(&cm, "kara", 0), 8);
+	TEST("add nic 9 eok", char_map_add(&cm, "nic", 0, 9), EOK);
+	TEST("find nic 9", char_map_find(&cm, "nic", 0), 9);
+	TEST("find blabla 5", char_map_find(&cm, "blabla", 0), 5);
+	TEST("add micnicnic 5 9 eok", char_map_add(&cm, "micnicnic", 5, 9), EOK);
+	TEST("find micni 9", char_map_find(&cm, "micni", 0), 9);
+	TEST("find micnicn 5 9", char_map_find(&cm, "micnicn", 5), 9);
+	TEST("add 10.0.2.2 4 15 eok", char_map_add(&cm, "\x10\x0\x2\x2", 4, 15), EOK);
+	TEST("find 10.0.2.2 4 15", char_map_find(&cm, "\x10\x0\x2\x2", 4), 15);
+	printf("\n\tdestroy");
+	char_map_destroy(&cm);
+	TEST("update ucho 3 einval", char_map_update(&cm, "ucho", 0, 3), EINVAL);
+	printf("\nOK");
+
+	if(error){
+		return EINVAL;
+	}
 
 #endif
 
 #if NET_SELF_TEST_INT_MAP
-	int_map_t	im;
-
-	x = ( int * ) malloc( sizeof( int ));
-	y = ( int * ) malloc( sizeof( int ));
-	z = ( int * ) malloc( sizeof( int ));
-	u = ( int * ) malloc( sizeof( int ));
-	v = ( int * ) malloc( sizeof( int ));
-	w = ( int * ) malloc( sizeof( int ));
+	int_map_t im;
+
+	x = (int *) malloc(sizeof(int));
+	y = (int *) malloc(sizeof(int));
+	z = (int *) malloc(sizeof(int));
+	u = (int *) malloc(sizeof(int));
+	v = (int *) malloc(sizeof(int));
+	w = (int *) malloc(sizeof(int));
 
 	im.magic = 0;
-	printf( "\nInt map test" );
-	TEST( "add 1 x einval", int_map_add( & im, 1, x ), EINVAL );
-	TEST( "count -1", int_map_count( & im ), -1 );
-	TEST( "initialize", int_map_initialize( & im ), EOK );
-	TEST( "count 0", int_map_count( & im ), 0 );
-	TEST( "find 1 null", int_map_find( & im, 1 ), NULL );
-	TEST( "add 1 x 0", int_map_add( & im, 1, x ), 0 );
-	TEST( "find 1 x", int_map_find( & im, 1 ), x );
-	int_map_exclude( & im, 1 );
-	TEST( "find 1 null", int_map_find( & im, 1 ), NULL );
-	TEST( "add 1 y 1", int_map_add( & im, 1, y ), 1 );
-	TEST( "find 1 y", int_map_find( & im, 1 ), y );
-	TEST( "add 4 z 2", int_map_add( & im, 4, z ), 2 );
-	TEST( "get 2 z", int_map_get_index( & im, 2 ), z );
-	TEST( "find 4 z", int_map_find( & im, 4 ), z );
-	TEST( "find 1 y", int_map_find( & im, 1 ), y );
-	TEST( "count 3", int_map_count( & im ), 3 );
-	TEST( "add 2 u 3", int_map_add( & im, 2, u ), 3 );
-	TEST( "find 2 u", int_map_find( & im, 2 ), u );
-	TEST( "add 3 v 4", int_map_add( & im, 3, v ), 4 );
-	TEST( "find 3 v", int_map_find( & im, 3 ), v );
-	TEST( "get 4 v", int_map_get_index( & im, 4 ), v );
-	TEST( "add 6 w 5", int_map_add( & im, 6, w ), 5 );
-	TEST( "find 6 w", int_map_find( & im, 6 ), w );
-	TEST( "count 6", int_map_count( & im ), 6 );
-	int_map_exclude( & im, 1 );
-	TEST( "find 1 null", int_map_find( & im, 1 ), NULL );
-	TEST( "find 2 u", int_map_find( & im, 2 ), u );
-	int_map_exclude( & im, 7 );
-	TEST( "find 2 u", int_map_find( & im, 2 ), u );
-	TEST( "find 6 w", int_map_find( & im, 6 ), w );
-	int_map_exclude_index( & im, 4 );
-	TEST( "get 4 null", int_map_get_index( & im, 4 ), NULL );
-	TEST( "find 3 null", int_map_find( & im, 3 ), NULL );
-	printf( "\n\tdestroy" );
-	int_map_destroy( & im );
-	TEST( "count -1", int_map_count( & im ), -1 );
-	printf( "\nOK" );
-
-	if( error ) return EINVAL;
+	printf("\nInt map test");
+	TEST("add 1 x einval", int_map_add(&im, 1, x), EINVAL);
+	TEST("count -1", int_map_count(&im), -1);
+	TEST("initialize", int_map_initialize(&im), EOK);
+	TEST("count 0", int_map_count(&im), 0);
+	TEST("find 1 null", int_map_find(&im, 1), NULL);
+	TEST("add 1 x 0", int_map_add(&im, 1, x), 0);
+	TEST("find 1 x", int_map_find(&im, 1), x);
+	int_map_exclude(&im, 1);
+	TEST("find 1 null", int_map_find(&im, 1), NULL);
+	TEST("add 1 y 1", int_map_add(&im, 1, y), 1);
+	TEST("find 1 y", int_map_find(&im, 1), y);
+	TEST("add 4 z 2", int_map_add(&im, 4, z), 2);
+	TEST("get 2 z", int_map_get_index(&im, 2), z);
+	TEST("find 4 z", int_map_find(&im, 4), z);
+	TEST("find 1 y", int_map_find(&im, 1), y);
+	TEST("count 3", int_map_count(&im), 3);
+	TEST("add 2 u 3", int_map_add(&im, 2, u), 3);
+	TEST("find 2 u", int_map_find(&im, 2), u);
+	TEST("add 3 v 4", int_map_add(&im, 3, v), 4);
+	TEST("find 3 v", int_map_find(&im, 3), v);
+	TEST("get 4 v", int_map_get_index(&im, 4), v);
+	TEST("add 6 w 5", int_map_add(&im, 6, w), 5);
+	TEST("find 6 w", int_map_find(&im, 6), w);
+	TEST("count 6", int_map_count(&im), 6);
+	int_map_exclude(&im, 1);
+	TEST("find 1 null", int_map_find(&im, 1), NULL);
+	TEST("find 2 u", int_map_find(&im, 2), u);
+	int_map_exclude(&im, 7);
+	TEST("find 2 u", int_map_find(&im, 2), u);
+	TEST("find 6 w", int_map_find(&im, 6), w);
+	int_map_exclude_index(&im, 4);
+	TEST("get 4 null", int_map_get_index(&im, 4), NULL);
+	TEST("find 3 null", int_map_find(&im, 3), NULL);
+	printf("\n\tdestroy");
+	int_map_destroy(&im);
+	TEST("count -1", int_map_count(&im), -1);
+	printf("\nOK");
+
+	if(error){
+		return EINVAL;
+	}
 
 #endif
 
 #if NET_SELF_TEST_GENERIC_FIELD
-	int_field_t	gf;
-
-	x = ( int * ) malloc( sizeof( int ));
-	y = ( int * ) malloc( sizeof( int ));
-	z = ( int * ) malloc( sizeof( int ));
-	u = ( int * ) malloc( sizeof( int ));
-	v = ( int * ) malloc( sizeof( int ));
-	w = ( int * ) malloc( sizeof( int ));
+	int_field_t gf;
+
+	x = (int *) malloc(sizeof(int));
+	y = (int *) malloc(sizeof(int));
+	z = (int *) malloc(sizeof(int));
+	u = (int *) malloc(sizeof(int));
+	v = (int *) malloc(sizeof(int));
+	w = (int *) malloc(sizeof(int));
 
 	gf.magic = 0;
-	printf( "\nGeneric field test" );
-	TEST( "add x einval", int_field_add( & gf, x ), EINVAL );
-	TEST( "count -1", int_field_count( & gf ), -1 );
-	TEST( "initialize", int_field_initialize( & gf ), EOK );
-	TEST( "count 0", int_field_count( & gf ), 0 );
-	TEST( "get 1 null", int_field_get_index( & gf, 1 ), NULL );
-	TEST( "add x 0", int_field_add( & gf, x ), 0 );
-	TEST( "get 0 x", int_field_get_index( & gf, 0 ), x );
-	int_field_exclude_index( & gf, 0 );
-	TEST( "get 0 null", int_field_get_index( & gf, 0 ), NULL );
-	TEST( "add y 1", int_field_add( & gf, y ), 1 );
-	TEST( "get 1 y", int_field_get_index( & gf, 1 ), y );
-	TEST( "add z 2", int_field_add( & gf, z ), 2 );
-	TEST( "get 2 z", int_field_get_index( & gf, 2 ), z );
-	TEST( "get 1 y", int_field_get_index( & gf, 1 ), y );
-	TEST( "count 3", int_field_count( & gf ), 3 );
-	TEST( "add u 3", int_field_add( & gf, u ), 3 );
-	TEST( "get 3 u", int_field_get_index( & gf, 3 ), u );
-	TEST( "add v 4", int_field_add( & gf, v ), 4 );
-	TEST( "get 4 v", int_field_get_index( & gf, 4 ), v );
-	TEST( "add w 5", int_field_add( & gf, w ), 5 );
-	TEST( "get 5 w", int_field_get_index( & gf, 5 ), w );
-	TEST( "count 6", int_field_count( & gf ), 6 );
-	int_field_exclude_index( & gf, 1 );
-	TEST( "get 1 null", int_field_get_index( & gf, 1 ), NULL );
-	TEST( "get 3 u", int_field_get_index( & gf, 3 ), u );
-	int_field_exclude_index( & gf, 7 );
-	TEST( "get 3 u", int_field_get_index( & gf, 3 ), u );
-	TEST( "get 5 w", int_field_get_index( & gf, 5 ), w );
-	int_field_exclude_index( & gf, 4 );
-	TEST( "get 4 null", int_field_get_index( & gf, 4 ), NULL );
-	printf( "\n\tdestroy" );
-	int_field_destroy( & gf );
-	TEST( "count -1", int_field_count( & gf ), -1 );
-	printf( "\nOK" );
-
-	if( error ) return EINVAL;
+	printf("\nGeneric field test");
+	TEST("add x einval", int_field_add(&gf, x), EINVAL);
+	TEST("count -1", int_field_count(&gf), -1);
+	TEST("initialize", int_field_initialize(&gf), EOK);
+	TEST("count 0", int_field_count(&gf), 0);
+	TEST("get 1 null", int_field_get_index(&gf, 1), NULL);
+	TEST("add x 0", int_field_add(&gf, x), 0);
+	TEST("get 0 x", int_field_get_index(&gf, 0), x);
+	int_field_exclude_index(&gf, 0);
+	TEST("get 0 null", int_field_get_index(&gf, 0), NULL);
+	TEST("add y 1", int_field_add(&gf, y), 1);
+	TEST("get 1 y", int_field_get_index(&gf, 1), y);
+	TEST("add z 2", int_field_add(&gf, z), 2);
+	TEST("get 2 z", int_field_get_index(&gf, 2), z);
+	TEST("get 1 y", int_field_get_index(&gf, 1), y);
+	TEST("count 3", int_field_count(&gf), 3);
+	TEST("add u 3", int_field_add(&gf, u), 3);
+	TEST("get 3 u", int_field_get_index(&gf, 3), u);
+	TEST("add v 4", int_field_add(&gf, v), 4);
+	TEST("get 4 v", int_field_get_index(&gf, 4), v);
+	TEST("add w 5", int_field_add(&gf, w), 5);
+	TEST("get 5 w", int_field_get_index(&gf, 5), w);
+	TEST("count 6", int_field_count(&gf), 6);
+	int_field_exclude_index(&gf, 1);
+	TEST("get 1 null", int_field_get_index(&gf, 1), NULL);
+	TEST("get 3 u", int_field_get_index(&gf, 3), u);
+	int_field_exclude_index(&gf, 7);
+	TEST("get 3 u", int_field_get_index(&gf, 3), u);
+	TEST("get 5 w", int_field_get_index(&gf, 5), w);
+	int_field_exclude_index(&gf, 4);
+	TEST("get 4 null", int_field_get_index(&gf, 4), NULL);
+	printf("\n\tdestroy");
+	int_field_destroy(&gf);
+	TEST("count -1", int_field_count(&gf), -1);
+	printf("\nOK");
+
+	if(error){
+		return EINVAL;
+	}
 
 #endif
 
 #if NET_SELF_TEST_GENERIC_CHAR_MAP
-	int_char_map_t	icm;
-
-	x = ( int * ) malloc( sizeof( int ));
-	y = ( int * ) malloc( sizeof( int ));
-	z = ( int * ) malloc( sizeof( int ));
-	u = ( int * ) malloc( sizeof( int ));
-	v = ( int * ) malloc( sizeof( int ));
-	w = ( int * ) malloc( sizeof( int ));
+	int_char_map_t icm;
+
+	x = (int *) malloc(sizeof(int));
+	y = (int *) malloc(sizeof(int));
+	z = (int *) malloc(sizeof(int));
+	u = (int *) malloc(sizeof(int));
+	v = (int *) malloc(sizeof(int));
+	w = (int *) malloc(sizeof(int));
 
 	icm.magic = 0;
-	printf( "\nGeneric char map test" );
-	TEST( "add ucho z einval", int_char_map_add( & icm, "ucho", 0, z ), EINVAL );
-	TEST( "initialize", int_char_map_initialize( & icm ), EOK );
-	printf( "\n\texclude bla null" );
-	int_char_map_exclude( & icm, "bla", 0 );
-	TEST( "find bla null", int_char_map_find( & icm, "bla", 0 ), NULL );
-	TEST( "add bla x eok", int_char_map_add( & icm, "bla", 0, x ), EOK );
-	TEST( "find bla x", int_char_map_find( & icm, "bla", 0 ), x );
-	TEST( "add bla y eexists", int_char_map_add( & icm, "bla", 0, y ), EEXISTS );
-	printf( "\n\texclude bla y" );
-	int_char_map_exclude( & icm, "bla", 0 );
-	printf( "\n\texclude bla null" );
-	int_char_map_exclude( & icm, "bla", 0 );
-	TEST( "add blabla v eok", int_char_map_add( & icm, "blabla", 0, v ), EOK );
-	TEST( "find blabla v", int_char_map_find( & icm, "blabla", 0 ), v );
-	TEST( "add bla w eok", int_char_map_add( & icm, "bla", 0, w ), EOK );
-	TEST( "find bla w", int_char_map_find( & icm, "bla", 0 ), w );
-	printf( "\n\texclude bla" );
-	int_char_map_exclude( & icm, "bla", 0 );
-	TEST( "find bla null", int_char_map_find( & icm, "bla", 0 ), NULL );
-	TEST( "find blabla v", int_char_map_find( & icm, "blabla", 0 ), v );
-	TEST( "add auto u eok", int_char_map_add( & icm, "auto", 0, u ), EOK );
-	TEST( "find auto u", int_char_map_find( & icm, "auto", 0 ), u );
-	printf( "\n\tdestroy" );
-	int_char_map_destroy( & icm );
-	TEST( "add ucho z einval", int_char_map_add( & icm, "ucho", 0, z ), EINVAL );
-	printf( "\nOK" );
-
-	if( error ) return EINVAL;
+	printf("\nGeneric char map test");
+	TEST("add ucho z einval", int_char_map_add(&icm, "ucho", 0, z), EINVAL);
+	TEST("initialize", int_char_map_initialize(&icm), EOK);
+	printf("\n\texclude bla null");
+	int_char_map_exclude(&icm, "bla", 0);
+	TEST("find bla null", int_char_map_find(&icm, "bla", 0), NULL);
+	TEST("add bla x eok", int_char_map_add(&icm, "bla", 0, x), EOK);
+	TEST("find bla x", int_char_map_find(&icm, "bla", 0), x);
+	TEST("add bla y eexists", int_char_map_add(&icm, "bla", 0, y), EEXISTS);
+	printf("\n\texclude bla y");
+	int_char_map_exclude(&icm, "bla", 0);
+	printf("\n\texclude bla null");
+	int_char_map_exclude(&icm, "bla", 0);
+	TEST("add blabla v eok", int_char_map_add(&icm, "blabla", 0, v), EOK);
+	TEST("find blabla v", int_char_map_find(&icm, "blabla", 0), v);
+	TEST("add bla w eok", int_char_map_add(&icm, "bla", 0, w), EOK);
+	TEST("find bla w", int_char_map_find(&icm, "bla", 0), w);
+	printf("\n\texclude bla");
+	int_char_map_exclude(&icm, "bla", 0);
+	TEST("find bla null", int_char_map_find(&icm, "bla", 0), NULL);
+	TEST("find blabla v", int_char_map_find(&icm, "blabla", 0), v);
+	TEST("add auto u eok", int_char_map_add(&icm, "auto", 0, u), EOK);
+	TEST("find auto u", int_char_map_find(&icm, "auto", 0), u);
+	printf("\n\tdestroy");
+	int_char_map_destroy(&icm);
+	TEST("add ucho z einval", int_char_map_add(&icm, "ucho", 0, z), EINVAL);
+	printf("\nOK");
+
+	if(error){
+		return EINVAL;
+	}
 
 #endif
 
 #if NET_SELF_TEST_CRC
-	uint32_t	value;
-
-	printf( "\nCRC computation test" );
-	value = ~ compute_crc32( ~ 0, "123456789", 8 * 9 );
-	TEST( "123456789", value, 0xCBF43926 );
-	printf( "\t=> %X", value );
-	value = ~ compute_crc32( ~ 0, "1", 8 );
-	TEST( "1", value, 0x83DCEFB7 );
-	printf( "\t=> %X", value );
-	value = ~ compute_crc32( ~ 0, "12", 8 * 2 );
-	TEST( "12", value, 0x4F5344CD );
-	printf( "\t=> %X", value );
-	value = ~ compute_crc32( ~ 0, "123", 8 * 3 );
-	TEST( "123", value, 0x884863D2 );
-	printf( "\t=> %X", value );
-	value = ~ compute_crc32( ~ 0, "1234", 8 * 4 );
-	TEST( "1234", value, 0x9BE3E0A3 );
-	printf( "\t=> %X", value );
-	value = ~ compute_crc32( ~ 0, "12345678", 8 * 8 );
-	TEST( "12345678", value, 0x9AE0DAAF );
-	printf( "\t=> %X", value );
-	value = ~ compute_crc32( ~ 0, "ahoj pane", 8 * 9 );
-	TEST( "ahoj pane", value, 0x5FC3D706 );
-	printf( "\t=> %X", value );
-
-	if( error ) return EINVAL;
+	uint32_t value;
+
+	printf("\nCRC computation test");
+	value = ~ compute_crc32(~ 0, "123456789", 8 * 9);
+	TEST("123456789", value, 0xCBF43926);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "1", 8);
+	TEST("1", value, 0x83DCEFB7);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "12", 8 * 2);
+	TEST("12", value, 0x4F5344CD);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "123", 8 * 3);
+	TEST("123", value, 0x884863D2);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "1234", 8 * 4);
+	TEST("1234", value, 0x9BE3E0A3);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "12345678", 8 * 8);
+	TEST("12345678", value, 0x9AE0DAAF);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "ahoj pane", 8 * 9);
+	TEST("ahoj pane", value, 0x5FC3D706);
+	printf("\t=> %X", value);
+
+	if(error){
+		return EINVAL;
+	}
 
 #endif
 
 #if NET_SELF_TEST_DYNAMIC_FIFO
-	dyn_fifo_t	fifo;
-
-	printf( "\nDynamic fifo test" );
-	TEST( "add 1 einval", dyn_fifo_push( & fifo, 1, 0 ), EINVAL );
-	TEST( "initialize", dyn_fifo_initialize( & fifo, 1 ), EOK );
-	TEST( "add 1 eok", dyn_fifo_push( & fifo, 1, 0 ), EOK );
-	TEST( "pop 1", dyn_fifo_pop( & fifo ), 1 );
-	TEST( "pop enoent", dyn_fifo_pop( & fifo ), ENOENT );
-	TEST( "add 2 eok", dyn_fifo_push( & fifo, 2, 1 ), EOK );
-	TEST( "add 3 enomem", dyn_fifo_push( & fifo, 3, 1 ), ENOMEM );
-	TEST( "add 3 eok", dyn_fifo_push( & fifo, 3, 0 ), EOK );
-	TEST( "pop 2", dyn_fifo_pop( & fifo ), 2 );
-	TEST( "pop 3", dyn_fifo_pop( & fifo ), 3 );
-	TEST( "add 4 eok", dyn_fifo_push( & fifo, 4, 2 ), EOK );
-	TEST( "add 5 eok", dyn_fifo_push( & fifo, 5, 2 ), EOK );
-	TEST( "add 6 enomem", dyn_fifo_push( & fifo, 6, 2 ), ENOMEM );
-	TEST( "add 6 eok", dyn_fifo_push( & fifo, 6, 5 ), EOK );
-	TEST( "add 7 eok", dyn_fifo_push( & fifo, 7, 5 ), EOK );
-	TEST( "pop 4", dyn_fifo_pop( & fifo ), 4 );
-	TEST( "pop 5", dyn_fifo_pop( & fifo ), 5 );
-	TEST( "add 8 eok", dyn_fifo_push( & fifo, 8, 5 ), EOK );
-	TEST( "add 9 eok", dyn_fifo_push( & fifo, 9, 5 ), EOK );
-	TEST( "add 10 eok", dyn_fifo_push( & fifo, 10, 6 ), EOK );
-	TEST( "add 11 eok", dyn_fifo_push( & fifo, 11, 6 ), EOK );
-	TEST( "pop 6", dyn_fifo_pop( & fifo ), 6 );
-	TEST( "pop 7", dyn_fifo_pop( & fifo ), 7 );
-	TEST( "add 12 eok", dyn_fifo_push( & fifo, 12, 6 ), EOK );
-	TEST( "add 13 eok", dyn_fifo_push( & fifo, 13, 6 ), EOK );
-	TEST( "add 14 enomem", dyn_fifo_push( & fifo, 14, 6 ), ENOMEM );
-	TEST( "add 14 eok", dyn_fifo_push( & fifo, 14, 8 ), EOK );
-	TEST( "pop 8", dyn_fifo_pop( & fifo ), 8 );
-	TEST( "pop 9", dyn_fifo_pop( & fifo ), 9 );
-	TEST( "pop 10", dyn_fifo_pop( & fifo ), 10 );
-	TEST( "pop 11", dyn_fifo_pop( & fifo ), 11 );
-	TEST( "pop 12", dyn_fifo_pop( & fifo ), 12 );
-	TEST( "pop 13", dyn_fifo_pop( & fifo ), 13 );
-	TEST( "pop 14", dyn_fifo_pop( & fifo ), 14 );
-	TEST( "destroy", dyn_fifo_destroy( & fifo ), EOK );
-	TEST( "add 15 einval", dyn_fifo_push( & fifo, 1, 0 ), EINVAL );
-	if( error ) return EINVAL;
+	dyn_fifo_t fifo;
+
+	printf("\nDynamic fifo test");
+	TEST("add 1 einval", dyn_fifo_push(&fifo, 1, 0), EINVAL);
+	TEST("initialize", dyn_fifo_initialize(&fifo, 1), EOK);
+	TEST("add 1 eok", dyn_fifo_push(&fifo, 1, 0), EOK);
+	TEST("pop 1", dyn_fifo_pop(&fifo), 1);
+	TEST("pop enoent", dyn_fifo_pop(&fifo), ENOENT);
+	TEST("add 2 eok", dyn_fifo_push(&fifo, 2, 1), EOK);
+	TEST("add 3 enomem", dyn_fifo_push(&fifo, 3, 1), ENOMEM);
+	TEST("add 3 eok", dyn_fifo_push(&fifo, 3, 0), EOK);
+	TEST("pop 2", dyn_fifo_pop(&fifo), 2);
+	TEST("pop 3", dyn_fifo_pop(&fifo), 3);
+	TEST("add 4 eok", dyn_fifo_push(&fifo, 4, 2), EOK);
+	TEST("add 5 eok", dyn_fifo_push(&fifo, 5, 2), EOK);
+	TEST("add 6 enomem", dyn_fifo_push(&fifo, 6, 2), ENOMEM);
+	TEST("add 6 eok", dyn_fifo_push(&fifo, 6, 5), EOK);
+	TEST("add 7 eok", dyn_fifo_push(&fifo, 7, 5), EOK);
+	TEST("pop 4", dyn_fifo_pop(&fifo), 4);
+	TEST("pop 5", dyn_fifo_pop(&fifo), 5);
+	TEST("add 8 eok", dyn_fifo_push(&fifo, 8, 5), EOK);
+	TEST("add 9 eok", dyn_fifo_push(&fifo, 9, 5), EOK);
+	TEST("add 10 eok", dyn_fifo_push(&fifo, 10, 6), EOK);
+	TEST("add 11 eok", dyn_fifo_push(&fifo, 11, 6), EOK);
+	TEST("pop 6", dyn_fifo_pop(&fifo), 6);
+	TEST("pop 7", dyn_fifo_pop(&fifo), 7);
+	TEST("add 12 eok", dyn_fifo_push(&fifo, 12, 6), EOK);
+	TEST("add 13 eok", dyn_fifo_push(&fifo, 13, 6), EOK);
+	TEST("add 14 enomem", dyn_fifo_push(&fifo, 14, 6), ENOMEM);
+	TEST("add 14 eok", dyn_fifo_push(&fifo, 14, 8), EOK);
+	TEST("pop 8", dyn_fifo_pop(&fifo), 8);
+	TEST("pop 9", dyn_fifo_pop(&fifo), 9);
+	TEST("pop 10", dyn_fifo_pop(&fifo), 10);
+	TEST("pop 11", dyn_fifo_pop(&fifo), 11);
+	TEST("pop 12", dyn_fifo_pop(&fifo), 12);
+	TEST("pop 13", dyn_fifo_pop(&fifo), 13);
+	TEST("pop 14", dyn_fifo_pop(&fifo), 14);
+	TEST("destroy", dyn_fifo_destroy(&fifo), EOK);
+	TEST("add 15 einval", dyn_fifo_push(&fifo, 1, 0), EINVAL);
+	if(error){
+		return EINVAL;
+	}
 
 #endif
Index: uspace/srv/net/self_test.h
===================================================================
--- uspace/srv/net/self_test.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/self_test.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -49,5 +49,5 @@
 #if NET_SELF_TEST
 
-int	self_test( void );
+int self_test(void);
 
 #else
Index: uspace/srv/net/socket/socket_client.c
===================================================================
--- uspace/srv/net/socket/socket_client.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/socket/socket_client.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -75,5 +75,5 @@
 /** Default timeout for connections in microseconds.
  */
-#define SOCKET_CONNECT_TIMEOUT	( 1 * 1000 * 1000 )
+#define SOCKET_CONNECT_TIMEOUT	(1 * 1000 * 1000)
 
 /** Maximum number of random attempts to find a new socket identifier before switching to the sequence.
@@ -97,51 +97,51 @@
 	/** Socket identifier.
 	 */
-	int					socket_id;
+	int socket_id;
 	/** Parent module phone.
 	 */
-	int					phone;
+	int phone;
 	/** Parent module service.
 	 */
-	services_t			service;
+	services_t service;
 	/** Underlying protocol header size.
 	 *  Sending and receiving optimalization.
 	 */
-	size_t				header_size;
+	size_t header_size;
 	/** Packet data fragment size.
 	 *  Sending optimalization.
 	 */
-	size_t				data_fragment_size;
+	size_t data_fragment_size;
 	/** Sending safety lock.
 	 *  Locks the header_size and data_fragment_size attributes.
 	 */
-	fibril_rwlock_t		sending_lock;
+	fibril_rwlock_t sending_lock;
 	/** Received packets queue.
 	 */
-	dyn_fifo_t			received;
+	dyn_fifo_t received;
 	/** Received packets safety lock.
 	 *  Used for receiving and receive notifications.
 	 *  Locks the received attribute.
 	 */
-	fibril_mutex_t		receive_lock;
+	fibril_mutex_t receive_lock;
 	/** Received packets signaling.
 	 *  Signaled upon receive notification.
 	 */
-	fibril_condvar_t	receive_signal;
+	fibril_condvar_t receive_signal;
 	/** Waiting sockets queue.
 	 */
-	dyn_fifo_t			accepted;
+	dyn_fifo_t accepted;
 	/** Waiting sockets safety lock.
 	 *  Used for accepting and accept notifications.
 	 *  Locks the accepted attribute.
 	 */
-	fibril_mutex_t		accept_lock;
+	fibril_mutex_t accept_lock;
 	/** Waiting sockets signaling.
 	 *  Signaled upon accept notification.
 	 */
-	fibril_condvar_t	accept_signal;
+	fibril_condvar_t accept_signal;
 	/** The number of blocked functions called.
 	 *  Used while waiting for the received packets or accepted sockets.
 	 */
-	int					blocked;
+	int blocked;
 };
 
@@ -150,5 +150,5 @@
  *  @see int_map.h
  */
-INT_MAP_DECLARE( sockets, socket_t );
+INT_MAP_DECLARE(sockets, socket_t);
 
 /** Socket client library global data.
@@ -157,8 +157,8 @@
 	/** TCP module phone.
 	 */
-	int	tcp_phone;
+	int tcp_phone;
 	/** UDP module phone.
 	 */
-	int	udp_phone;
+	int udp_phone;
 //	/** The last socket identifier.
 //	 */
@@ -166,5 +166,5 @@
 	/** Active sockets.
 	 */
-	sockets_ref	sockets;
+	sockets_ref sockets;
 	/** Safety lock.
 	 *  Write lock is used only for adding or removing sockets.
@@ -173,5 +173,5 @@
 	 *  No socket lock may be locked if this lock is unlocked.
 	 */
-	fibril_rwlock_t	lock;
+	fibril_rwlock_t lock;
 } socket_globals = {
 	.tcp_phone = -1,
@@ -183,11 +183,11 @@
 		.writers = 0,
 		.waiters = {
-			.prev = & socket_globals.lock.waiters,
-			.next = & socket_globals.lock.waiters
+			.prev = &socket_globals.lock.waiters,
+			.next = &socket_globals.lock.waiters
 		}
 	}
 };
 
-INT_MAP_IMPLEMENT( sockets, socket_t );
+INT_MAP_IMPLEMENT(sockets, socket_t);
 
 /** Returns the TCP module phone.
@@ -196,5 +196,5 @@
  *  @returns Other error codes as defined for the bind_service_timeout() function.
  */
-static int	socket_get_tcp_phone( void );
+static int socket_get_tcp_phone(void);
 
 /** Returns the UDP module phone.
@@ -203,10 +203,10 @@
  *  @returns Other error codes as defined for the bind_service_timeout() function.
  */
-static int	socket_get_udp_phone( void );
+static int socket_get_udp_phone(void);
 
 /** Returns the active sockets.
  *  @returns The active sockets.
  */
-static sockets_ref	socket_get_sockets( void );
+static sockets_ref socket_get_sockets(void);
 
 /** Tries to find a new free socket identifier.
@@ -214,5 +214,5 @@
  *  @returns ELIMIT if there is no socket identifier available.
  */
-static int	socket_generate_new_id( void );
+static int socket_generate_new_id(void);
 
 /** Default thread for new connections.
@@ -220,5 +220,5 @@
  *  @param[in] icall The initial message call structure.
  */
-void	socket_connection( ipc_callid_t iid, ipc_call_t * icall );
+void socket_connection(ipc_callid_t iid, ipc_call_t * icall);
 
 /** Sends message to the socket parent module with specified data.
@@ -234,5 +234,5 @@
  *  @returns Other error codes as defined for the spcific message.
  */
-int	socket_send_data( int socket_id, ipcarg_t message, ipcarg_t arg2, const void * data, size_t datalength );
+int socket_send_data(int socket_id, ipcarg_t message, ipcarg_t arg2, const void * data, size_t datalength);
 
 /** Initializes a new socket specific data.
@@ -242,10 +242,10 @@
  *  @param[in] service The parent module service.
  */
-void	socket_initialize( socket_ref socket, int socket_id, int phone, services_t service );
+void socket_initialize(socket_ref socket, int socket_id, int phone, services_t service);
 
 /** Clears and destroys the socket.
  *  @param[in] socket The socket to be destroyed.
  */
-void	socket_destroy( socket_ref socket );
+void socket_destroy(socket_ref socket);
 
 /** Receives data via the socket.
@@ -263,5 +263,5 @@
  *  @returns Other error codes as defined for the spcific message.
  */
-int	recvfrom_core( ipcarg_t message, int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen );
+int recvfrom_core(ipcarg_t message, int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen);
 
 /** Sends data via the socket to the remote address.
@@ -280,37 +280,39 @@
  *  @returns Other error codes as defined for the NET_SOCKET_SENDTO message.
  */
-int	sendto_core( ipcarg_t message, int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen );
-
-static int socket_get_tcp_phone( void ){
-	if( socket_globals.tcp_phone < 0 ){
-		socket_globals.tcp_phone = bind_service_timeout( SERVICE_TCP, 0, 0, SERVICE_TCP, socket_connection, SOCKET_CONNECT_TIMEOUT );
+int sendto_core(ipcarg_t message, int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen);
+
+static int socket_get_tcp_phone(void){
+	if(socket_globals.tcp_phone < 0){
+		socket_globals.tcp_phone = bind_service_timeout(SERVICE_TCP, 0, 0, SERVICE_TCP, socket_connection, SOCKET_CONNECT_TIMEOUT);
 	}
 	return socket_globals.tcp_phone;
 }
 
-static int socket_get_udp_phone( void ){
-	if( socket_globals.udp_phone < 0 ){
-		socket_globals.udp_phone = bind_service_timeout( SERVICE_UDP, 0, 0, SERVICE_UDP, socket_connection, SOCKET_CONNECT_TIMEOUT );
+static int socket_get_udp_phone(void){
+	if(socket_globals.udp_phone < 0){
+		socket_globals.udp_phone = bind_service_timeout(SERVICE_UDP, 0, 0, SERVICE_UDP, socket_connection, SOCKET_CONNECT_TIMEOUT);
 	}
 	return socket_globals.udp_phone;
 }
 
-static sockets_ref socket_get_sockets( void ){
-	if( ! socket_globals.sockets ){
-		socket_globals.sockets = ( sockets_ref ) malloc( sizeof( sockets_t ));
-		if( ! socket_globals.sockets ) return NULL;
-		if( sockets_initialize( socket_globals.sockets ) != EOK ){
-			free( socket_globals.sockets );
+static sockets_ref socket_get_sockets(void){
+	if(! socket_globals.sockets){
+		socket_globals.sockets = (sockets_ref) malloc(sizeof(sockets_t));
+		if(! socket_globals.sockets){
+			return NULL;
+		}
+		if(sockets_initialize(socket_globals.sockets) != EOK){
+			free(socket_globals.sockets);
 			socket_globals.sockets = NULL;
 		}
-		srand( task_get_id());
+		srand(task_get_id());
 	}
 	return socket_globals.sockets;
 }
 
-static int socket_generate_new_id( void ){
-	sockets_ref	sockets;
-	int			socket_id;
-	int			count;
+static int socket_generate_new_id(void){
+	sockets_ref sockets;
+	int socket_id;
+	int count;
 
 	sockets = socket_get_sockets();
@@ -318,15 +320,15 @@
 //	socket_id = socket_globals.last_id;
 	do{
-		if( count < SOCKET_ID_TRIES ){
+		if(count < SOCKET_ID_TRIES){
 			socket_id = rand() % INT_MAX;
 			++ count;
-		}else if( count == SOCKET_ID_TRIES ){
+		}else if(count == SOCKET_ID_TRIES){
 			socket_id = 1;
 			++ count;
 		// only this branch for last_id
 		}else{
-			if( socket_id < INT_MAX ){
+			if(socket_id < INT_MAX){
 				++ socket_id;
-/*			}else if( socket_globals.last_id ){
+/*			}else if(socket_globals.last_id){
 *				socket_globals.last_id = 0;
 *				socket_id = 1;
@@ -335,96 +337,98 @@
 			}
 		}
-	}while( sockets_find( sockets, socket_id ));
+	}while(sockets_find(sockets, socket_id));
 //	last_id = socket_id
 	return socket_id;
 }
 
-void socket_initialize( socket_ref socket, int socket_id, int phone, services_t service ){
+void socket_initialize(socket_ref socket, int socket_id, int phone, services_t service){
 	socket->socket_id = socket_id;
 	socket->phone = phone;
 	socket->service = service;
-	dyn_fifo_initialize( & socket->received, SOCKET_INITIAL_RECEIVED_SIZE );
-	dyn_fifo_initialize( & socket->accepted, SOCKET_INITIAL_ACCEPTED_SIZE );
-	fibril_mutex_initialize( & socket->receive_lock );
-	fibril_condvar_initialize( & socket->receive_signal );
-	fibril_mutex_initialize( & socket->accept_lock );
-	fibril_condvar_initialize( & socket->accept_signal );
-	fibril_rwlock_initialize( & socket->sending_lock );
-}
-
-void socket_connection( ipc_callid_t iid, ipc_call_t * icall ){
+	dyn_fifo_initialize(&socket->received, SOCKET_INITIAL_RECEIVED_SIZE);
+	dyn_fifo_initialize(&socket->accepted, SOCKET_INITIAL_ACCEPTED_SIZE);
+	fibril_mutex_initialize(&socket->receive_lock);
+	fibril_condvar_initialize(&socket->receive_signal);
+	fibril_mutex_initialize(&socket->accept_lock);
+	fibril_condvar_initialize(&socket->accept_signal);
+	fibril_rwlock_initialize(&socket->sending_lock);
+}
+
+void socket_connection(ipc_callid_t iid, ipc_call_t * icall){
 	ERROR_DECLARE;
 
-	ipc_callid_t	callid;
-	ipc_call_t		call;
-	socket_ref		socket;
-
-	while( true ){
-
-		callid = async_get_call( & call );
-		switch( IPC_GET_METHOD( call )){
+	ipc_callid_t callid;
+	ipc_call_t call;
+	socket_ref socket;
+
+	while(true){
+
+		callid = async_get_call(&call);
+		switch(IPC_GET_METHOD(call)){
 			case NET_SOCKET_RECEIVED:
 			case NET_SOCKET_ACCEPTED:
 			case NET_SOCKET_DATA_FRAGMENT_SIZE:
-				fibril_rwlock_read_lock( & socket_globals.lock );
+				fibril_rwlock_read_lock(&socket_globals.lock);
 				// find the socket
-				socket = sockets_find( socket_get_sockets(), SOCKET_GET_SOCKET_ID( call ));
-				if( ! socket ){
+				socket = sockets_find(socket_get_sockets(), SOCKET_GET_SOCKET_ID(call));
+				if(! socket){
 					ERROR_CODE = ENOTSOCK;
 				}else{
-					switch( IPC_GET_METHOD( call )){
+					switch(IPC_GET_METHOD(call)){
 						case NET_SOCKET_RECEIVED:
-							fibril_mutex_lock( & socket->receive_lock );
+							fibril_mutex_lock(&socket->receive_lock);
 							// push the number of received packet fragments
-							if( ! ERROR_OCCURRED( dyn_fifo_push( & socket->received, SOCKET_GET_DATA_FRAGMENTS( call ), SOCKET_MAX_RECEIVED_SIZE ))){
+							if(! ERROR_OCCURRED(dyn_fifo_push(&socket->received, SOCKET_GET_DATA_FRAGMENTS(call), SOCKET_MAX_RECEIVED_SIZE))){
 								// signal the received packet
-								fibril_condvar_signal( & socket->receive_signal );
+								fibril_condvar_signal(&socket->receive_signal);
 							}
-							fibril_mutex_unlock( & socket->receive_lock );
+							fibril_mutex_unlock(&socket->receive_lock);
 							break;
 						case NET_SOCKET_ACCEPTED:
 							// push the new socket identifier
-							fibril_mutex_lock( & socket->accept_lock );
-							if( ! ERROR_OCCURRED( dyn_fifo_push( & socket->accepted, 1, SOCKET_MAX_ACCEPTED_SIZE ))){
+							fibril_mutex_lock(&socket->accept_lock);
+							if(! ERROR_OCCURRED(dyn_fifo_push(&socket->accepted, 1, SOCKET_MAX_ACCEPTED_SIZE))){
 								// signal the accepted socket
-								fibril_condvar_signal( & socket->accept_signal );
+								fibril_condvar_signal(&socket->accept_signal);
 							}
-							fibril_mutex_unlock( & socket->accept_lock );
+							fibril_mutex_unlock(&socket->accept_lock);
 							break;
 						default:
 							ERROR_CODE = ENOTSUP;
 					}
-					if(( SOCKET_GET_DATA_FRAGMENT_SIZE( call ) > 0 )
-					&& ( SOCKET_GET_DATA_FRAGMENT_SIZE( call ) != socket->data_fragment_size )){
-						fibril_rwlock_write_lock( & socket->sending_lock );
+					if((SOCKET_GET_DATA_FRAGMENT_SIZE(call) > 0)
+						&& (SOCKET_GET_DATA_FRAGMENT_SIZE(call) != socket->data_fragment_size)){
+						fibril_rwlock_write_lock(&socket->sending_lock);
 						// set the data fragment size
-						socket->data_fragment_size = SOCKET_GET_DATA_FRAGMENT_SIZE( call );
-						fibril_rwlock_write_unlock( & socket->sending_lock );
+						socket->data_fragment_size = SOCKET_GET_DATA_FRAGMENT_SIZE(call);
+						fibril_rwlock_write_unlock(&socket->sending_lock);
 					}
 				}
-				fibril_rwlock_read_unlock( & socket_globals.lock );
+				fibril_rwlock_read_unlock(&socket_globals.lock);
 				break;
 			default:
 				ERROR_CODE = ENOTSUP;
 		}
-		ipc_answer_0( callid, ( ipcarg_t ) ERROR_CODE );
-	}
-}
-
-int socket( int domain, int type, int protocol ){
+		ipc_answer_0(callid, (ipcarg_t) ERROR_CODE);
+	}
+}
+
+int socket(int domain, int type, int protocol){
 	ERROR_DECLARE;
 
-	socket_ref	socket;
-	int			phone;
-	int			socket_id;
-	services_t	service;
+	socket_ref socket;
+	int phone;
+	int socket_id;
+	services_t service;
 
 	// find the appropriate service
-	switch( domain ){
+	switch(domain){
 		case PF_INET:
-			switch( type ){
+			switch(type){
 				case SOCK_STREAM:
-					if( ! protocol ) protocol = IPPROTO_TCP;
-					switch( protocol ){
+					if(! protocol){
+						protocol = IPPROTO_TCP;
+					}
+					switch(protocol){
 						case IPPROTO_TCP:
 							phone = socket_get_tcp_phone();
@@ -436,6 +440,8 @@
 					break;
 				case SOCK_DGRAM:
-					if( ! protocol ) protocol = IPPROTO_UDP;
-					switch( protocol ){
+					if(! protocol){
+						protocol = IPPROTO_UDP;
+					}
+					switch(protocol){
 						case IPPROTO_UDP:
 							phone = socket_get_udp_phone();
@@ -455,32 +461,36 @@
 			return EPFNOSUPPORT;
 	}
-	if( phone < 0 ) return phone;
+	if(phone < 0){
+		return phone;
+	}
 	// create a new socket structure
-	socket = ( socket_ref ) malloc( sizeof( socket_t ));
-	if( ! socket ) return ENOMEM;
-	bzero( socket, sizeof( * socket ));
-	fibril_rwlock_write_lock( & socket_globals.lock );
+	socket = (socket_ref) malloc(sizeof(socket_t));
+	if(! socket){
+		return ENOMEM;
+	}
+	bzero(socket, sizeof(*socket));
+	fibril_rwlock_write_lock(&socket_globals.lock);
 	// request a new socket
 	socket_id = socket_generate_new_id();
-	if( socket_id <= 0 ){
-		fibril_rwlock_write_unlock( & socket_globals.lock );
-		free( socket );
+	if(socket_id <= 0){
+		fibril_rwlock_write_unlock(&socket_globals.lock);
+		free(socket);
 		return socket_id;
 	}
-	if( ERROR_OCCURRED(( int ) async_req_3_3( phone, NET_SOCKET, socket_id, 0, service, NULL, ( ipcarg_t * ) & socket->data_fragment_size, ( ipcarg_t * ) & socket->header_size ))){
-		fibril_rwlock_write_unlock( & socket_globals.lock );
-		free( socket );
+	if(ERROR_OCCURRED((int) async_req_3_3(phone, NET_SOCKET, socket_id, 0, service, NULL, (ipcarg_t *) &socket->data_fragment_size, (ipcarg_t *) &socket->header_size))){
+		fibril_rwlock_write_unlock(&socket_globals.lock);
+		free(socket);
 		return ERROR_CODE;
 	}
 	// finish the new socket initialization
-	socket_initialize( socket, socket_id, phone, service );
+	socket_initialize(socket, socket_id, phone, service);
 	// store the new socket
-	ERROR_CODE = sockets_add( socket_get_sockets(), socket_id, socket );
-	fibril_rwlock_write_unlock( & socket_globals.lock );
-	if( ERROR_CODE < 0 ){
-		dyn_fifo_destroy( & socket->received );
-		dyn_fifo_destroy( & socket->accepted );
-		free( socket );
-		async_msg_3( phone, NET_SOCKET_CLOSE, ( ipcarg_t ) socket_id, 0, service );
+	ERROR_CODE = sockets_add(socket_get_sockets(), socket_id, socket);
+	fibril_rwlock_write_unlock(&socket_globals.lock);
+	if(ERROR_CODE < 0){
+		dyn_fifo_destroy(&socket->received);
+		dyn_fifo_destroy(&socket->accepted);
+		free(socket);
+		async_msg_3(phone, NET_SOCKET_CLOSE, (ipcarg_t) socket_id, 0, service);
 		return ERROR_CODE;
 	}
@@ -489,362 +499,400 @@
 }
 
-int socket_send_data( int socket_id, ipcarg_t message, ipcarg_t arg2, const void * data, size_t datalength ){
-	socket_ref		socket;
-	aid_t			message_id;
-	ipcarg_t		result;
-
-	if( ! data ) return EBADMEM;
-	if( ! datalength ) return NO_DATA;
-
-	fibril_rwlock_read_lock( & socket_globals.lock );
+int socket_send_data(int socket_id, ipcarg_t message, ipcarg_t arg2, const void * data, size_t datalength){
+	socket_ref socket;
+	aid_t message_id;
+	ipcarg_t result;
+
+	if(! data){
+		return EBADMEM;
+	}
+	if(! datalength){
+		return NO_DATA;
+	}
+
+	fibril_rwlock_read_lock(&socket_globals.lock);
 	// find the socket
-	socket = sockets_find( socket_get_sockets(), socket_id );
-	if( ! socket ){
-		fibril_rwlock_read_unlock( & socket_globals.lock );
+	socket = sockets_find(socket_get_sockets(), socket_id);
+	if(! socket){
+		fibril_rwlock_read_unlock(&socket_globals.lock);
 		return ENOTSOCK;
 	}
 	// request the message
-	message_id = async_send_3( socket->phone, message, ( ipcarg_t ) socket->socket_id, arg2, socket->service, NULL );
+	message_id = async_send_3(socket->phone, message, (ipcarg_t) socket->socket_id, arg2, socket->service, NULL);
 	// send the address
-	async_data_write_start( socket->phone, data, datalength );
-	fibril_rwlock_read_unlock( & socket_globals.lock );
-	async_wait_for( message_id, & result );
-	return ( int ) result;
-}
-
-int bind( int socket_id, const struct sockaddr * my_addr, socklen_t addrlen ){
-	if( addrlen <= 0 ) return EINVAL;
+	async_data_write_start(socket->phone, data, datalength);
+	fibril_rwlock_read_unlock(&socket_globals.lock);
+	async_wait_for(message_id, &result);
+	return (int) result;
+}
+
+int bind(int socket_id, const struct sockaddr * my_addr, socklen_t addrlen){
+	if(addrlen <= 0){
+		return EINVAL;
+	}
 	// send the address
-	return socket_send_data( socket_id, NET_SOCKET_BIND, 0, my_addr, ( size_t ) addrlen );
-}
-
-int listen( int socket_id, int backlog ){
-	socket_ref	socket;
-	int			result;
-
-	if( backlog <= 0 ) return EINVAL;
-	fibril_rwlock_read_lock( & socket_globals.lock );
+	return socket_send_data(socket_id, NET_SOCKET_BIND, 0, my_addr, (size_t) addrlen);
+}
+
+int listen(int socket_id, int backlog){
+	socket_ref socket;
+	int result;
+
+	if(backlog <= 0){
+		return EINVAL;
+	}
+	fibril_rwlock_read_lock(&socket_globals.lock);
 	// find the socket
-	socket = sockets_find( socket_get_sockets(), socket_id );
-	if( ! socket ){
-		fibril_rwlock_read_unlock( & socket_globals.lock );
+	socket = sockets_find(socket_get_sockets(), socket_id);
+	if(! socket){
+		fibril_rwlock_read_unlock(&socket_globals.lock);
 		return ENOTSOCK;
 	}
 	// request listen backlog change
-	result = ( int ) async_req_3_0( socket->phone, NET_SOCKET_LISTEN, ( ipcarg_t ) socket->socket_id, ( ipcarg_t ) backlog, socket->service );
-	fibril_rwlock_read_unlock( & socket_globals.lock );
+	result = (int) async_req_3_0(socket->phone, NET_SOCKET_LISTEN, (ipcarg_t) socket->socket_id, (ipcarg_t) backlog, socket->service);
+	fibril_rwlock_read_unlock(&socket_globals.lock);
 	return result;
 }
 
-int accept( int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen ){
-	socket_ref		socket;
-	socket_ref		new_socket;
-	aid_t			message_id;
-	ipcarg_t		ipc_result;
-	int			result;
-	ipc_call_t		answer;
-
-	if(( ! cliaddr ) || ( ! addrlen )) return EBADMEM;
-
-	fibril_rwlock_write_lock( & socket_globals.lock );
+int accept(int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen){
+	socket_ref socket;
+	socket_ref new_socket;
+	aid_t message_id;
+	ipcarg_t ipc_result;
+	int result;
+	ipc_call_t answer;
+
+	if((! cliaddr) || (! addrlen)){
+		return EBADMEM;
+	}
+
+	fibril_rwlock_write_lock(&socket_globals.lock);
 	// find the socket
-	socket = sockets_find( socket_get_sockets(), socket_id );
-	if( ! socket ){
-		fibril_rwlock_write_unlock( & socket_globals.lock );
+	socket = sockets_find(socket_get_sockets(), socket_id);
+	if(! socket){
+		fibril_rwlock_write_unlock(&socket_globals.lock);
 		return ENOTSOCK;
 	}
-	fibril_mutex_lock( & socket->accept_lock );
+	fibril_mutex_lock(&socket->accept_lock);
 	// wait for an accepted socket
 	++ socket->blocked;
-	while( dyn_fifo_value( & socket->accepted ) <= 0 ){
-		fibril_rwlock_write_unlock( & socket_globals.lock );
-		fibril_condvar_wait( & socket->accept_signal, & socket->accept_lock );
+	while(dyn_fifo_value(&socket->accepted) <= 0){
+		fibril_rwlock_write_unlock(&socket_globals.lock);
+		fibril_condvar_wait(&socket->accept_signal, &socket->accept_lock);
 		// drop the accept lock to avoid deadlock
-		fibril_mutex_unlock( & socket->accept_lock );
-		fibril_rwlock_write_lock( & socket_globals.lock );
-		fibril_mutex_lock( & socket->accept_lock );
+		fibril_mutex_unlock(&socket->accept_lock);
+		fibril_rwlock_write_lock(&socket_globals.lock);
+		fibril_mutex_lock(&socket->accept_lock);
 	}
 	-- socket->blocked;
 
 	// create a new scoket
-	new_socket = ( socket_ref ) malloc( sizeof( socket_t ));
-	if( ! new_socket ){
-		fibril_mutex_unlock( & socket->accept_lock );
-		fibril_rwlock_write_unlock( & socket_globals.lock );
+	new_socket = (socket_ref) malloc(sizeof(socket_t));
+	if(! new_socket){
+		fibril_mutex_unlock(&socket->accept_lock);
+		fibril_rwlock_write_unlock(&socket_globals.lock);
 		return ENOMEM;
 	}
-	bzero( new_socket, sizeof( * new_socket ));
+	bzero(new_socket, sizeof(*new_socket));
 	socket_id = socket_generate_new_id();
-	if( socket_id <= 0 ){
-		fibril_mutex_unlock( & socket->accept_lock );
-		fibril_rwlock_write_unlock( & socket_globals.lock );
-		free( new_socket );
+	if(socket_id <= 0){
+		fibril_mutex_unlock(&socket->accept_lock);
+		fibril_rwlock_write_unlock(&socket_globals.lock);
+		free(new_socket);
 		return socket_id;
 	}
-	socket_initialize( new_socket, socket_id, socket->phone, socket->service );
-	result = sockets_add( socket_get_sockets(), new_socket->socket_id, new_socket );
-	if( result < 0 ){
-		fibril_mutex_unlock( & socket->accept_lock );
-		fibril_rwlock_write_unlock( & socket_globals.lock );
-		free( new_socket );
+	socket_initialize(new_socket, socket_id, socket->phone, socket->service);
+	result = sockets_add(socket_get_sockets(), new_socket->socket_id, new_socket);
+	if(result < 0){
+		fibril_mutex_unlock(&socket->accept_lock);
+		fibril_rwlock_write_unlock(&socket_globals.lock);
+		free(new_socket);
 		return result;
 	}
 
 	// request accept
-	message_id = async_send_5( socket->phone, NET_SOCKET_ACCEPT, ( ipcarg_t ) socket->socket_id, 0, socket->service, 0, new_socket->socket_id, & answer );
+	message_id = async_send_5(socket->phone, NET_SOCKET_ACCEPT, (ipcarg_t) socket->socket_id, 0, socket->service, 0, new_socket->socket_id, &answer);
 	// read address
-	ipc_data_read_start( socket->phone, cliaddr, * addrlen );
-	fibril_rwlock_write_unlock( & socket_globals.lock );
-	async_wait_for( message_id, & ipc_result );
+	ipc_data_read_start(socket->phone, cliaddr, * addrlen);
+	fibril_rwlock_write_unlock(&socket_globals.lock);
+	async_wait_for(message_id, &ipc_result);
 	result = (int) ipc_result;
-	if( result > 0 ){
-		if( result != socket_id ){
+	if(result > 0){
+		if(result != socket_id){
 			result = EINVAL;
 		}
 		// dequeue the accepted socket if successful
-		dyn_fifo_pop( & socket->accepted );
+		dyn_fifo_pop(&socket->accepted);
 		// set address length
-		* addrlen = SOCKET_GET_ADDRESS_LENGTH( answer );
-		new_socket->data_fragment_size = SOCKET_GET_DATA_FRAGMENT_SIZE( answer );
-	}else if( result == ENOTSOCK ){
+		*addrlen = SOCKET_GET_ADDRESS_LENGTH(answer);
+		new_socket->data_fragment_size = SOCKET_GET_DATA_FRAGMENT_SIZE(answer);
+	}else if(result == ENOTSOCK){
 		// empty the queue if no accepted sockets
-		while( dyn_fifo_pop( & socket->accepted ) > 0 );
-	}
-	fibril_mutex_unlock( & socket->accept_lock );
+		while(dyn_fifo_pop(&socket->accepted) > 0);
+	}
+	fibril_mutex_unlock(&socket->accept_lock);
 	return result;
 }
 
-int connect( int socket_id, const struct sockaddr * serv_addr, socklen_t addrlen ){
-	if( ! serv_addr ) return EDESTADDRREQ;
-	if( ! addrlen ) return EDESTADDRREQ;
+int connect(int socket_id, const struct sockaddr * serv_addr, socklen_t addrlen){
+	if(! serv_addr){
+		return EDESTADDRREQ;
+	}
+	if(! addrlen){
+		return EDESTADDRREQ;
+	}
 	// send the address
-	return socket_send_data( socket_id, NET_SOCKET_CONNECT, 0, serv_addr, addrlen );
-}
-
-int closesocket( int socket_id ){
+	return socket_send_data(socket_id, NET_SOCKET_CONNECT, 0, serv_addr, addrlen);
+}
+
+int closesocket(int socket_id){
 	ERROR_DECLARE;
 
-	socket_ref		socket;
-
-	fibril_rwlock_write_lock( & socket_globals.lock );
-	socket = sockets_find( socket_get_sockets(), socket_id );
-	if( ! socket ){
-		fibril_rwlock_write_unlock( & socket_globals.lock );
+	socket_ref socket;
+
+	fibril_rwlock_write_lock(&socket_globals.lock);
+	socket = sockets_find(socket_get_sockets(), socket_id);
+	if(! socket){
+		fibril_rwlock_write_unlock(&socket_globals.lock);
 		return ENOTSOCK;
 	}
-	if( socket->blocked ){
-		fibril_rwlock_write_unlock( & socket_globals.lock );
+	if(socket->blocked){
+		fibril_rwlock_write_unlock(&socket_globals.lock);
 		return EINPROGRESS;
 	}
 	// request close
-	ERROR_PROPAGATE(( int ) async_req_3_0( socket->phone, NET_SOCKET_CLOSE, ( ipcarg_t ) socket->socket_id, 0, socket->service ));
+	ERROR_PROPAGATE((int) async_req_3_0(socket->phone, NET_SOCKET_CLOSE, (ipcarg_t) socket->socket_id, 0, socket->service));
 	// free the socket structure
-	socket_destroy( socket );
-	fibril_rwlock_write_unlock( & socket_globals.lock );
+	socket_destroy(socket);
+	fibril_rwlock_write_unlock(&socket_globals.lock);
 	return EOK;
 }
 
-void socket_destroy( socket_ref socket ){
-	int	accepted_id;
+void socket_destroy(socket_ref socket){
+	int accepted_id;
 
 	// destroy all accepted sockets
-	while(( accepted_id = dyn_fifo_pop( & socket->accepted )) >= 0 ){
-		socket_destroy( sockets_find( socket_get_sockets(), accepted_id ));
-	}
-	dyn_fifo_destroy( & socket->received );
-	dyn_fifo_destroy( & socket->accepted );
-	sockets_exclude( socket_get_sockets(), socket->socket_id );
-}
-
-int send( int socket_id, void * data, size_t datalength, int flags ){
+	while((accepted_id = dyn_fifo_pop(&socket->accepted)) >= 0){
+		socket_destroy(sockets_find(socket_get_sockets(), accepted_id));
+	}
+	dyn_fifo_destroy(&socket->received);
+	dyn_fifo_destroy(&socket->accepted);
+	sockets_exclude(socket_get_sockets(), socket->socket_id);
+}
+
+int send(int socket_id, void * data, size_t datalength, int flags){
 	// without the address
-	return sendto_core( NET_SOCKET_SEND, socket_id, data, datalength, flags, NULL, 0 );
-}
-
-int sendto( int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen ){
-	if( ! toaddr ) return EDESTADDRREQ;
-	if( ! addrlen ) return EDESTADDRREQ;
+	return sendto_core(NET_SOCKET_SEND, socket_id, data, datalength, flags, NULL, 0);
+}
+
+int sendto(int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen){
+	if(! toaddr){
+		return EDESTADDRREQ;
+	}
+	if(! addrlen){
+		return EDESTADDRREQ;
+	}
 	// with the address
-	return sendto_core( NET_SOCKET_SENDTO, socket_id, data, datalength, flags, toaddr, addrlen );
-}
-
-int sendto_core( ipcarg_t message, int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen ){
-	socket_ref		socket;
-	aid_t			message_id;
-	ipcarg_t		result;
-	size_t			fragments;
-	ipc_call_t		answer;
-
-	if( ! data ) return EBADMEM;
-	if( ! datalength ) return NO_DATA;
-	fibril_rwlock_read_lock( & socket_globals.lock );
+	return sendto_core(NET_SOCKET_SENDTO, socket_id, data, datalength, flags, toaddr, addrlen);
+}
+
+int sendto_core(ipcarg_t message, int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen){
+	socket_ref socket;
+	aid_t message_id;
+	ipcarg_t result;
+	size_t fragments;
+	ipc_call_t answer;
+
+	if(! data){
+		return EBADMEM;
+	}
+	if(! datalength){
+		return NO_DATA;
+	}
+	fibril_rwlock_read_lock(&socket_globals.lock);
 	// find socket
-	socket = sockets_find( socket_get_sockets(), socket_id );
-	if( ! socket ){
-		fibril_rwlock_read_unlock( & socket_globals.lock );
+	socket = sockets_find(socket_get_sockets(), socket_id);
+	if(! socket){
+		fibril_rwlock_read_unlock(&socket_globals.lock);
 		return ENOTSOCK;
 	}
-	fibril_rwlock_read_lock( & socket->sending_lock );
+	fibril_rwlock_read_lock(&socket->sending_lock);
 	// compute data fragment count
-	if( socket->data_fragment_size > 0 ){
-		fragments = ( datalength + socket->header_size ) / socket->data_fragment_size;
-		if(( datalength + socket->header_size ) % socket->data_fragment_size ) ++ fragments;
+	if(socket->data_fragment_size > 0){
+		fragments = (datalength + socket->header_size) / socket->data_fragment_size;
+		if((datalength + socket->header_size) % socket->data_fragment_size) ++ fragments;
 	}else{
 		fragments = 1;
 	}
 	// request send
-	message_id = async_send_5( socket->phone, message, ( ipcarg_t ) socket->socket_id, ( fragments == 1 ? datalength : socket->data_fragment_size ), socket->service, ( ipcarg_t ) flags, fragments, & answer );
+	message_id = async_send_5(socket->phone, message, (ipcarg_t) socket->socket_id, (fragments == 1 ? datalength : socket->data_fragment_size), socket->service, (ipcarg_t) flags, fragments, &answer);
 	// send the address if given
-	if(( ! toaddr ) || ( async_data_write_start( socket->phone, toaddr, addrlen ) == EOK )){
-		if( fragments == 1 ){
+	if((! toaddr) || (async_data_write_start(socket->phone, toaddr, addrlen) == EOK)){
+		if(fragments == 1){
 			// send all if only one fragment
-			async_data_write_start( socket->phone, data, datalength );
+			async_data_write_start(socket->phone, data, datalength);
 		}else{
 			// send the first fragment
-			async_data_write_start( socket->phone, data, socket->data_fragment_size - socket->header_size );
-			data = (( const uint8_t * ) data ) + socket->data_fragment_size - socket->header_size;
+			async_data_write_start(socket->phone, data, socket->data_fragment_size - socket->header_size);
+			data = ((const uint8_t *) data) + socket->data_fragment_size - socket->header_size;
 			// send the middle fragments
-			while(( -- fragments ) > 1 ){
-				async_data_write_start( socket->phone, data, socket->data_fragment_size );
-				data = (( const uint8_t * ) data ) + socket->data_fragment_size;
+			while((-- fragments) > 1){
+				async_data_write_start(socket->phone, data, socket->data_fragment_size);
+				data = ((const uint8_t *) data) + socket->data_fragment_size;
 			}
 			// send the last fragment
-			async_data_write_start( socket->phone, data, ( datalength + socket->header_size ) % socket->data_fragment_size );
-		}
-	}
-	async_wait_for( message_id, & result );
-	if(( SOCKET_GET_DATA_FRAGMENT_SIZE( answer ) > 0 )
-	&& ( SOCKET_GET_DATA_FRAGMENT_SIZE( answer ) != socket->data_fragment_size )){
+			async_data_write_start(socket->phone, data, (datalength + socket->header_size) % socket->data_fragment_size);
+		}
+	}
+	async_wait_for(message_id, &result);
+	if((SOCKET_GET_DATA_FRAGMENT_SIZE(answer) > 0)
+		&& (SOCKET_GET_DATA_FRAGMENT_SIZE(answer) != socket->data_fragment_size)){
 		// set the data fragment size
-		socket->data_fragment_size = SOCKET_GET_DATA_FRAGMENT_SIZE( answer );
-	}
-	fibril_rwlock_read_unlock( & socket->sending_lock );
-	fibril_rwlock_read_unlock( & socket_globals.lock );
-	return ( int ) result;
-}
-
-int recv( int socket_id, void * data, size_t datalength, int flags ){
+		socket->data_fragment_size = SOCKET_GET_DATA_FRAGMENT_SIZE(answer);
+	}
+	fibril_rwlock_read_unlock(&socket->sending_lock);
+	fibril_rwlock_read_unlock(&socket_globals.lock);
+	return (int) result;
+}
+
+int recv(int socket_id, void * data, size_t datalength, int flags){
 	// without the address
-	return recvfrom_core( NET_SOCKET_RECV, socket_id, data, datalength, flags, NULL, NULL );
-}
-
-int recvfrom( int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen ){
-	if( ! fromaddr ) return EBADMEM;
-	if( ! addrlen ) return NO_DATA;
+	return recvfrom_core(NET_SOCKET_RECV, socket_id, data, datalength, flags, NULL, NULL);
+}
+
+int recvfrom(int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen){
+	if(! fromaddr){
+		return EBADMEM;
+	}
+	if(! addrlen){
+		return NO_DATA;
+	}
 	// with the address
-	return recvfrom_core( NET_SOCKET_RECVFROM, socket_id, data, datalength, flags, fromaddr, addrlen );
-}
-
-int recvfrom_core( ipcarg_t message, int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen ){
-	socket_ref		socket;
-	aid_t			message_id;
-	ipcarg_t		ipc_result;
-	int			result;
-	size_t			fragments;
-	size_t *		lengths;
-	size_t			index;
-	ipc_call_t		answer;
-
-	if( ! data ) return EBADMEM;
-	if( ! datalength ) return NO_DATA;
-	if( fromaddr && ( ! addrlen )) return EINVAL;
-	fibril_rwlock_read_lock( & socket_globals.lock );
+	return recvfrom_core(NET_SOCKET_RECVFROM, socket_id, data, datalength, flags, fromaddr, addrlen);
+}
+
+int recvfrom_core(ipcarg_t message, int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen){
+	socket_ref socket;
+	aid_t message_id;
+	ipcarg_t ipc_result;
+	int result;
+	size_t fragments;
+	size_t * lengths;
+	size_t index;
+	ipc_call_t answer;
+
+	if(! data){
+		return EBADMEM;
+	}
+	if(! datalength){
+		return NO_DATA;
+	}
+	if(fromaddr && (! addrlen)){
+		return EINVAL;
+	}
+	fibril_rwlock_read_lock(&socket_globals.lock);
 	// find the socket
-	socket = sockets_find( socket_get_sockets(), socket_id );
-	if( ! socket ){
-		fibril_rwlock_read_unlock( & socket_globals.lock );
+	socket = sockets_find(socket_get_sockets(), socket_id);
+	if(! socket){
+		fibril_rwlock_read_unlock(&socket_globals.lock);
 		return ENOTSOCK;
 	}
-	fibril_mutex_lock( & socket->receive_lock );
+	fibril_mutex_lock(&socket->receive_lock);
 	// wait for a received packet
 	++ socket->blocked;
-	while(( result = dyn_fifo_value( & socket->received )) <= 0 ){
-		fibril_rwlock_read_unlock( & socket_globals.lock );
-		fibril_condvar_wait( & socket->receive_signal, & socket->receive_lock );
+	while((result = dyn_fifo_value(&socket->received)) <= 0){
+		fibril_rwlock_read_unlock(&socket_globals.lock);
+		fibril_condvar_wait(&socket->receive_signal, &socket->receive_lock);
 		// drop the receive lock to avoid deadlock
-		fibril_mutex_unlock( & socket->receive_lock );
-		fibril_rwlock_read_lock( & socket_globals.lock );
-		fibril_mutex_lock( & socket->receive_lock );
+		fibril_mutex_unlock(&socket->receive_lock);
+		fibril_rwlock_read_lock(&socket_globals.lock);
+		fibril_mutex_lock(&socket->receive_lock);
 	}
 	-- socket->blocked;
-	fragments = ( size_t ) result;
+	fragments = (size_t) result;
 	// prepare lengths if more fragments
-	if( fragments > 1 ){
-		lengths = ( size_t * ) malloc( sizeof( size_t ) * fragments + sizeof( size_t ));
-		if( ! lengths ){
-			fibril_mutex_unlock( & socket->receive_lock );
-			fibril_rwlock_read_unlock( & socket_globals.lock );
+	if(fragments > 1){
+		lengths = (size_t *) malloc(sizeof(size_t) * fragments + sizeof(size_t));
+		if(! lengths){
+			fibril_mutex_unlock(&socket->receive_lock);
+			fibril_rwlock_read_unlock(&socket_globals.lock);
 			return ENOMEM;
 		}
 		// request packet data
-		message_id = async_send_4( socket->phone, message, ( ipcarg_t ) socket->socket_id, 0, socket->service, ( ipcarg_t ) flags, & answer );
+		message_id = async_send_4(socket->phone, message, (ipcarg_t) socket->socket_id, 0, socket->service, (ipcarg_t) flags, &answer);
 		// read the address if desired
-		if(( ! fromaddr ) || ( async_data_read_start( socket->phone, fromaddr, * addrlen ) == EOK )){
+		if((! fromaddr) || (async_data_read_start(socket->phone, fromaddr, * addrlen) == EOK)){
 		// read the fragment lengths
-			if( async_data_read_start( socket->phone, lengths, sizeof( int ) * ( fragments + 1 )) == EOK ){
-				if( lengths[ fragments ] <= datalength ){
+			if(async_data_read_start(socket->phone, lengths, sizeof(int) * (fragments + 1)) == EOK){
+				if(lengths[fragments] <= datalength){
 					// read all fragments if long enough
-					for( index = 0; index < fragments; ++ index ){
-						async_data_read_start( socket->phone, data, lengths[ index ] );
-						data = (( uint8_t * ) data ) + lengths[ index ];
+					for(index = 0; index < fragments; ++ index){
+						async_data_read_start(socket->phone, data, lengths[index]);
+						data = ((uint8_t *) data) + lengths[index];
 					}
 				}
 			}
 		}
-		free( lengths );
+		free(lengths);
 	}else{
 		// request packet data
-		message_id = async_send_4( socket->phone, message, ( ipcarg_t ) socket->socket_id, 0, socket->service, ( ipcarg_t ) flags, & answer );
+		message_id = async_send_4(socket->phone, message, (ipcarg_t) socket->socket_id, 0, socket->service, (ipcarg_t) flags, &answer);
 		// read the address if desired
-		if(( ! fromaddr ) || ( async_data_read_start( socket->phone, fromaddr, * addrlen ) == EOK )){
+		if((! fromaddr) || (async_data_read_start(socket->phone, fromaddr, * addrlen) == EOK)){
 			// read all if only one fragment
-			async_data_read_start( socket->phone, data, datalength );
-		}
-	}
-	async_wait_for( message_id, & ipc_result );
+			async_data_read_start(socket->phone, data, datalength);
+		}
+	}
+	async_wait_for(message_id, &ipc_result);
 	result = (int) ipc_result;
 	// if successful
-	if( result == EOK ){
+	if(result == EOK){
 		// dequeue the received packet
-		dyn_fifo_pop( & socket->received );
+		dyn_fifo_pop(&socket->received);
 		// return read data length
-		result = SOCKET_GET_READ_DATA_LENGTH( answer );
+		result = SOCKET_GET_READ_DATA_LENGTH(answer);
 		// set address length
-		if( fromaddr && addrlen ) * addrlen = SOCKET_GET_ADDRESS_LENGTH( answer );
-	}
-	fibril_mutex_unlock( & socket->receive_lock );
-	fibril_rwlock_read_unlock( & socket_globals.lock );
+		if(fromaddr && addrlen){
+			*addrlen = SOCKET_GET_ADDRESS_LENGTH(answer);
+		}
+	}
+	fibril_mutex_unlock(&socket->receive_lock);
+	fibril_rwlock_read_unlock(&socket_globals.lock);
 	return result;
 }
 
-int getsockopt( int socket_id, int level, int optname, void * value, size_t * optlen ){
-	socket_ref		socket;
-	aid_t			message_id;
-	ipcarg_t		result;
-
-	if( !( value && optlen )) return EBADMEM;
-	if( !( * optlen )) return NO_DATA;
-	fibril_rwlock_read_lock( & socket_globals.lock );
+int getsockopt(int socket_id, int level, int optname, void * value, size_t * optlen){
+	socket_ref socket;
+	aid_t message_id;
+	ipcarg_t result;
+
+	if(!(value && optlen)){
+		return EBADMEM;
+	}
+	if(!(*optlen)){
+		return NO_DATA;
+	}
+	fibril_rwlock_read_lock(&socket_globals.lock);
 	// find the socket
-	socket = sockets_find( socket_get_sockets(), socket_id );
-	if( ! socket ){
-		fibril_rwlock_read_unlock( & socket_globals.lock );
+	socket = sockets_find(socket_get_sockets(), socket_id);
+	if(! socket){
+		fibril_rwlock_read_unlock(&socket_globals.lock);
 		return ENOTSOCK;
 	}
 	// request option value
-	message_id = async_send_3( socket->phone, NET_SOCKET_GETSOCKOPT, ( ipcarg_t ) socket->socket_id, ( ipcarg_t ) optname, socket->service, NULL );
+	message_id = async_send_3(socket->phone, NET_SOCKET_GETSOCKOPT, (ipcarg_t) socket->socket_id, (ipcarg_t) optname, socket->service, NULL);
 	// read the length
-	if( async_data_read_start( socket->phone, optlen, sizeof( * optlen )) == EOK ){
+	if(async_data_read_start(socket->phone, optlen, sizeof(*optlen)) == EOK){
 		// read the value
-		async_data_read_start( socket->phone, value, * optlen );
-	}
-	fibril_rwlock_read_unlock( & socket_globals.lock );
-	async_wait_for( message_id, & result );
-	return ( int ) result;
-}
-
-int setsockopt( int socket_id, int level, int optname, const void * value, size_t optlen ){
+		async_data_read_start(socket->phone, value, * optlen);
+	}
+	fibril_rwlock_read_unlock(&socket_globals.lock);
+	async_wait_for(message_id, &result);
+	return (int) result;
+}
+
+int setsockopt(int socket_id, int level, int optname, const void * value, size_t optlen){
 	// send the value
-	return socket_send_data( socket_id, NET_SOCKET_SETSOCKOPT, ( ipcarg_t ) optname, value, optlen );
+	return socket_send_data(socket_id, NET_SOCKET_SETSOCKOPT, (ipcarg_t) optname, value, optlen);
 
 }
Index: uspace/srv/net/socket/socket_core.c
===================================================================
--- uspace/srv/net/socket/socket_core.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/socket/socket_core.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -64,8 +64,8 @@
 	/** The bound sockets map.
 	 */
-	socket_port_map_t	map;
+	socket_port_map_t map;
 	/** The bound sockets count.
 	 */
-	int					count;
+	int count;
 };
 
@@ -79,5 +79,5 @@
  *  @returns Other error codes as defined for the socket_ports_add() function.
  */
-int	socket_bind_insert( socket_ports_ref global_sockets, socket_core_ref socket, int port );
+int socket_bind_insert(socket_ports_ref global_sockets, socket_core_ref socket, int port);
 
 /** Destroys the socket.
@@ -90,5 +90,5 @@
  *  @param[in] socket_release The client release callback function.
  */
-void	socket_destroy_core( int packet_phone, socket_core_ref socket, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void ( * socket_release )( socket_core_ref socket ));
+void socket_destroy_core(int packet_phone, socket_core_ref socket, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket));
 
 /** Adds the socket to a socket port.
@@ -100,5 +100,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	socket_port_add_core( socket_port_ref socket_port, socket_core_ref socket, const char * key, size_t key_length );
+int socket_port_add_core(socket_port_ref socket_port, socket_core_ref socket, const char * key, size_t key_length);
 
 /** Tries to find a new free socket identifier.
@@ -108,83 +108,89 @@
  *  @returns ELIMIT if there is no socket identifier available.
  */
-static int	socket_generate_new_id( socket_cores_ref local_sockets, int positive );
-
-INT_MAP_IMPLEMENT( socket_cores, socket_core_t );
-
-GENERIC_CHAR_MAP_IMPLEMENT( socket_port_map, socket_core_ref );
-
-INT_MAP_IMPLEMENT( socket_ports, socket_port_t );
-
-void socket_cores_release( int packet_phone, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void ( * socket_release )( socket_core_ref socket )){
-	if( socket_cores_is_valid( local_sockets )){
-		int	index;
+static int socket_generate_new_id(socket_cores_ref local_sockets, int positive);
+
+INT_MAP_IMPLEMENT(socket_cores, socket_core_t);
+
+GENERIC_CHAR_MAP_IMPLEMENT(socket_port_map, socket_core_ref);
+
+INT_MAP_IMPLEMENT(socket_ports, socket_port_t);
+
+void socket_cores_release(int packet_phone, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket)){
+	if(socket_cores_is_valid(local_sockets)){
+		int index;
 
 		local_sockets->magic = 0;
-		for( index = 0; index < local_sockets->next; ++ index ){
-			if( socket_cores_item_is_valid( &( local_sockets->items[ index ] ))){
-				local_sockets->items[ index ].magic = 0;
-				if( local_sockets->items[ index ].value ){
-					socket_destroy_core( packet_phone, local_sockets->items[ index ].value, local_sockets, global_sockets, socket_release );
-					free( local_sockets->items[ index ].value );
-					local_sockets->items[ index ].value = NULL;
+		for(index = 0; index < local_sockets->next; ++ index){
+			if(socket_cores_item_is_valid(&(local_sockets->items[index]))){
+				local_sockets->items[index].magic = 0;
+				if(local_sockets->items[index].value){
+					socket_destroy_core(packet_phone, local_sockets->items[index].value, local_sockets, global_sockets, socket_release);
+					free(local_sockets->items[index].value);
+					local_sockets->items[index].value = NULL;
 				}
 			}
 		}
-		free( local_sockets->items );
-	}
-}
-
-void socket_destroy_core( int packet_phone, socket_core_ref socket, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void ( * socket_release )( socket_core_ref socket )){
-	int	packet_id;
+		free(local_sockets->items);
+	}
+}
+
+void socket_destroy_core(int packet_phone, socket_core_ref socket, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket)){
+	int packet_id;
 
 	// if bound
-	if( socket->port ){
+	if(socket->port){
 		// release the port
-		socket_port_release( global_sockets, socket );
+		socket_port_release(global_sockets, socket);
 	}
 	// release all received packets
-	while(( packet_id = dyn_fifo_pop( & socket->received )) >= 0 ){
-		pq_release( packet_phone, packet_id );
-	}
-	dyn_fifo_destroy( & socket->received );
-	dyn_fifo_destroy( & socket->accepted );
-	if( socket_release ){
-		socket_release( socket );
-	}
-	socket_cores_exclude( local_sockets, socket->socket_id );
-}
-
-int socket_bind( socket_cores_ref local_sockets, socket_ports_ref global_sockets, int socket_id, void * addr, size_t addrlen, int free_ports_start, int free_ports_end, int last_used_port ){
-	socket_core_ref			socket;
-	socket_port_ref			socket_port;
-	struct sockaddr *		address;
-	struct sockaddr_in *	address_in;
-
-	if( addrlen < sizeof( struct sockaddr )) return EINVAL;
-	address = ( struct sockaddr * ) addr;
-	switch( address->sa_family ){
+	while((packet_id = dyn_fifo_pop(&socket->received)) >= 0){
+		pq_release(packet_phone, packet_id);
+	}
+	dyn_fifo_destroy(&socket->received);
+	dyn_fifo_destroy(&socket->accepted);
+	if(socket_release){
+		socket_release(socket);
+	}
+	socket_cores_exclude(local_sockets, socket->socket_id);
+}
+
+int socket_bind(socket_cores_ref local_sockets, socket_ports_ref global_sockets, int socket_id, void * addr, size_t addrlen, int free_ports_start, int free_ports_end, int last_used_port){
+	socket_core_ref socket;
+	socket_port_ref socket_port;
+	struct sockaddr * address;
+	struct sockaddr_in * address_in;
+
+	if(addrlen < sizeof(struct sockaddr)){
+		return EINVAL;
+	}
+	address = (struct sockaddr *) addr;
+	switch(address->sa_family){
 		case AF_INET:
-			if( addrlen != sizeof( struct sockaddr_in )) return EINVAL;
-			address_in = ( struct sockaddr_in * ) addr;
+			if(addrlen != sizeof(struct sockaddr_in)){
+				return EINVAL;
+			}
+			address_in = (struct sockaddr_in *) addr;
 			// find the socket
-			socket = socket_cores_find( local_sockets, socket_id );
-			if( ! socket ) return ENOTSOCK;
+			socket = socket_cores_find(local_sockets, socket_id);
+			if(! socket){
+				return ENOTSOCK;
+			}
 			// bind a free port?
-			if( address_in->sin_port <= 0 ){
-				return socket_bind_free_port( global_sockets, socket, free_ports_start, free_ports_end, last_used_port );
+			if(address_in->sin_port <= 0){
+				return socket_bind_free_port(global_sockets, socket, free_ports_start, free_ports_end, last_used_port);
 			}
 			// try to find the port
-			socket_port = socket_ports_find( global_sockets, ntohs( address_in->sin_port ));
-			if( socket_port ){
+			socket_port = socket_ports_find(global_sockets, ntohs(address_in->sin_port));
+			if(socket_port){
 				// already used
 				return EADDRINUSE;
 			}
 			// if bound
-			if( socket->port ){
+			if(socket->port){
 				// release the port
-				socket_port_release( global_sockets, socket );
+				socket_port_release(global_sockets, socket);
 			}
 			socket->port = -1;
-			return socket_bind_insert( global_sockets, socket, ntohs( address_in->sin_port ));
+			return socket_bind_insert(global_sockets, socket, ntohs(address_in->sin_port));
 			break;
 		// TODO IPv6
@@ -193,6 +199,6 @@
 }
 
-int socket_bind_free_port( socket_ports_ref global_sockets, socket_core_ref socket, int free_ports_start, int free_ports_end, int last_used_port ){
-	int	index;
+int socket_bind_free_port(socket_ports_ref global_sockets, socket_core_ref socket, int free_ports_start, int free_ports_end, int last_used_port){
+	int index;
 
 	// from the last used one
@@ -201,5 +207,5 @@
 		++ index;
 		// til the range end
-		if( index >= free_ports_end ){
+		if(index >= free_ports_end){
 			// start from the range beginning
 			index = free_ports_start - 1;
@@ -207,36 +213,38 @@
 				++ index;
 				// til the last used one
-				if( index >= last_used_port ){
+				if(index >= last_used_port){
 					// none found
 					return ENOTCONN;
 				}
-			}while( socket_ports_find( global_sockets, index ) != NULL );
+			}while(socket_ports_find(global_sockets, index) != NULL);
 			// found, break immediately
 			break;
 		}
-	}while( socket_ports_find( global_sockets, index ) != NULL );
-	return socket_bind_insert( global_sockets, socket, index );
-}
-
-int socket_bind_insert( socket_ports_ref global_sockets, socket_core_ref socket, int port ){
+	}while(socket_ports_find(global_sockets, index) != NULL);
+	return socket_bind_insert(global_sockets, socket, index);
+}
+
+int socket_bind_insert(socket_ports_ref global_sockets, socket_core_ref socket, int port){
 	ERROR_DECLARE;
 
-	socket_port_ref	socket_port;
+	socket_port_ref socket_port;
 
 	// create a wrapper
-	socket_port = malloc( sizeof( * socket_port ));
-	if( ! socket_port ) return ENOMEM;
+	socket_port = malloc(sizeof(*socket_port));
+	if(! socket_port){
+		return ENOMEM;
+	}
 	socket_port->count = 0;
-	if( ERROR_OCCURRED( socket_port_map_initialize( & socket_port->map ))
-	|| ERROR_OCCURRED( socket_port_add_core( socket_port, socket, SOCKET_MAP_KEY_LISTENING, 0 ))){
-		socket_port_map_destroy( & socket_port->map );
-		free( socket_port );
+	if(ERROR_OCCURRED(socket_port_map_initialize(&socket_port->map))
+		|| ERROR_OCCURRED(socket_port_add_core(socket_port, socket, SOCKET_MAP_KEY_LISTENING, 0))){
+		socket_port_map_destroy(&socket_port->map);
+		free(socket_port);
 		return ERROR_CODE;
 	}
 	// register the incomming port
-	ERROR_CODE = socket_ports_add( global_sockets, port, socket_port );
-	if( ERROR_CODE < 0 ){
-		socket_port_map_destroy( & socket_port->map );
-		free( socket_port );
+	ERROR_CODE = socket_ports_add(global_sockets, port, socket_port);
+	if(ERROR_CODE < 0){
+		socket_port_map_destroy(&socket_port->map);
+		free(socket_port);
 		return ERROR_CODE;
 	}
@@ -246,22 +254,22 @@
 
 
-static int socket_generate_new_id( socket_cores_ref local_sockets, int positive ){
-	int			socket_id;
-	int			count;
+static int socket_generate_new_id(socket_cores_ref local_sockets, int positive){
+	int socket_id;
+	int count;
 
 	count = 0;
 //	socket_id = socket_globals.last_id;
 	do{
-		if( count < SOCKET_ID_TRIES ){
+		if(count < SOCKET_ID_TRIES){
 			socket_id = rand() % INT_MAX;
 			++ count;
-		}else if( count == SOCKET_ID_TRIES ){
+		}else if(count == SOCKET_ID_TRIES){
 			socket_id = 1;
 			++ count;
 		// only this branch for last_id
 		}else{
-			if( socket_id < INT_MAX ){
+			if(socket_id < INT_MAX){
 				++ socket_id;
-/*			}else if( socket_globals.last_id ){
+/*			}else if(socket_globals.last_id){
 *				socket_globals.last_id = 0;
 *				socket_id = 1;
@@ -270,32 +278,36 @@
 			}
 		}
-	}while( socket_cores_find( local_sockets, (( positive ? 1 : -1 ) * socket_id )));
+	}while(socket_cores_find(local_sockets, ((positive ? 1 : -1) * socket_id)));
 //	last_id = socket_id
 	return socket_id;
 }
 
-int socket_create( socket_cores_ref local_sockets, int app_phone, void * specific_data, int * socket_id ){
+int socket_create(socket_cores_ref local_sockets, int app_phone, void * specific_data, int * socket_id){
 	ERROR_DECLARE;
 
-	socket_core_ref	socket;
-	int				res;
-	int				positive;
-
-	if( ! socket_id ) return EINVAL;
+	socket_core_ref socket;
+	int res;
+	int positive;
+
+	if(! socket_id){
+		return EINVAL;
+	}
 	// store the socket
-	if( * socket_id <= 0 ){
-		positive = ( * socket_id == 0 );
-		* socket_id = socket_generate_new_id( local_sockets, positive );
-		if( * socket_id <= 0 ){
+	if(*socket_id <= 0){
+		positive = (*socket_id == 0);
+		*socket_id = socket_generate_new_id(local_sockets, positive);
+		if(*socket_id <= 0){
 			return * socket_id;
 		}
-		if( ! positive ){
-			* socket_id *= -1;
-		}
-	}else if( socket_cores_find( local_sockets, * socket_id )){
+		if(! positive){
+			*socket_id *= -1;
+		}
+	}else if(socket_cores_find(local_sockets, * socket_id)){
 		return EEXIST;
 	}
-	socket = ( socket_core_ref ) malloc( sizeof( * socket ));
-	if( ! socket ) return ENOMEM;
+	socket = (socket_core_ref) malloc(sizeof(*socket));
+	if(! socket){
+		return ENOMEM;
+	}
 	// initialize
 	socket->phone = app_phone;
@@ -304,19 +316,19 @@
 	socket->key_length = 0;
 	socket->specific_data = specific_data;
-	if( ERROR_OCCURRED( dyn_fifo_initialize( & socket->received, SOCKET_INITIAL_RECEIVED_SIZE ))){
-		free( socket );
+	if(ERROR_OCCURRED(dyn_fifo_initialize(&socket->received, SOCKET_INITIAL_RECEIVED_SIZE))){
+		free(socket);
 		return ERROR_CODE;
 	}
-	if( ERROR_OCCURRED( dyn_fifo_initialize( & socket->accepted, SOCKET_INITIAL_ACCEPTED_SIZE ))){
-		dyn_fifo_destroy( & socket->received );
-		free( socket );
+	if(ERROR_OCCURRED(dyn_fifo_initialize(&socket->accepted, SOCKET_INITIAL_ACCEPTED_SIZE))){
+		dyn_fifo_destroy(&socket->received);
+		free(socket);
 		return ERROR_CODE;
 	}
 	socket->socket_id = * socket_id;
-	res = socket_cores_add( local_sockets, socket->socket_id, socket );
-	if( res < 0 ){
-		dyn_fifo_destroy( & socket->received );
-		dyn_fifo_destroy( & socket->accepted );
-		free( socket );
+	res = socket_cores_add(local_sockets, socket->socket_id, socket);
+	if(res < 0){
+		dyn_fifo_destroy(&socket->received);
+		dyn_fifo_destroy(&socket->accepted);
+		free(socket);
 		return res;
 	}
@@ -324,75 +336,81 @@
 }
 
-int socket_destroy( int packet_phone, int socket_id, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void ( * socket_release )( socket_core_ref socket )){
-	socket_core_ref	socket;
-	int				accepted_id;
+int socket_destroy(int packet_phone, int socket_id, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket)){
+	socket_core_ref socket;
+	int accepted_id;
 
 	// find the socket
-	socket = socket_cores_find( local_sockets, socket_id );
-	if( ! socket ) return ENOTSOCK;
+	socket = socket_cores_find(local_sockets, socket_id);
+	if(! socket){
+		return ENOTSOCK;
+	}
 	// destroy all accepted sockets
-	while(( accepted_id = dyn_fifo_pop( & socket->accepted )) >= 0 ){
-		socket_destroy( packet_phone, accepted_id, local_sockets, global_sockets, socket_release );
-	}
-	socket_destroy_core( packet_phone, socket, local_sockets, global_sockets, socket_release );
-	return EOK;
-}
-
-int socket_reply_packets( packet_t packet, size_t * length ){
+	while((accepted_id = dyn_fifo_pop(&socket->accepted)) >= 0){
+		socket_destroy(packet_phone, accepted_id, local_sockets, global_sockets, socket_release);
+	}
+	socket_destroy_core(packet_phone, socket, local_sockets, global_sockets, socket_release);
+	return EOK;
+}
+
+int socket_reply_packets(packet_t packet, size_t * length){
 	ERROR_DECLARE;
 
-	packet_t		next_packet;
-	size_t			fragments;
-	size_t *		lengths;
-	size_t			index;
-
-	if( ! length ) return EBADMEM;
-	next_packet = pq_next( packet );
-	if( ! next_packet ){
+	packet_t next_packet;
+	size_t fragments;
+	size_t * lengths;
+	size_t index;
+
+	if(! length){
+		return EBADMEM;
+	}
+	next_packet = pq_next(packet);
+	if(! next_packet){
 		// write all if only one fragment
-		ERROR_PROPAGATE( data_reply( packet_get_data( packet ), packet_get_data_length( packet )));
+		ERROR_PROPAGATE(data_reply(packet_get_data(packet), packet_get_data_length(packet)));
 		// store the total length
-		* length = packet_get_data_length( packet );
+		*length = packet_get_data_length(packet);
 	}else{
 		// count the packet fragments
 		fragments = 1;
-		next_packet = pq_next( packet );
-		while(( next_packet = pq_next( next_packet ))){
+		next_packet = pq_next(packet);
+		while((next_packet = pq_next(next_packet))){
 			++ fragments;
 		}
 		// compute and store the fragment lengths
-		lengths = ( size_t * ) malloc( sizeof( size_t ) * fragments + sizeof( size_t ));
-		if( ! lengths ) return ENOMEM;
-		lengths[ 0 ] = packet_get_data_length( packet );
-		lengths[ fragments ] = lengths[ 0 ];
-		next_packet = pq_next( packet );
-		for( index = 1; index < fragments; ++ index ){
-			lengths[ index ] = packet_get_data_length( next_packet );
-			lengths[ fragments ] += lengths[ index ];
-			next_packet = pq_next( packet );
-		}while( next_packet );
+		lengths = (size_t *) malloc(sizeof(size_t) * fragments + sizeof(size_t));
+		if(! lengths){
+			return ENOMEM;
+		}
+		lengths[0] = packet_get_data_length(packet);
+		lengths[fragments] = lengths[0];
+		next_packet = pq_next(packet);
+		for(index = 1; index < fragments; ++ index){
+			lengths[index] = packet_get_data_length(next_packet);
+			lengths[fragments] += lengths[index];
+			next_packet = pq_next(packet);
+		}while(next_packet);
 		// write the fragment lengths
-		ERROR_PROPAGATE( data_reply( lengths, sizeof( int ) * ( fragments + 1 )));
+		ERROR_PROPAGATE(data_reply(lengths, sizeof(int) * (fragments + 1)));
 		next_packet = packet;
 		// write the fragments
-		for( index = 0; index < fragments; ++ index ){
-			ERROR_PROPAGATE( data_reply( packet_get_data( next_packet ), lengths[ index ] ));
-			next_packet = pq_next( next_packet );
-		}while( next_packet );
+		for(index = 0; index < fragments; ++ index){
+			ERROR_PROPAGATE(data_reply(packet_get_data(next_packet), lengths[index]));
+			next_packet = pq_next(next_packet);
+		}while(next_packet);
 		// store the total length
-		* length = lengths[ fragments ];
-		free( lengths );
-	}
-	return EOK;
-}
-
-socket_core_ref socket_port_find( socket_ports_ref global_sockets, int port, const char * key, size_t key_length ){
-	socket_port_ref		socket_port;
-	socket_core_ref *	socket_ref;
-
-	socket_port = socket_ports_find( global_sockets, port );
-	if( socket_port && ( socket_port->count > 0 )){
-		socket_ref = socket_port_map_find( & socket_port->map, key, key_length );
-		if( socket_ref ){
+		*length = lengths[fragments];
+		free(lengths);
+	}
+	return EOK;
+}
+
+socket_core_ref socket_port_find(socket_ports_ref global_sockets, int port, const char * key, size_t key_length){
+	socket_port_ref socket_port;
+	socket_core_ref * socket_ref;
+
+	socket_port = socket_ports_find(global_sockets, port);
+	if(socket_port && (socket_port->count > 0)){
+		socket_ref = socket_port_map_find(&socket_port->map, key, key_length);
+		if(socket_ref){
 			return * socket_ref;
 		}
@@ -401,25 +419,25 @@
 }
 
-void socket_port_release( socket_ports_ref global_sockets, socket_core_ref socket ){
-	socket_port_ref	socket_port;
-	socket_core_ref *	socket_ref;
-
-	if( socket->port ){
+void socket_port_release(socket_ports_ref global_sockets, socket_core_ref socket){
+	socket_port_ref socket_port;
+	socket_core_ref * socket_ref;
+
+	if(socket->port){
 		// find ports
-		socket_port = socket_ports_find( global_sockets, socket->port );
-		if( socket_port ){
+		socket_port = socket_ports_find(global_sockets, socket->port);
+		if(socket_port){
 			// find the socket
-			socket_ref = socket_port_map_find( & socket_port->map, socket->key, socket->key_length );
-			if( socket_ref ){
+			socket_ref = socket_port_map_find(&socket_port->map, socket->key, socket->key_length);
+			if(socket_ref){
 				-- socket_port->count;
 				// release if empty
-				if( socket_port->count <= 0 ){
+				if(socket_port->count <= 0){
 					// destroy the map
-					socket_port_map_destroy( & socket_port->map );
+					socket_port_map_destroy(&socket_port->map);
 					// release the port
-					socket_ports_exclude( global_sockets, socket->port );
+					socket_ports_exclude(global_sockets, socket->port);
 				}else{
 					// remove
-					socket_port_map_exclude( & socket_port->map, socket->key, socket->key_length );
+					socket_port_map_exclude(&socket_port->map, socket->key, socket->key_length);
 				}
 			}
@@ -431,30 +449,34 @@
 }
 
-int socket_port_add( socket_ports_ref global_sockets, int port, socket_core_ref socket, const char * key, size_t key_length ){
+int socket_port_add(socket_ports_ref global_sockets, int port, socket_core_ref socket, const char * key, size_t key_length){
 	ERROR_DECLARE;
 
-	socket_port_ref		socket_port;
+	socket_port_ref socket_port;
 
 	// find ports
-	socket_port = socket_ports_find( global_sockets, port );
-	if( ! socket_port ) return ENOENT;
+	socket_port = socket_ports_find(global_sockets, port);
+	if(! socket_port){
+		return ENOENT;
+	}
 	// add the socket
-	ERROR_PROPAGATE( socket_port_add_core( socket_port, socket, key, key_length ));
+	ERROR_PROPAGATE(socket_port_add_core(socket_port, socket, key, key_length));
 	socket->port = port;
 	return EOK;
 }
 
-int socket_port_add_core( socket_port_ref socket_port, socket_core_ref socket, const char * key, size_t key_length ){
+int socket_port_add_core(socket_port_ref socket_port, socket_core_ref socket, const char * key, size_t key_length){
 	ERROR_DECLARE;
 
-	socket_core_ref *	socket_ref;
+	socket_core_ref * socket_ref;
 
 	// create a wrapper
-	socket_ref = malloc( sizeof( * socket_ref ));
-	if( ! socket_ref ) return ENOMEM;
-	* socket_ref = socket;
+	socket_ref = malloc(sizeof(*socket_ref));
+	if(! socket_ref){
+		return ENOMEM;
+	}
+	*socket_ref = socket;
 	// add the wrapper
-	if( ERROR_OCCURRED( socket_port_map_add( & socket_port->map, key, key_length, socket_ref ))){
-		free( socket_ref );
+	if(ERROR_OCCURRED(socket_port_map_add(&socket_port->map, key, key_length, socket_ref))){
+		free(socket_ref);
 		return ERROR_CODE;
 	}
Index: uspace/srv/net/socket/socket_core.h
===================================================================
--- uspace/srv/net/socket/socket_core.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/socket/socket_core.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -93,26 +93,26 @@
 	/** Socket identifier.
 	 */
-	int				socket_id;
+	int socket_id;
 	/** Client application phone.
 	 */
-	int				phone;
+	int phone;
 	/** Bound port.
 	 */
-	int				port;
+	int port;
 	/** Received packets queue.
 	 */
-	dyn_fifo_t		received;
+	dyn_fifo_t received;
 	/** Sockets for acceptance queue.
 	 */
-	dyn_fifo_t		accepted;
+	dyn_fifo_t accepted;
 	/** Protocol specific data.
 	 */
-	void *			specific_data;
+	void * specific_data;
 	/** Socket ports map key.
 	 */
-	const char *	key;
+	const char * key;
 	/** Length of the Socket ports map key.
 	 */
-	size_t			key_length;
+	size_t key_length;
 };
 
@@ -120,15 +120,15 @@
  *  The key is the socket identifier.
  */
-INT_MAP_DECLARE( socket_cores, socket_core_t );
+INT_MAP_DECLARE(socket_cores, socket_core_t);
 
 /** Bount port sockets map.
  *  The listening socket has the SOCKET_MAP_KEY_LISTENING key identifier whereas the other use the remote addresses.
  */
-GENERIC_CHAR_MAP_DECLARE( socket_port_map, socket_core_ref );
+GENERIC_CHAR_MAP_DECLARE(socket_port_map, socket_core_ref);
 
 /** Ports map.
  *  The key is the port number.
  */
-INT_MAP_DECLARE( socket_ports, socket_port_t );
+INT_MAP_DECLARE(socket_ports, socket_port_t);
 
 /** Destroys local sockets.
@@ -139,5 +139,5 @@
  *  @param[in] socket_release The client release callback function.
  */
-void	socket_cores_release( int packet_phone, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void ( * socket_release )( socket_core_ref socket ));
+void socket_cores_release(int packet_phone, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket));
 
 /** Binds the socket to the port.
@@ -158,5 +158,5 @@
  *  @returns Other error codes as defined for the socket_bind_insert() function.
  */
-int socket_bind( socket_cores_ref local_sockets, socket_ports_ref global_sockets, int socket_id, void * addr, size_t addrlen, int free_ports_start, int free_ports_end, int last_used_port );
+int socket_bind(socket_cores_ref local_sockets, socket_ports_ref global_sockets, int socket_id, void * addr, size_t addrlen, int free_ports_start, int free_ports_end, int last_used_port);
 
 /** Binds the socket to a free port.
@@ -171,5 +171,5 @@
  *  @returns Other error codes as defined for the socket_bind_insert() function.
  */
-int	socket_bind_free_port( socket_ports_ref global_sockets, socket_core_ref socket, int free_ports_start, int free_ports_end, int last_used_port );
+int socket_bind_free_port(socket_ports_ref global_sockets, socket_core_ref socket, int free_ports_start, int free_ports_end, int last_used_port);
 
 /** Creates a new socket.
@@ -182,5 +182,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int socket_create( socket_cores_ref local_sockets, int app_phone, void * specific_data, int * socket_id );
+int socket_create(socket_cores_ref local_sockets, int app_phone, void * specific_data, int * socket_id);
 
 /** Destroys the socket.
@@ -195,5 +195,5 @@
  *  @returns ENOTSOCK if the socket is not found.
  */
-int socket_destroy( int packet_phone, int socket_id, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void ( * socket_release )( socket_core_ref socket ));
+int socket_destroy(int packet_phone, int socket_id, socket_cores_ref local_sockets, socket_ports_ref global_sockets, void (*socket_release)(socket_core_ref socket));
 
 /** Replies the packet or the packet queue data to the application via the socket.
@@ -206,5 +206,5 @@
  *  @returns Other error codes as defined for the data_reply() function.
  */
-int	socket_reply_packets( packet_t packet, size_t * length );
+int socket_reply_packets(packet_t packet, size_t * length);
 
 /** Finds the bound port socket.
@@ -216,5 +216,5 @@
  *  @returns NULL if no socket was found.
  */
-socket_core_ref	socket_port_find( socket_ports_ref global_sockets, int port, const char * key, size_t key_length );
+socket_core_ref socket_port_find(socket_ports_ref global_sockets, int port, const char * key, size_t key_length);
 
 /** Releases the socket port.
@@ -224,5 +224,5 @@
  *  @param[in] socket The socket to be unbound.
  */
-void	socket_port_release( socket_ports_ref global_sockets, socket_core_ref socket );
+void socket_port_release(socket_ports_ref global_sockets, socket_core_ref socket);
 
 /** Adds the socket to an already bound port.
@@ -236,5 +236,5 @@
  *  @returns Other error codes as defined for the socket_port_add_core() function.
  */
-int	socket_port_add( socket_ports_ref global_sockets, int port, socket_core_ref socket, const char * key, size_t key_length );
+int socket_port_add(socket_ports_ref global_sockets, int port, socket_core_ref socket, const char * key, size_t key_length);
 
 #endif
Index: uspace/srv/net/socket/socket_messages.h
===================================================================
--- uspace/srv/net/socket/socket_messages.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/socket/socket_messages.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -115,80 +115,80 @@
  *  @param[out] answer The message answer structure.
  */
-#define SOCKET_SET_SOCKET_ID( answer )			( int * ) & IPC_GET_ARG1( answer )
+#define SOCKET_SET_SOCKET_ID(answer)			(int *) &IPC_GET_ARG1(answer)
 
 /** Returns the socket identifier message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_SOCKET_ID( call )			( int ) IPC_GET_ARG1( call )
+#define SOCKET_GET_SOCKET_ID(call)			(int) IPC_GET_ARG1(call)
 
 /** Sets the read data length in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define SOCKET_SET_READ_DATA_LENGTH( answer )	( int * ) & IPC_GET_ARG1( answer )
+#define SOCKET_SET_READ_DATA_LENGTH(answer)	(int *) &IPC_GET_ARG1(answer)
 
 /** Returns the read data length message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_READ_DATA_LENGTH( call )		( int ) IPC_GET_ARG1( call )
+#define SOCKET_GET_READ_DATA_LENGTH(call)		(int) IPC_GET_ARG1(call)
 
 /** Returns the backlog message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_BACKLOG( call )				( int ) IPC_GET_ARG2( call )
+#define SOCKET_GET_BACKLOG(call)				(int) IPC_GET_ARG2(call)
 
 /** Returns the option level message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_OPT_LEVEL( call )			( int ) IPC_GET_ARG2( call )
+#define SOCKET_GET_OPT_LEVEL(call)			(int) IPC_GET_ARG2(call)
 
 /** Returns the data fragment size message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_DATA_FRAGMENT_SIZE( call )	( size_t ) IPC_GET_ARG2( call )
+#define SOCKET_GET_DATA_FRAGMENT_SIZE(call)	(size_t) IPC_GET_ARG2(call)
 
 /** Sets the data fragment size in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define SOCKET_SET_DATA_FRAGMENT_SIZE( answer )	( size_t * ) & IPC_GET_ARG2( answer )
+#define SOCKET_SET_DATA_FRAGMENT_SIZE(answer)	(size_t *) &IPC_GET_ARG2(answer)
 
 /** Sets the address length in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define SOCKET_SET_ADDRESS_LENGTH( answer )		( socklen_t * ) & IPC_GET_ARG3( answer )
+#define SOCKET_SET_ADDRESS_LENGTH(answer)		(socklen_t *) &IPC_GET_ARG3(answer)
 
 /** Returns the address length message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_ADDRESS_LENGTH( call )		( socklen_t ) IPC_GET_ARG3( call )
+#define SOCKET_GET_ADDRESS_LENGTH(call)		(socklen_t) IPC_GET_ARG3(call)
 
 /** Sets the header size in the message answer.
  *  @param[out] answer The message answer structure.
  */
-#define SOCKET_SET_HEADER_SIZE( answer )		( int * ) & IPC_GET_ARG3( answer )
+#define SOCKET_SET_HEADER_SIZE(answer)		(int *) &IPC_GET_ARG3(answer)
 
 /** Returns the header size message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_HEADER_SIZE( call )			( int ) IPC_GET_ARG3( call )
+#define SOCKET_GET_HEADER_SIZE(call)			(int) IPC_GET_ARG3(call)
 
 /** Returns the flags message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_FLAGS( call )				( int ) IPC_GET_ARG4( call )
+#define SOCKET_GET_FLAGS(call)				(int) IPC_GET_ARG4(call)
 
 /** Returns the option name message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_OPT_NAME( call )				( int ) IPC_GET_ARG4( call )
+#define SOCKET_GET_OPT_NAME(call)				(int) IPC_GET_ARG4(call)
 
 /** Returns the data fragments message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_DATA_FRAGMENTS( call )		( int ) IPC_GET_ARG5( call )
+#define SOCKET_GET_DATA_FRAGMENTS(call)		(int) IPC_GET_ARG5(call)
 
 /** Returns the new socket identifier message parameter.
  *  @param[in] call The message call structure.
  */
-#define SOCKET_GET_NEW_SOCKET_ID( call )		( int ) IPC_GET_ARG5( call )
+#define SOCKET_GET_NEW_SOCKET_ID(call)		(int) IPC_GET_ARG5(call)
 
 /*@}*/
Index: uspace/srv/net/structures/char_map.c
===================================================================
--- uspace/srv/net/structures/char_map.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/char_map.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -57,5 +57,5 @@
  *  @returns EEXIST if the key character string is already used.
  */
-int	char_map_add_item( char_map_ref map, const char * identifier, size_t length, const int value );
+int char_map_add_item(char_map_ref map, const char * identifier, size_t length, const int value);
 
 /** Returns the node assigned to the key from the map.
@@ -66,5 +66,5 @@
  *  @returns NULL if the key is not assigned a&nbsp;node.
  */
-char_map_ref	char_map_find_node( const char_map_ref map, const char * identifier, const size_t length );
+char_map_ref char_map_find_node(const char_map_ref map, const char * identifier, const size_t length);
 
 /** Returns the value assigned to the map.
@@ -73,5 +73,5 @@
  *  @returns CHAR_MAP_NULL if the map is not assigned a&nbsp;value.
  */
-int	char_map_get_value( const char_map_ref map );
+int char_map_get_value(const char_map_ref map);
 
 /** Checks if the map is valid.
@@ -80,74 +80,80 @@
  *  @returns FALSE otherwise.
  */
-int	char_map_is_valid( const char_map_ref map );
-
-int char_map_add( char_map_ref map, const char * identifier, size_t length, const int value ){
-	if( char_map_is_valid( map ) && ( identifier ) && (( length ) || ( * identifier ))){
-		int	index;
-
-		for( index = 0; index < map->next; ++ index ){
-			if( map->items[ index ]->c == * identifier ){
+int char_map_is_valid(const char_map_ref map);
+
+int char_map_add(char_map_ref map, const char * identifier, size_t length, const int value){
+	if(char_map_is_valid(map) && (identifier) && ((length) || (*identifier))){
+		int index;
+
+		for(index = 0; index < map->next; ++ index){
+			if(map->items[index]->c == * identifier){
 				++ identifier;
-				if(( length > 1 ) || (( length == 0 ) && ( * identifier ))){
-					return char_map_add( map->items[ index ], identifier, length ? length - 1 : 0, value );
+				if((length > 1) || ((length == 0) && (*identifier))){
+					return char_map_add(map->items[index], identifier, length ? length - 1 : 0, value);
 				}else{
-					if( map->items[ index ]->value != CHAR_MAP_NULL ) return EEXISTS;
-					map->items[ index ]->value = value;
+					if(map->items[index]->value != CHAR_MAP_NULL){
+						return EEXISTS;
+					}
+					map->items[index]->value = value;
 					return EOK;
 				}
 			}
 		}
-		return char_map_add_item( map, identifier, length, value );
+		return char_map_add_item(map, identifier, length, value);
 	}
 	return EINVAL;
 }
 
-int char_map_add_item( char_map_ref map, const char * identifier, size_t length, const int value ){
-	if( map->next == ( map->size - 1 )){
-		char_map_ref	* tmp;
-
-		tmp = ( char_map_ref * ) realloc( map->items, sizeof( char_map_ref ) * 2 * map->size );
-		if( ! tmp ) return ENOMEM;
+int char_map_add_item(char_map_ref map, const char * identifier, size_t length, const int value){
+	if(map->next == (map->size - 1)){
+		char_map_ref *tmp;
+
+		tmp = (char_map_ref *) realloc(map->items, sizeof(char_map_ref) * 2 * map->size);
+		if(! tmp){
+			return ENOMEM;
+		}
 		map->size *= 2;
 		map->items = tmp;
 	}
-	map->items[ map->next ] = ( char_map_ref ) malloc( sizeof( char_map_t ));
-	if( ! map->items[ map->next ] ) return ENOMEM;
-	if( char_map_initialize( map->items[ map->next ] ) != EOK ){
-		free( map->items[ map->next ] );
-		map->items[ map->next ] = NULL;
+	map->items[map->next] = (char_map_ref) malloc(sizeof(char_map_t));
+	if(! map->items[map->next]){
 		return ENOMEM;
 	}
-	map->items[ map->next ]->c = * identifier;
+	if(char_map_initialize(map->items[map->next]) != EOK){
+		free(map->items[map->next]);
+		map->items[map->next] = NULL;
+		return ENOMEM;
+	}
+	map->items[map->next]->c = * identifier;
 	++ identifier;
 	++ map->next;
-	if(( length > 1 ) || (( length == 0 ) && ( * identifier ))){
-		map->items[ map->next - 1 ]->value = CHAR_MAP_NULL;
-		return char_map_add_item( map->items[ map->next - 1 ], identifier, length ? length - 1 : 0, value );
+	if((length > 1) || ((length == 0) && (*identifier))){
+		map->items[map->next - 1]->value = CHAR_MAP_NULL;
+		return char_map_add_item(map->items[map->next - 1], identifier, length ? length - 1 : 0, value);
 	}else{
-		map->items[ map->next - 1 ]->value = value;
+		map->items[map->next - 1]->value = value;
 	}
 	return EOK;
 }
 
-void char_map_destroy( char_map_ref map ){
-	if( char_map_is_valid( map )){
-		int	index;
+void char_map_destroy(char_map_ref map){
+	if(char_map_is_valid(map)){
+		int index;
 
 		map->magic = 0;
-		for( index = 0; index < map->next; ++ index ){
-			char_map_destroy( map->items[ index ] );
-		}
-		free( map->items );
+		for(index = 0; index < map->next; ++ index){
+			char_map_destroy(map->items[index]);
+		}
+		free(map->items);
 		map->items = NULL;
 	}
 }
 
-int char_map_exclude( char_map_ref map, const char * identifier, size_t length ){
-	char_map_ref	node;
-
-	node = char_map_find_node( map, identifier, length );
-	if( node ){
-		int	value;
+int char_map_exclude(char_map_ref map, const char * identifier, size_t length){
+	char_map_ref node;
+
+	node = char_map_find_node(map, identifier, length);
+	if(node){
+		int value;
 
 		value = node->value;
@@ -158,21 +164,25 @@
 }
 
-int char_map_find( const char_map_ref map, const char * identifier, size_t length ){
-	char_map_ref	node;
-
-	node = char_map_find_node( map, identifier, length );
+int char_map_find(const char_map_ref map, const char * identifier, size_t length){
+	char_map_ref node;
+
+	node = char_map_find_node(map, identifier, length);
 	return node ? node->value : CHAR_MAP_NULL;
 }
 
-char_map_ref char_map_find_node( const char_map_ref map, const char * identifier, size_t length ){
-	if( ! char_map_is_valid( map )) return NULL;
-	if( length || ( * identifier )){
-		int	index;
-
-		for( index = 0; index < map->next; ++ index ){
-			if( map->items[ index ]->c == * identifier ){
+char_map_ref char_map_find_node(const char_map_ref map, const char * identifier, size_t length){
+	if(! char_map_is_valid(map)){
+		return NULL;
+	}
+	if(length || (*identifier)){
+		int index;
+
+		for(index = 0; index < map->next; ++ index){
+			if(map->items[index]->c == * identifier){
 				++ identifier;
-				if( length == 1 ) return map->items[ index ];
-				return char_map_find_node( map->items[ index ], identifier, length ? length - 1 : 0 );
+				if(length == 1){
+					return map->items[index];
+				}
+				return char_map_find_node(map->items[index], identifier, length ? length - 1 : 0);
 			}
 		}
@@ -182,38 +192,40 @@
 }
 
-int char_map_get_value( const char_map_ref map ){
-	return char_map_is_valid( map ) ? map->value : CHAR_MAP_NULL;
-}
-
-int char_map_initialize( char_map_ref map ){
-	if( ! map ) return EINVAL;
+int char_map_get_value(const char_map_ref map){
+	return char_map_is_valid(map) ? map->value : CHAR_MAP_NULL;
+}
+
+int char_map_initialize(char_map_ref map){
+	if(! map){
+		return EINVAL;
+	}
 	map->c = '\0';
 	map->value = CHAR_MAP_NULL;
 	map->size = 2;
 	map->next = 0;
-	map->items = malloc( sizeof( char_map_ref ) * map->size );
-	if( ! map->items ){
+	map->items = malloc(sizeof(char_map_ref) * map->size);
+	if(! map->items){
 		map->magic = 0;
 		return ENOMEM;
 	}
-	map->items[ map->next ] = NULL;
+	map->items[map->next] = NULL;
 	map->magic = CHAR_MAP_MAGIC_VALUE;
 	return EOK;
 }
 
-int char_map_is_valid( const char_map_ref map ){
-	return map && ( map->magic == CHAR_MAP_MAGIC_VALUE );
-}
-
-int char_map_update( char_map_ref map, const char * identifier, const size_t length, const int value ){
-	char_map_ref	node;
-
-//	if( ! char_map_is_valid( map )) return EINVAL;
-	node = char_map_find_node( map, identifier, length );
-	if( node ){
+int char_map_is_valid(const char_map_ref map){
+	return map && (map->magic == CHAR_MAP_MAGIC_VALUE);
+}
+
+int char_map_update(char_map_ref map, const char * identifier, const size_t length, const int value){
+	char_map_ref node;
+
+//	if(! char_map_is_valid(map)) return EINVAL;
+	node = char_map_find_node(map, identifier, length);
+	if(node){
 		node->value = value;
 		return EOK;
 	}else{
-		return char_map_add( map, identifier, length, value );
+		return char_map_add(map, identifier, length, value);
 	}
 }
Index: uspace/srv/net/structures/char_map.h
===================================================================
--- uspace/srv/net/structures/char_map.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/char_map.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -40,5 +40,5 @@
 /** Invalid assigned value used also if an&nbsp;entry does not exist.
  */
-#define CHAR_MAP_NULL	( -1 )
+#define CHAR_MAP_NULL	(-1)
 
 /** Type definition of the character string to integer map.
@@ -59,20 +59,20 @@
 	/** Actually mapped character.
 	 */
-	char			c;
+	char c;
 	/** Stored integral value.
 	 */
-	int				value;
+	int value;
 	/** Next character array size.
 	 */
-	int				size;
+	int size;
 	/** First free position in the next character array.
 	 */
-	int				next;
+	int next;
 	/** Next character array.
 	 */
-	char_map_ref *	items;
+	char_map_ref * items;
 	/** Consistency check magic value.
 	 */
-	int				magic;
+	int magic;
 };
 
@@ -89,10 +89,10 @@
  *  @returns Other error codes as defined for the char_map_add_item() function.
  */
-int	char_map_add( char_map_ref map, const char * identifier, size_t length, const int value );
+int char_map_add(char_map_ref map, const char * identifier, size_t length, const int value);
 
 /** Clears and destroys the map.
  *  @param[in,out] map The character string to integer map.
  */
-void	char_map_destroy( char_map_ref map );
+void char_map_destroy(char_map_ref map);
 
 /** Excludes the value assigned to the key from the map.
@@ -104,5 +104,5 @@
  *  @returns CHAR_MAP_NULL if the key is not assigned a&nbsp;value.
  */
-int	char_map_exclude( char_map_ref map, const char * identifier, size_t length );
+int char_map_exclude(char_map_ref map, const char * identifier, size_t length);
 
 /** Returns the value assigned to the key from the map.
@@ -113,5 +113,5 @@
  *  @returns CHAR_MAP_NULL if the key is not assigned a&nbsp;value.
  */
-int	char_map_find( const char_map_ref map, const char * identifier, size_t length );
+int char_map_find(const char_map_ref map, const char * identifier, size_t length);
 
 /** Initializes the map.
@@ -121,5 +121,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	char_map_initialize( char_map_ref map );
+int char_map_initialize(char_map_ref map);
 
 /** Adds or updates the value with the key to the map.
@@ -135,5 +135,5 @@
  *  @returns Other error codes as defined for the char_map_add_item() function.
  */
-int	char_map_update( char_map_ref map, const char * identifier, size_t length, const int value );
+int char_map_update(char_map_ref map, const char * identifier, size_t length, const int value);
 
 #endif
Index: uspace/srv/net/structures/dynamic_fifo.c
===================================================================
--- uspace/srv/net/structures/dynamic_fifo.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/dynamic_fifo.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -50,5 +50,5 @@
  *  @param[in] index The actual index to be shifted.
  */
-#define NEXT_INDEX( fifo, index )	((( index ) + 1 ) % (( fifo )->size + 1 ))
+#define NEXT_INDEX(fifo, index)	(((index) + 1) % ((fifo)->size + 1))
 
 /** Checks if the queue is valid.
@@ -57,15 +57,21 @@
  *  @returns FALSE otherwise.
  */
-int	dyn_fifo_is_valid( dyn_fifo_ref fifo );
+int dyn_fifo_is_valid(dyn_fifo_ref fifo);
 
-int dyn_fifo_is_valid( dyn_fifo_ref fifo ){
-	return fifo && ( fifo->magic_value == DYN_FIFO_MAGIC_VALUE );
+int dyn_fifo_is_valid(dyn_fifo_ref fifo){
+	return fifo && (fifo->magic_value == DYN_FIFO_MAGIC_VALUE);
 }
 
-int dyn_fifo_initialize( dyn_fifo_ref fifo, int size ){
-	if( ! fifo ) return EBADMEM;
-	if( size <= 0 ) return EINVAL;
-	fifo->items = ( int * ) malloc( sizeof( int ) * size + 1 );
-	if( ! fifo->items ) return ENOMEM;
+int dyn_fifo_initialize(dyn_fifo_ref fifo, int size){
+	if(! fifo){
+		return EBADMEM;
+	}
+	if(size <= 0){
+		return EINVAL;
+	}
+	fifo->items = (int *) malloc(sizeof(int) * size + 1);
+	if(! fifo->items){
+		return ENOMEM;
+	}
 	fifo->size = size;
 	fifo->head = 0;
@@ -75,24 +81,30 @@
 }
 
-int	dyn_fifo_push( dyn_fifo_ref fifo, int value, int max_size ){
-	int *	new_items;
+int dyn_fifo_push(dyn_fifo_ref fifo, int value, int max_size){
+	int * new_items;
 
-	if( ! dyn_fifo_is_valid( fifo )) return EINVAL;
-	if( NEXT_INDEX( fifo, fifo->tail ) == fifo->head ){
-		if(( max_size > 0 ) && (( fifo->size * 2 ) > max_size )){
-			if( fifo->size >= max_size ) return ENOMEM;
+	if(! dyn_fifo_is_valid(fifo)){
+		return EINVAL;
+	}
+	if(NEXT_INDEX(fifo, fifo->tail) == fifo->head){
+		if((max_size > 0) && ((fifo->size * 2) > max_size)){
+			if(fifo->size >= max_size){
+				return ENOMEM;
+			}
 		}else{
 			max_size = fifo->size * 2;
 		}
-		new_items = realloc( fifo->items, sizeof( int ) * max_size + 1 );
-		if( ! new_items ) return ENOMEM;
+		new_items = realloc(fifo->items, sizeof(int) * max_size + 1);
+		if(! new_items){
+			return ENOMEM;
+		}
 		fifo->items = new_items;
-		if( fifo->tail < fifo->head ){
-			if( fifo->tail < max_size - fifo->size ){
-				memcpy( fifo->items + fifo->size + 1, fifo->items, fifo->tail * sizeof( int ));
+		if(fifo->tail < fifo->head){
+			if(fifo->tail < max_size - fifo->size){
+				memcpy(fifo->items + fifo->size + 1, fifo->items, fifo->tail * sizeof(int));
 				fifo->tail += fifo->size + 1;
 			}else{
-				memcpy( fifo->items + fifo->size + 1, fifo->items, ( max_size - fifo->size ) * sizeof( int ));
-				memcpy( fifo->items, fifo->items + max_size - fifo->size, fifo->tail - max_size + fifo->size );
+				memcpy(fifo->items + fifo->size + 1, fifo->items, (max_size - fifo->size) * sizeof(int));
+				memcpy(fifo->items, fifo->items + max_size - fifo->size, fifo->tail - max_size + fifo->size);
 				fifo->tail -= max_size - fifo->size;
 			}
@@ -100,28 +112,38 @@
 		fifo->size = max_size;
 	}
-	fifo->items[ fifo->tail ] = value;
-	fifo->tail = NEXT_INDEX( fifo, fifo->tail );
+	fifo->items[fifo->tail] = value;
+	fifo->tail = NEXT_INDEX(fifo, fifo->tail);
 	return EOK;
 }
 
-int dyn_fifo_pop( dyn_fifo_ref fifo ){
-	int	value;
+int dyn_fifo_pop(dyn_fifo_ref fifo){
+	int value;
 
-	if( ! dyn_fifo_is_valid( fifo )) return EINVAL;
-	if( fifo->head == fifo->tail ) return ENOENT;
-	value = fifo->items[ fifo->head ];
-	fifo->head = NEXT_INDEX( fifo, fifo->head );
+	if(! dyn_fifo_is_valid(fifo)){
+		return EINVAL;
+	}
+	if(fifo->head == fifo->tail){
+		return ENOENT;
+	}
+	value = fifo->items[fifo->head];
+	fifo->head = NEXT_INDEX(fifo, fifo->head);
 	return value;
 }
 
-int dyn_fifo_value( dyn_fifo_ref fifo ){
-	if( ! dyn_fifo_is_valid( fifo )) return EINVAL;
-	if( fifo->head == fifo->tail ) return ENOENT;
-	return fifo->items[ fifo->head ];
+int dyn_fifo_value(dyn_fifo_ref fifo){
+	if(! dyn_fifo_is_valid(fifo)){
+		return EINVAL;
+	}
+	if(fifo->head == fifo->tail){
+		return ENOENT;
+	}
+	return fifo->items[fifo->head];
 }
 
-int dyn_fifo_destroy( dyn_fifo_ref fifo ){
-	if( ! dyn_fifo_is_valid( fifo )) return EINVAL;
-	free( fifo->items );
+int dyn_fifo_destroy(dyn_fifo_ref fifo){
+	if(! dyn_fifo_is_valid(fifo)){
+		return EINVAL;
+	}
+	free(fifo->items);
 	fifo->magic_value = 0;
 	return EOK;
Index: uspace/srv/net/structures/dynamic_fifo.h
===================================================================
--- uspace/srv/net/structures/dynamic_fifo.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/dynamic_fifo.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -56,17 +56,17 @@
 	/** Stored item field.
 	 */
-	int	*	items;
+	int *	items;
 	/** Actual field size.
 	 */
-	int		size;
+	int size;
 	/** First item in the queue index.
 	 */
-	int		head;
+	int head;
 	/** Last item in the queue index.
 	 */
-	int		tail;
+	int tail;
 	/** Consistency check magic value.
 	 */
-	int		magic_value;
+	int magic_value;
 };
 
@@ -79,5 +79,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	dyn_fifo_initialize( dyn_fifo_ref fifo, int size );
+int dyn_fifo_initialize(dyn_fifo_ref fifo, int size);
 
 /** Appends a new item to the queue end.
@@ -89,5 +89,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	dyn_fifo_push( dyn_fifo_ref fifo, int value, int max_size );
+int dyn_fifo_push(dyn_fifo_ref fifo, int value, int max_size);
 
 /** Returns and excludes the first item in the queue.
@@ -97,5 +97,5 @@
  *  @returns ENOENT if the queue is empty.
  */
-int	dyn_fifo_pop( dyn_fifo_ref fifo );
+int dyn_fifo_pop(dyn_fifo_ref fifo);
 
 /** Returns and keeps the first item in the queue.
@@ -105,5 +105,5 @@
  *  @returns ENOENT if the queue is empty.
  */
-int	dyn_fifo_value( dyn_fifo_ref fifo );
+int dyn_fifo_value(dyn_fifo_ref fifo);
 
 /** Clears and destroys the queue.
@@ -112,5 +112,5 @@
  *  @returns EINVAL if the queue is not valid.
  */
-int dyn_fifo_destroy( dyn_fifo_ref fifo );
+int dyn_fifo_destroy(dyn_fifo_ref fifo);
 
 #endif
Index: uspace/srv/net/structures/generic_char_map.h
===================================================================
--- uspace/srv/net/structures/generic_char_map.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/generic_char_map.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -54,7 +54,7 @@
  *  @param[in] type Inner object type.
  */
-#define GENERIC_CHAR_MAP_DECLARE( name, type )									\
+#define GENERIC_CHAR_MAP_DECLARE(name, type)									\
 																				\
-GENERIC_FIELD_DECLARE( name##_items, type )										\
+GENERIC_FIELD_DECLARE(name##_items, type)										\
 																				\
 typedef	struct name		name##_t;												\
@@ -62,16 +62,16 @@
 																				\
 struct	name{																	\
-	char_map_t		names;														\
-	name##_items_t	values;														\
-	int				magic;														\
+	char_map_t names;														\
+	name##_items_t values;														\
+	int magic;														\
 };																				\
 																				\
-int	name##_add( name##_ref map, const char * name, const size_t length, type * value );	\
-int	name##_count( name##_ref map );												\
-void	name##_destroy( name##_ref map );										\
-void	name##_exclude( name##_ref map, const char * name, const size_t length );	\
-type *	name##_find( name##_ref map, const char * name, const size_t length );	\
-int	name##_initialize( name##_ref map );										\
-int	name##_is_valid( name##_ref map );
+int name##_add(name##_ref map, const char * name, const size_t length, type * value);	\
+int name##_count(name##_ref map);												\
+void name##_destroy(name##_ref map);											\
+void name##_exclude(name##_ref map, const char * name, const size_t length);	\
+type * name##_find(name##_ref map, const char * name, const size_t length);		\
+int name##_initialize(name##_ref map);											\
+int name##_is_valid(name##_ref map);
 
 /** Character string to generic type map implementation.
@@ -80,18 +80,22 @@
  *  @param[in] type Inner object type.
  */
-#define GENERIC_CHAR_MAP_IMPLEMENT( name, type )								\
+#define GENERIC_CHAR_MAP_IMPLEMENT(name, type)									\
 																				\
-GENERIC_FIELD_IMPLEMENT( name##_items, type )									\
+GENERIC_FIELD_IMPLEMENT(name##_items, type)										\
 																				\
-int name##_add( name##_ref map, const char * name, const size_t length, type * value ){	\
+int name##_add(name##_ref map, const char * name, const size_t length, type * value){	\
 	ERROR_DECLARE;																\
 																				\
-	int	index;																	\
+	int index;																	\
 																				\
-	if( ! name##_is_valid( map )) return EINVAL;								\
-	index = name##_items_add( & map->values, value );							\
-	if( index < 0 ) return index;												\
-	if( ERROR_OCCURRED( char_map_add( & map->names, name, length, index ))){		\
-		name##_items_exclude_index( & map->values, index );						\
+	if(! name##_is_valid(map)){													\
+		return EINVAL;															\
+	}																			\
+	index = name##_items_add(&map->values, value);								\
+	if(index < 0){																\
+		return index;															\
+	}																			\
+	if(ERROR_OCCURRED(char_map_add(&map->names, name, length, index))){			\
+		name##_items_exclude_index(&map->values, index);						\
 		return ERROR_CODE;														\
 	}																			\
@@ -99,33 +103,33 @@
 }																				\
 																				\
-int name##_count( name##_ref map ){												\
-	return name##_is_valid( map ) ? name##_items_count( & map->values ) : -1;	\
+int name##_count(name##_ref map){												\
+	return name##_is_valid(map) ? name##_items_count(&map->values) : -1;		\
 }																				\
 																				\
-void name##_destroy( name##_ref map ){											\
-	if( name##_is_valid( map )){												\
-		char_map_destroy( & map->names );										\
-		name##_items_destroy( & map->values );									\
+void name##_destroy(name##_ref map){											\
+	if(name##_is_valid(map)){													\
+		char_map_destroy(&map->names);											\
+		name##_items_destroy(&map->values);										\
 	}																			\
 }																				\
 																				\
-void name##_exclude( name##_ref map, const char * name, const size_t length ){	\
-	if( name##_is_valid( map )){												\
-		int	index;																\
+void name##_exclude(name##_ref map, const char * name, const size_t length){	\
+	if(name##_is_valid(map)){													\
+		int index;																\
 																				\
-		index = char_map_exclude( & map->names, name, length );					\
-		if( index != CHAR_MAP_NULL ){											\
-			name##_items_exclude_index( & map->values, index );					\
+		index = char_map_exclude(&map->names, name, length);					\
+		if(index != CHAR_MAP_NULL){												\
+			name##_items_exclude_index(&map->values, index);					\
 		}																		\
 	}																			\
 }																				\
 																				\
-type * name##_find( name##_ref map, const char * name, const size_t length ){	\
-	if( name##_is_valid( map )){												\
-		int	index;																\
+type * name##_find(name##_ref map, const char * name, const size_t length){		\
+	if(name##_is_valid(map)){													\
+		int index;																\
 																				\
-		index = char_map_find( & map->names, name, length );					\
-		if( index != CHAR_MAP_NULL ){											\
-			return name##_items_get_index( & map->values, index );				\
+		index = char_map_find(&map->names, name, length);						\
+		if(index != CHAR_MAP_NULL){												\
+			return name##_items_get_index(&map->values, index);					\
 		}																		\
 	}																			\
@@ -133,11 +137,13 @@
 }																				\
 																				\
-int name##_initialize( name##_ref map ){										\
+int name##_initialize(name##_ref map){											\
 	ERROR_DECLARE;																\
 																				\
-	if( ! map ) return EINVAL;													\
-	ERROR_PROPAGATE( char_map_initialize( & map->names ));						\
-	if( ERROR_OCCURRED( name##_items_initialize( & map->values ))){				\
-		char_map_destroy( & map->names );										\
+	if(! map){																	\
+		return EINVAL;															\
+	}																			\
+	ERROR_PROPAGATE(char_map_initialize(&map->names));							\
+	if(ERROR_OCCURRED(name##_items_initialize(&map->values))){					\
+		char_map_destroy(&map->names);											\
 		return ERROR_CODE;														\
 	}																			\
@@ -146,6 +152,6 @@
 }																				\
 																				\
-int name##_is_valid( name##_ref map ){											\
-	return map && ( map->magic == GENERIC_CHAR_MAP_MAGIC_VALUE );				\
+int name##_is_valid(name##_ref map){											\
+	return map && (map->magic == GENERIC_CHAR_MAP_MAGIC_VALUE);					\
 }
 
Index: uspace/srv/net/structures/generic_field.h
===================================================================
--- uspace/srv/net/structures/generic_field.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/generic_field.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -51,24 +51,24 @@
  *  @param[in] type Inner object type.
  */
-#define GENERIC_FIELD_DECLARE( name, type )					\
-										\
-typedef	struct name		name##_t;					\
-typedef	name##_t *		name##_ref;					\
-										\
-struct	name{									\
-	int	size;								\
-	int	next;								\
-	type **	items;								\
-	int	magic;								\
-};										\
-										\
-int	name##_add( name##_ref field, type * value );				\
-int	name##_count( name##_ref field );					\
-void	name##_destroy( name##_ref field );					\
-void	name##_exclude_index( name##_ref field, int index );			\
-type **	name##_get_field( name##_ref field );					\
-type *	name##_get_index( name##_ref field, int index );			\
-int	name##_initialize( name##_ref field );					\
-int	name##_is_valid( name##_ref field );
+#define GENERIC_FIELD_DECLARE(name, type)										\
+																				\
+typedef	struct name		name##_t;												\
+typedef	name##_t *		name##_ref;												\
+																				\
+struct	name{																	\
+	int size;																	\
+	int next;																	\
+	type **	items;																\
+	int magic;																	\
+};																				\
+																				\
+int name##_add(name##_ref field, type * value);									\
+int name##_count(name##_ref field);												\
+void name##_destroy(name##_ref field);											\
+void name##_exclude_index(name##_ref field, int index);							\
+type ** name##_get_field(name##_ref field);										\
+type * name##_get_index(name##_ref field, int index);							\
+int name##_initialize(name##_ref field);										\
+int name##_is_valid(name##_ref field);
 
 /** Generic type field implementation.
@@ -77,71 +77,79 @@
  *  @param[in] type Inner object type.
  */
-#define GENERIC_FIELD_IMPLEMENT( name, type )					\
-										\
-int name##_add( name##_ref field, type * value ){				\
-	if( name##_is_valid( field )){						\
-		if( field->next == ( field->size - 1 )){			\
-			type **	tmp;					\
-										\
-			tmp = ( type ** ) realloc( field->items, sizeof( type * ) * 2 * field->size );	\
-			if( ! tmp ) return ENOMEM;				\
-			field->size *= 2;					\
-			field->items = tmp;					\
-		}								\
-		field->items[ field->next ] = value;				\
-		++ field->next;							\
-		field->items[ field->next ] = NULL;				\
-		return field->next - 1;						\
-	}									\
-	return EINVAL;								\
-}										\
-										\
-int name##_count( name##_ref field ){						\
-	return name##_is_valid( field ) ? field->next : -1;			\
-}										\
-										\
-void name##_destroy( name##_ref field ){					\
-	if( name##_is_valid( field )){						\
-		int	index;							\
-										\
-		field->magic = 0;						\
-		for( index = 0; index < field->next; ++ index ){		\
-			if( field->items[ index ] ) free( field->items[ index ] );				\
-		}								\
-		free( field->items );						\
-	}									\
-}										\
-										\
-void name##_exclude_index( name##_ref field, int index ){			\
-	if( name##_is_valid( field ) && ( index >= 0 ) && ( index < field->next ) && ( field->items[ index ] )){	\
-		free( field->items[ index ] );					\
-		field->items[ index ] = NULL;					\
-	}									\
-}										\
-										\
-type * name##_get_index( name##_ref field, int index ){				\
-	if( name##_is_valid( field ) && ( index >= 0 ) && ( index < field->next ) && ( field->items[ index ] )){	\
-		return field->items[ index ];					\
-	}									\
-	return NULL;								\
-}										\
-										\
-type ** name##_get_field( name##_ref field ){					\
-	return name##_is_valid( field ) ? field->items : NULL;			\
-}										\
-										\
-int name##_initialize( name##_ref field ){					\
-	if( ! field ) return EINVAL;						\
-	field->size = 2;							\
-	field->next = 0;							\
-	field->items = ( type ** ) malloc( sizeof( type * ) * field->size );	\
-	if( ! field->items ) return ENOMEM;					\
-	field->items[ field->next ] = NULL;					\
-	field->magic = GENERIC_FIELD_MAGIC_VALUE;					\
-	return EOK;								\
-}										\
-										\
-int name##_is_valid( name##_ref field ){					\
-	return field && ( field->magic == GENERIC_FIELD_MAGIC_VALUE );		\
+#define GENERIC_FIELD_IMPLEMENT(name, type)										\
+																				\
+int name##_add(name##_ref field, type * value){									\
+	if(name##_is_valid(field)){													\
+		if(field->next == (field->size - 1)){									\
+			type **	tmp;														\
+																				\
+			tmp = (type **) realloc(field->items, sizeof(type *) * 2 * field->size);	\
+			if(! tmp){															\
+				return ENOMEM;													\
+			}																	\
+			field->size *= 2;													\
+			field->items = tmp;													\
+		}																		\
+		field->items[field->next] = value;										\
+		++ field->next;															\
+		field->items[field->next] = NULL;										\
+		return field->next - 1;													\
+	}																			\
+	return EINVAL;																\
+}																				\
+																				\
+int name##_count(name##_ref field){												\
+	return name##_is_valid(field) ? field->next : -1;							\
+}																				\
+																				\
+void name##_destroy(name##_ref field){											\
+	if(name##_is_valid(field)){													\
+		int index;																\
+																				\
+		field->magic = 0;														\
+		for(index = 0; index < field->next; ++ index){							\
+			if(field->items[index]){											\
+				free(field->items[index]);										\
+			}																	\
+		}																		\
+		free(field->items);														\
+	}																			\
+}																				\
+																				\
+void name##_exclude_index(name##_ref field, int index){							\
+	if(name##_is_valid(field) && (index >= 0) && (index < field->next) && (field->items[index])){	\
+		free(field->items[index]);												\
+		field->items[index] = NULL;												\
+	}																			\
+}																				\
+																				\
+type * name##_get_index(name##_ref field, int index){							\
+	if(name##_is_valid(field) && (index >= 0) && (index < field->next) && (field->items[index])){	\
+		return field->items[index];												\
+	}																			\
+	return NULL;																\
+}																				\
+																				\
+type ** name##_get_field(name##_ref field){										\
+	return name##_is_valid(field) ? field->items : NULL;						\
+}																				\
+																				\
+int name##_initialize(name##_ref field){										\
+	if(! field){																\
+		return EINVAL;															\
+	}																			\
+	field->size = 2;															\
+	field->next = 0;															\
+	field->items = (type **) malloc(sizeof(type *) * field->size);				\
+	if(! field->items){															\
+		return ENOMEM;															\
+	}																			\
+	field->items[field->next] = NULL;											\
+	field->magic = GENERIC_FIELD_MAGIC_VALUE;									\
+	return EOK;																	\
+}																				\
+																				\
+int name##_is_valid(name##_ref field){											\
+	return field && (field->magic == GENERIC_FIELD_MAGIC_VALUE);				\
 }
 
Index: uspace/srv/net/structures/int_map.h
===================================================================
--- uspace/srv/net/structures/int_map.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/int_map.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -55,5 +55,5 @@
  *  @param[in] type Inner object type.
  */
-#define INT_MAP_DECLARE( name, type )											\
+#define INT_MAP_DECLARE(name, type)												\
 																				\
 typedef	struct name			name##_t;											\
@@ -63,29 +63,29 @@
 																				\
 struct	name##_item{															\
-	int		key;																\
-	type *	value;																\
-	int		magic;																\
+	int key;																\
+	type * value;																\
+	int magic;																\
 };																				\
 																				\
 struct	name{																	\
-	int				size;														\
-	int				next;														\
-	name##_item_ref	items;														\
-	int				magic;														\
+	int size;														\
+	int next;														\
+	name##_item_ref items;														\
+	int magic;														\
 };																				\
 																				\
-int		name##_add( name##_ref map, int key, type * value );					\
-void	name##_clear( name##_ref map );											\
-int		name##_count( name##_ref map );											\
-void	name##_destroy( name##_ref map );										\
-void	name##_exclude( name##_ref map, int key );								\
-void	name##_exclude_index( name##_ref map, int index );						\
-type *	name##_find( name##_ref map, int key );									\
-int		name##_update( name##_ref map, int key, int new_key );					\
-type *	name##_get_index( name##_ref map, int index );							\
-int		name##_initialize( name##_ref map );									\
-int		name##_is_valid( name##_ref map );										\
-void	name##_item_destroy( name##_item_ref item );							\
-int		name##_item_is_valid( name##_item_ref item );
+int name##_add(name##_ref map, int key, type * value);							\
+void name##_clear(name##_ref map);												\
+int name##_count(name##_ref map);												\
+void name##_destroy(name##_ref map);											\
+void name##_exclude(name##_ref map, int key);									\
+void name##_exclude_index(name##_ref map, int index);							\
+type * name##_find(name##_ref map, int key);									\
+int name##_update(name##_ref map, int key, int new_key);						\
+type * name##_get_index(name##_ref map, int index);								\
+int name##_initialize(name##_ref map);											\
+int name##_is_valid(name##_ref map);											\
+void name##_item_destroy(name##_item_ref item);									\
+int name##_item_is_valid(name##_item_ref item);
 
 /** Integer to generic type map implementation.
@@ -94,21 +94,23 @@
  *  @param[in] type Inner object type.
  */
-#define INT_MAP_IMPLEMENT( name, type )											\
-																				\
-int name##_add( name##_ref map, int key, type * value ){						\
-	if( name##_is_valid( map )){												\
-		if( map->next == ( map->size - 1 )){									\
-			name##_item_ref	tmp;												\
-																				\
-			tmp = ( name##_item_ref ) realloc( map->items, sizeof( name##_item_t ) * 2 * map->size );	\
-			if( ! tmp ) return ENOMEM;											\
+#define INT_MAP_IMPLEMENT(name, type)											\
+																				\
+int name##_add(name##_ref map, int key, type * value){							\
+	if(name##_is_valid(map)){													\
+		if(map->next == (map->size - 1)){										\
+			name##_item_ref tmp;												\
+																				\
+			tmp = (name##_item_ref) realloc(map->items, sizeof(name##_item_t) * 2 * map->size);	\
+			if(! tmp){															\
+				return ENOMEM;													\
+			}																	\
 			map->size *= 2;														\
 			map->items = tmp;													\
 		}																		\
-		map->items[ map->next ].key = key;										\
-		map->items[ map->next ].value = value;									\
-		map->items[ map->next ].magic = INT_MAP_ITEM_MAGIC_VALUE;				\
+		map->items[map->next].key = key;										\
+		map->items[map->next].value = value;									\
+		map->items[map->next].magic = INT_MAP_ITEM_MAGIC_VALUE;					\
 		++ map->next;															\
-		map->items[ map->next ].magic = 0;										\
+		map->items[map->next].magic = 0;										\
 		return map->next - 1;													\
 	}																			\
@@ -116,63 +118,63 @@
 }																				\
 																				\
-void name##_clear( name##_ref map ){											\
-	if( name##_is_valid( map )){												\
-		int	index;																\
+void name##_clear(name##_ref map){												\
+	if(name##_is_valid(map)){													\
+		int index;																\
 																				\
 /*		map->magic = 0;*/														\
-		for( index = 0; index < map->next; ++ index ){							\
-			if( name##_item_is_valid( &( map->items[ index ] ))){				\
-				name##_item_destroy( &( map->items[ index ] ));					\
+		for(index = 0; index < map->next; ++ index){							\
+			if(name##_item_is_valid(&(map->items[index]))){						\
+				name##_item_destroy(&(map->items[index]));						\
 			}																	\
 		}																		\
 		map->next = 0;															\
-		map->items[ map->next ].magic = 0;										\
+		map->items[map->next].magic = 0;										\
 /*		map->magic = INT_MAP_MAGIC_VALUE;*/										\
 	}																			\
 }																				\
 																				\
-int name##_count( name##_ref map ){												\
-	return name##_is_valid( map ) ? map->next : -1;								\
-}																				\
-																				\
-void name##_destroy( name##_ref map ){											\
-	if( name##_is_valid( map )){												\
-		int	index;																\
+int name##_count(name##_ref map){												\
+	return name##_is_valid(map) ? map->next : -1;								\
+}																				\
+																				\
+void name##_destroy(name##_ref map){											\
+	if(name##_is_valid(map)){													\
+		int index;																\
 																				\
 		map->magic = 0;															\
-		for( index = 0; index < map->next; ++ index ){							\
-			if( name##_item_is_valid( &( map->items[ index ] ))){				\
-				name##_item_destroy( &( map->items[ index ] ));					\
-			}																	\
-		}																		\
-		free( map->items );														\
-	}																			\
-}																				\
-																				\
-void name##_exclude( name##_ref map, int key ){									\
-	if( name##_is_valid( map )){												\
-		int	index;																\
-																				\
-		for( index = 0; index < map->next; ++ index ){							\
-			if( name##_item_is_valid( &( map->items[ index ] )) && ( map->items[ index ].key == key )){	\
-				name##_item_destroy( &( map->items[ index ] ));					\
-			}																	\
-		}																		\
-	}																			\
-}																				\
-																				\
-void name##_exclude_index( name##_ref map, int index ){							\
-	if( name##_is_valid( map ) && ( index >= 0 ) && ( index < map->next ) && name##_item_is_valid( &( map->items[ index ] ))){	\
-		name##_item_destroy( &( map->items[ index ] ));							\
-	}																			\
-}																				\
-																				\
-type * name##_find( name##_ref map, int key ){									\
-	if( name##_is_valid( map )){												\
-		int	index;																\
-																				\
-		for( index = 0; index < map->next; ++ index ){							\
-			if( name##_item_is_valid( &( map->items[ index ] )) && ( map->items[ index ].key == key )){	\
-				return map->items[ index ].value;								\
+		for(index = 0; index < map->next; ++ index){							\
+			if(name##_item_is_valid(&(map->items[index]))){						\
+				name##_item_destroy(&(map->items[index]));						\
+			}																	\
+		}																		\
+		free(map->items);														\
+	}																			\
+}																				\
+																				\
+void name##_exclude(name##_ref map, int key){									\
+	if(name##_is_valid(map)){													\
+		int index;																\
+																				\
+		for(index = 0; index < map->next; ++ index){							\
+			if(name##_item_is_valid(&(map->items[index])) && (map->items[index].key == key)){	\
+				name##_item_destroy(&(map->items[index]));						\
+			}																	\
+		}																		\
+	}																			\
+}																				\
+																				\
+void name##_exclude_index(name##_ref map, int index){							\
+	if(name##_is_valid(map) && (index >= 0) && (index < map->next) && name##_item_is_valid(&(map->items[index]))){	\
+		name##_item_destroy(&(map->items[index]));								\
+	}																			\
+}																				\
+																				\
+type * name##_find(name##_ref map, int key){									\
+	if(name##_is_valid(map)){													\
+		int index;																\
+																				\
+		for(index = 0; index < map->next; ++ index){							\
+			if(name##_item_is_valid(&(map->items[index])) && (map->items[index].key == key)){	\
+				return map->items[index].value;									\
 			}																	\
 		}																		\
@@ -181,14 +183,14 @@
 }																				\
 																				\
-int name##_update( name##_ref map, int key, int new_key ){						\
-	if( name##_is_valid( map )){												\
-		int	index;																\
-																				\
-		for( index = 0; index < map->next; ++ index ){							\
-			if( name##_item_is_valid( &( map->items[ index ] ))){				\
-				if( map->items[ index ].key == new_key ){						\
+int name##_update(name##_ref map, int key, int new_key){						\
+	if(name##_is_valid(map)){													\
+		int index;																\
+																				\
+		for(index = 0; index < map->next; ++ index){							\
+			if(name##_item_is_valid(&(map->items[index]))){						\
+				if(map->items[index].key == new_key){							\
 					return EEXIST;												\
-				}else if( map->items[ index ].key == key ){						\
-					map->items[ index ].key = new_key;							\
+				}else if(map->items[index].key == key){							\
+					map->items[index].key = new_key;							\
 					return EOK;													\
 				}																\
@@ -199,31 +201,35 @@
 }																				\
 																				\
-type * name##_get_index( name##_ref map, int index ){							\
-	if( name##_is_valid( map ) && ( index >= 0 ) && ( index < map->next ) && name##_item_is_valid( &( map->items[ index ] ))){	\
-		return map->items[ index ].value;										\
+type * name##_get_index(name##_ref map, int index){								\
+	if(name##_is_valid(map) && (index >= 0) && (index < map->next) && name##_item_is_valid(&(map->items[index]))){	\
+		return map->items[index].value;											\
 	}																			\
 	return NULL;																\
 }																				\
 																				\
-int name##_initialize( name##_ref map ){										\
-	if( ! map ) return EINVAL;													\
+int name##_initialize(name##_ref map){											\
+	if(! map){																	\
+		return EINVAL;															\
+	}																			\
 	map->size = 2;																\
 	map->next = 0;																\
-	map->items = ( name##_item_ref ) malloc( sizeof( name##_item_t ) * map->size );	\
-	if( ! map->items ) return ENOMEM;											\
-	map->items[ map->next ].magic = 0;											\
+	map->items = (name##_item_ref) malloc(sizeof(name##_item_t) * map->size);	\
+	if(! map->items){															\
+		return ENOMEM;															\
+	}																			\
+	map->items[map->next].magic = 0;											\
 	map->magic = INT_MAP_MAGIC_VALUE;											\
 	return EOK;																	\
 }																				\
 																				\
-int name##_is_valid( name##_ref map ){											\
-	return map && ( map->magic == INT_MAP_MAGIC_VALUE );						\
-}																				\
-																				\
-void name##_item_destroy( name##_item_ref item ){								\
-	if( name##_item_is_valid( item )){											\
+int name##_is_valid(name##_ref map){											\
+	return map && (map->magic == INT_MAP_MAGIC_VALUE);							\
+}																				\
+																				\
+void name##_item_destroy(name##_item_ref item){									\
+	if(name##_item_is_valid(item)){												\
 		item->magic = 0;														\
-		if( item->value ){														\
-			free( item->value );												\
+		if(item->value){														\
+			free(item->value);													\
 			item->value = NULL;													\
 		}																		\
@@ -231,6 +237,6 @@
 }																				\
 																				\
-int name##_item_is_valid( name##_item_ref item ){								\
-	return item && ( item->magic == INT_MAP_ITEM_MAGIC_VALUE );					\
+int name##_item_is_valid(name##_item_ref item){									\
+	return item && (item->magic == INT_MAP_ITEM_MAGIC_VALUE);					\
 }
 
Index: uspace/srv/net/structures/measured_strings.c
===================================================================
--- uspace/srv/net/structures/measured_strings.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/measured_strings.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -54,36 +54,42 @@
  *  @returns NULL if there is not enough memory left.
  */
-size_t *	prepare_lengths( const measured_string_ref strings, size_t count );
-
-measured_string_ref measured_string_create_bulk( const char * string, size_t length ){
-	measured_string_ref	new;
-
-	if( length == 0 ){
-		while( string[ length ] ) ++ length;
-	}
-	new = ( measured_string_ref ) malloc( sizeof( measured_string_t ) + ( sizeof( char ) * ( length + 1 )));
-	if( ! new ) return NULL;
+size_t * prepare_lengths(const measured_string_ref strings, size_t count);
+
+measured_string_ref measured_string_create_bulk(const char * string, size_t length){
+	measured_string_ref new;
+
+	if(length == 0){
+		while(string[length]){
+			++ length;
+		}
+	}
+	new = (measured_string_ref) malloc(sizeof(measured_string_t) + (sizeof(char) * (length + 1)));
+	if(! new){
+		return NULL;
+	}
 	new->length = length;
-	new->value = (( char * ) new ) + sizeof( measured_string_t );
+	new->value = ((char *) new) + sizeof(measured_string_t);
 	// append terminating zero explicitly - to be safe
-	memcpy( new->value, string, new->length );
-	new->value[ new->length ] = '\0';
+	memcpy(new->value, string, new->length);
+	new->value[new->length] = '\0';
 	return new;
 }
 
-measured_string_ref measured_string_copy( measured_string_ref source ){
-	measured_string_ref	new;
-
-	if( ! source ) return NULL;
-	new = ( measured_string_ref ) malloc( sizeof( measured_string_t ));
-	if( new ){
-		new->value = ( char * ) malloc( source->length + 1 );
-		if( new->value ){
+measured_string_ref measured_string_copy(measured_string_ref source){
+	measured_string_ref new;
+
+	if(! source){
+		return NULL;
+	}
+	new = (measured_string_ref) malloc(sizeof(measured_string_t));
+	if(new){
+		new->value = (char *) malloc(source->length + 1);
+		if(new->value){
 			new->length = source->length;
-			memcpy( new->value, source->value, new->length );
-			new->value[ new->length ] = '\0';
+			memcpy(new->value, source->value, new->length);
+			new->value[new->length] = '\0';
 			return new;
 		}else{
-			free( new );
+			free(new);
 		}
 	}
@@ -91,173 +97,187 @@
 }
 
-int measured_strings_receive( measured_string_ref * strings, char ** data, size_t count ){
-	ERROR_DECLARE;
-
-	size_t *		lengths;
-	size_t			index;
-	size_t			length;
-	char *			next;
-	ipc_callid_t	callid;
-
-	if(( ! strings ) || ( ! data ) || ( count <= 0 )){
-		return EINVAL;
-	}
-	lengths = ( size_t * ) malloc( sizeof( size_t ) * ( count + 1 ));
-	if( ! lengths ) return ENOMEM;
-	if(( ! async_data_write_receive( & callid, & length ))
-	|| ( length != sizeof( size_t ) * ( count + 1 ))){
-		free( lengths );
-		return EINVAL;
-	}
-	if( ERROR_OCCURRED( async_data_write_finalize( callid, lengths, sizeof( size_t ) * ( count + 1 )))){
-		free( lengths );
-		return ERROR_CODE;
-	}
-	* data = malloc( lengths[ count ] );
-	if( !( * data )) return ENOMEM;
-	( * data )[ lengths[ count ] - 1 ] = '\0';
-	* strings = ( measured_string_ref ) malloc( sizeof( measured_string_t ) * count );
-	if( !( * strings )){
-		free( lengths );
-		free( * data );
+int measured_strings_receive(measured_string_ref * strings, char ** data, size_t count){
+	ERROR_DECLARE;
+
+	size_t * lengths;
+	size_t index;
+	size_t length;
+	char * next;
+	ipc_callid_t callid;
+
+	if((! strings) || (! data) || (count <= 0)){
+		return EINVAL;
+	}
+	lengths = (size_t *) malloc(sizeof(size_t) * (count + 1));
+	if(! lengths){
+		return ENOMEM;
+	}
+	if((! async_data_write_receive(&callid, &length))
+		|| (length != sizeof(size_t) * (count + 1))){
+		free(lengths);
+		return EINVAL;
+	}
+	if(ERROR_OCCURRED(async_data_write_finalize(callid, lengths, sizeof(size_t) * (count + 1)))){
+		free(lengths);
+		return ERROR_CODE;
+	}
+	*data = malloc(lengths[count]);
+	if(!(*data)){
+		return ENOMEM;
+	}
+	(*data)[lengths[count] - 1] = '\0';
+	*strings = (measured_string_ref) malloc(sizeof(measured_string_t) * count);
+	if(!(*strings)){
+		free(lengths);
+		free(*data);
 		return ENOMEM;
 	}
 	next = * data;
-	for( index = 0; index < count; ++ index ){
-		( * strings)[ index ].length = lengths[ index ];
-		if( lengths[ index ] > 0 ){
-			if(( ! async_data_write_receive( & callid, & length ))
-			|| ( length != lengths[ index ] )){
-				free( * data );
-				free( * strings );
-				free( lengths );
+	for(index = 0; index < count; ++ index){
+		(*strings)[index].length = lengths[index];
+		if(lengths[index] > 0){
+			if((! async_data_write_receive(&callid, &length))
+				|| (length != lengths[index])){
+				free(*data);
+				free(*strings);
+				free(lengths);
 				return EINVAL;
 			}
-			ERROR_PROPAGATE( async_data_write_finalize( callid, next, lengths[ index ] ));
-			( * strings)[ index ].value = next;
-			next += lengths[ index ];
-			* next = '\0';
+			ERROR_PROPAGATE(async_data_write_finalize(callid, next, lengths[index]));
+			(*strings)[index].value = next;
+			next += lengths[index];
+			*next = '\0';
 			++ next;
 		}else{
-			( * strings )[ index ].value = NULL;
-		}
-	}
-	free( lengths );
-	return EOK;
-}
-
-int measured_strings_reply( const measured_string_ref strings, size_t count ){
-	ERROR_DECLARE;
-
-	size_t *		lengths;
-	size_t			index;
-	size_t			length;
-	ipc_callid_t	callid;
-
-	if(( ! strings ) || ( count <= 0 )){
-		return EINVAL;
-	}
-	lengths = prepare_lengths( strings, count );
-	if( ! lengths ) return ENOMEM;
-	if(( ! async_data_read_receive( & callid, & length ))
-	|| ( length != sizeof( size_t ) * ( count + 1 ))){
-		free( lengths );
-		return EINVAL;
-	}
-	if( ERROR_OCCURRED( async_data_read_finalize( callid, lengths, sizeof( size_t ) * ( count + 1 )))){
-		free( lengths );
-		return ERROR_CODE;
-	}
-	free( lengths );
-	for( index = 0; index < count; ++ index ){
-		if( strings[ index ].length > 0 ){
-			if(( ! async_data_read_receive( & callid, & length ))
-			|| ( length != strings[ index ].length )){
+			(*strings)[index].value = NULL;
+		}
+	}
+	free(lengths);
+	return EOK;
+}
+
+int measured_strings_reply(const measured_string_ref strings, size_t count){
+	ERROR_DECLARE;
+
+	size_t * lengths;
+	size_t index;
+	size_t length;
+	ipc_callid_t callid;
+
+	if((! strings) || (count <= 0)){
+		return EINVAL;
+	}
+	lengths = prepare_lengths(strings, count);
+	if(! lengths){
+		return ENOMEM;
+	}
+	if((! async_data_read_receive(&callid, &length))
+		|| (length != sizeof(size_t) * (count + 1))){
+		free(lengths);
+		return EINVAL;
+	}
+	if(ERROR_OCCURRED(async_data_read_finalize(callid, lengths, sizeof(size_t) * (count + 1)))){
+		free(lengths);
+		return ERROR_CODE;
+	}
+	free(lengths);
+	for(index = 0; index < count; ++ index){
+		if(strings[index].length > 0){
+			if((! async_data_read_receive(&callid, &length))
+				|| (length != strings[index].length)){
 				return EINVAL;
 			}
-			ERROR_PROPAGATE( async_data_read_finalize( callid, strings[ index ].value, strings[ index ].length ));
-		}
-	}
-	return EOK;
-}
-
-int measured_strings_return( int phone, measured_string_ref * strings, char ** data, size_t count ){
-	ERROR_DECLARE;
-
-	size_t *	lengths;
-	size_t		index;
-	char *		next;
-
-	if(( phone <= 0 ) || ( ! strings ) || ( ! data ) || ( count <= 0 )){
-		return EINVAL;
-	}
-	lengths = ( size_t * ) malloc( sizeof( size_t ) * ( count + 1 ));
-	if( ! lengths ) return ENOMEM;
-	if( ERROR_OCCURRED( async_data_read_start( phone, lengths, sizeof( size_t ) * ( count + 1 )))){
-		free( lengths );
-		return ERROR_CODE;
-	}
-	* data = malloc( lengths[ count ] );
-	if( !( * data )) return ENOMEM;
-	* strings = ( measured_string_ref ) malloc( sizeof( measured_string_t ) * count );
-	if( !( * strings )){
-		free( lengths );
-		free( * data );
+			ERROR_PROPAGATE(async_data_read_finalize(callid, strings[index].value, strings[index].length));
+		}
+	}
+	return EOK;
+}
+
+int measured_strings_return(int phone, measured_string_ref * strings, char ** data, size_t count){
+	ERROR_DECLARE;
+
+	size_t * lengths;
+	size_t index;
+	char * next;
+
+	if((phone <= 0) || (! strings) || (! data) || (count <= 0)){
+		return EINVAL;
+	}
+	lengths = (size_t *) malloc(sizeof(size_t) * (count + 1));
+	if(! lengths){
+		return ENOMEM;
+	}
+	if(ERROR_OCCURRED(async_data_read_start(phone, lengths, sizeof(size_t) * (count + 1)))){
+		free(lengths);
+		return ERROR_CODE;
+	}
+	*data = malloc(lengths[count]);
+	if(!(*data)){
+		return ENOMEM;
+	}
+	*strings = (measured_string_ref) malloc(sizeof(measured_string_t) * count);
+	if(!(*strings)){
+		free(lengths);
+		free(*data);
 		return ENOMEM;
 	}
 	next = * data;
-	for( index = 0; index < count; ++ index ){
-		( * strings )[ index ].length = lengths[ index ];
-		if( lengths[ index ] > 0 ){
-			ERROR_PROPAGATE( async_data_read_start( phone, next, lengths[ index ] ));
-			( * strings )[ index ].value = next;
-			next += lengths[ index ];
-			* next = '\0';
+	for(index = 0; index < count; ++ index){
+		(*strings)[index].length = lengths[index];
+		if(lengths[index] > 0){
+			ERROR_PROPAGATE(async_data_read_start(phone, next, lengths[index]));
+			(*strings)[index].value = next;
+			next += lengths[index];
+			*next = '\0';
 			++ next;
 		}else{
-			( * strings )[ index ].value = NULL;
-		}
-	}
-	free( lengths );
-	return EOK;
-}
-
-int measured_strings_send( int phone, const measured_string_ref strings, size_t count ){
-	ERROR_DECLARE;
-
-	size_t *	lengths;
-	size_t		index;
-
-	if(( phone <= 0 ) || ( ! strings ) || ( count <= 0 )){
-		return EINVAL;
-	}
-	lengths = prepare_lengths( strings, count );
-	if( ! lengths ) return ENOMEM;
-	if( ERROR_OCCURRED( async_data_write_start( phone, lengths, sizeof( size_t ) * ( count + 1 )))){
-		free( lengths );
-		return ERROR_CODE;
-	}
-	free( lengths );
-	for( index = 0; index < count; ++ index ){
-		if( strings[ index ].length > 0 ){
-			ERROR_PROPAGATE( async_data_write_start( phone, strings[ index ].value, strings[ index ].length ));
-		}
-	}
-	return EOK;
-}
-
-size_t * prepare_lengths( const measured_string_ref strings, size_t count ){
-	size_t *	lengths;
-	size_t		index;
-	size_t		length;
-
-	lengths = ( size_t * ) malloc( sizeof( size_t ) * ( count + 1 ));
-	if( ! lengths ) return NULL;
+			(*strings)[index].value = NULL;
+		}
+	}
+	free(lengths);
+	return EOK;
+}
+
+int measured_strings_send(int phone, const measured_string_ref strings, size_t count){
+	ERROR_DECLARE;
+
+	size_t * lengths;
+	size_t index;
+
+	if((phone <= 0) || (! strings) || (count <= 0)){
+		return EINVAL;
+	}
+	lengths = prepare_lengths(strings, count);
+	if(! lengths){
+		return ENOMEM;
+	}
+	if(ERROR_OCCURRED(async_data_write_start(phone, lengths, sizeof(size_t) * (count + 1)))){
+		free(lengths);
+		return ERROR_CODE;
+	}
+	free(lengths);
+	for(index = 0; index < count; ++ index){
+		if(strings[index].length > 0){
+			ERROR_PROPAGATE(async_data_write_start(phone, strings[index].value, strings[index].length));
+		}
+	}
+	return EOK;
+}
+
+size_t * prepare_lengths(const measured_string_ref strings, size_t count){
+	size_t * lengths;
+	size_t index;
+	size_t length;
+
+	lengths = (size_t *) malloc(sizeof(size_t) * (count + 1));
+	if(! lengths){
+		return NULL;
+	}
 	length = 0;
-	for( index = 0; index < count; ++ index ){
-		lengths[ index ] = strings[ index ].length;
-		length += lengths[ index ] + 1;
-	}
-	lengths[ count ] = length;
+	for(index = 0; index < count; ++ index){
+		lengths[index] = strings[index].length;
+		length += lengths[index] + 1;
+	}
+	lengths[count] = length;
 	return lengths;
 }
Index: uspace/srv/net/structures/measured_strings.h
===================================================================
--- uspace/srv/net/structures/measured_strings.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/measured_strings.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -57,8 +57,8 @@
 	/** Character string data.
 	 */
-	char *	value;
+	char * value;
 	/** Character string length.
 	 */
-	size_t	length;
+	size_t length;
 };
 
@@ -71,5 +71,5 @@
  *  @returns NULL if there is not enough memory left.
  */
-measured_string_ref	measured_string_create_bulk( const char * string, size_t length );
+measured_string_ref measured_string_create_bulk(const char * string, size_t length);
 
 /** Copies the given measured string with separated header and data parts.
@@ -79,5 +79,5 @@
  *  @returns NULL if there is not enough memory left.
  */
-measured_string_ref	measured_string_copy( measured_string_ref source );
+measured_string_ref measured_string_copy(measured_string_ref source);
 
 /** Receives a&nbsp;measured strings array from a&nbsp;calling module.
@@ -95,5 +95,5 @@
  *  @returns Other error codes as defined for the async_data_write_finalize() function.
  */
-int	measured_strings_receive( measured_string_ref * strings, char ** data, size_t count );
+int measured_strings_receive(measured_string_ref * strings, char ** data, size_t count);
 
 /** Replies the given measured strings array to a&nbsp;calling module.
@@ -108,5 +108,5 @@
  *  @returns Other error codes as defined for the async_data_read_finalize() function.
  */
-int	measured_strings_reply( const measured_string_ref strings, size_t count );
+int measured_strings_reply(const measured_string_ref strings, size_t count);
 
 /** Receives a&nbsp;measured strings array from another module.
@@ -124,5 +124,5 @@
  *  @returns Other error codes as defined for the async_data_read_start() function.
  */
-int	measured_strings_return( int phone, measured_string_ref * strings, char ** data, size_t count );
+int measured_strings_return(int phone, measured_string_ref * strings, char ** data, size_t count);
 
 /** Sends the given measured strings array to another module.
@@ -136,5 +136,5 @@
  *  @returns Other error codes as defined for the async_data_write_start() function.
  */
-int	measured_strings_send( int phone, const measured_string_ref strings, size_t count );
+int measured_strings_send(int phone, const measured_string_ref strings, size_t count);
 
 #endif
Index: uspace/srv/net/structures/module_map.c
===================================================================
--- uspace/srv/net/structures/module_map.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/module_map.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -47,13 +47,15 @@
 #include "module_map.h"
 
-GENERIC_CHAR_MAP_IMPLEMENT( modules, module_t )
+GENERIC_CHAR_MAP_IMPLEMENT(modules, module_t)
 
-int add_module( module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id, connect_module_t connect_module ){
+int add_module(module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id, connect_module_t connect_module){
 	ERROR_DECLARE;
 
-	module_ref	tmp_module;
+	module_ref tmp_module;
 
-	tmp_module = ( module_ref ) malloc( sizeof( module_t ));
-	if( ! tmp_module ) return ENOMEM;
+	tmp_module = (module_ref) malloc(sizeof(module_t));
+	if(! tmp_module){
+		return ENOMEM;
+	}
 	tmp_module->task_id = task_id;
 	tmp_module->phone = 0;
@@ -63,34 +65,40 @@
 	tmp_module->service = service;
 	tmp_module->connect_module = connect_module;
-	if( ERROR_OCCURRED( modules_add( modules, tmp_module->name, 0, tmp_module ))){
-		free( tmp_module );
+	if(ERROR_OCCURRED(modules_add(modules, tmp_module->name, 0, tmp_module))){
+		free(tmp_module);
 		return ERROR_CODE;
 	}
-	if( module ) * module = tmp_module;
+	if(module){
+		*module = tmp_module;
+	}
 	return EOK;
 }
 
-module_ref get_running_module( modules_ref modules, char * name ){
-	module_ref	module;
+module_ref get_running_module(modules_ref modules, char * name){
+	module_ref module;
 
-	module = modules_find( modules, name, 0 );
-	if( ! module ) return NULL;
-	if( ! module->task_id ){
-		module->task_id = spawn( module->filename );
-		if( ! module->task_id ) return NULL;
+	module = modules_find(modules, name, 0);
+	if(! module){
+		return NULL;
 	}
-	if( ! module->phone ){
-		module->phone = module->connect_module( module->service );
+	if(! module->task_id){
+		module->task_id = spawn(module->filename);
+		if(! module->task_id){
+			return NULL;
+		}
+	}
+	if(! module->phone){
+		module->phone = module->connect_module(module->service);
 	}
 	return module;
 }
 
-task_id_t spawn( const char * fname ){
-	const char * argv[ 2 ];
-	task_id_t	res;
+task_id_t spawn(const char * fname){
+	const char * argv[2];
+	task_id_t res;
 
-	argv[ 0 ] = fname;
-	argv[ 1 ] = NULL;
-	res = task_spawn( fname, argv );
+	argv[0] = fname;
+	argv[1] = NULL;
+	res = task_spawn(fname, argv);
 
 	return res;
Index: uspace/srv/net/structures/module_map.h
===================================================================
--- uspace/srv/net/structures/module_map.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/module_map.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -60,5 +60,5 @@
  *  @see generic_char_map.h
  */
-GENERIC_CHAR_MAP_DECLARE( modules, module_t )
+GENERIC_CHAR_MAP_DECLARE(modules, module_t)
 
 /** Module structure.
@@ -67,23 +67,23 @@
 	/** Module task identifier if running.
 	 */
-	task_id_t	task_id;
+	task_id_t task_id;
 	/** Module service identifier.
 	 */
-	services_t	service;
+	services_t service;
 	/** Module phone if running and connected.
 	 */
-	int			phone;
+	int phone;
 	/** Usage counter.
 	 */
-	int			usage;
+	int usage;
 	/** Module name.
 	 */
-	const char *		name;
+	const char * name;
 	/** Module full path filename.
 	 */
-	const char *		filename;
+	const char * filename;
 	/** Connecting function.
 	 */
-	connect_module_t *	connect_module;
+	connect_module_t * connect_module;
 };
 
@@ -99,5 +99,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	add_module( module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id, connect_module_t * connect_module );
+int add_module(module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id, connect_module_t * connect_module);
 
 /** Searches and returns the specified module.
@@ -109,5 +109,5 @@
  *  @returns NULL if there is no such module.
  */
-module_ref	get_running_module( modules_ref modules, char * name );
+module_ref get_running_module(modules_ref modules, char * name);
 
 /** Starts the given module.
@@ -116,5 +116,5 @@
  *  @returns 0 if there is no such module.
  */
-task_id_t	spawn( const char * fname );
+task_id_t spawn(const char * fname);
 
 #endif
Index: uspace/srv/net/structures/packet/packet.c
===================================================================
--- uspace/srv/net/structures/packet/packet.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/packet/packet.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -59,14 +59,14 @@
  *  @param[in] packet_id The packet identifier.
  */
-#define PACKET_MAP_PAGE( packet_id )	((( packet_id ) - 1 ) / PACKET_MAP_SIZE )
+#define PACKET_MAP_PAGE(packet_id)	(((packet_id) - 1) / PACKET_MAP_SIZE)
 
 /** Returns the packet index in the corresponding packet map page.
  *  @param[in] packet_id The packet identifier.
  */
-#define PACKET_MAP_INDEX( packet_id )	((( packet_id ) - 1 ) % PACKET_MAP_SIZE )
+#define PACKET_MAP_INDEX(packet_id)	(((packet_id) - 1) % PACKET_MAP_SIZE)
 
 /** Type definition of the packet map page.
  */
-typedef packet_t packet_map_t[ PACKET_MAP_SIZE ];
+typedef packet_t packet_map_t[PACKET_MAP_SIZE];
 /** Type definition of the packet map page pointer.
  */
@@ -77,5 +77,5 @@
  *  @see generic_field.h
  */
-GENERIC_FIELD_DECLARE( gpm, packet_map_t );
+GENERIC_FIELD_DECLARE(gpm, packet_map_t);
 
 /** Releases the packet.
@@ -84,5 +84,5 @@
  *  @returns EINVAL if the packet is not valid.
  */
-int packet_destroy( packet_t packet );
+int packet_destroy(packet_t packet);
 
 /** Packet map global data.
@@ -91,77 +91,83 @@
 	/** Safety lock.
 	 */
-	fibril_rwlock_t	lock;
+	fibril_rwlock_t lock;
 	/** Packet map.
 	 */
-	gpm_t	packet_map;
+	gpm_t packet_map;
 } pm_globals;
 
-GENERIC_FIELD_IMPLEMENT( gpm, packet_map_t );
-
-int packet_destroy( packet_t packet ){
-	if( ! packet_is_valid( packet )) return EINVAL;
-	return munmap( packet, packet->length );
-}
-
-int pm_init( void ){
+GENERIC_FIELD_IMPLEMENT(gpm, packet_map_t);
+
+int packet_destroy(packet_t packet){
+	if(! packet_is_valid(packet)){
+		return EINVAL;
+	}
+	return munmap(packet, packet->length);
+}
+
+int pm_init(void){
 	ERROR_DECLARE;
 
-	fibril_rwlock_initialize( & pm_globals.lock );
-	fibril_rwlock_write_lock( & pm_globals.lock );
-	ERROR_PROPAGATE( gpm_initialize( & pm_globals.packet_map ));
-	fibril_rwlock_write_unlock( & pm_globals.lock );
-	return EOK;
-}
-
-packet_t pm_find( packet_id_t packet_id ){
+	fibril_rwlock_initialize(&pm_globals.lock);
+	fibril_rwlock_write_lock(&pm_globals.lock);
+	ERROR_PROPAGATE(gpm_initialize(&pm_globals.packet_map));
+	fibril_rwlock_write_unlock(&pm_globals.lock);
+	return EOK;
+}
+
+packet_t pm_find(packet_id_t packet_id){
 	packet_map_ref map;
 	packet_t packet;
 
-	if( ! packet_id ) return NULL;
-	fibril_rwlock_read_lock( & pm_globals.lock );
-	if( packet_id > PACKET_MAP_SIZE * gpm_count( & pm_globals.packet_map )){
-		fibril_rwlock_read_unlock( & pm_globals.lock );
-		return NULL;
-	}
-	map = gpm_get_index( & pm_globals.packet_map, PACKET_MAP_PAGE( packet_id ));
-	if( ! map ){
-		fibril_rwlock_read_unlock( & pm_globals.lock );
-		return NULL;
-	}
-	packet = ( * map )[ PACKET_MAP_INDEX( packet_id ) ];
-	fibril_rwlock_read_unlock( & pm_globals.lock );
+	if(! packet_id){
+		return NULL;
+	}
+	fibril_rwlock_read_lock(&pm_globals.lock);
+	if(packet_id > PACKET_MAP_SIZE * gpm_count(&pm_globals.packet_map)){
+		fibril_rwlock_read_unlock(&pm_globals.lock);
+		return NULL;
+	}
+	map = gpm_get_index(&pm_globals.packet_map, PACKET_MAP_PAGE(packet_id));
+	if(! map){
+		fibril_rwlock_read_unlock(&pm_globals.lock);
+		return NULL;
+	}
+	packet = (*map)[PACKET_MAP_INDEX(packet_id)];
+	fibril_rwlock_read_unlock(&pm_globals.lock);
 	return packet;
 }
 
-int pm_add( packet_t packet ){
+int pm_add(packet_t packet){
 	ERROR_DECLARE;
 
 	packet_map_ref map;
 
-	if( ! packet_is_valid( packet )) return EINVAL;
-	fibril_rwlock_write_lock( & pm_globals.lock );
-	if( PACKET_MAP_PAGE( packet->packet_id ) < gpm_count( & pm_globals.packet_map )){
-		map = gpm_get_index( & pm_globals.packet_map, PACKET_MAP_PAGE( packet->packet_id ));
+	if(! packet_is_valid(packet)){
+		return EINVAL;
+	}
+	fibril_rwlock_write_lock(&pm_globals.lock);
+	if(PACKET_MAP_PAGE(packet->packet_id) < gpm_count(&pm_globals.packet_map)){
+		map = gpm_get_index(&pm_globals.packet_map, PACKET_MAP_PAGE(packet->packet_id));
 	}else{
 		do{
-			map = ( packet_map_ref ) malloc( sizeof( packet_map_t ));
-			if( ! map ){
-				fibril_rwlock_write_unlock( & pm_globals.lock );
+			map = (packet_map_ref) malloc(sizeof(packet_map_t));
+			if(! map){
+				fibril_rwlock_write_unlock(&pm_globals.lock);
 				return ENOMEM;
 			}
-			bzero( map, sizeof( packet_map_t ));
-			if(( ERROR_CODE = gpm_add( & pm_globals.packet_map, map )) < 0 ){
-				fibril_rwlock_write_unlock( & pm_globals.lock );
-				free( map );
+			bzero(map, sizeof(packet_map_t));
+			if((ERROR_CODE = gpm_add(&pm_globals.packet_map, map)) < 0){
+				fibril_rwlock_write_unlock(&pm_globals.lock);
+				free(map);
 				return ERROR_CODE;
 			}
-		}while( PACKET_MAP_PAGE( packet->packet_id ) >= gpm_count( & pm_globals.packet_map ));
-	}
-	( * map )[ PACKET_MAP_INDEX( packet->packet_id ) ] = packet;
-	fibril_rwlock_write_unlock( & pm_globals.lock );
-	return EOK;
-}
-
-void pm_destroy( void ){
+		}while(PACKET_MAP_PAGE(packet->packet_id) >= gpm_count(&pm_globals.packet_map));
+	}
+	(*map)[PACKET_MAP_INDEX(packet->packet_id)] = packet;
+	fibril_rwlock_write_unlock(&pm_globals.lock);
+	return EOK;
+}
+
+void pm_destroy(void){
 	int count;
 	int index;
@@ -169,30 +175,32 @@
 	packet_t packet;
 
-	fibril_rwlock_write_lock( & pm_globals.lock );
-	count = gpm_count( & pm_globals.packet_map );
-	while( count > 0 ){
-		map = gpm_get_index( & pm_globals.packet_map, count - 1 );
-		for( index = PACKET_MAP_SIZE - 1; index >= 0; -- index ){
-			packet = ( * map )[ index ];
-			if( packet_is_valid( packet )){
-				munmap( packet, packet->length );
+	fibril_rwlock_write_lock(&pm_globals.lock);
+	count = gpm_count(&pm_globals.packet_map);
+	while(count > 0){
+		map = gpm_get_index(&pm_globals.packet_map, count - 1);
+		for(index = PACKET_MAP_SIZE - 1; index >= 0; -- index){
+			packet = (*map)[index];
+			if(packet_is_valid(packet)){
+				munmap(packet, packet->length);
 			}
 		}
 	}
-	gpm_destroy( & pm_globals.packet_map );
+	gpm_destroy(&pm_globals.packet_map);
 	// leave locked
 }
 
-int pq_add( packet_t * first, packet_t packet, size_t order, size_t metric ){
-	packet_t	item;
-
-	if(( ! first ) || ( ! packet_is_valid( packet ))) return EINVAL;
-	pq_set_order( packet, order, metric );
-	if( packet_is_valid( * first )){
+int pq_add(packet_t * first, packet_t packet, size_t order, size_t metric){
+	packet_t item;
+
+	if((! first) || (! packet_is_valid(packet))){
+		return EINVAL;
+	}
+	pq_set_order(packet, order, metric);
+	if(packet_is_valid(*first)){
 		item = * first;
 		do{
-			if( item->order < order ){
-				if( item->next ){
-					item = pm_find( item->next );
+			if(item->order < order){
+				if(item->next){
+					item = pm_find(item->next);
 				}else{
 					item->next = packet->packet_id;
@@ -204,27 +212,31 @@
 				packet->next = item->packet_id;
 				item->previous = packet->packet_id;
-				item = pm_find( packet->previous );
-				if( item ){
+				item = pm_find(packet->previous);
+				if(item){
 					item->next = packet->packet_id;
 				}else{
-					* first = packet;
+					*first = packet;
 				}
 				return EOK;
 			}
-		}while( packet_is_valid( item ));
-	}
-	* first = packet;
-	return EOK;
-}
-
-packet_t pq_find( packet_t packet, size_t order ){
-	packet_t	item;
-
-	if( ! packet_is_valid( packet )) return NULL;
-	if( packet->order == order ) return packet;
-	item = pm_find( packet->next );
-	while( item && ( item != packet )){
-		item = pm_find( item->next );
-		if( item->order == order ){
+		}while(packet_is_valid(item));
+	}
+	*first = packet;
+	return EOK;
+}
+
+packet_t pq_find(packet_t packet, size_t order){
+	packet_t item;
+
+	if(! packet_is_valid(packet)){
+		return NULL;
+	}
+	if(packet->order == order){
+		return packet;
+	}
+	item = pm_find(packet->next);
+	while(item && (item != packet)){
+		item = pm_find(item->next);
+		if(item->order == order){
 			return item;
 		}
@@ -233,26 +245,32 @@
 }
 
-int	pq_insert_after( packet_t packet, packet_t new_packet ){
-	packet_t	item;
-
-	if( !( packet_is_valid( packet ) && packet_is_valid( new_packet ))) return EINVAL;
+int pq_insert_after(packet_t packet, packet_t new_packet){
+	packet_t item;
+
+	if(!(packet_is_valid(packet) && packet_is_valid(new_packet))){
+		return EINVAL;
+	}
 	new_packet->previous = packet->packet_id;
 	new_packet->next = packet->next;
-	item = pm_find( packet->next );
-	if( item ) item->previous = new_packet->packet_id;
+	item = pm_find(packet->next);
+	if(item){
+		item->previous = new_packet->packet_id;
+	}
 	packet->next = new_packet->packet_id;
 	return EOK;
 }
 
-packet_t pq_detach( packet_t packet ){
+packet_t pq_detach(packet_t packet){
 	packet_t next;
 	packet_t previous;
 
-	if( ! packet_is_valid( packet )) return NULL;
-	next = pm_find( packet->next );
-	if( next ){
+	if(! packet_is_valid(packet)){
+		return NULL;
+	}
+	next = pm_find(packet->next);
+	if(next){
 		next->previous = packet->previous;
-		previous = pm_find( next->previous );
-		if( previous ){
+		previous = pm_find(next->previous);
+		if(previous){
 			previous->next = next->packet_id;
 		}
@@ -263,6 +281,8 @@
 }
 
-int pq_set_order( packet_t packet, size_t order, size_t metric ){
-	if( ! packet_is_valid( packet )) return EINVAL;
+int pq_set_order(packet_t packet, size_t order, size_t metric){
+	if(! packet_is_valid(packet)){
+		return EINVAL;
+	}
 	packet->order = order;
 	packet->metric = metric;
@@ -270,33 +290,45 @@
 }
 
-int pq_get_order( packet_t packet, size_t * order, size_t * metric ){
-	if( ! packet_is_valid( packet )) return EINVAL;
-	if( order ) * order = packet->order;
-	if( metric ) * metric = packet->metric;
-	return EOK;
-}
-
-void pq_destroy( packet_t first, void ( * packet_release )( packet_t packet )){
-	packet_t	actual;
-	packet_t	next;
+int pq_get_order(packet_t packet, size_t * order, size_t * metric){
+	if(! packet_is_valid(packet)){
+		return EINVAL;
+	}
+	if(order){
+		*order = packet->order;
+	}
+	if(metric){
+		*metric = packet->metric;
+	}
+	return EOK;
+}
+
+void pq_destroy(packet_t first, void (*packet_release)(packet_t packet)){
+	packet_t actual;
+	packet_t next;
 
 	actual = first;
-	while( packet_is_valid( actual )){
-		next = pm_find( actual->next );
+	while(packet_is_valid(actual)){
+		next = pm_find(actual->next);
 		actual->next = 0;
 		actual->previous = 0;
-		if( packet_release ) packet_release( actual );
+		if(packet_release){
+			packet_release(actual);
+		}
 		actual = next;
 	}
 }
 
-packet_t pq_next( packet_t packet ){
-	if( ! packet_is_valid( packet )) return NULL;
-	return pm_find( packet->next );
-}
-
-packet_t pq_previous( packet_t packet ){
-	if( ! packet_is_valid( packet )) return NULL;
-	return pm_find( packet->previous );
+packet_t pq_next(packet_t packet){
+	if(! packet_is_valid(packet)){
+		return NULL;
+	}
+	return pm_find(packet->next);
+}
+
+packet_t pq_previous(packet_t packet){
+	if(! packet_is_valid(packet)){
+		return NULL;
+	}
+	return pm_find(packet->previous);
 }
 
Index: uspace/srv/net/structures/packet/packet.h
===================================================================
--- uspace/srv/net/structures/packet/packet.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/packet/packet.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -68,14 +68,14 @@
 	/** Reserved packet prefix length.
 	 */
-	size_t			prefix;
+	size_t prefix;
 	/** Maximal packet content length.
 	 */
-	size_t			content;
+	size_t content;
 	/** Reserved packet suffix length.
 	 */
-	size_t			suffix;
+	size_t suffix;
 	/** Maximal packet address length.
 	 */
-	size_t			addr_len;
+	size_t addr_len;
 };
 
@@ -89,5 +89,5 @@
  *  @returns NULL if the mapping does not exist.
  */
-packet_t	pm_find( packet_id_t packet_id );
+packet_t pm_find(packet_id_t packet_id);
 
 /** Adds the packet mapping.
@@ -98,5 +98,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	pm_add( packet_t packet );
+int pm_add(packet_t packet);
 
 /** Initializes the packet map.
@@ -104,9 +104,9 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	pm_init( void );
+int pm_init(void);
 
 /** Releases the packet map.
  */
-void	pm_destroy( void );
+void pm_destroy(void);
 
 /** Add packet to the sorted queue.
@@ -121,5 +121,5 @@
  *  @returns EINVAL if the packet is not valid.
  */
-int	pq_add( packet_t * first, packet_t packet, size_t order, size_t metric );
+int pq_add(packet_t * first, packet_t packet, size_t order, size_t metric);
 
 /** Finds the packet with the given order.
@@ -130,5 +130,5 @@
  *  @returns NULL if the packet is not found.
  */
-packet_t	pq_find( packet_t first, size_t order );
+packet_t pq_find(packet_t first, size_t order);
 
 /** Inserts packet after the given one.
@@ -138,5 +138,5 @@
  *  @returns EINVAL if etiher of the packets is invalid.
  */
-int	pq_insert_after( packet_t packet, packet_t new_packet );
+int pq_insert_after(packet_t packet, packet_t new_packet);
 
 /** Detach the packet from the queue.
@@ -146,5 +146,5 @@
  *  @returns NULL if the packet is not valid.
  */
-packet_t	pq_detach( packet_t packet );
+packet_t pq_detach(packet_t packet);
 
 /** Sets the packet order and metric attributes.
@@ -155,5 +155,5 @@
  *  @returns EINVAL if the packet is invalid..
  */
-int	pq_set_order( packet_t packet, size_t order, size_t metric );
+int pq_set_order(packet_t packet, size_t order, size_t metric);
 
 /** Sets the packet order and metric attributes.
@@ -164,5 +164,5 @@
  *  @returns EINVAL if the packet is invalid..
  */
-int	pq_get_order( packet_t packet, size_t * order, size_t * metric );
+int pq_get_order(packet_t packet, size_t * order, size_t * metric);
 
 /** Releases the whole queue.
@@ -171,5 +171,5 @@
  *  @param[in] packet_release The releasing function called for each of the packets after its detachment.
  */
-void	pq_destroy( packet_t first, void ( * packet_release )( packet_t packet ));
+void pq_destroy(packet_t first, void (*packet_release)(packet_t packet));
 
 /** Returns the next packet in the queue.
@@ -179,5 +179,5 @@
  *  @returns NULL if the packet is not valid.
  */
-packet_t	pq_next( packet_t packet );
+packet_t pq_next(packet_t packet);
 
 /** Returns the previous packet in the queue.
@@ -187,5 +187,5 @@
  *  @returns NULL if the packet is not valid.
  */
-packet_t	pq_previous( packet_t packet );
+packet_t pq_previous(packet_t packet);
 
 /*@}*/
Index: uspace/srv/net/structures/packet/packet_client.c
===================================================================
--- uspace/srv/net/structures/packet/packet_client.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/packet/packet_client.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -48,9 +48,13 @@
 #include "packet_client.h"
 
-int packet_copy_data( packet_t packet, const void * data, size_t length ){
-	if( ! packet_is_valid( packet )) return EINVAL;
-	if( packet->data_start + length >= packet->length ) return ENOMEM;
-	memcpy(( void * ) packet + packet->data_start, data, length );
-	if( packet->data_start + length > packet->data_end ){
+int packet_copy_data(packet_t packet, const void * data, size_t length){
+	if(! packet_is_valid(packet)){
+		return EINVAL;
+	}
+	if(packet->data_start + length >= packet->length){
+		return ENOMEM;
+	}
+	memcpy((void *) packet + packet->data_start, data, length);
+	if(packet->data_start + length > packet->data_end){
 		packet->data_end = packet->data_start + length;
 	}
@@ -58,19 +62,27 @@
 }
 
-void * packet_prefix( packet_t packet, size_t length ){
-	if(( ! packet_is_valid( packet )) || ( packet->data_start - sizeof( struct packet ) - 2 * ( packet->dest_addr - packet->src_addr ) < length )) return NULL;
+void * packet_prefix(packet_t packet, size_t length){
+	if((! packet_is_valid(packet)) || (packet->data_start - sizeof(struct packet) - 2 * (packet->dest_addr - packet->src_addr) < length)){
+		return NULL;
+	}
 	packet->data_start -= length;
-	return ( void * ) packet + packet->data_start;
+	return (void *) packet + packet->data_start;
 }
 
-void * packet_suffix( packet_t packet, size_t length ){
-	if(( ! packet_is_valid( packet )) || ( packet->data_end + length >= packet->length )) return NULL;
+void * packet_suffix(packet_t packet, size_t length){
+	if((! packet_is_valid(packet)) || (packet->data_end + length >= packet->length)){
+		return NULL;
+	}
 	packet->data_end += length;
-	return ( void * ) packet + packet->data_end - length;
+	return (void *) packet + packet->data_end - length;
 }
 
-int packet_trim( packet_t packet, size_t prefix, size_t suffix ){
-	if( ! packet_is_valid( packet )) return EINVAL;
-	if( prefix + suffix > PACKET_DATA_LENGTH( packet )) return ENOMEM;
+int packet_trim(packet_t packet, size_t prefix, size_t suffix){
+	if(! packet_is_valid(packet)){
+		return EINVAL;
+	}
+	if(prefix + suffix > PACKET_DATA_LENGTH(packet)){
+		return ENOMEM;
+	}
 	packet->data_start += prefix;
 	packet->data_end -= suffix;
@@ -78,71 +90,95 @@
 }
 
-packet_id_t packet_get_id( const packet_t packet ){
-	return packet_is_valid( packet ) ? packet->packet_id : 0;
+packet_id_t packet_get_id(const packet_t packet){
+	return packet_is_valid(packet) ? packet->packet_id : 0;
 }
 
-int packet_get_addr( const packet_t packet, uint8_t ** src, uint8_t ** dest ){
-	if( ! packet_is_valid( packet )) return EINVAL;
-	if( ! packet->addr_len ) return 0;
-	if( src ) * src = ( void * ) packet + packet->src_addr;
-	if( dest ) * dest = ( void * ) packet + packet->dest_addr;
+int packet_get_addr(const packet_t packet, uint8_t ** src, uint8_t ** dest){
+	if(! packet_is_valid(packet)){
+		return EINVAL;
+	}
+	if(! packet->addr_len){
+		return 0;
+	}
+	if(src){
+		*src = (void *) packet + packet->src_addr;
+	}
+	if(dest){
+		*dest = (void *) packet + packet->dest_addr;
+	}
 	return packet->addr_len;
 }
 
-size_t packet_get_data_length( const packet_t packet ){
-	if( ! packet_is_valid( packet )) return 0;
-	return PACKET_DATA_LENGTH( packet );
+size_t packet_get_data_length(const packet_t packet){
+	if(! packet_is_valid(packet)){
+		return 0;
+	}
+	return PACKET_DATA_LENGTH(packet);
 }
 
-void * packet_get_data( const packet_t packet ){
-	if( ! packet_is_valid( packet )) return NULL;
-	return ( void * ) packet + packet->data_start;
+void * packet_get_data(const packet_t packet){
+	if(! packet_is_valid(packet)){
+		return NULL;
+	}
+	return (void *) packet + packet->data_start;
 }
 
-int packet_set_addr( packet_t packet, const uint8_t * src, const uint8_t * dest, size_t addr_len ){
-	size_t	padding;
-	size_t	allocated;
+int packet_set_addr(packet_t packet, const uint8_t * src, const uint8_t * dest, size_t addr_len){
+	size_t padding;
+	size_t allocated;
 
-	if( ! packet_is_valid( packet )) return EINVAL;
-	allocated = PACKET_MAX_ADDRESS_LENGTH( packet );
-	if( allocated < addr_len ) return ENOMEM;
+	if(! packet_is_valid(packet)){
+		return EINVAL;
+	}
+	allocated = PACKET_MAX_ADDRESS_LENGTH(packet);
+	if(allocated < addr_len){
+		return ENOMEM;
+	}
 	padding = allocated - addr_len;
 	packet->addr_len = addr_len;
-	if( src ){
-		memcpy(( void * ) packet + packet->src_addr, src, addr_len );
-		if( padding ) bzero(( void * ) packet + packet->src_addr + addr_len, padding );
+	if(src){
+		memcpy((void *) packet + packet->src_addr, src, addr_len);
+		if(padding){
+			bzero((void *) packet + packet->src_addr + addr_len, padding);
+		}
 	}else{
-		bzero(( void * ) packet + packet->src_addr, allocated );
+		bzero((void *) packet + packet->src_addr, allocated);
 	}
-	if( dest ){
-		memcpy(( void * ) packet + packet->dest_addr, dest, addr_len );
-		if( padding ) bzero(( void * ) packet + packet->dest_addr + addr_len, padding );
+	if(dest){
+		memcpy((void *) packet + packet->dest_addr, dest, addr_len);
+		if(padding){
+			bzero((void *) packet + packet->dest_addr + addr_len, padding);
+		}
 	}else{
-		bzero(( void * ) packet + packet->dest_addr, allocated );
+		bzero((void *) packet + packet->dest_addr, allocated);
 	}
 	return EOK;
 }
 
-packet_t packet_get_copy( int phone, packet_t packet ){
-	packet_t	copy;
-	uint8_t *	src;
-	uint8_t *	dest;
-	size_t		addrlen;
+packet_t packet_get_copy(int phone, packet_t packet){
+	packet_t copy;
+	uint8_t * src;
+	uint8_t * dest;
+	size_t addrlen;
 
-	if( ! packet_is_valid( packet )) return NULL;
+	if(! packet_is_valid(packet)){
+		return NULL;
+	}
 	// get a new packet
-	copy = packet_get_4( phone, PACKET_DATA_LENGTH( packet ), PACKET_MAX_ADDRESS_LENGTH( packet ), packet->max_prefix, PACKET_MIN_SUFFIX( packet ));
-	if( ! copy ) return NULL;
+	copy = packet_get_4(phone, PACKET_DATA_LENGTH(packet), PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix, PACKET_MIN_SUFFIX(packet));
+	if(! copy){
+		return NULL;
+	}
 	// get addresses
-	addrlen = packet_get_addr( packet, & src, & dest );
+	addrlen = packet_get_addr(packet, &src, &dest);
 	// copy data
-	if(( packet_copy_data( copy, packet_get_data( packet ), PACKET_DATA_LENGTH( packet )) == EOK )
+	if((packet_copy_data(copy, packet_get_data(packet), PACKET_DATA_LENGTH(packet)) == EOK)
 	// copy addresses if present
-	&& (( addrlen <= 0 ) || ( packet_set_addr( copy, src, dest, addrlen ) == EOK ))){
+		&& ((addrlen <= 0) || (packet_set_addr(copy, src, dest, addrlen) == EOK))){
 		copy->order = packet->order;
 		copy->metric = packet->metric;
 		return copy;
 	}else{
-		pq_release( phone, copy->packet_id );
+		pq_release(phone, copy->packet_id);
 		return NULL;
 	}
Index: uspace/srv/net/structures/packet/packet_client.h
===================================================================
--- uspace/srv/net/structures/packet/packet_client.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/packet/packet_client.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -59,5 +59,5 @@
  *  @returns NULL if there is not enough memory left.
  */
-#define PACKET_PREFIX( packet, type )	( type * ) packet_prefix(( packet ), sizeof( type ))
+#define PACKET_PREFIX(packet, type)	(type *) packet_prefix((packet), sizeof(type))
 
 /** Allocates the specified type right after the actual packet content and returns its pointer.
@@ -69,5 +69,5 @@
  *  @returns NULL if there is not enough memory left.
  */
-#define PACKET_SUFFIX( packet, type )	( type * ) packet_suffix(( packet ), sizeof( type ))
+#define PACKET_SUFFIX(packet, type)	(type *) packet_suffix((packet), sizeof(type))
 
 /** Trims the actual packet content by the specified prefix and suffix types.
@@ -80,5 +80,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-#define PACKET_TRIM( packet, prefix, suffix )	packet_trim(( packet ), sizeof( prefix ), sizeof( suffix ))
+#define PACKET_TRIM(packet, prefix, suffix)	packet_trim((packet), sizeof(prefix), sizeof(suffix))
 
 /** Allocates the specified space right before the actual packet content and returns its pointer.
@@ -88,5 +88,5 @@
  *  @returns NULL if there is not enough memory left.
  */
-void *	packet_prefix( packet_t packet, size_t length );
+void * packet_prefix(packet_t packet, size_t length);
 
 /** Allocates the specified space right after the actual packet content and returns its pointer.
@@ -96,5 +96,5 @@
  *  @returns NULL if there is not enough memory left.
  */
-void *	packet_suffix( packet_t packet, size_t length );
+void * packet_suffix(packet_t packet, size_t length);
 
 /** Trims the actual packet content by the specified prefix and suffix lengths.
@@ -106,5 +106,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	packet_trim( packet_t packet, size_t prefix, size_t suffix );
+int packet_trim(packet_t packet, size_t prefix, size_t suffix);
 
 /** Copies the specified data to the beginning of the actual packet content.
@@ -117,5 +117,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	packet_copy_data( packet_t packet, const void * data, size_t length );
+int packet_copy_data(packet_t packet, const void * data, size_t length);
 
 /** Returns the packet identifier.
@@ -124,5 +124,5 @@
  *  @returns Zero (0) if the packet is not valid.
  */
-packet_id_t packet_get_id( const packet_t packet );
+packet_id_t packet_get_id(const packet_t packet);
 
 /** Returns the packet content length.
@@ -131,5 +131,5 @@
  *  @returns Zero (0) if the packet is not valid.
  */
-size_t	packet_get_data_length( const packet_t packet );
+size_t packet_get_data_length(const packet_t packet);
 
 /** Returns the pointer to the beginning of the packet content.
@@ -138,5 +138,5 @@
  *  @returns NULL if the packet is not valid.
  */
-void *	packet_get_data( const packet_t packet );
+void * packet_get_data(const packet_t packet);
 
 /** Returns the stored packet addresses and their length.
@@ -148,5 +148,5 @@
  *  @returns EINVAL if the packet is not valid.
  */
-int	packet_get_addr( const packet_t packet, uint8_t ** src, uint8_t ** dest );
+int packet_get_addr(const packet_t packet, uint8_t ** src, uint8_t ** dest);
 
 /** Sets the packet addresses.
@@ -159,5 +159,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	packet_set_addr( packet_t packet, const uint8_t * src, const uint8_t * dest, size_t addr_len );
+int packet_set_addr(packet_t packet, const uint8_t * src, const uint8_t * dest, size_t addr_len);
 
 /** Translates the packet identifier to the packet reference.
@@ -172,5 +172,5 @@
  *  @returns Other error codes as defined for the packet_return() function.
  */
-int packet_translate( int phone, packet_ref packet, packet_id_t packet_id );
+int packet_translate(int phone, packet_ref packet, packet_id_t packet_id);
 
 /** Obtains the packet of the given dimensions.
@@ -184,5 +184,5 @@
  *  @returns NULL on error.
  */
-packet_t packet_get_4( int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix );
+packet_t packet_get_4(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix);
 
 /** Obtains the packet of the given content size.
@@ -193,5 +193,5 @@
  *  @returns NULL on error.
  */
-packet_t packet_get_1( int phone, size_t content );
+packet_t packet_get_1(int phone, size_t content);
 
 /** Releases the packet queue.
@@ -202,5 +202,5 @@
  *  @param[in] packet_id The packet identifier.
  */
-void pq_release( int phone, packet_id_t packet_id );
+void pq_release(int phone, packet_id_t packet_id);
 
 /** Returns the packet copy.
@@ -212,5 +212,5 @@
  *  @returns NULL on error.
  */
-packet_t	packet_get_copy( int phone, packet_t packet );
+packet_t packet_get_copy(int phone, packet_t packet);
 
 /*@}*/
Index: uspace/srv/net/structures/packet/packet_header.h
===================================================================
--- uspace/srv/net/structures/packet/packet_header.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/packet/packet_header.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -43,15 +43,15 @@
  *  @param[in] header The packet header.
  */
-#define PACKET_DATA_LENGTH( header )		(( header )->data_end - ( header )->data_start )
+#define PACKET_DATA_LENGTH(header)		((header)->data_end - (header)->data_start)
 
 /** Returns the maximum packet address length.
  *  @param[in] header The packet header.
  */
-#define PACKET_MAX_ADDRESS_LENGTH( header )		(( header )->dest_addr - ( header )->src_addr )
+#define PACKET_MAX_ADDRESS_LENGTH(header)		((header)->dest_addr - (header)->src_addr)
 
 /** Returns the minimum packet suffix.
  *  @param[in] header The packet header.
  */
-#define PACKET_MIN_SUFFIX( header )		(( header )->length - ( header )->data_start - ( header )->max_content )
+#define PACKET_MIN_SUFFIX(header)		((header)->length - (header)->data_start - (header)->max_content)
 
 /** Packet integrity check magic value.
@@ -64,47 +64,47 @@
 	/** Packet identifier.
 	 */
-	packet_id_t		packet_id;
+	packet_id_t packet_id;
 	/** Packet queue sorting value.
 	 *  The packet queue is sorted the ascending order.
 	 */
-	size_t			order;
+	size_t order;
 	/** Packet metric.
 	 */
-	size_t			metric;
+	size_t metric;
 	/** Previous packet in the queue.
 	 */
-	packet_id_t		previous;
+	packet_id_t previous;
 	/** Next packet in the queue.
 	 */
-	packet_id_t		next;
+	packet_id_t next;
 	/** Total length of the packet.
 	 *  Contains the header, the addresses and the data of the packet.
 	 *  Corresponds to the mapped sharable memory block.
 	 */
-	size_t			length;
+	size_t length;
 	/** Stored source and destination addresses length.
 	 */
-	size_t			addr_len;
+	size_t addr_len;
 	/** Souce address offset in bytes from the beginning of the packet header.
 	 */
-	size_t			src_addr;
+	size_t src_addr;
 	/** Destination address offset in bytes from the beginning of the packet header.
 	 */
-	size_t			dest_addr;
+	size_t dest_addr;
 	/** Reserved data prefix length in bytes.
 	 */
-	size_t			max_prefix;
+	size_t max_prefix;
 	/** Reserved content length in bytes.
 	 */
-	size_t			max_content;
+	size_t max_content;
 	/** Actual data start offset in bytes from the beginning of the packet header.
 	 */
-	size_t			data_start;
+	size_t data_start;
 	/** Actual data end offset in bytes from the beginning of the packet header.
 	 */
-	size_t			data_end;
+	size_t data_end;
 	/** Integrity check magic value.
 	 */
-	int				magic_value;
+	int magic_value;
 };
 
@@ -114,6 +114,6 @@
  *  @returns false otherwise.
  */
-static inline int	packet_is_valid( const packet_t packet ){
-	return packet && ( packet->magic_value == PACKET_MAGIC_VALUE );
+static inline int packet_is_valid(const packet_t packet){
+	return packet && (packet->magic_value == PACKET_MAGIC_VALUE);
 }
 
Index: uspace/srv/net/structures/packet/packet_messages.h
===================================================================
--- uspace/srv/net/structures/packet/packet_messages.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/packet/packet_messages.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -69,25 +69,25 @@
 /** Returns the protocol service message parameter.
  */
-#define ARP_GET_PROTO( call )		( services_t ) IPC_GET_ARG2( * call )
+#define ARP_GET_PROTO(call)		(services_t) IPC_GET_ARG2(*call)
 
 /** Returns the packet identifier message parameter.
  */
-#define IPC_GET_ID( call )			( packet_id_t ) IPC_GET_ARG1( * call )
+#define IPC_GET_ID(call)			(packet_id_t) IPC_GET_ARG1(*call)
 
 /** Returns the maximal content length message parameter.
  */
-#define IPC_GET_CONTENT( call )		( size_t ) IPC_GET_ARG1( * call )
+#define IPC_GET_CONTENT(call)		(size_t) IPC_GET_ARG1(*call)
 
 /** Returns the maximal address length message parameter.
  */
-#define IPC_GET_ADDR_LEN( call )	( size_t ) IPC_GET_ARG2( * call )
+#define IPC_GET_ADDR_LEN(call)	(size_t) IPC_GET_ARG2(*call)
 
 /** Returns the maximal prefix length message parameter.
  */
-#define IPC_GET_PREFIX( call )		( size_t ) IPC_GET_ARG3( * call )
+#define IPC_GET_PREFIX(call)		(size_t) IPC_GET_ARG3(*call)
 
 /** Returns the maximal suffix length message parameter.
  */
-#define IPC_GET_SUFFIX( call )		( size_t ) IPC_GET_ARG4( * call )
+#define IPC_GET_SUFFIX(call)		(size_t) IPC_GET_ARG4(*call)
 
 #endif
Index: uspace/srv/net/structures/packet/packet_remote.c
===================================================================
--- uspace/srv/net/structures/packet/packet_remote.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/packet/packet_remote.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -60,43 +60,45 @@
  *  @returns Other error codes as defined for the async_share_in_start() function.
  */
-int packet_return( int phone, packet_ref packet, packet_id_t packet_id, size_t size );
+int packet_return(int phone, packet_ref packet, packet_id_t packet_id, size_t size);
 
-int packet_translate( int phone, packet_ref packet, packet_id_t packet_id ){
+int packet_translate(int phone, packet_ref packet, packet_id_t packet_id){
 	ERROR_DECLARE;
 
-	ipcarg_t			size;
-	packet_t			next;
+	ipcarg_t size;
+	packet_t next;
 
-	if( ! packet ) return EINVAL;
-	* packet = pm_find( packet_id );
-	if( !( * packet )){
-		ERROR_PROPAGATE( async_req_1_1( phone, NET_PACKET_GET_SIZE, packet_id, & size ));
-		ERROR_PROPAGATE( packet_return( phone, packet, packet_id, size ));
+	if(! packet){
+		return EINVAL;
 	}
-	if(( ** packet ).next ){
-		return packet_translate( phone, & next, ( ** packet ).next );
+	*packet = pm_find(packet_id);
+	if(!(*packet)){
+		ERROR_PROPAGATE(async_req_1_1(phone, NET_PACKET_GET_SIZE, packet_id, &size));
+		ERROR_PROPAGATE(packet_return(phone, packet, packet_id, size));
+	}
+	if((** packet).next){
+		return packet_translate(phone, &next, (** packet).next);
 	}else return EOK;
 }
 
-int packet_return( int phone, packet_ref packet, packet_id_t packet_id, size_t size ){
+int packet_return(int phone, packet_ref packet, packet_id_t packet_id, size_t size){
 	ERROR_DECLARE;
 
-	aid_t		message;
-	ipc_call_t	answer;
-	ipcarg_t	result;
+	aid_t message;
+	ipc_call_t answer;
+	ipcarg_t result;
 
-	message = async_send_1( phone, NET_PACKET_GET, packet_id, & answer );
-	* packet = ( packet_t ) as_get_mappable_page( size );
-	if( ERROR_OCCURRED( async_share_in_start_0_0( phone, * packet, size ))
-	|| ERROR_OCCURRED( pm_add( * packet ))){
-		munmap( * packet, size );
-		async_wait_for( message, NULL );
+	message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer);
+	*packet = (packet_t) as_get_mappable_page(size);
+	if(ERROR_OCCURRED(async_share_in_start_0_0(phone, * packet, size))
+		|| ERROR_OCCURRED(pm_add(*packet))){
+		munmap(*packet, size);
+		async_wait_for(message, NULL);
 		return ERROR_CODE;
 	}
-	async_wait_for( message, & result );
+	async_wait_for(message, &result);
 	return result;
 }
 
-packet_t packet_get_4( int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix ){
+packet_t packet_get_4(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix){
 	ERROR_DECLARE;
 
@@ -105,10 +107,10 @@
 	packet_t packet;
 
-	if( ERROR_OCCURRED( async_req_4_2( phone, NET_PACKET_CREATE_4, max_content, addr_len, max_prefix, max_suffix, & packet_id, & size ))){
+	if(ERROR_OCCURRED(async_req_4_2(phone, NET_PACKET_CREATE_4, max_content, addr_len, max_prefix, max_suffix, &packet_id, &size))){
 		return NULL;
 	}
-	packet = pm_find( packet_id );
-	if( ! packet ){
-		if( ERROR_OCCURRED( packet_return( phone, & packet, packet_id, size ))){
+	packet = pm_find(packet_id);
+	if(! packet){
+		if(ERROR_OCCURRED(packet_return(phone, &packet, packet_id, size))){
 			return NULL;
 		}
@@ -117,17 +119,17 @@
 }
 
-packet_t packet_get_1( int phone, size_t content ){
+packet_t packet_get_1(int phone, size_t content){
 	ERROR_DECLARE;
 
-	ipcarg_t	packet_id;
-	ipcarg_t	size;
-	packet_t	packet;
+	ipcarg_t packet_id;
+	ipcarg_t size;
+	packet_t packet;
 
-	if( ERROR_OCCURRED( async_req_1_2( phone, NET_PACKET_CREATE_1, content, & packet_id, & size ))){
+	if(ERROR_OCCURRED(async_req_1_2(phone, NET_PACKET_CREATE_1, content, &packet_id, &size))){
 		return NULL;
 	}
-	packet = pm_find( packet_id );
-	if( ! packet ){
-		if( ERROR_OCCURRED( packet_return( phone, & packet, packet_id, size ))){
+	packet = pm_find(packet_id);
+	if(! packet){
+		if(ERROR_OCCURRED(packet_return(phone, &packet, packet_id, size))){
 			return NULL;
 		}
@@ -136,6 +138,6 @@
 }
 
-void pq_release( int phone, packet_id_t packet_id ){
-	async_msg_1( phone, NET_PACKET_RELEASE, packet_id );
+void pq_release(int phone, packet_id_t packet_id){
+	async_msg_1(phone, NET_PACKET_RELEASE, packet_id);
 }
 
Index: uspace/srv/net/structures/packet/packet_server.c
===================================================================
--- uspace/srv/net/structures/packet/packet_server.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/packet/packet_server.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -76,10 +76,10 @@
 	/** Free packet queues.
 	 */
-	packet_t free[ FREE_QUEUES_COUNT ];
+	packet_t free[FREE_QUEUES_COUNT];
 	/** Packet length upper bounds of the free packet queues.
 	 *  The maximal lengths of packets in each queue in the ascending order.
 	 *  The last queue is not limited.
 	 */
-	size_t sizes[ FREE_QUEUES_COUNT ];
+	size_t sizes[FREE_QUEUES_COUNT];
 	/** Total packets allocated.
 	 */
@@ -89,10 +89,10 @@
 		.counter = 1,
 		.waiters = {
-			.prev = & ps_globals.lock.waiters,
-			.next = & ps_globals.lock.waiters,
+			.prev = &ps_globals.lock.waiters,
+			.next = &ps_globals.lock.waiters,
 		}
 	},
-	.free = { NULL, NULL, NULL, NULL, NULL, NULL, NULL },
-	.sizes = { PAGE_SIZE, PAGE_SIZE * 2, PAGE_SIZE * 4, PAGE_SIZE * 8, PAGE_SIZE * 16, PAGE_SIZE * 32, PAGE_SIZE * 64 },
+	.free = {NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	.sizes = {PAGE_SIZE, PAGE_SIZE * 2, PAGE_SIZE * 4, PAGE_SIZE * 8, PAGE_SIZE * 16, PAGE_SIZE * 32, PAGE_SIZE * 64},
 	.count = 0
 };
@@ -113,5 +113,5 @@
  *  @returns NULL if there is not enough memory left.
  */
-packet_t	packet_get( size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix );
+packet_t packet_get(size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix);
 
 /** Releases the packet queue.
@@ -120,5 +120,5 @@
  *  @returns ENOENT if there is no such packet.
  */
-int	packet_release_wrapper( packet_id_t packet_id );
+int packet_release_wrapper(packet_id_t packet_id);
 
 /** Releases the packet and returns it to the appropriate free packet queue.
@@ -126,5 +126,5 @@
  *  @param[in] packet The packet to be released.
  */
-void packet_release( packet_t packet );
+void packet_release(packet_t packet);
 
 /** Creates a&nbsp;new packet of dimensions at least as given.
@@ -138,5 +138,5 @@
  *  @returns NULL if there is not enough memory left.
  */
-packet_t	packet_create( size_t length, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix );
+packet_t packet_create(size_t length, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix);
 
 /** Clears and initializes the packet according to the given dimensions.
@@ -147,5 +147,5 @@
  *  @param[in] max_suffix The maximal suffix length in bytes.
  */
-void	packet_init( packet_t packet, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix );
+void packet_init(packet_t packet, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix);
 
 /** Shares the packet memory block.
@@ -157,134 +157,148 @@
  *  @returns Other error codes as defined for the async_share_in_finalize() function.
  */
-int packet_reply( const packet_t packet );
+int packet_reply(const packet_t packet);
 
 /*@}*/
 
-int packet_translate( int phone, packet_ref packet, packet_id_t packet_id ){
-	if( ! packet ) return EINVAL;
-	* packet = pm_find( packet_id );
-	return ( * packet ) ? EOK : ENOENT;
-}
-
-packet_t packet_get_4( int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix ){
-	return packet_get( addr_len, max_prefix, max_content, max_suffix );
-}
-
-packet_t packet_get_1( int phone, size_t content ){
-	return packet_get( DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content, DEFAULT_SUFFIX );
-}
-
-void pq_release( int phone, packet_id_t packet_id ){
-	( void ) packet_release_wrapper( packet_id );
-}
-
-int	packet_server_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+int packet_translate(int phone, packet_ref packet, packet_id_t packet_id){
+	if(! packet){
+		return EINVAL;
+	}
+	*packet = pm_find(packet_id);
+	return (*packet) ? EOK : ENOENT;
+}
+
+packet_t packet_get_4(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix){
+	return packet_get(addr_len, max_prefix, max_content, max_suffix);
+}
+
+packet_t packet_get_1(int phone, size_t content){
+	return packet_get(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content, DEFAULT_SUFFIX);
+}
+
+void pq_release(int phone, packet_id_t packet_id){
+	(void) packet_release_wrapper(packet_id);
+}
+
+int packet_server_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	packet_t packet;
 
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_PACKET_CREATE_1:
-			packet = packet_get( DEFAULT_ADDR_LEN, DEFAULT_PREFIX, IPC_GET_CONTENT( call ), DEFAULT_SUFFIX );
-			if( ! packet ) return ENOMEM;
-			* answer_count = 2;
-			IPC_SET_ARG1( * answer, packet->packet_id );
-			IPC_SET_ARG2( * answer, packet->length );
+			packet = packet_get(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, IPC_GET_CONTENT(call), DEFAULT_SUFFIX);
+			if(! packet){
+				return ENOMEM;
+			}
+			*answer_count = 2;
+			IPC_SET_ARG1(*answer, packet->packet_id);
+			IPC_SET_ARG2(*answer, packet->length);
 			return EOK;
 		case NET_PACKET_CREATE_4:
-			packet = packet_get((( DEFAULT_ADDR_LEN < IPC_GET_ADDR_LEN( call )) ? IPC_GET_ADDR_LEN( call ) : DEFAULT_ADDR_LEN ), DEFAULT_PREFIX + IPC_GET_PREFIX( call ), IPC_GET_CONTENT( call ), DEFAULT_SUFFIX + IPC_GET_SUFFIX( call ));
-			if( ! packet ) return ENOMEM;
-			* answer_count = 2;
-			IPC_SET_ARG1( * answer, packet->packet_id );
-			IPC_SET_ARG2( * answer, packet->length );
+			packet = packet_get(((DEFAULT_ADDR_LEN < IPC_GET_ADDR_LEN(call)) ? IPC_GET_ADDR_LEN(call) : DEFAULT_ADDR_LEN), DEFAULT_PREFIX + IPC_GET_PREFIX(call), IPC_GET_CONTENT(call), DEFAULT_SUFFIX + IPC_GET_SUFFIX(call));
+			if(! packet){
+				return ENOMEM;
+			}
+			*answer_count = 2;
+			IPC_SET_ARG1(*answer, packet->packet_id);
+			IPC_SET_ARG2(*answer, packet->length);
 			return EOK;
 		case NET_PACKET_GET:
-			packet = pm_find( IPC_GET_ID( call ));
-			if( ! packet_is_valid( packet )) return ENOENT;
-			return packet_reply( packet );
+			packet = pm_find(IPC_GET_ID(call));
+			if(! packet_is_valid(packet)){
+				return ENOENT;
+			}
+			return packet_reply(packet);
 		case NET_PACKET_GET_SIZE:
-			packet = pm_find( IPC_GET_ID( call ));
-			if( ! packet_is_valid( packet )) return ENOENT;
-			IPC_SET_ARG1( * answer, packet->length );
-			* answer_count = 1;
+			packet = pm_find(IPC_GET_ID(call));
+			if(! packet_is_valid(packet)){
+				return ENOENT;
+			}
+			IPC_SET_ARG1(*answer, packet->length);
+			*answer_count = 1;
 			return EOK;
 		case NET_PACKET_RELEASE:
-			return packet_release_wrapper( IPC_GET_ID( call ));
+			return packet_release_wrapper(IPC_GET_ID(call));
 	}
 	return ENOTSUP;
 }
 
-int packet_release_wrapper( packet_id_t packet_id ){
-	packet_t	packet;
-
-	packet = pm_find( packet_id );
-	if( ! packet_is_valid( packet )) return ENOENT;
-	fibril_mutex_lock( & ps_globals.lock );
-	pq_destroy( packet, packet_release );
-	fibril_mutex_unlock( & ps_globals.lock );
+int packet_release_wrapper(packet_id_t packet_id){
+	packet_t packet;
+
+	packet = pm_find(packet_id);
+	if(! packet_is_valid(packet)){
+		return ENOENT;
+	}
+	fibril_mutex_lock(&ps_globals.lock);
+	pq_destroy(packet, packet_release);
+	fibril_mutex_unlock(&ps_globals.lock);
 	return EOK;
 }
 
-void packet_release( packet_t packet ){
+void packet_release(packet_t packet){
 	int index;
 	int result;
 
 	// remove debug dump
-//	printf( "packet %d released\n", packet->packet_id );
-	for( index = 0; ( index < FREE_QUEUES_COUNT - 1 ) && ( packet->length > ps_globals.sizes[ index ] ); ++ index );
-	result = pq_add( & ps_globals.free[ index ], packet, packet->length, packet->length );
-	assert( result == EOK );
-}
-
-packet_t packet_get( size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix ){
+//	printf("packet %d released\n", packet->packet_id);
+	for(index = 0; (index < FREE_QUEUES_COUNT - 1) && (packet->length > ps_globals.sizes[index]); ++ index);
+	result = pq_add(&ps_globals.free[index], packet, packet->length, packet->length);
+	assert(result == EOK);
+}
+
+packet_t packet_get(size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix){
 	int index;
 	packet_t packet;
 	size_t length;
 
-	length = ALIGN_UP( sizeof( struct packet ) + 2 * addr_len + max_prefix + max_content + max_suffix, PAGE_SIZE );
-	fibril_mutex_lock( & ps_globals.lock );
-	for( index = 0; index < FREE_QUEUES_COUNT - 1; ++ index ){
-		if( length <= ps_globals.sizes[ index ] ){
-			packet = ps_globals.free[ index ];
-			while( packet_is_valid( packet ) && ( packet->length < length )){
-				packet = pm_find( packet->next );
-			}
-			if( packet_is_valid( packet )){
-				if( packet == ps_globals.free[ index ] ){
-					ps_globals.free[ index ] = pq_detach( packet );
+	length = ALIGN_UP(sizeof(struct packet) + 2 * addr_len + max_prefix + max_content + max_suffix, PAGE_SIZE);
+	fibril_mutex_lock(&ps_globals.lock);
+	for(index = 0; index < FREE_QUEUES_COUNT - 1; ++ index){
+		if(length <= ps_globals.sizes[index]){
+			packet = ps_globals.free[index];
+			while(packet_is_valid(packet) && (packet->length < length)){
+				packet = pm_find(packet->next);
+			}
+			if(packet_is_valid(packet)){
+				if(packet == ps_globals.free[index]){
+					ps_globals.free[index] = pq_detach(packet);
 				}else{
-					pq_detach( packet );
+					pq_detach(packet);
 				}
-				packet_init( packet, addr_len, max_prefix, max_content, max_suffix );
-				fibril_mutex_unlock( & ps_globals.lock );
+				packet_init(packet, addr_len, max_prefix, max_content, max_suffix);
+				fibril_mutex_unlock(&ps_globals.lock);
 				// remove debug dump
-//				printf( "packet %d got\n", packet->packet_id );
+//				printf("packet %d got\n", packet->packet_id);
 				return packet;
 			}
 		}
 	}
-	packet = packet_create( length, addr_len, max_prefix, max_content, max_suffix );
-	fibril_mutex_unlock( & ps_globals.lock );
+	packet = packet_create(length, addr_len, max_prefix, max_content, max_suffix);
+	fibril_mutex_unlock(&ps_globals.lock);
 	// remove debug dump
-//	printf( "packet %d created\n", packet->packet_id );
+//	printf("packet %d created\n", packet->packet_id);
 	return packet;
 }
 
-packet_t packet_create( size_t length, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix ){
+packet_t packet_create(size_t length, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix){
 	ERROR_DECLARE;
 
-	packet_t	packet;
+	packet_t packet;
 
 	// already locked
-	packet = ( packet_t ) mmap( NULL, length, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0 );
-	if( packet == MAP_FAILED ) return NULL;
+	packet = (packet_t) mmap(NULL, length, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
+	if(packet == MAP_FAILED){
+		return NULL;
+	}
 	++ ps_globals.count;
 	packet->packet_id = ps_globals.count;
 	packet->length = length;
-	packet_init( packet, addr_len, max_prefix, max_content, max_suffix );
+	packet_init(packet, addr_len, max_prefix, max_content, max_suffix);
 	packet->magic_value = PACKET_MAGIC_VALUE;
-	if( ERROR_OCCURRED( pm_add( packet ))){
-		munmap( packet, packet->length );
+	if(ERROR_OCCURRED(pm_add(packet))){
+		munmap(packet, packet->length);
 		return NULL;
 	}
@@ -292,7 +306,7 @@
 }
 
-void packet_init( packet_t packet, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix ){
+void packet_init(packet_t packet, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix){
 	// clear the packet content
-	bzero((( void * ) packet ) + sizeof( struct packet ), packet->length - sizeof( struct packet ));
+	bzero(((void *) packet) + sizeof(struct packet), packet->length - sizeof(struct packet));
 	// clear the packet header
 	packet->order = 0;
@@ -301,5 +315,5 @@
 	packet->next = 0;
 	packet->addr_len = 0;
-	packet->src_addr = sizeof( struct packet );
+	packet->src_addr = sizeof(struct packet);
 	packet->dest_addr = packet->src_addr + addr_len;
 	packet->max_prefix = max_prefix;
@@ -309,12 +323,16 @@
 }
 
-int packet_reply( const packet_t packet ){
-	ipc_callid_t	callid;
-	size_t			size;
-
-	if( ! packet_is_valid( packet )) return EINVAL;
-	if( async_share_in_receive( & callid, & size ) <= 0 ) return EINVAL;
-	if( size != packet->length ) return ENOMEM;
-	return async_share_in_finalize( callid, packet, PROTO_READ | PROTO_WRITE );
+int packet_reply(const packet_t packet){
+	ipc_callid_t callid;
+	size_t size;
+
+	if(! packet_is_valid(packet)){
+		return EINVAL;
+	}
+	if(async_share_in_receive(&callid, &size) <= 0) return EINVAL;
+	if(size != packet->length){
+		return ENOMEM;
+	}
+	return async_share_in_finalize(callid, packet, PROTO_READ | PROTO_WRITE);
 }
 
Index: uspace/srv/net/structures/packet/packet_server.h
===================================================================
--- uspace/srv/net/structures/packet/packet_server.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/structures/packet/packet_server.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -56,5 +56,5 @@
  *  @returns Other error codes as defined for the packet_release_wrapper() function.
  */
-int	packet_server_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int packet_server_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/tl/icmp/icmp.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -102,5 +102,5 @@
  *  @returns The computed checksum.
  */
-#define ICMP_CHECKSUM( header, length )		htons( ip_checksum(( uint8_t * ) ( header ), ( length )))
+#define ICMP_CHECKSUM(header, length)		htons(ip_checksum((uint8_t *) (header), (length)))
 
 /** An echo request datagrams pattern.
@@ -113,5 +113,5 @@
  *  @returns The computed ICMP reply data key.
  */
-#define ICMP_GET_REPLY_KEY( id, sequence )	((( id ) << 16 ) | ( sequence & 0xFFFF ))
+#define ICMP_GET_REPLY_KEY(id, sequence)	(((id) << 16) | (sequence &0xFFFF))
 
 /** Processes the received ICMP packet.
@@ -125,5 +125,5 @@
  *  @returns Other error codes as defined for the icmp_process_packet() function.
  */
-int	icmp_received_msg( device_id_t device_id, packet_t packet, services_t receiver, services_t error );
+int icmp_received_msg(device_id_t device_id, packet_t packet, services_t receiver, services_t error);
 
 /** Processes the received ICMP packet.
@@ -140,5 +140,5 @@
  *  @returns Other error codes as defined for the ip_client_process_packet() function.
  */
-int	icmp_process_packet( packet_t packet, services_t error );
+int icmp_process_packet(packet_t packet, services_t error);
 
 /** Processes the client messages.
@@ -151,5 +151,5 @@
  *  @see icmp_api.h
  */
-int icmp_process_client_messages( ipc_callid_t callid, ipc_call_t call );
+int icmp_process_client_messages(ipc_callid_t callid, ipc_call_t call);
 
 /** Processes the generic client messages.
@@ -164,5 +164,5 @@
  *  @see icmp_interface.h
  */
-int	icmp_process_message( ipc_call_t * call );
+int icmp_process_message(ipc_call_t * call);
 
 /** Releases the packet and returns the result.
@@ -171,5 +171,5 @@
  *  @returns The result parameter.
  */
-int	icmp_release_and_return( packet_t packet, int result );
+int icmp_release_and_return(packet_t packet, int result);
 
 /** Requests an echo message.
@@ -192,5 +192,5 @@
  *  @returns EPARTY if there was an internal error.
  */
-int	icmp_echo( icmp_param_t id, icmp_param_t sequence, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen );
+int icmp_echo(icmp_param_t id, icmp_param_t sequence, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen);
 
 /** Prepares the ICMP error packet.
@@ -201,5 +201,5 @@
  *  @returns NULL on errors.
  */
-icmp_header_ref	icmp_prepare_packet( packet_t packet );
+icmp_header_ref icmp_prepare_packet(packet_t packet);
 
 /** Sends the ICMP message.
@@ -218,5 +218,5 @@
  *  @returns EPERM if the error message is not allowed.
  */
-int	icmp_send_packet( icmp_type_t type, icmp_code_t code, packet_t packet, icmp_header_ref header, services_t error, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment );
+int icmp_send_packet(icmp_type_t type, icmp_code_t code, packet_t packet, icmp_header_ref header, services_t error, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment);
 
 /** Tries to set the pending reply result as the received message type.
@@ -230,5 +230,5 @@
  *  @returns EOK.
  */
-int	icmp_process_echo_reply( packet_t packet, icmp_header_ref header, icmp_type_t type, icmp_code_t code );
+int icmp_process_echo_reply(packet_t packet, icmp_header_ref header, icmp_type_t type, icmp_code_t code);
 
 /** Assigns a new identifier for the connection.
@@ -239,5 +239,5 @@
  *  @returns ENOTCONN if no free identifier have been found.
  */
-int	icmp_bind_free_id( icmp_echo_ref echo_data );
+int icmp_bind_free_id(icmp_echo_ref echo_data);
 
 /** ICMP global data.
@@ -245,20 +245,20 @@
 icmp_globals_t	icmp_globals;
 
-INT_MAP_IMPLEMENT( icmp_replies, icmp_reply_t );
-
-INT_MAP_IMPLEMENT( icmp_echo_data, icmp_echo_t );
-
-int icmp_echo_msg( int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen ){
-	icmp_echo_ref	echo_data;
-	int				res;
-
-	fibril_rwlock_write_lock( & icmp_globals.lock );
+INT_MAP_IMPLEMENT(icmp_replies, icmp_reply_t);
+
+INT_MAP_IMPLEMENT(icmp_echo_data, icmp_echo_t);
+
+int icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen){
+	icmp_echo_ref echo_data;
+	int res;
+
+	fibril_rwlock_write_lock(&icmp_globals.lock);
 	// use the phone as the echo data index
-	echo_data = icmp_echo_data_find( & icmp_globals.echo_data, icmp_phone );
-	if( ! echo_data ){
+	echo_data = icmp_echo_data_find(&icmp_globals.echo_data, icmp_phone);
+	if(! echo_data){
 		res = ENOENT;
 	}else{
-		res = icmp_echo( echo_data->identifier, echo_data->sequence_number, size, timeout, ttl, tos, dont_fragment, addr, addrlen );
-		if( echo_data->sequence_number < MAX_UINT16 ){
+		res = icmp_echo(echo_data->identifier, echo_data->sequence_number, size, timeout, ttl, tos, dont_fragment, addr, addrlen);
+		if(echo_data->sequence_number < MAX_UINT16){
 			++ echo_data->sequence_number;
 		}else{
@@ -266,79 +266,81 @@
 		}
 	}
-	fibril_rwlock_write_unlock( & icmp_globals.lock );
+	fibril_rwlock_write_unlock(&icmp_globals.lock);
 	return res;
 }
 
-int icmp_echo( icmp_param_t id, icmp_param_t sequence, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen ){
+int icmp_echo(icmp_param_t id, icmp_param_t sequence, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen){
 	ERROR_DECLARE;
 
-	icmp_header_ref	header;
-	packet_t		packet;
-	size_t			length;
-	uint8_t *		data;
-	icmp_reply_ref			reply;
-	int				reply_key;
-	int				result;
-	int				index;
-
-	if( addrlen <= 0 ){
+	icmp_header_ref header;
+	packet_t packet;
+	size_t length;
+	uint8_t * data;
+	icmp_reply_ref reply;
+	int reply_key;
+	int result;
+	int index;
+
+	if(addrlen <= 0){
 		return EINVAL;
 	}
-	length = ( size_t ) addrlen;
+	length = (size_t) addrlen;
 	// TODO do not ask all the time
-	ERROR_PROPAGATE( ip_packet_size_req( icmp_globals.ip_phone, -1, & icmp_globals.packet_dimension ));
-	packet = packet_get_4( icmp_globals.net_phone, size, icmp_globals.packet_dimension.addr_len, ICMP_HEADER_SIZE + icmp_globals.packet_dimension.prefix, icmp_globals.packet_dimension.suffix );
-	if( ! packet ) return ENOMEM;
+	ERROR_PROPAGATE(ip_packet_size_req(icmp_globals.ip_phone, -1, &icmp_globals.packet_dimension));
+	packet = packet_get_4(icmp_globals.net_phone, size, icmp_globals.packet_dimension.addr_len, ICMP_HEADER_SIZE + icmp_globals.packet_dimension.prefix, icmp_globals.packet_dimension.suffix);
+	if(! packet){
+		return ENOMEM;
+	}
 
 	// prepare the requesting packet
 	// set the destination address
-	if( ERROR_OCCURRED( packet_set_addr( packet, NULL, ( const uint8_t * ) addr, length ))){
-		return icmp_release_and_return( packet, ERROR_CODE );
+	if(ERROR_OCCURRED(packet_set_addr(packet, NULL, (const uint8_t *) addr, length))){
+		return icmp_release_and_return(packet, ERROR_CODE);
 	}
 	// allocate space in the packet
-	data = ( uint8_t * ) packet_suffix( packet, size );
-	if( ! data ){
-		return icmp_release_and_return( packet, ENOMEM );
+	data = (uint8_t *) packet_suffix(packet, size);
+	if(! data){
+		return icmp_release_and_return(packet, ENOMEM);
 	}
 	// fill the data
 	length = 0;
-	while( size > length + sizeof( ICMP_ECHO_TEXT )){
-		memcpy( data + length, ICMP_ECHO_TEXT, sizeof( ICMP_ECHO_TEXT ));
-		length += sizeof( ICMP_ECHO_TEXT );
-	}
-	memcpy( data + length, ICMP_ECHO_TEXT, size - length );
+	while(size > length + sizeof(ICMP_ECHO_TEXT)){
+		memcpy(data + length, ICMP_ECHO_TEXT, sizeof(ICMP_ECHO_TEXT));
+		length += sizeof(ICMP_ECHO_TEXT);
+	}
+	memcpy(data + length, ICMP_ECHO_TEXT, size - length);
 	// prefix the header
-	header = PACKET_PREFIX( packet, icmp_header_t );
-	if( ! header ){
-		return icmp_release_and_return( packet, ENOMEM );
-	}
-	bzero( header, sizeof( * header ));
+	header = PACKET_PREFIX(packet, icmp_header_t);
+	if(! header){
+		return icmp_release_and_return(packet, ENOMEM);
+	}
+	bzero(header, sizeof(*header));
 	header->un.echo.identifier = id;
 	header->un.echo.sequence_number = sequence;
 
 	// prepare the reply structure
-	reply = malloc( sizeof( * reply ));
-	if( ! reply ){
-		return icmp_release_and_return( packet, ENOMEM );
-	}
-	fibril_mutex_initialize( & reply->mutex );
-	fibril_mutex_lock( & reply->mutex );
-	fibril_condvar_initialize( & reply->condvar );
-	reply_key = ICMP_GET_REPLY_KEY( header->un.echo.identifier, header->un.echo.sequence_number );
-	index = icmp_replies_add( & icmp_globals.replies, reply_key, reply );
-	if( index < 0 ){
-		free( reply );
-		return icmp_release_and_return( packet, index );
+	reply = malloc(sizeof(*reply));
+	if(! reply){
+		return icmp_release_and_return(packet, ENOMEM);
+	}
+	fibril_mutex_initialize(&reply->mutex);
+	fibril_mutex_lock(&reply->mutex);
+	fibril_condvar_initialize(&reply->condvar);
+	reply_key = ICMP_GET_REPLY_KEY(header->un.echo.identifier, header->un.echo.sequence_number);
+	index = icmp_replies_add(&icmp_globals.replies, reply_key, reply);
+	if(index < 0){
+		free(reply);
+		return icmp_release_and_return(packet, index);
 	}
 
 	// unlock the globals so that we can wait for the reply
-	fibril_rwlock_write_unlock( & icmp_globals.lock );
+	fibril_rwlock_write_unlock(&icmp_globals.lock);
 
 	// send the request
-	icmp_send_packet( ICMP_ECHO, 0, packet, header, 0, ttl, tos, dont_fragment );
+	icmp_send_packet(ICMP_ECHO, 0, packet, header, 0, ttl, tos, dont_fragment);
 
 	// wait for the reply
 	// timeout in microseconds
-	if( ERROR_OCCURRED( fibril_condvar_wait_timeout( & reply->condvar, & reply->mutex, timeout * 1000 ))){
+	if(ERROR_OCCURRED(fibril_condvar_wait_timeout(&reply->condvar, &reply->mutex, timeout * 1000))){
 		result = ERROR_CODE;
 	}else{
@@ -348,110 +350,118 @@
 
 	// drop the reply mutex before locking the globals again
-	fibril_mutex_unlock( & reply->mutex );
-	fibril_rwlock_write_lock( & icmp_globals.lock );
+	fibril_mutex_unlock(&reply->mutex);
+	fibril_rwlock_write_lock(&icmp_globals.lock);
 
 	// destroy the reply structure
-	icmp_replies_exclude_index( & icmp_globals.replies, index );
+	icmp_replies_exclude_index(&icmp_globals.replies, index);
 	return result;
 }
 
-int icmp_destination_unreachable_msg( int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet ){
-	icmp_header_ref	header;
-
-	header = icmp_prepare_packet( packet );
-	if( ! header ){
-		return icmp_release_and_return( packet, ENOMEM );
-	}
-	if( mtu ){
+int icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet){
+	icmp_header_ref header;
+
+	header = icmp_prepare_packet(packet);
+	if(! header){
+		return icmp_release_and_return(packet, ENOMEM);
+	}
+	if(mtu){
 		header->un.frag.mtu = mtu;
 	}
-	return icmp_send_packet( ICMP_DEST_UNREACH, code, packet, header, SERVICE_ICMP, 0, 0, 0 );
-}
-
-int icmp_source_quench_msg( int icmp_phone, packet_t packet ){
-	icmp_header_ref	header;
-
-	header = icmp_prepare_packet( packet );
-	if( ! header ){
-		return icmp_release_and_return( packet, ENOMEM );
-	}
-	return icmp_send_packet( ICMP_SOURCE_QUENCH, 0, packet, header, SERVICE_ICMP, 0, 0, 0 );
-}
-
-int icmp_time_exceeded_msg( int icmp_phone, icmp_code_t code, packet_t packet ){
-	icmp_header_ref	header;
-
-	header = icmp_prepare_packet( packet );
-	if( ! header ){
-		return icmp_release_and_return( packet, ENOMEM );
-	}
-	return icmp_send_packet( ICMP_TIME_EXCEEDED, code, packet, header, SERVICE_ICMP, 0, 0, 0 );
-}
-
-int icmp_parameter_problem_msg( int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet ){
-	icmp_header_ref	header;
-
-	header = icmp_prepare_packet( packet );
-	if( ! header ){
-		return icmp_release_and_return( packet, ENOMEM );
+	return icmp_send_packet(ICMP_DEST_UNREACH, code, packet, header, SERVICE_ICMP, 0, 0, 0);
+}
+
+int icmp_source_quench_msg(int icmp_phone, packet_t packet){
+	icmp_header_ref header;
+
+	header = icmp_prepare_packet(packet);
+	if(! header){
+		return icmp_release_and_return(packet, ENOMEM);
+	}
+	return icmp_send_packet(ICMP_SOURCE_QUENCH, 0, packet, header, SERVICE_ICMP, 0, 0, 0);
+}
+
+int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet){
+	icmp_header_ref header;
+
+	header = icmp_prepare_packet(packet);
+	if(! header){
+		return icmp_release_and_return(packet, ENOMEM);
+	}
+	return icmp_send_packet(ICMP_TIME_EXCEEDED, code, packet, header, SERVICE_ICMP, 0, 0, 0);
+}
+
+int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet){
+	icmp_header_ref header;
+
+	header = icmp_prepare_packet(packet);
+	if(! header){
+		return icmp_release_and_return(packet, ENOMEM);
 	}
 	header->un.param.pointer = pointer;
-	return icmp_send_packet( ICMP_PARAMETERPROB, code, packet, header, SERVICE_ICMP, 0, 0, 0 );
-}
-
-icmp_header_ref icmp_prepare_packet( packet_t packet ){
-	icmp_header_ref	header;
-	size_t			header_length;
-	size_t			total_length;
-
-	total_length = packet_get_data_length( packet );
-	if( total_length <= 0 ) return NULL;
-	header_length = ip_client_header_length( packet );
-	if( header_length <= 0 ) return NULL;
+	return icmp_send_packet(ICMP_PARAMETERPROB, code, packet, header, SERVICE_ICMP, 0, 0, 0);
+}
+
+icmp_header_ref icmp_prepare_packet(packet_t packet){
+	icmp_header_ref header;
+	size_t header_length;
+	size_t total_length;
+
+	total_length = packet_get_data_length(packet);
+	if(total_length <= 0){
+		return NULL;
+	}
+	header_length = ip_client_header_length(packet);
+	if(header_length <= 0){
+		return NULL;
+	}
 	// truncate if longer than 64 bits (without the IP header)
-	if(( total_length > header_length + ICMP_KEEP_LENGTH )
-	&& ( packet_trim( packet, 0, total_length - header_length - ICMP_KEEP_LENGTH ) != EOK )){
+	if((total_length > header_length + ICMP_KEEP_LENGTH)
+		&& (packet_trim(packet, 0, total_length - header_length - ICMP_KEEP_LENGTH) != EOK)){
 		return NULL;
 	}
-	header = PACKET_PREFIX( packet, icmp_header_t );
-	if( ! header ) return NULL;
-	bzero( header, sizeof( * header ));
+	header = PACKET_PREFIX(packet, icmp_header_t);
+	if(! header){
+		return NULL;
+	}
+	bzero(header, sizeof(*header));
 	return header;
 }
 
-int icmp_send_packet( icmp_type_t type, icmp_code_t code, packet_t packet, icmp_header_ref header, services_t error, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment ){
+int icmp_send_packet(icmp_type_t type, icmp_code_t code, packet_t packet, icmp_header_ref header, services_t error, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment){
 	ERROR_DECLARE;
 
 	// do not send an error if disabled
-	if( error && ( ! icmp_globals.error_reporting )){
-		return icmp_release_and_return( packet, EPERM );
+	if(error && (! icmp_globals.error_reporting)){
+		return icmp_release_and_return(packet, EPERM);
 	}
 	header->type = type;
 	header->code = code;
 	header->checksum = 0;
-	header->checksum = ICMP_CHECKSUM( header, packet_get_data_length( packet ));
-	if( ERROR_OCCURRED( ip_client_prepare_packet( packet, IPPROTO_ICMP, ttl, tos, dont_fragment, 0 ))){
-		return icmp_release_and_return( packet, ERROR_CODE );
-	}
-	return ip_send_msg( icmp_globals.ip_phone, -1, packet, SERVICE_ICMP, error );
-}
-
-int icmp_connect_module( services_t service, suseconds_t timeout ){
-	icmp_echo_ref	echo_data;
-	icmp_param_t	id;
-	int				index;
-
-	echo_data = ( icmp_echo_ref ) malloc( sizeof( * echo_data ));
-	if( ! echo_data ) return ENOMEM;
+	header->checksum = ICMP_CHECKSUM(header, packet_get_data_length(packet));
+	if(ERROR_OCCURRED(ip_client_prepare_packet(packet, IPPROTO_ICMP, ttl, tos, dont_fragment, 0))){
+		return icmp_release_and_return(packet, ERROR_CODE);
+	}
+	return ip_send_msg(icmp_globals.ip_phone, -1, packet, SERVICE_ICMP, error);
+}
+
+int icmp_connect_module(services_t service, suseconds_t timeout){
+	icmp_echo_ref echo_data;
+	icmp_param_t id;
+	int index;
+
+	echo_data = (icmp_echo_ref) malloc(sizeof(*echo_data));
+	if(! echo_data){
+		return ENOMEM;
+	}
 	// assign a new identifier
-	fibril_rwlock_write_lock( & icmp_globals.lock );
-	index = icmp_bind_free_id( echo_data );
-	if( index < 0 ){
-		free( echo_data );
-		fibril_rwlock_write_unlock( & icmp_globals.lock );
+	fibril_rwlock_write_lock(&icmp_globals.lock);
+	index = icmp_bind_free_id(echo_data);
+	if(index < 0){
+		free(echo_data);
+		fibril_rwlock_write_unlock(&icmp_globals.lock);
 		return index;
 	}else{
 		id = echo_data->identifier;
-		fibril_rwlock_write_unlock( & icmp_globals.lock );
+		fibril_rwlock_write_unlock(&icmp_globals.lock);
 		// return the echo data identifier as the ICMP phone
 		return id;
@@ -459,21 +469,21 @@
 }
 
-int icmp_initialize( async_client_conn_t client_connection ){
+int icmp_initialize(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	measured_string_t	names[] = {{ str_dup("ICMP_ERROR_REPORTING"), 20 }, { str_dup("ICMP_ECHO_REPLYING"), 18 }};
-	measured_string_ref	configuration;
-	size_t				count = sizeof( names ) / sizeof( measured_string_t );
-	char *				data;
-
-	fibril_rwlock_initialize( & icmp_globals.lock );
-	fibril_rwlock_write_lock( & icmp_globals.lock );
-	icmp_replies_initialize( & icmp_globals.replies );
-	icmp_echo_data_initialize( & icmp_globals.echo_data );
-	icmp_globals.ip_phone = ip_bind_service( SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP, client_connection, icmp_received_msg );
-	if( icmp_globals.ip_phone < 0 ){
+	measured_string_t names[] = {{str_dup("ICMP_ERROR_REPORTING"), 20}, {str_dup("ICMP_ECHO_REPLYING"), 18}};
+	measured_string_ref configuration;
+	size_t count = sizeof(names) / sizeof(measured_string_t);
+	char * data;
+
+	fibril_rwlock_initialize(&icmp_globals.lock);
+	fibril_rwlock_write_lock(&icmp_globals.lock);
+	icmp_replies_initialize(&icmp_globals.replies);
+	icmp_echo_data_initialize(&icmp_globals.echo_data);
+	icmp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP, client_connection, icmp_received_msg);
+	if(icmp_globals.ip_phone < 0){
 		return icmp_globals.ip_phone;
 	}
-	ERROR_PROPAGATE( ip_packet_size_req( icmp_globals.ip_phone, -1, & icmp_globals.packet_dimension ));
+	ERROR_PROPAGATE(ip_packet_size_req(icmp_globals.ip_phone, -1, &icmp_globals.packet_dimension));
 	icmp_globals.packet_dimension.prefix += ICMP_HEADER_SIZE;
 	icmp_globals.packet_dimension.content -= ICMP_HEADER_SIZE;
@@ -481,24 +491,24 @@
 	icmp_globals.error_reporting = NET_DEFAULT_ICMP_ERROR_REPORTING;
 	icmp_globals.echo_replying = NET_DEFAULT_ICMP_ECHO_REPLYING;
-	configuration = & names[ 0 ];
-	ERROR_PROPAGATE( net_get_conf_req( icmp_globals.net_phone, & configuration, count, & data ));
-	if( configuration ){
-		if( configuration[ 0 ].value ){
-			icmp_globals.error_reporting = ( configuration[ 0 ].value[ 0 ] == 'y' );
+	configuration = &names[0];
+	ERROR_PROPAGATE(net_get_conf_req(icmp_globals.net_phone, &configuration, count, &data));
+	if(configuration){
+		if(configuration[0].value){
+			icmp_globals.error_reporting = (configuration[0].value[0] == 'y');
 		}
-		if( configuration[ 1 ].value ){
-			icmp_globals.echo_replying = ( configuration[ 1 ].value[ 0 ] == 'y' );
+		if(configuration[1].value){
+			icmp_globals.echo_replying = (configuration[1].value[0] == 'y');
 		}
-		net_free_settings( configuration, data );
-	}
-	fibril_rwlock_write_unlock( & icmp_globals.lock );
+		net_free_settings(configuration, data);
+	}
+	fibril_rwlock_write_unlock(&icmp_globals.lock);
 	return EOK;
 }
 
-int	icmp_received_msg( device_id_t device_id, packet_t packet, services_t receiver, services_t error ){
+int icmp_received_msg(device_id_t device_id, packet_t packet, services_t receiver, services_t error){
 	ERROR_DECLARE;
 
-	if( ERROR_OCCURRED( icmp_process_packet( packet, error ))){
-		return icmp_release_and_return( packet, ERROR_CODE );
+	if(ERROR_OCCURRED(icmp_process_packet(packet, error))){
+		return icmp_release_and_return(packet, ERROR_CODE);
 	}
 
@@ -506,25 +516,27 @@
 }
 
-int icmp_process_packet( packet_t packet, services_t error ){
+int icmp_process_packet(packet_t packet, services_t error){
 	ERROR_DECLARE;
 
-	size_t			length;
-	uint8_t *		src;
-	int				addrlen;
-	int				result;
-	void *			data;
-	icmp_header_ref	header;
-	icmp_type_t		type;
-	icmp_code_t		code;
-
-	if( error ){
-		switch( error ){
+	size_t length;
+	uint8_t * src;
+	int addrlen;
+	int result;
+	void * data;
+	icmp_header_ref header;
+	icmp_type_t type;
+	icmp_code_t code;
+
+	if(error){
+		switch(error){
 			case SERVICE_ICMP:
 				// process error
-				result = icmp_client_process_packet( packet, & type, & code, NULL, NULL );
-				if( result < 0 ) return result;
-				length = ( size_t ) result;
+				result = icmp_client_process_packet(packet, &type, &code, NULL, NULL);
+				if(result < 0){
+					return result;
+				}
+				length = (size_t) result;
 				// remove the error header
-				ERROR_PROPAGATE( packet_trim( packet, length, 0 ));
+				ERROR_PROPAGATE(packet_trim(packet, length, 0));
 				break;
 			default:
@@ -533,21 +545,27 @@
 	}
 	// get rid of the ip header
-	length = ip_client_header_length( packet );
-	ERROR_PROPAGATE( packet_trim( packet, length, 0 ));
-
-	length = packet_get_data_length( packet );
-	if( length <= 0 ) return EINVAL;
-	if( length < ICMP_HEADER_SIZE) return EINVAL;
-	data = packet_get_data( packet );
-	if( ! data ) return EINVAL;
+	length = ip_client_header_length(packet);
+	ERROR_PROPAGATE(packet_trim(packet, length, 0));
+
+	length = packet_get_data_length(packet);
+	if(length <= 0){
+		return EINVAL;
+	}
+	if(length < ICMP_HEADER_SIZE){
+		return EINVAL;
+	}
+	data = packet_get_data(packet);
+	if(! data){
+		return EINVAL;
+	}
 	// get icmp header
-	header = ( icmp_header_ref ) data;
+	header = (icmp_header_ref) data;
 	// checksum
-	if( header->checksum ){
-		while( ICMP_CHECKSUM( header, length ) != IP_CHECKSUM_ZERO ){
+	if(header->checksum){
+		while(ICMP_CHECKSUM(header, length) != IP_CHECKSUM_ZERO){
 			// set the original message type on error notification
 			// type swap observed in Qemu
-			if( error ){
-				switch( header->type ){
+			if(error){
+				switch(header->type){
 					case ICMP_ECHOREPLY:
 						header->type = ICMP_ECHO;
@@ -558,22 +576,22 @@
 		}
 	}
-	switch( header->type ){
+	switch(header->type){
 		case ICMP_ECHOREPLY:
-			if( error ){
-				return icmp_process_echo_reply( packet, header, type, code );
+			if(error){
+				return icmp_process_echo_reply(packet, header, type, code);
 			}else{
-				return icmp_process_echo_reply( packet, header, ICMP_ECHO, 0 );
+				return icmp_process_echo_reply(packet, header, ICMP_ECHO, 0);
 			}
 		case ICMP_ECHO:
-			if( error ){
-				return icmp_process_echo_reply( packet, header, type, code );
+			if(error){
+				return icmp_process_echo_reply(packet, header, type, code);
 			// do not send a reply if disabled
-			}else if( icmp_globals.echo_replying ){
-				addrlen = packet_get_addr( packet, & src, NULL );
-				if(( addrlen > 0 )
+			}else if(icmp_globals.echo_replying){
+				addrlen = packet_get_addr(packet, &src, NULL);
+				if((addrlen > 0)
 				// set both addresses to the source one (avoids the source address deletion before setting the destination one)
-				&& ( packet_set_addr( packet, src, src, ( size_t ) addrlen ) == EOK )){
+					&& (packet_set_addr(packet, src, src, (size_t) addrlen) == EOK)){
 					// send the reply
-					icmp_send_packet( ICMP_ECHOREPLY, 0, packet, header, 0, 0, 0, 0 );
+					icmp_send_packet(ICMP_ECHOREPLY, 0, packet, header, 0, 0, 0, 0);
 					return EOK;
 				}else{
@@ -595,5 +613,5 @@
 		case ICMP_SKIP:
 		case ICMP_PHOTURIS:
-			ip_received_error_msg( icmp_globals.ip_phone, -1, packet, SERVICE_IP, SERVICE_ICMP );
+			ip_received_error_msg(icmp_globals.ip_phone, -1, packet, SERVICE_IP, SERVICE_ICMP);
 			return EOK;
 		default:
@@ -602,56 +620,57 @@
 }
 
-int icmp_process_echo_reply( packet_t packet, icmp_header_ref header, icmp_type_t type, icmp_code_t code ){
-	int				reply_key;
-	icmp_reply_ref	reply;
+int icmp_process_echo_reply(packet_t packet, icmp_header_ref header, icmp_type_t type, icmp_code_t code){
+	int reply_key;
+	icmp_reply_ref reply;
 
 	// compute the reply key
-	reply_key = ICMP_GET_REPLY_KEY( header->un.echo.identifier, header->un.echo.sequence_number );
-	pq_release( icmp_globals.net_phone, packet_get_id( packet ));
+	reply_key = ICMP_GET_REPLY_KEY(header->un.echo.identifier, header->un.echo.sequence_number);
+	pq_release(icmp_globals.net_phone, packet_get_id(packet));
 	// lock the globals
-	fibril_rwlock_write_lock( & icmp_globals.lock );
+	fibril_rwlock_write_lock(&icmp_globals.lock);
 	// find the pending reply
-	reply = icmp_replies_find( & icmp_globals.replies, reply_key );
-	if( reply ){
+	reply = icmp_replies_find(&icmp_globals.replies, reply_key);
+	if(reply){
 		// set the result
 		reply->result = type;
 		// notify the waiting fibril
-		fibril_condvar_signal( & reply->condvar );
-	}
-	fibril_rwlock_write_unlock( & icmp_globals.lock );
+		fibril_condvar_signal(&reply->condvar);
+	}
+	fibril_rwlock_write_unlock(&icmp_globals.lock);
 	return EOK;
 }
 
-int icmp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+int icmp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
-	packet_t			packet;
-
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+	packet_t packet;
+
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case NET_TL_RECEIVED:
-			if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){
-				ERROR_CODE = icmp_received_msg( IPC_GET_DEVICE( call ), packet, SERVICE_ICMP, IPC_GET_ERROR( call ));
+			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+				ERROR_CODE = icmp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_ICMP, IPC_GET_ERROR(call));
 			}
 			return ERROR_CODE;
 		case NET_ICMP_INIT:
-			return icmp_process_client_messages( callid, * call );
+			return icmp_process_client_messages(callid, * call);
 		default:
-			return icmp_process_message( call );
+			return icmp_process_message(call);
 	}
 	return ENOTSUP;
 }
 
-int icmp_process_client_messages( ipc_callid_t callid, ipc_call_t call ){
+int icmp_process_client_messages(ipc_callid_t callid, ipc_call_t call){
 	ERROR_DECLARE;
 
-	bool					keep_on_going = true;
+	bool keep_on_going = true;
 //	fibril_rwlock_t			lock;
-	ipc_call_t				answer;
-	int						answer_count;
-	size_t					length;
-	struct sockaddr *		addr;
-	ipc_callid_t			data_callid;
-	icmp_echo_ref			echo_data;
+	ipc_call_t answer;
+	int answer_count;
+	size_t length;
+	struct sockaddr * addr;
+	ipc_callid_t data_callid;
+	icmp_echo_ref echo_data;
+	int res;
 
 	/*
@@ -659,91 +678,102 @@
 	 *  - Answer the first NET_ICMP_INIT call.
 	 */
-	ipc_answer_0( callid, EOK );
-
-//	fibril_rwlock_initialize( & lock );
-
-	echo_data = ( icmp_echo_ref ) malloc( sizeof( * echo_data ));
-	if( ! echo_data ) return ENOMEM;
+	res = EOK;
+	answer_count = 0;
+
+//	fibril_rwlock_initialize(&lock);
+
+	echo_data = (icmp_echo_ref) malloc(sizeof(*echo_data));
+	if(! echo_data){
+		return ENOMEM;
+	}
+
 	// assign a new identifier
-	fibril_rwlock_write_lock( & icmp_globals.lock );
-	ERROR_CODE = icmp_bind_free_id( echo_data );
-	fibril_rwlock_write_unlock( & icmp_globals.lock );
-	if( ERROR_CODE < 0 ){
-		free( echo_data );
-		return ERROR_CODE;
-	}
-
-	while( keep_on_going ){
-		refresh_answer( & answer, & answer_count );
-
-		callid = async_get_call( & call );
-
-		switch( IPC_GET_METHOD( call )){
+	fibril_rwlock_write_lock(&icmp_globals.lock);
+	res = icmp_bind_free_id(echo_data);
+	fibril_rwlock_write_unlock(&icmp_globals.lock);
+	if(res < 0){
+		free(echo_data);
+		return res;
+	}
+
+	while(keep_on_going){
+
+		// answer the call
+		answer_call(callid, res, &answer, answer_count);
+
+		// refresh data
+		refresh_answer(&answer, &answer_count);
+
+		// get the next call
+		callid = async_get_call(&call);
+
+		// process the call
+		switch(IPC_GET_METHOD(call)){
 			case IPC_M_PHONE_HUNGUP:
 				keep_on_going = false;
-				ERROR_CODE = EOK;
+				res = EHANGUP;
 				break;
 			case NET_ICMP_ECHO:
-//				fibril_rwlock_write_lock( & lock );
-				if( ! async_data_write_receive( & data_callid, & length )){
-					ERROR_CODE = EINVAL;
+//				fibril_rwlock_write_lock(&lock);
+				if(! async_data_write_receive(&data_callid, &length)){
+					res = EINVAL;
 				}else{
-					addr = malloc( length );
-					if( ! addr ){
-						ERROR_CODE = ENOMEM;
+					addr = malloc(length);
+					if(! addr){
+						res = ENOMEM;
 					}else{
-						if( ! ERROR_OCCURRED( async_data_write_finalize( data_callid, addr, length ))){
-							fibril_rwlock_write_lock( & icmp_globals.lock );
-							ERROR_CODE = icmp_echo( echo_data->identifier, echo_data->sequence_number, ICMP_GET_SIZE( call ), ICMP_GET_TIMEOUT( call ), ICMP_GET_TTL( call ), ICMP_GET_TOS( call ), ICMP_GET_DONT_FRAGMENT( call ), addr, ( socklen_t ) length );
-							fibril_rwlock_write_unlock( & icmp_globals.lock );
-							free( addr );
-							if( echo_data->sequence_number < MAX_UINT16 ){
+						if(! ERROR_OCCURRED(async_data_write_finalize(data_callid, addr, length))){
+							fibril_rwlock_write_lock(&icmp_globals.lock);
+							res = icmp_echo(echo_data->identifier, echo_data->sequence_number, ICMP_GET_SIZE(call), ICMP_GET_TIMEOUT(call), ICMP_GET_TTL(call), ICMP_GET_TOS(call), ICMP_GET_DONT_FRAGMENT(call), addr, (socklen_t) length);
+							fibril_rwlock_write_unlock(&icmp_globals.lock);
+							free(addr);
+							if(echo_data->sequence_number < MAX_UINT16){
 								++ echo_data->sequence_number;
 							}else{
 								echo_data->sequence_number = 0;
 							}
+						}else{
+							res = ERROR_CODE;
 						}
 					}
 				}
-//				fibril_rwlock_write_unlock( & lock );
+//				fibril_rwlock_write_unlock(&lock);
 				break;
 			default:
-				ERROR_CODE = icmp_process_message( & call );
+				res = icmp_process_message(&call);
 		}
-
-		answer_call( callid, ERROR_CODE, & answer, answer_count );
 	}
 
 	// release the identifier
-	fibril_rwlock_write_lock( & icmp_globals.lock );
-	icmp_echo_data_exclude( & icmp_globals.echo_data, echo_data->identifier );
-	fibril_rwlock_write_unlock( & icmp_globals.lock );
-	return EOK;
-}
-
-int icmp_process_message( ipc_call_t * call ){
+	fibril_rwlock_write_lock(&icmp_globals.lock);
+	icmp_echo_data_exclude(&icmp_globals.echo_data, echo_data->identifier);
+	fibril_rwlock_write_unlock(&icmp_globals.lock);
+	return res;
+}
+
+int icmp_process_message(ipc_call_t * call){
 	ERROR_DECLARE;
 
-	packet_t	packet;
-
-	switch( IPC_GET_METHOD( * call )){
+	packet_t packet;
+
+	switch(IPC_GET_METHOD(*call)){
 		case NET_ICMP_DEST_UNREACH:
-			if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){
-				ERROR_CODE = icmp_destination_unreachable_msg( 0, ICMP_GET_CODE( call ), ICMP_GET_MTU( call ), packet );
+			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+				ERROR_CODE = icmp_destination_unreachable_msg(0, ICMP_GET_CODE(call), ICMP_GET_MTU(call), packet);
 			}
 			return ERROR_CODE;
 		case NET_ICMP_SOURCE_QUENCH:
-			if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){
-				ERROR_CODE = icmp_source_quench_msg( 0, packet );
+			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+				ERROR_CODE = icmp_source_quench_msg(0, packet);
 			}
 			return ERROR_CODE;
 		case NET_ICMP_TIME_EXCEEDED:
-			if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){
-				ERROR_CODE = icmp_time_exceeded_msg( 0, ICMP_GET_CODE( call ), packet );
+			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+				ERROR_CODE = icmp_time_exceeded_msg(0, ICMP_GET_CODE(call), packet);
 			}
 			return ERROR_CODE;
 		case NET_ICMP_PARAMETERPROB:
-			if( ! ERROR_OCCURRED( packet_translate( icmp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){
-				ERROR_CODE = icmp_parameter_problem_msg( 0, ICMP_GET_CODE( call ), ICMP_GET_POINTER( call ), packet );
+			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+				ERROR_CODE = icmp_parameter_problem_msg(0, ICMP_GET_CODE(call), ICMP_GET_POINTER(call), packet);
 			}
 			return ERROR_CODE;
@@ -753,13 +783,15 @@
 }
 
-int	icmp_release_and_return( packet_t packet, int result ){
-	pq_release( icmp_globals.net_phone, packet_get_id( packet ));
+int icmp_release_and_return(packet_t packet, int result){
+	pq_release(icmp_globals.net_phone, packet_get_id(packet));
 	return result;
 }
 
-int icmp_bind_free_id( icmp_echo_ref echo_data ){
-	icmp_param_t	index;
-
-	if( ! echo_data ) return EBADMEM;
+int icmp_bind_free_id(icmp_echo_ref echo_data){
+	icmp_param_t index;
+
+	if(! echo_data){
+		return EBADMEM;
+	}
 	// from the last used one
 	index = icmp_globals.last_used_id;
@@ -767,5 +799,5 @@
 		++ index;
 		// til the range end
-		if( index >= ICMP_FREE_IDS_END ){
+		if(index >= ICMP_FREE_IDS_END){
 			// start from the range beginning
 			index = ICMP_FREE_IDS_START - 1;
@@ -773,16 +805,16 @@
 				++ index;
 				// til the last used one
-				if( index >= icmp_globals.last_used_id ){
+				if(index >= icmp_globals.last_used_id){
 					// none found
 					return ENOTCONN;
 				}
-			}while( icmp_echo_data_find( & icmp_globals.echo_data, index ) != NULL );
+			}while(icmp_echo_data_find(&icmp_globals.echo_data, index) != NULL);
 			// found, break immediately
 			break;
 		}
-	}while( icmp_echo_data_find( & icmp_globals.echo_data, index ) != NULL );
+	}while(icmp_echo_data_find(&icmp_globals.echo_data, index) != NULL);
 	echo_data->identifier = index;
 	echo_data->sequence_number = 0;
-	return icmp_echo_data_add( & icmp_globals.echo_data, index, echo_data );
+	return icmp_echo_data_add(&icmp_globals.echo_data, index, echo_data);
 }
 
Index: uspace/srv/net/tl/icmp/icmp.h
===================================================================
--- uspace/srv/net/tl/icmp/icmp.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -66,5 +66,5 @@
  *  Receiving fibril sets the associated reply with the return value and signals the event.
  */
-INT_MAP_DECLARE( icmp_replies, icmp_reply_t );
+INT_MAP_DECLARE(icmp_replies, icmp_reply_t);
 
 /** Echo specific data map.
@@ -72,5 +72,5 @@
  *  The identifier is used in the future semi-remote calls instead of the ICMP phone.
  */
-INT_MAP_DECLARE( icmp_echo_data, icmp_echo_t );
+INT_MAP_DECLARE(icmp_echo_data, icmp_echo_t);
 
 /** ICMP reply data.
@@ -79,11 +79,11 @@
 	/** Reply result.
 	 */
-	int					result;
+	int result;
 	/** Safety lock.
 	 */
-	fibril_mutex_t		mutex;
+	fibril_mutex_t mutex;
 	/** Received or timeouted reply signaling.
 	 */
-	fibril_condvar_t	condvar;
+	fibril_condvar_t condvar;
 };
 
@@ -93,29 +93,29 @@
 	/** IP module phone.
 	 */
-	int				ip_phone;
+	int ip_phone;
 	/** Packet dimension.
 	 */
-	packet_dimension_t	packet_dimension;
+	packet_dimension_t packet_dimension;
 	/** Networking module phone.
 	 */
-	int				net_phone;
+	int net_phone;
 	/** Indicates whether ICMP error reporting is enabled.
 	 */
-	int				error_reporting;
+	int error_reporting;
 	/** Indicates whether ICMP echo replying (ping) is enabled.
 	 */
-	int				echo_replying;
+	int echo_replying;
 	/** The last used identifier number.
 	 */
-	icmp_param_t	last_used_id;
+	icmp_param_t last_used_id;
 	/** The budled modules assigned echo specific data.
 	 */
-	icmp_echo_data_t	echo_data;
+	icmp_echo_data_t echo_data;
 	/** Echo timeout locks.
 	 */
-	icmp_replies_t	replies;
+	icmp_replies_t replies;
 	/** Safety lock.
 	 */
-	fibril_rwlock_t	lock;
+	fibril_rwlock_t lock;
 };
 
Index: uspace/srv/net/tl/icmp/icmp_api.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp_api.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp_api.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -52,18 +52,18 @@
 #include "icmp_messages.h"
 
-int icmp_echo_msg( int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen ){
-	aid_t			message_id;
-	ipcarg_t		result;
+int icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen){
+	aid_t message_id;
+	ipcarg_t result;
 
-	if( addrlen <= 0 ){
+	if(addrlen <= 0){
 		return EINVAL;
 	}
-	message_id = async_send_5( icmp_phone, NET_ICMP_ECHO, size, timeout, ttl, tos, ( ipcarg_t ) dont_fragment, NULL );
+	message_id = async_send_5(icmp_phone, NET_ICMP_ECHO, size, timeout, ttl, tos, (ipcarg_t) dont_fragment, NULL);
 	// send the address
-	async_data_write_start( icmp_phone, addr, ( size_t ) addrlen );
+	async_data_write_start(icmp_phone, addr, (size_t) addrlen);
 	// timeout version may cause inconsistency - there is also an inner timer
-	// return async_wait_timeout( message_id, & result, timeout );
-	async_wait_for( message_id, & result );
-	return ( int ) result;
+	// return async_wait_timeout(message_id, &result, timeout);
+	async_wait_for(message_id, &result);
+	return (int) result;
 }
 
Index: uspace/srv/net/tl/icmp/icmp_client.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp_client.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp_client.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -49,26 +49,34 @@
 #include "icmp_header.h"
 
-int	icmp_client_process_packet( packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu ){
-	icmp_header_ref	header;
+int icmp_client_process_packet(packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu){
+	icmp_header_ref header;
 
-	header = ( icmp_header_ref ) packet_get_data( packet );
-	if(( ! header )
-	|| ( packet_get_data_length( packet ) < sizeof( icmp_header_t ))){
+	header = (icmp_header_ref) packet_get_data(packet);
+	if((! header)
+		|| (packet_get_data_length(packet) < sizeof(icmp_header_t))){
 		return 0;
 	}
-	if( type ) * type = header->type;
-	if( code ) * code = header->code;
-	if( pointer ) * pointer = header->un.param.pointer;
-	if( mtu ) * mtu = header->un.frag.mtu;
+	if(type){
+		*type = header->type;
+	}
+	if(code){
+		*code = header->code;
+	}
+	if(pointer){
+		*pointer = header->un.param.pointer;
+	}
+	if(mtu){
+		*mtu = header->un.frag.mtu;
+	}
 	// remove debug dump
-//	printf( "ICMP error %d (%d) in packet %d\n", header->type, header->code, packet_get_id( packet ));
-	return sizeof( icmp_header_t );
+//	printf("ICMP error %d (%d) in packet %d\n", header->type, header->code, packet_get_id(packet));
+	return sizeof(icmp_header_t);
 }
 
-size_t icmp_client_header_length( packet_t packet ){
-	if( packet_get_data_length( packet ) < sizeof( icmp_header_t )){
+size_t icmp_client_header_length(packet_t packet){
+	if(packet_get_data_length(packet) < sizeof(icmp_header_t)){
 		return 0;
 	}
-	return sizeof( icmp_header_t );
+	return sizeof(icmp_header_t);
 }
 
Index: uspace/srv/net/tl/icmp/icmp_common.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp_common.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp_common.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -45,10 +45,10 @@
 #include "icmp_messages.h"
 
-int icmp_connect_module( services_t service, suseconds_t timeout ){
-	int	phone;
+int icmp_connect_module(services_t service, suseconds_t timeout){
+	int phone;
 
-	phone = connect_to_service_timeout( SERVICE_ICMP, timeout );
-	if( phone >= 0 ){
-		async_req_0_0( phone, NET_ICMP_INIT );
+	phone = connect_to_service_timeout(SERVICE_ICMP, timeout);
+	if(phone >= 0){
+		async_req_0_0(phone, NET_ICMP_INIT);
 	}
 	return phone;
Index: uspace/srv/net/tl/icmp/icmp_header.h
===================================================================
--- uspace/srv/net/tl/icmp/icmp_header.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp_header.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -46,5 +46,5 @@
 /** ICMP header size in bytes.
  */
-#define ICMP_HEADER_SIZE			sizeof( icmp_header_t )
+#define ICMP_HEADER_SIZE			sizeof(icmp_header_t)
 
 /** Type definition of the echo specific data.
@@ -63,8 +63,8 @@
 	/** Message idintifier.
 	 */
-	icmp_param_t	identifier;
+	icmp_param_t identifier;
 	/** Message sequence number.
 	 */
-	icmp_param_t	sequence_number;
+	icmp_param_t sequence_number;
 } __attribute__ ((packed));
 
@@ -84,14 +84,14 @@
 	/** The type of the message.
 	 */
-	uint8_t	type;
+	uint8_t type;
 	/** The error code for the datagram reported by the ICMP message.
 	 *  The interpretation is dependent on the message type.
 	 */
-	uint8_t	code;
+	uint8_t code;
 	/** The checksum is the 16-bit ones's complement of the one's complement sum of the ICMP message starting with the ICMP Type.
      *  For computing the checksum, the checksum field should be zero.
 	 *  If the checksum does not match the contents, the datagram is discarded.
 	 */
-	uint16_t	checksum;
+	uint16_t checksum;
 	/** Message specific data.
 	 */
@@ -99,8 +99,8 @@
 		/** Echo specific data.
 		 */
-		icmp_echo_t 		echo;
+		icmp_echo_t  echo;
 		/** Proposed gateway value.
 		 */
-		in_addr_t			gateway;
+		in_addr_t gateway;
 		/** Fragmentation needed specific data.
 		 */
@@ -109,8 +109,8 @@
 			 *  Must be zero.
 			 */
-			icmp_param_t	reserved;
+			icmp_param_t reserved;
 			/** Proposed MTU.
 			 */
-			icmp_param_t	mtu;
+			icmp_param_t mtu;
 		} frag;
 		/** Parameter problem specific data.
@@ -119,9 +119,9 @@
 			/** Problem pointer.
 			 */
-			icmp_param_t	pointer;
+			icmp_param_t pointer;
 			/** Reserved field.
 			 *  Must be zero.
 			 */
-			icmp_param_t	reserved;
+			icmp_param_t reserved;
 		} param;
 	} un;
Index: uspace/srv/net/tl/icmp/icmp_messages.h
===================================================================
--- uspace/srv/net/tl/icmp/icmp_messages.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp_messages.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -82,40 +82,40 @@
  *  @param[in] call The message call structure.
  */
-#define ICMP_GET_CODE( call )		( icmp_code_t ) IPC_GET_ARG1( * call )
+#define ICMP_GET_CODE(call)		(icmp_code_t) IPC_GET_ARG1(*call)
 
 /** Returns the ICMP link MTU message parameter.
  *  @param[in] call The message call structure.
  */
-#define ICMP_GET_MTU( call )		( icmp_param_t ) IPC_GET_ARG3( * call )
+#define ICMP_GET_MTU(call)		(icmp_param_t) IPC_GET_ARG3(*call)
 
 /** Returns the pointer message parameter.
  *  @param[in] call The message call structure.
  */
-#define ICMP_GET_POINTER( call )		( icmp_param_t ) IPC_GET_ARG3( * call )
+#define ICMP_GET_POINTER(call)		(icmp_param_t) IPC_GET_ARG3(*call)
 
 /** Returns the size message parameter.
  *  @param[in] call The message call structure.
  */
-#define ICMP_GET_SIZE( call )	( size_t ) IPC_GET_ARG1( call )
+#define ICMP_GET_SIZE(call)	(size_t) IPC_GET_ARG1(call)
 
 /** Returns the timeout message parameter.
  *  @param[in] call The message call structure.
  */
-#define ICMP_GET_TIMEOUT( call )	(( suseconds_t ) IPC_GET_ARG2( call ))
+#define ICMP_GET_TIMEOUT(call)	((suseconds_t) IPC_GET_ARG2(call))
 
 /** Returns the time to live message parameter.
  *  @param[in] call The message call structure.
  */
-#define ICMP_GET_TTL( call )	( ip_ttl_t ) IPC_GET_ARG3( call )
+#define ICMP_GET_TTL(call)	(ip_ttl_t) IPC_GET_ARG3(call)
 
 /** Returns the type of service message parameter.
  *  @param[in] call The message call structure.
  */
-#define ICMP_GET_TOS( call )	( ip_tos_t ) IPC_GET_ARG4( call )
+#define ICMP_GET_TOS(call)	(ip_tos_t) IPC_GET_ARG4(call)
 
 /** Returns the dont fragment message parameter.
  *  @param[in] call The message call structure.
  */
-#define ICMP_GET_DONT_FRAGMENT( call )		( int ) IPC_GET_ARG5( call )
+#define ICMP_GET_DONT_FRAGMENT(call)		(int) IPC_GET_ARG5(call)
 
 /*@}*/
Index: uspace/srv/net/tl/icmp/icmp_module.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp_module.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp_module.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -61,5 +61,5 @@
  *  @see NAME
  */
-void	module_print_name( void );
+void module_print_name(void);
 
 /** Starts the ICMP module.
@@ -70,5 +70,5 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int	module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
 /** Processes the ICMP message.
@@ -80,5 +80,5 @@
  *  @returns Other error codes as defined for the icmp_message() function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** ICMP module global data.
@@ -86,21 +86,21 @@
 extern icmp_globals_t	icmp_globals;
 
-void module_print_name( void ){
-	printf( "%s", NAME );
+void module_print_name(void){
+	printf("%s", NAME);
 }
 
-int module_start( async_client_conn_t client_connection ){
+int module_start(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ipcarg_t	phonehash;
+	ipcarg_t phonehash;
 
-	async_set_client_connection( client_connection );
-	icmp_globals.net_phone = net_connect_module( SERVICE_NETWORKING );
-	if( icmp_globals.net_phone < 0 ){
+	async_set_client_connection(client_connection);
+	icmp_globals.net_phone = net_connect_module(SERVICE_NETWORKING);
+	if(icmp_globals.net_phone < 0){
 		return icmp_globals.net_phone;
 	}
-	ERROR_PROPAGATE( pm_init());
-	if( ERROR_OCCURRED( icmp_initialize( client_connection ))
-	|| ERROR_OCCURRED( REGISTER_ME( SERVICE_ICMP, & phonehash ))){
+	ERROR_PROPAGATE(pm_init());
+	if(ERROR_OCCURRED(icmp_initialize(client_connection))
+		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_ICMP, &phonehash))){
 		pm_destroy();
 		return ERROR_CODE;
@@ -113,6 +113,6 @@
 }
 
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	return icmp_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return icmp_message(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/tl/icmp/icmp_module.h
===================================================================
--- uspace/srv/net/tl/icmp/icmp_module.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp_module.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -47,5 +47,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	icmp_initialize( async_client_conn_t client_connection );
+int icmp_initialize(async_client_conn_t client_connection);
 
 /** Processes the ICMP message.
@@ -59,5 +59,5 @@
  *  @see IS_NET_ICMP_MESSAGE()
  */
-int	icmp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int icmp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/tl/icmp/icmp_remote.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp_remote.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/icmp/icmp_remote.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -53,21 +53,21 @@
 #include "icmp_messages.h"
 
-int icmp_destination_unreachable_msg( int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet ){
-	async_msg_3( icmp_phone, NET_ICMP_DEST_UNREACH, ( ipcarg_t ) code, ( ipcarg_t ) packet_get_id( packet ), ( ipcarg_t ) mtu );
+int icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet){
+	async_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (ipcarg_t) code, (ipcarg_t) packet_get_id(packet), (ipcarg_t) mtu);
 	return EOK;
 }
 
-int icmp_source_quench_msg( int icmp_phone, packet_t packet ){
-	async_msg_2( icmp_phone, NET_ICMP_SOURCE_QUENCH, 0, ( ipcarg_t ) packet_get_id( packet ));
+int icmp_source_quench_msg(int icmp_phone, packet_t packet){
+	async_msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0, (ipcarg_t) packet_get_id(packet));
 	return EOK;
 }
 
-int icmp_time_exceeded_msg( int icmp_phone, icmp_code_t code, packet_t packet ){
-	async_msg_2( icmp_phone, NET_ICMP_TIME_EXCEEDED, ( ipcarg_t ) code, ( ipcarg_t ) packet_get_id( packet ));
+int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet){
+	async_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (ipcarg_t) code, (ipcarg_t) packet_get_id(packet));
 	return EOK;
 }
 
-int icmp_parameter_problem_msg( int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet ){
-	async_msg_3( icmp_phone, NET_ICMP_PARAMETERPROB, ( ipcarg_t ) code, ( ipcarg_t ) packet_get_id( packet ), ( ipcarg_t ) pointer );
+int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet){
+	async_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (ipcarg_t) code, (ipcarg_t) packet_get_id(packet), (ipcarg_t) pointer);
 	return EOK;
 }
Index: uspace/srv/net/tl/tcp/tcp.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/tcp/tcp.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -123,5 +123,5 @@
  *  @param[in] higher_equal The last value in the interval.
  */
-#define IS_IN_INTERVAL_OVERFLOW( lower, value, higher_equal )	(((( lower ) < ( value )) && ((( value ) <= ( higher_equal )) || (( higher_equal ) < ( lower )))) || ((( value ) <= ( higher_equal )) && (( higher_equal ) < ( lower ))))
+#define IS_IN_INTERVAL_OVERFLOW(lower, value, higher_equal)	((((lower) < (value)) && (((value) <= (higher_equal)) || ((higher_equal) < (lower)))) || (((value) <= (higher_equal)) && ((higher_equal) < (lower))))
 
 /** Type definition of the TCP timeout.
@@ -142,29 +142,29 @@
 	/** TCP global data are going to be read only.
 	 */
-	int					globals_read_only;
+	int globals_read_only;
 	/** Socket port.
 	 */
-	int					port;
+	int port;
 	/** Local sockets.
 	 */
-	socket_cores_ref	local_sockets;
+	socket_cores_ref local_sockets;
 	/** Socket identifier.
 	 */
-	int					socket_id;
+	int socket_id;
 	/** Socket state.
 	 */
-	tcp_socket_state_t	state;
+	tcp_socket_state_t state;
 	/** Sent packet sequence number.
 	 */
-	int					sequence_number;
+	int sequence_number;
 	/** Timeout in microseconds.
 	 */
-	suseconds_t			timeout;
+	suseconds_t timeout;
 	/** Port map key.
 	 */
-	char *				key;
+	char * key;
 	/** Port map key length.
 	 */
-	size_t				key_length;
+	size_t key_length;
 };
 
@@ -174,38 +174,38 @@
  *  @return The result parameter.
  */
-int	tcp_release_and_return( packet_t packet, int result );
-
-void	tcp_prepare_operation_header( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, int synchronize, int finalize );
-int	tcp_prepare_timeout( int ( * timeout_function )( void * tcp_timeout_t ), socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number, tcp_socket_state_t state, suseconds_t timeout, int globals_read_only );
-void	tcp_free_socket_data( socket_core_ref socket );
-int	tcp_timeout( void * data );
-int	tcp_release_after_timeout( void * data );
-int	tcp_process_packet( device_id_t device_id, packet_t packet, services_t error );
-int	tcp_connect_core( socket_core_ref socket, socket_cores_ref local_sockets, struct sockaddr * addr, socklen_t addrlen );
-int	tcp_queue_prepare_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length );
-int	tcp_queue_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length );
-packet_t	tcp_get_packets_to_send( socket_core_ref socket, tcp_socket_data_ref socket_data );
-void	tcp_send_packets( device_id_t device_id, packet_t packet );
-void	tcp_process_acknowledgement( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header );
-packet_t	tcp_send_prepare_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number );
-packet_t	tcp_prepare_copy( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number );
-void	tcp_retransmit_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number );
-int	tcp_create_notification_packet( packet_t * packet, socket_core_ref socket, tcp_socket_data_ref socket_data, int synchronize, int finalize );
-void	tcp_refresh_socket_data( tcp_socket_data_ref socket_data );
-void	tcp_initialize_socket_data( tcp_socket_data_ref socket_data );
-int	tcp_process_listen( socket_core_ref listening_socket, tcp_socket_data_ref listening_socket_data, tcp_header_ref header, packet_t packet, struct sockaddr * src, struct sockaddr * dest, size_t addrlen );
-int	tcp_process_syn_sent( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet );
-int	tcp_process_syn_received( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet );
-int	tcp_process_established( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet, int fragments, size_t total_length );
-int	tcp_queue_received_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, int fragments, size_t total_length );
-
-int	tcp_received_msg( device_id_t device_id, packet_t packet, services_t receiver, services_t error );
-int	tcp_process_client_messages( ipc_callid_t callid, ipc_call_t call );
-int	tcp_listen_message( socket_cores_ref local_sockets, int socket_id, int backlog );
-int	tcp_connect_message( socket_cores_ref local_sockets, int socket_id, struct sockaddr * addr, socklen_t addrlen );
-int	tcp_recvfrom_message( socket_cores_ref local_sockets, int socket_id, int flags, size_t * addrlen );
-int	tcp_send_message( socket_cores_ref local_sockets, int socket_id, int fragments, size_t * data_fragment_size, int flags );
-int	tcp_accept_message( socket_cores_ref local_sockets, int socket_id, int new_socket_id, size_t * data_fragment_size, size_t * addrlen );
-int tcp_close_message( socket_cores_ref local_sockets, int socket_id );
+int tcp_release_and_return(packet_t packet, int result);
+
+void tcp_prepare_operation_header(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, int synchronize, int finalize);
+int tcp_prepare_timeout(int (*timeout_function)(void * tcp_timeout_t), socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number, tcp_socket_state_t state, suseconds_t timeout, int globals_read_only);
+void tcp_free_socket_data(socket_core_ref socket);
+int tcp_timeout(void * data);
+int tcp_release_after_timeout(void * data);
+int tcp_process_packet(device_id_t device_id, packet_t packet, services_t error);
+int tcp_connect_core(socket_core_ref socket, socket_cores_ref local_sockets, struct sockaddr * addr, socklen_t addrlen);
+int tcp_queue_prepare_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length);
+int tcp_queue_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length);
+packet_t tcp_get_packets_to_send(socket_core_ref socket, tcp_socket_data_ref socket_data);
+void tcp_send_packets(device_id_t device_id, packet_t packet);
+void tcp_process_acknowledgement(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header);
+packet_t tcp_send_prepare_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number);
+packet_t tcp_prepare_copy(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number);
+void tcp_retransmit_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number);
+int tcp_create_notification_packet(packet_t * packet, socket_core_ref socket, tcp_socket_data_ref socket_data, int synchronize, int finalize);
+void tcp_refresh_socket_data(tcp_socket_data_ref socket_data);
+void tcp_initialize_socket_data(tcp_socket_data_ref socket_data);
+int tcp_process_listen(socket_core_ref listening_socket, tcp_socket_data_ref listening_socket_data, tcp_header_ref header, packet_t packet, struct sockaddr * src, struct sockaddr * dest, size_t addrlen);
+int tcp_process_syn_sent(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet);
+int tcp_process_syn_received(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet);
+int tcp_process_established(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet, int fragments, size_t total_length);
+int tcp_queue_received_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, int fragments, size_t total_length);
+
+int tcp_received_msg(device_id_t device_id, packet_t packet, services_t receiver, services_t error);
+int tcp_process_client_messages(ipc_callid_t callid, ipc_call_t call);
+int tcp_listen_message(socket_cores_ref local_sockets, int socket_id, int backlog);
+int tcp_connect_message(socket_cores_ref local_sockets, int socket_id, struct sockaddr * addr, socklen_t addrlen);
+int tcp_recvfrom_message(socket_cores_ref local_sockets, int socket_id, int flags, size_t * addrlen);
+int tcp_send_message(socket_cores_ref local_sockets, int socket_id, int fragments, size_t * data_fragment_size, int flags);
+int tcp_accept_message(socket_cores_ref local_sockets, int socket_id, int new_socket_id, size_t * data_fragment_size, size_t * addrlen);
+int tcp_close_message(socket_cores_ref local_sockets, int socket_id);
 
 /** TCP global data.
@@ -213,131 +213,133 @@
 tcp_globals_t	tcp_globals;
 
-int tcp_initialize( async_client_conn_t client_connection ){
+int tcp_initialize(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	assert( client_connection );
-	fibril_rwlock_initialize( & tcp_globals.lock );
-	fibril_rwlock_write_lock( & tcp_globals.lock );
-	tcp_globals.icmp_phone = icmp_connect_module( SERVICE_ICMP, ICMP_CONNECT_TIMEOUT );
-	tcp_globals.ip_phone = ip_bind_service( SERVICE_IP, IPPROTO_TCP, SERVICE_TCP, client_connection, tcp_received_msg );
-	if( tcp_globals.ip_phone < 0 ){
+	assert(client_connection);
+	fibril_rwlock_initialize(&tcp_globals.lock);
+	fibril_rwlock_write_lock(&tcp_globals.lock);
+	tcp_globals.icmp_phone = icmp_connect_module(SERVICE_ICMP, ICMP_CONNECT_TIMEOUT);
+	tcp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_TCP, SERVICE_TCP, client_connection, tcp_received_msg);
+	if(tcp_globals.ip_phone < 0){
 		return tcp_globals.ip_phone;
 	}
-	ERROR_PROPAGATE( socket_ports_initialize( & tcp_globals.sockets ));
-	if( ERROR_OCCURRED( packet_dimensions_initialize( & tcp_globals.dimensions ))){
-		socket_ports_destroy( & tcp_globals.sockets );
+	ERROR_PROPAGATE(socket_ports_initialize(&tcp_globals.sockets));
+	if(ERROR_OCCURRED(packet_dimensions_initialize(&tcp_globals.dimensions))){
+		socket_ports_destroy(&tcp_globals.sockets);
 		return ERROR_CODE;
 	}
 	tcp_globals.last_used_port = TCP_FREE_PORTS_START - 1;
-	fibril_rwlock_write_unlock( & tcp_globals.lock );
+	fibril_rwlock_write_unlock(&tcp_globals.lock);
 	return EOK;
 }
 
-int	tcp_received_msg( device_id_t device_id, packet_t packet, services_t receiver, services_t error ){
+int tcp_received_msg(device_id_t device_id, packet_t packet, services_t receiver, services_t error){
 	ERROR_DECLARE;
 
-	if( receiver != SERVICE_TCP ) return EREFUSED;
-	fibril_rwlock_write_lock( & tcp_globals.lock );
-	if( ERROR_OCCURRED( tcp_process_packet( device_id, packet, error ))){
-		fibril_rwlock_write_unlock( & tcp_globals.lock );
-	}
-	printf( "receive %d \n", ERROR_CODE );
+	if(receiver != SERVICE_TCP){
+		return EREFUSED;
+	}
+	fibril_rwlock_write_lock(&tcp_globals.lock);
+	if(ERROR_OCCURRED(tcp_process_packet(device_id, packet, error))){
+		fibril_rwlock_write_unlock(&tcp_globals.lock);
+	}
+	printf("receive %d \n", ERROR_CODE);
 
 	return ERROR_CODE;
 }
 
-int tcp_process_packet( device_id_t device_id, packet_t packet, services_t error ){
+int tcp_process_packet(device_id_t device_id, packet_t packet, services_t error){
 	ERROR_DECLARE;
 
-	size_t				length;
-	size_t				offset;
-	int					result;
-	tcp_header_ref		header;
-	socket_core_ref 	socket;
-	tcp_socket_data_ref	socket_data;
-	packet_t			next_packet;
-	size_t				total_length;
-	uint32_t			checksum;
-	int					fragments;
-	icmp_type_t			type;
-	icmp_code_t			code;
-	struct sockaddr *	src;
-	struct sockaddr *	dest;
-	size_t				addrlen;
-
-	printf( "p1 \n" );
-	if( error ){
-		switch( error ){
+	size_t length;
+	size_t offset;
+	int result;
+	tcp_header_ref header;
+	socket_core_ref  socket;
+	tcp_socket_data_ref socket_data;
+	packet_t next_packet;
+	size_t total_length;
+	uint32_t checksum;
+	int fragments;
+	icmp_type_t type;
+	icmp_code_t code;
+	struct sockaddr * src;
+	struct sockaddr * dest;
+	size_t addrlen;
+
+	printf("p1 \n");
+	if(error){
+		switch(error){
 			case SERVICE_ICMP:
 				// process error
-				result = icmp_client_process_packet( packet, & type, & code, NULL, NULL );
-				if( result < 0 ){
-					return tcp_release_and_return( packet, result );
-				}
-				length = ( size_t ) result;
-				if( ERROR_OCCURRED( packet_trim( packet, length, 0 ))){
-					return tcp_release_and_return( packet, ERROR_CODE );
+				result = icmp_client_process_packet(packet, &type, &code, NULL, NULL);
+				if(result < 0){
+					return tcp_release_and_return(packet, result);
+				}
+				length = (size_t) result;
+				if(ERROR_OCCURRED(packet_trim(packet, length, 0))){
+					return tcp_release_and_return(packet, ERROR_CODE);
 				}
 				break;
 			default:
-				return tcp_release_and_return( packet, ENOTSUP );
+				return tcp_release_and_return(packet, ENOTSUP);
 		}
 	}
 
 	// TODO process received ipopts?
-	result = ip_client_process_packet( packet, NULL, NULL, NULL, NULL, NULL );
-//	printf("ip len %d\n", result );
-	if( result < 0 ){
-		return tcp_release_and_return( packet, result );
-	}
-	offset = ( size_t ) result;
-
-	length = packet_get_data_length( packet );
-//	printf("packet len %d\n", length );
-	if( length <= 0 ){
-		return tcp_release_and_return( packet, EINVAL );
-	}
-	if( length < TCP_HEADER_SIZE + offset ){
-		return tcp_release_and_return( packet, NO_DATA );
+	result = ip_client_process_packet(packet, NULL, NULL, NULL, NULL, NULL);
+//	printf("ip len %d\n", result);
+	if(result < 0){
+		return tcp_release_and_return(packet, result);
+	}
+	offset = (size_t) result;
+
+	length = packet_get_data_length(packet);
+//	printf("packet len %d\n", length);
+	if(length <= 0){
+		return tcp_release_and_return(packet, EINVAL);
+	}
+	if(length < TCP_HEADER_SIZE + offset){
+		return tcp_release_and_return(packet, NO_DATA);
 	}
 
 	// trim all but TCP header
-	if( ERROR_OCCURRED( packet_trim( packet, offset, 0 ))){
-		return tcp_release_and_return( packet, ERROR_CODE );
+	if(ERROR_OCCURRED(packet_trim(packet, offset, 0))){
+		return tcp_release_and_return(packet, ERROR_CODE);
 	}
 
 	// get tcp header
-	header = ( tcp_header_ref ) packet_get_data( packet );
-	if( ! header ){
-		return tcp_release_and_return( packet, NO_DATA );
-	}
-//	printf( "header len %d, port %d \n", TCP_HEADER_LENGTH( header ), ntohs( header->destination_port ));
-
-	result = packet_get_addr( packet, ( uint8_t ** ) & src, ( uint8_t ** ) & dest );
-	if( result <= 0 ){
-		return tcp_release_and_return( packet, result );
-	}
-	addrlen = ( size_t ) result;
-
-	if( ERROR_OCCURRED( tl_set_address_port( src, addrlen, ntohs( header->source_port )))){
-		return tcp_release_and_return( packet, ERROR_CODE );
+	header = (tcp_header_ref) packet_get_data(packet);
+	if(! header){
+		return tcp_release_and_return(packet, NO_DATA);
+	}
+//	printf("header len %d, port %d \n", TCP_HEADER_LENGTH(header), ntohs(header->destination_port));
+
+	result = packet_get_addr(packet, (uint8_t **) &src, (uint8_t **) &dest);
+	if(result <= 0){
+		return tcp_release_and_return(packet, result);
+	}
+	addrlen = (size_t) result;
+
+	if(ERROR_OCCURRED(tl_set_address_port(src, addrlen, ntohs(header->source_port)))){
+		return tcp_release_and_return(packet, ERROR_CODE);
 	}
 
 	// find the destination socket
-	socket = socket_port_find( & tcp_globals.sockets, ntohs( header->destination_port ), ( const char * ) src, addrlen );
-	if( ! socket ){
+	socket = socket_port_find(&tcp_globals.sockets, ntohs(header->destination_port), (const char *) src, addrlen);
+	if(! socket){
 //		printf("listening?\n");
 		// find the listening destination socket
-		socket = socket_port_find( & tcp_globals.sockets, ntohs( header->destination_port ), SOCKET_MAP_KEY_LISTENING, 0 );
-		if( ! socket ){
-			if( tl_prepare_icmp_packet( tcp_globals.net_phone, tcp_globals.icmp_phone, packet, error ) == EOK ){
-				icmp_destination_unreachable_msg( tcp_globals.icmp_phone, ICMP_PORT_UNREACH, 0, packet );
+		socket = socket_port_find(&tcp_globals.sockets, ntohs(header->destination_port), SOCKET_MAP_KEY_LISTENING, 0);
+		if(! socket){
+			if(tl_prepare_icmp_packet(tcp_globals.net_phone, tcp_globals.icmp_phone, packet, error) == EOK){
+				icmp_destination_unreachable_msg(tcp_globals.icmp_phone, ICMP_PORT_UNREACH, 0, packet);
 			}
 			return EADDRNOTAVAIL;
 		}
 	}
-	printf("socket id %d\n", socket->socket_id );
-	socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-	assert( socket_data );
+	printf("socket id %d\n", socket->socket_id);
+	socket_data = (tcp_socket_data_ref) socket->specific_data;
+	assert(socket_data);
 
 	// some data received, clear the timeout counter
@@ -351,41 +353,41 @@
 	do{
 		++ fragments;
-		length = packet_get_data_length( next_packet );
-		if( length <= 0 ){
-			return tcp_release_and_return( packet, NO_DATA );
+		length = packet_get_data_length(next_packet);
+		if(length <= 0){
+			return tcp_release_and_return(packet, NO_DATA);
 		}
 		total_length += length;
 		// add partial checksum if set
-		if( ! error ){
-			checksum = compute_checksum( checksum, packet_get_data( packet ), packet_get_data_length( packet ));
-		}
-	}while(( next_packet = pq_next( next_packet )));
-//	printf( "fragments %d of %d bytes\n", fragments, total_length );
+		if(! error){
+			checksum = compute_checksum(checksum, packet_get_data(packet), packet_get_data_length(packet));
+		}
+	}while((next_packet = pq_next(next_packet)));
+//	printf("fragments %d of %d bytes\n", fragments, total_length);
 
 //	printf("lock?\n");
-	fibril_rwlock_write_lock( socket_data->local_lock );
+	fibril_rwlock_write_lock(socket_data->local_lock);
 //	printf("locked\n");
-	if( ! error ){
-		if( socket_data->state == TCP_SOCKET_LISTEN ){
-			if( socket_data->pseudo_header ){
-				free( socket_data->pseudo_header );
+	if(! error){
+		if(socket_data->state == TCP_SOCKET_LISTEN){
+			if(socket_data->pseudo_header){
+				free(socket_data->pseudo_header);
 				socket_data->pseudo_header = NULL;
 				socket_data->headerlen = 0;
 			}
-			if( ERROR_OCCURRED( ip_client_get_pseudo_header( IPPROTO_TCP, src, addrlen, dest, addrlen, total_length, & socket_data->pseudo_header, & socket_data->headerlen ))){
-				fibril_rwlock_write_unlock( socket_data->local_lock );
-				return tcp_release_and_return( packet, ERROR_CODE );
-			}
-		}else if( ERROR_OCCURRED( ip_client_set_pseudo_header_data_length( socket_data->pseudo_header, socket_data->headerlen, total_length ))){
-			fibril_rwlock_write_unlock( socket_data->local_lock );
-			return tcp_release_and_return( packet, ERROR_CODE );
-		}
-		checksum = compute_checksum( checksum, socket_data->pseudo_header, socket_data->headerlen );
-		if( flip_checksum( compact_checksum( checksum )) != IP_CHECKSUM_ZERO ){
-			printf( "checksum err %x -> %x\n", header->checksum, flip_checksum( compact_checksum( checksum )));
-			fibril_rwlock_write_unlock( socket_data->local_lock );
-			if( ! ERROR_OCCURRED( tl_prepare_icmp_packet( tcp_globals.net_phone, tcp_globals.icmp_phone, packet, error ))){
+			if(ERROR_OCCURRED(ip_client_get_pseudo_header(IPPROTO_TCP, src, addrlen, dest, addrlen, total_length, &socket_data->pseudo_header, &socket_data->headerlen))){
+				fibril_rwlock_write_unlock(socket_data->local_lock);
+				return tcp_release_and_return(packet, ERROR_CODE);
+			}
+		}else if(ERROR_OCCURRED(ip_client_set_pseudo_header_data_length(socket_data->pseudo_header, socket_data->headerlen, total_length))){
+			fibril_rwlock_write_unlock(socket_data->local_lock);
+			return tcp_release_and_return(packet, ERROR_CODE);
+		}
+		checksum = compute_checksum(checksum, socket_data->pseudo_header, socket_data->headerlen);
+		if(flip_checksum(compact_checksum(checksum)) != IP_CHECKSUM_ZERO){
+			printf("checksum err %x -> %x\n", header->checksum, flip_checksum(compact_checksum(checksum)));
+			fibril_rwlock_write_unlock(socket_data->local_lock);
+			if(! ERROR_OCCURRED(tl_prepare_icmp_packet(tcp_globals.net_phone, tcp_globals.icmp_phone, packet, error))){
 				// checksum error ICMP
-				icmp_parameter_problem_msg( tcp_globals.icmp_phone, ICMP_PARAM_POINTER, (( size_t ) (( void * ) & header->checksum )) - (( size_t ) (( void * ) header )), packet );
+				icmp_parameter_problem_msg(tcp_globals.icmp_phone, ICMP_PARAM_POINTER, ((size_t) ((void *) &header->checksum)) - ((size_t) ((void *) header)), packet);
 			}
 			return EINVAL;
@@ -393,17 +395,17 @@
 	}
 
-	fibril_rwlock_read_unlock( & tcp_globals.lock );
+	fibril_rwlock_read_unlock(&tcp_globals.lock);
 
 	// TODO error reporting/handling
-//	printf( "st %d\n", socket_data->state );
-	switch( socket_data->state ){
+//	printf("st %d\n", socket_data->state);
+	switch(socket_data->state){
 		case TCP_SOCKET_LISTEN:
-			ERROR_CODE = tcp_process_listen( socket, socket_data, header, packet, src, dest, addrlen );
+			ERROR_CODE = tcp_process_listen(socket, socket_data, header, packet, src, dest, addrlen);
 			break;
 		case TCP_SOCKET_SYN_RECEIVED:
-			ERROR_CODE = tcp_process_syn_received( socket, socket_data, header, packet );
+			ERROR_CODE = tcp_process_syn_received(socket, socket_data, header, packet);
 			break;
 		case TCP_SOCKET_SYN_SENT:
-			ERROR_CODE = tcp_process_syn_sent( socket, socket_data, header, packet );
+			ERROR_CODE = tcp_process_syn_sent(socket, socket_data, header, packet);
 			break;
 		case TCP_SOCKET_FIN_WAIT_1:
@@ -416,81 +418,81 @@
 			// ack releasing the socket gets processed later
 		case TCP_SOCKET_ESTABLISHED:
-			ERROR_CODE = tcp_process_established( socket, socket_data, header, packet, fragments, total_length );
+			ERROR_CODE = tcp_process_established(socket, socket_data, header, packet, fragments, total_length);
 			break;
 		default:
-			pq_release( tcp_globals.net_phone, packet_get_id( packet ));
-	}
-
-	if( ERROR_CODE != EOK ){
-		printf( "process %d\n", ERROR_CODE );
-		fibril_rwlock_write_unlock( socket_data->local_lock );
+			pq_release(tcp_globals.net_phone, packet_get_id(packet));
+	}
+
+	if(ERROR_CODE != EOK){
+		printf("process %d\n", ERROR_CODE);
+		fibril_rwlock_write_unlock(socket_data->local_lock);
 	}
 	return EOK;
 }
 
-int tcp_process_established( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet, int fragments, size_t total_length ){
+int tcp_process_established(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet, int fragments, size_t total_length){
 	ERROR_DECLARE;
 
-	packet_t	next_packet;
-	packet_t	tmp_packet;
-	uint32_t	old_incoming;
-	size_t		order;
-	uint32_t	sequence_number;
-	size_t		length;
-	size_t		offset;
-	uint32_t	new_sequence_number;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
-	assert( header );
-	assert( packet );
-
-	new_sequence_number = ntohl( header->sequence_number );
+	packet_t next_packet;
+	packet_t tmp_packet;
+	uint32_t old_incoming;
+	size_t order;
+	uint32_t sequence_number;
+	size_t length;
+	size_t offset;
+	uint32_t new_sequence_number;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
+	assert(header);
+	assert(packet);
+
+	new_sequence_number = ntohl(header->sequence_number);
 	old_incoming = socket_data->next_incoming;
 
-	if( header->finalize ){
+	if(header->finalize){
 		socket_data->fin_incoming = new_sequence_number;
 	}
 
-//	printf( "pe %d < %d <= %d\n", new_sequence_number, socket_data->next_incoming, new_sequence_number + total_length );
+//	printf("pe %d < %d <= %d\n", new_sequence_number, socket_data->next_incoming, new_sequence_number + total_length);
 	// trim begining if containing expected data
-	if( IS_IN_INTERVAL_OVERFLOW( new_sequence_number, socket_data->next_incoming, new_sequence_number + total_length )){
+	if(IS_IN_INTERVAL_OVERFLOW(new_sequence_number, socket_data->next_incoming, new_sequence_number + total_length)){
 		// get the acknowledged offset
-		if( socket_data->next_incoming < new_sequence_number ){
+		if(socket_data->next_incoming < new_sequence_number){
 			offset = new_sequence_number - socket_data->next_incoming;
 		}else{
 			offset = socket_data->next_incoming - new_sequence_number;
 		}
-//		printf( "offset %d\n", offset );
+//		printf("offset %d\n", offset);
 		new_sequence_number += offset;
 		total_length -= offset;
-		length = packet_get_data_length( packet );
+		length = packet_get_data_length(packet);
 		// trim the acknowledged data
-		while( length <= offset ){
+		while(length <= offset){
 			// release the acknowledged packets
-			next_packet = pq_next( packet );
-			pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+			next_packet = pq_next(packet);
+			pq_release(tcp_globals.net_phone, packet_get_id(packet));
 			packet = next_packet;
 			offset -= length;
-			length = packet_get_data_length( packet );
-		}
-		if(( offset > 0 )
-		&& ( ERROR_OCCURRED( packet_trim( packet, offset, 0 )))){
-			return tcp_release_and_return( packet, ERROR_CODE );
-		}
-		assert( new_sequence_number == socket_data->next_incoming );
+			length = packet_get_data_length(packet);
+		}
+		if((offset > 0)
+			&& (ERROR_OCCURRED(packet_trim(packet, offset, 0)))){
+			return tcp_release_and_return(packet, ERROR_CODE);
+		}
+		assert(new_sequence_number == socket_data->next_incoming);
 	}
 
 	// release if overflowing the window
-//	if( IS_IN_INTERVAL_OVERFLOW( socket_data->next_incoming + socket_data->window, new_sequence_number, new_sequence_number + total_length )){
-//		return tcp_release_and_return( packet, EOVERFLOW );
+//	if(IS_IN_INTERVAL_OVERFLOW(socket_data->next_incoming + socket_data->window, new_sequence_number, new_sequence_number + total_length)){
+//		return tcp_release_and_return(packet, EOVERFLOW);
 //	}
 
 /*
 	// trim end if overflowing the window
-	if( IS_IN_INTERVAL_OVERFLOW( new_sequence_number, socket_data->next_incoming + socket_data->window, new_sequence_number + total_length )){
+	if(IS_IN_INTERVAL_OVERFLOW(new_sequence_number, socket_data->next_incoming + socket_data->window, new_sequence_number + total_length)){
 		// get the allowed data length
-		if( socket_data->next_incoming + socket_data->window < new_sequence_number ){
+		if(socket_data->next_incoming + socket_data->window < new_sequence_number){
 			offset = new_sequence_number - socket_data->next_incoming + socket_data->window;
 		}else{
@@ -499,10 +501,10 @@
 		next_packet = packet;
 		// trim the overflowing data
-		while( next_packet && ( offset > 0 )){
-			length = packet_get_data_length( packet );
-			if( length <= offset ){
-				next_packet = pq_next( next_packet );
-			}else if( ERROR_OCCURRED( packet_trim( next_packet, 0, length - offset ))){
-				return tcp_release_and_return( packet, ERROR_CODE );
+		while(next_packet && (offset > 0)){
+			length = packet_get_data_length(packet);
+			if(length <= offset){
+				next_packet = pq_next(next_packet);
+			}else if(ERROR_OCCURRED(packet_trim(next_packet, 0, length - offset))){
+				return tcp_release_and_return(packet, ERROR_CODE);
 			}
 			offset -= length;
@@ -510,28 +512,28 @@
 		}
 		// release the overflowing packets
-		next_packet = pq_next( next_packet );
-		if( next_packet ){
+		next_packet = pq_next(next_packet);
+		if(next_packet){
 			tmp_packet = next_packet;
-			next_packet = pq_next( next_packet );
-			pq_insert_after( tmp_packet, next_packet );
-			pq_release( tcp_globals.net_phone, packet_get_id( tmp_packet ));
-		}
-		assert( new_sequence_number + total_length == socket_data->next_incoming + socket_data->window );
+			next_packet = pq_next(next_packet);
+			pq_insert_after(tmp_packet, next_packet);
+			pq_release(tcp_globals.net_phone, packet_get_id(tmp_packet));
+		}
+		assert(new_sequence_number + total_length == socket_data->next_incoming + socket_data->window);
 	}
 */
 	// the expected one arrived?
-	if( new_sequence_number == socket_data->next_incoming ){
+	if(new_sequence_number == socket_data->next_incoming){
 		printf("expected\n");
 		// process acknowledgement
-		tcp_process_acknowledgement( socket, socket_data, header );
+		tcp_process_acknowledgement(socket, socket_data, header);
 
 		// remove the header
-		total_length -= TCP_HEADER_LENGTH( header );
-		if( ERROR_OCCURRED( packet_trim( packet, TCP_HEADER_LENGTH( header ), 0 ))){
-			return tcp_release_and_return( packet, ERROR_CODE );
-		}
-
-		if( total_length ){
-			ERROR_PROPAGATE( tcp_queue_received_packet( socket, socket_data, packet, fragments, total_length ));
+		total_length -= TCP_HEADER_LENGTH(header);
+		if(ERROR_OCCURRED(packet_trim(packet, TCP_HEADER_LENGTH(header), 0))){
+			return tcp_release_and_return(packet, ERROR_CODE);
+		}
+
+		if(total_length){
+			ERROR_PROPAGATE(tcp_queue_received_packet(socket, socket_data, packet, fragments, total_length));
 		}else{
 			total_length = 1;
@@ -539,52 +541,52 @@
 		socket_data->next_incoming = old_incoming + total_length;
 		packet = socket_data->incoming;
-		while( packet ){
-			if( ERROR_OCCURRED( pq_get_order( socket_data->incoming, & order, NULL ))){
+		while(packet){
+			if(ERROR_OCCURRED(pq_get_order(socket_data->incoming, &order, NULL))){
 				// remove the corrupted packet
-				next_packet = pq_detach( packet );
-				if( packet == socket_data->incoming ){
+				next_packet = pq_detach(packet);
+				if(packet == socket_data->incoming){
 					socket_data->incoming = next_packet;
 				}
-				pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+				pq_release(tcp_globals.net_phone, packet_get_id(packet));
 				packet = next_packet;
 				continue;
 			}
-			sequence_number = ( uint32_t ) order;
-			if( IS_IN_INTERVAL_OVERFLOW( sequence_number, old_incoming, socket_data->next_incoming )){
+			sequence_number = (uint32_t) order;
+			if(IS_IN_INTERVAL_OVERFLOW(sequence_number, old_incoming, socket_data->next_incoming)){
 				// move to the next
-				packet = pq_next( packet );
+				packet = pq_next(packet);
 			// coninual data?
-			}else if( IS_IN_INTERVAL_OVERFLOW( old_incoming, sequence_number, socket_data->next_incoming )){
+			}else if(IS_IN_INTERVAL_OVERFLOW(old_incoming, sequence_number, socket_data->next_incoming)){
 				// detach the packet
-				next_packet = pq_detach( packet );
-				if( packet == socket_data->incoming ){
+				next_packet = pq_detach(packet);
+				if(packet == socket_data->incoming){
 					socket_data->incoming = next_packet;
 				}
 				// get data length
-				length = packet_get_data_length( packet );
+				length = packet_get_data_length(packet);
 				new_sequence_number = sequence_number + length;
-				if( length <= 0 ){
+				if(length <= 0){
 					// remove the empty packet
-					pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+					pq_release(tcp_globals.net_phone, packet_get_id(packet));
 					packet = next_packet;
 					continue;
 				}
 				// exactly following
-				if( sequence_number == socket_data->next_incoming ){
+				if(sequence_number == socket_data->next_incoming){
 					// queue received data
-					ERROR_PROPAGATE( tcp_queue_received_packet( socket, socket_data, packet, 1, packet_get_data_length( packet )));
+					ERROR_PROPAGATE(tcp_queue_received_packet(socket, socket_data, packet, 1, packet_get_data_length(packet)));
 					socket_data->next_incoming = new_sequence_number;
 					packet = next_packet;
 					continue;
 				// at least partly following data?
-				}else if( IS_IN_INTERVAL_OVERFLOW( sequence_number, socket_data->next_incoming, new_sequence_number )){
-					if( socket_data->next_incoming < new_sequence_number ){
+				}else if(IS_IN_INTERVAL_OVERFLOW(sequence_number, socket_data->next_incoming, new_sequence_number)){
+					if(socket_data->next_incoming < new_sequence_number){
 						length = new_sequence_number - socket_data->next_incoming;
 					}else{
 						length = socket_data->next_incoming - new_sequence_number;
 					}
-					if( ! ERROR_OCCURRED( packet_trim( packet, length, 0 ))){
+					if(! ERROR_OCCURRED(packet_trim(packet, length, 0))){
 						// queue received data
-						ERROR_PROPAGATE( tcp_queue_received_packet( socket, socket_data, packet, 1, packet_get_data_length( packet )));
+						ERROR_PROPAGATE(tcp_queue_received_packet(socket, socket_data, packet, 1, packet_get_data_length(packet)));
 						socket_data->next_incoming = new_sequence_number;
 						packet = next_packet;
@@ -593,5 +595,5 @@
 				}
 				// remove the duplicit or corrupted packet
-				pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+				pq_release(tcp_globals.net_phone, packet_get_id(packet));
 				packet = next_packet;
 				continue;
@@ -600,29 +602,29 @@
 			}
 		}
-	}else if( IS_IN_INTERVAL( socket_data->next_incoming, new_sequence_number, socket_data->next_incoming + socket_data->window )){
+	}else if(IS_IN_INTERVAL(socket_data->next_incoming, new_sequence_number, socket_data->next_incoming + socket_data->window)){
 		printf("in window\n");
 		// process acknowledgement
-		tcp_process_acknowledgement( socket, socket_data, header );
+		tcp_process_acknowledgement(socket, socket_data, header);
 
 		// remove the header
-		total_length -= TCP_HEADER_LENGTH( header );
-		if( ERROR_OCCURRED( packet_trim( packet, TCP_HEADER_LENGTH( header ), 0 ))){
-			return tcp_release_and_return( packet, ERROR_CODE );
-		}
-
-		next_packet = pq_detach( packet );
-		length = packet_get_data_length( packet );
-		if( ERROR_OCCURRED( pq_add( & socket_data->incoming, packet, new_sequence_number, length ))){
+		total_length -= TCP_HEADER_LENGTH(header);
+		if(ERROR_OCCURRED(packet_trim(packet, TCP_HEADER_LENGTH(header), 0))){
+			return tcp_release_and_return(packet, ERROR_CODE);
+		}
+
+		next_packet = pq_detach(packet);
+		length = packet_get_data_length(packet);
+		if(ERROR_OCCURRED(pq_add(&socket_data->incoming, packet, new_sequence_number, length))){
 			// remove the corrupted packets
-			pq_release( tcp_globals.net_phone, packet_get_id( packet ));
-			pq_release( tcp_globals.net_phone, packet_get_id( next_packet ));
+			pq_release(tcp_globals.net_phone, packet_get_id(packet));
+			pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
 		}else{
-			while( next_packet ){
+			while(next_packet){
 				new_sequence_number += length;
-				tmp_packet = pq_detach( next_packet );
-				length = packet_get_data_length( next_packet );
-				if( ERROR_OCCURRED( pq_set_order( next_packet, new_sequence_number, length ))
-				|| ERROR_OCCURRED( pq_insert_after( packet, next_packet ))){
-					pq_release( tcp_globals.net_phone, packet_get_id( next_packet ));
+				tmp_packet = pq_detach(next_packet);
+				length = packet_get_data_length(next_packet);
+				if(ERROR_OCCURRED(pq_set_order(next_packet, new_sequence_number, length))
+					|| ERROR_OCCURRED(pq_insert_after(packet, next_packet))){
+					pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
 				}
 				next_packet = tmp_packet;
@@ -632,10 +634,10 @@
 		printf("unexpected\n");
 		// release duplicite or restricted
-		pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+		pq_release(tcp_globals.net_phone, packet_get_id(packet));
 	}
 
 	// change state according to the acknowledging incoming fin
-	if( IS_IN_INTERVAL_OVERFLOW( old_incoming, socket_data->fin_incoming, socket_data->next_incoming )){
-		switch( socket_data->state ){
+	if(IS_IN_INTERVAL_OVERFLOW(old_incoming, socket_data->fin_incoming, socket_data->next_incoming)){
+		switch(socket_data->state){
 			case TCP_SOCKET_FIN_WAIT_1:
 			case TCP_SOCKET_FIN_WAIT_2:
@@ -650,33 +652,33 @@
 	}
 
-	packet = tcp_get_packets_to_send( socket, socket_data );
-	if( ! packet ){
+	packet = tcp_get_packets_to_send(socket, socket_data);
+	if(! packet){
 		// create the notification packet
-		ERROR_PROPAGATE( tcp_create_notification_packet( & packet, socket, socket_data, 0, 0 ));
-		ERROR_PROPAGATE( tcp_queue_prepare_packet( socket, socket_data, packet, 1 ));
-		packet = tcp_send_prepare_packet( socket, socket_data, packet, 1, socket_data->last_outgoing + 1 );
-	}
-	fibril_rwlock_write_unlock( socket_data->local_lock );
+		ERROR_PROPAGATE(tcp_create_notification_packet(&packet, socket, socket_data, 0, 0));
+		ERROR_PROPAGATE(tcp_queue_prepare_packet(socket, socket_data, packet, 1));
+		packet = tcp_send_prepare_packet(socket, socket_data, packet, 1, socket_data->last_outgoing + 1);
+	}
+	fibril_rwlock_write_unlock(socket_data->local_lock);
 	// send the packet
-	tcp_send_packets( socket_data->device_id, packet );
+	tcp_send_packets(socket_data->device_id, packet);
 	return EOK;
 }
 
-int tcp_queue_received_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, int fragments, size_t total_length ){
+int tcp_queue_received_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, int fragments, size_t total_length){
 	ERROR_DECLARE;
 
-	packet_dimension_ref	packet_dimension;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
-	assert( packet );
-	assert( fragments >= 1 );
-	assert( socket_data->window > total_length );
+	packet_dimension_ref packet_dimension;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
+	assert(packet);
+	assert(fragments >= 1);
+	assert(socket_data->window > total_length);
 
 	// queue the received packet
-	if( ERROR_OCCURRED( dyn_fifo_push( & socket->received, packet_get_id( packet ), SOCKET_MAX_RECEIVED_SIZE ))
-	|| ERROR_OCCURRED( tl_get_ip_packet_dimension( tcp_globals.ip_phone, & tcp_globals.dimensions, socket_data->device_id, & packet_dimension ))){
-		return tcp_release_and_return( packet, ERROR_CODE );
+	if(ERROR_OCCURRED(dyn_fifo_push(&socket->received, packet_get_id(packet), SOCKET_MAX_RECEIVED_SIZE))
+		|| ERROR_OCCURRED(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension))){
+		return tcp_release_and_return(packet, ERROR_CODE);
 	}
 
@@ -685,108 +687,108 @@
 
 	// notify the destination socket
-	async_msg_5( socket->phone, NET_SOCKET_RECEIVED, ( ipcarg_t ) socket->socket_id, (( packet_dimension->content < socket_data->data_fragment_size ) ? packet_dimension->content : socket_data->data_fragment_size ), 0, 0, ( ipcarg_t ) fragments );
+	async_msg_5(socket->phone, NET_SOCKET_RECEIVED, (ipcarg_t) socket->socket_id, ((packet_dimension->content < socket_data->data_fragment_size) ? packet_dimension->content : socket_data->data_fragment_size), 0, 0, (ipcarg_t) fragments);
 	return EOK;
 }
 
-int tcp_process_syn_sent( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet ){
+int tcp_process_syn_sent(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet){
 	ERROR_DECLARE;
 
-	packet_t	next_packet;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
-	assert( header );
-	assert( packet );
-
-	if( header->synchronize ){
+	packet_t next_packet;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
+	assert(header);
+	assert(packet);
+
+	if(header->synchronize){
 		// process acknowledgement
-		tcp_process_acknowledgement( socket, socket_data, header );
-
-		socket_data->next_incoming = ntohl( header->sequence_number ) + 1;
+		tcp_process_acknowledgement(socket, socket_data, header);
+
+		socket_data->next_incoming = ntohl(header->sequence_number) + 1;
 		// release additional packets
-		next_packet = pq_detach( packet );
-		if( next_packet ){
-			pq_release( tcp_globals.net_phone, packet_get_id( next_packet ));
+		next_packet = pq_detach(packet);
+		if(next_packet){
+			pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
 		}
 		// trim if longer than the header
-		if(( packet_get_data_length( packet ) > sizeof( * header ))
-		&& ERROR_OCCURRED( packet_trim( packet, 0, packet_get_data_length( packet ) - sizeof( * header )))){
-			return tcp_release_and_return( packet, ERROR_CODE );
-		}
-		tcp_prepare_operation_header( socket, socket_data, header, 0, 0 );
-		fibril_mutex_lock( & socket_data->operation.mutex );
-		socket_data->operation.result = tcp_queue_packet( socket, socket_data, packet, 1 );
-		if( socket_data->operation.result == EOK ){
+		if((packet_get_data_length(packet) > sizeof(*header))
+			&& ERROR_OCCURRED(packet_trim(packet, 0, packet_get_data_length(packet) - sizeof(*header)))){
+			return tcp_release_and_return(packet, ERROR_CODE);
+		}
+		tcp_prepare_operation_header(socket, socket_data, header, 0, 0);
+		fibril_mutex_lock(&socket_data->operation.mutex);
+		socket_data->operation.result = tcp_queue_packet(socket, socket_data, packet, 1);
+		if(socket_data->operation.result == EOK){
 			socket_data->state = TCP_SOCKET_ESTABLISHED;
-			packet = tcp_get_packets_to_send( socket, socket_data );
-			if( packet ){
-				fibril_rwlock_write_unlock( socket_data->local_lock );
+			packet = tcp_get_packets_to_send(socket, socket_data);
+			if(packet){
+				fibril_rwlock_write_unlock(socket_data->local_lock);
 				// send the packet
-				tcp_send_packets( socket_data->device_id, packet );
+				tcp_send_packets(socket_data->device_id, packet);
 				// signal the result
-				fibril_condvar_signal( & socket_data->operation.condvar );
-				fibril_mutex_unlock( & socket_data->operation.mutex );
+				fibril_condvar_signal(&socket_data->operation.condvar);
+				fibril_mutex_unlock(&socket_data->operation.mutex);
 				return EOK;
 			}
 		}
-		fibril_mutex_unlock( & socket_data->operation.mutex );
-	}
-	return tcp_release_and_return( packet, EINVAL );
-}
-
-int tcp_process_listen( socket_core_ref listening_socket, tcp_socket_data_ref listening_socket_data, tcp_header_ref header, packet_t packet, struct sockaddr * src, struct sockaddr * dest, size_t addrlen ){
+		fibril_mutex_unlock(&socket_data->operation.mutex);
+	}
+	return tcp_release_and_return(packet, EINVAL);
+}
+
+int tcp_process_listen(socket_core_ref listening_socket, tcp_socket_data_ref listening_socket_data, tcp_header_ref header, packet_t packet, struct sockaddr * src, struct sockaddr * dest, size_t addrlen){
 	ERROR_DECLARE;
 
-	packet_t			next_packet;
-	socket_core_ref		socket;
-	tcp_socket_data_ref	socket_data;
-	int					socket_id;
-	int					listening_socket_id = listening_socket->socket_id;
-	int					listening_port = listening_socket->port;
-
-	assert( listening_socket );
-	assert( listening_socket_data );
-	assert( listening_socket->specific_data == listening_socket_data );
-	assert( header );
-	assert( packet );
-
-//	printf( "syn %d\n", header->synchronize );
-	if( header->synchronize ){
-		socket_data = ( tcp_socket_data_ref ) malloc( sizeof( * socket_data ));
-		if( ! socket_data ){
-			return tcp_release_and_return( packet, ENOMEM );
+	packet_t next_packet;
+	socket_core_ref socket;
+	tcp_socket_data_ref socket_data;
+	int socket_id;
+	int listening_socket_id = listening_socket->socket_id;
+	int listening_port = listening_socket->port;
+
+	assert(listening_socket);
+	assert(listening_socket_data);
+	assert(listening_socket->specific_data == listening_socket_data);
+	assert(header);
+	assert(packet);
+
+//	printf("syn %d\n", header->synchronize);
+	if(header->synchronize){
+		socket_data = (tcp_socket_data_ref) malloc(sizeof(*socket_data));
+		if(! socket_data){
+			return tcp_release_and_return(packet, ENOMEM);
 		}else{
-			tcp_initialize_socket_data( socket_data );
+			tcp_initialize_socket_data(socket_data);
 			socket_data->local_lock = listening_socket_data->local_lock;
 			socket_data->local_sockets = listening_socket_data->local_sockets;
 			socket_data->listening_socket_id = listening_socket->socket_id;
 
-			socket_data->next_incoming = ntohl( header->sequence_number );
-			socket_data->treshold = socket_data->next_incoming + ntohs( header->window );
+			socket_data->next_incoming = ntohl(header->sequence_number);
+			socket_data->treshold = socket_data->next_incoming + ntohs(header->window);
 
 			socket_data->addrlen = addrlen;
-			socket_data->addr = malloc( socket_data->addrlen );
-			if( ! socket_data->addr ){
-				free( socket_data );
-				return tcp_release_and_return( packet, ENOMEM );
-			}
-			memcpy( socket_data->addr, src, socket_data->addrlen );
-
-			socket_data->dest_port = ntohs( header->source_port );
-			if( ERROR_OCCURRED( tl_set_address_port( socket_data->addr, socket_data->addrlen, socket_data->dest_port ))){
-				free( socket_data->addr );
-				free( socket_data );
-				pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+			socket_data->addr = malloc(socket_data->addrlen);
+			if(! socket_data->addr){
+				free(socket_data);
+				return tcp_release_and_return(packet, ENOMEM);
+			}
+			memcpy(socket_data->addr, src, socket_data->addrlen);
+
+			socket_data->dest_port = ntohs(header->source_port);
+			if(ERROR_OCCURRED(tl_set_address_port(socket_data->addr, socket_data->addrlen, socket_data->dest_port))){
+				free(socket_data->addr);
+				free(socket_data);
+				pq_release(tcp_globals.net_phone, packet_get_id(packet));
 				return ERROR_CODE;
 			}
 
-//			printf( "addr %p\n", socket_data->addr, socket_data->addrlen );
+//			printf("addr %p\n", socket_data->addr, socket_data->addrlen);
 			// create a socket
 			socket_id = -1;
-			if( ERROR_OCCURRED( socket_create( socket_data->local_sockets, listening_socket->phone, socket_data, & socket_id ))){
-				free( socket_data->addr );
-				free( socket_data );
-				return tcp_release_and_return( packet, ERROR_CODE );
+			if(ERROR_OCCURRED(socket_create(socket_data->local_sockets, listening_socket->phone, socket_data, &socket_id))){
+				free(socket_data->addr);
+				free(socket_data);
+				return tcp_release_and_return(packet, ERROR_CODE);
 			}
 
@@ -797,112 +799,112 @@
 			listening_socket_data->headerlen = 0;
 
-			fibril_rwlock_write_unlock( socket_data->local_lock );
+			fibril_rwlock_write_unlock(socket_data->local_lock);
 //			printf("list lg\n");
-			fibril_rwlock_write_lock( & tcp_globals.lock );
+			fibril_rwlock_write_lock(&tcp_globals.lock);
 //			printf("list locked\n");
 			// find the destination socket
-			listening_socket = socket_port_find( & tcp_globals.sockets, listening_port, SOCKET_MAP_KEY_LISTENING, 0 );
-			if(( ! listening_socket ) || ( listening_socket->socket_id != listening_socket_id )){
-				fibril_rwlock_write_unlock( & tcp_globals.lock );
+			listening_socket = socket_port_find(&tcp_globals.sockets, listening_port, SOCKET_MAP_KEY_LISTENING, 0);
+			if((! listening_socket) || (listening_socket->socket_id != listening_socket_id)){
+				fibril_rwlock_write_unlock(&tcp_globals.lock);
 				// a shadow may remain until app hangs up
-				return tcp_release_and_return( packet, EOK/*ENOTSOCK*/ );
-			}
-//			printf("port %d\n", listening_socket->port );
-			listening_socket_data = ( tcp_socket_data_ref ) listening_socket->specific_data;
-			assert( listening_socket_data );
+				return tcp_release_and_return(packet, EOK/*ENOTSOCK*/);
+			}
+//			printf("port %d\n", listening_socket->port);
+			listening_socket_data = (tcp_socket_data_ref) listening_socket->specific_data;
+			assert(listening_socket_data);
 
 //			printf("list ll\n");
-			fibril_rwlock_write_lock( listening_socket_data->local_lock );
+			fibril_rwlock_write_lock(listening_socket_data->local_lock);
 //			printf("list locked\n");
 
-			socket = socket_cores_find( listening_socket_data->local_sockets, socket_id );
-			if( ! socket ){
+			socket = socket_cores_find(listening_socket_data->local_sockets, socket_id);
+			if(! socket){
 				// where is the socket?!?
-				fibril_rwlock_write_unlock( & tcp_globals.lock );
+				fibril_rwlock_write_unlock(&tcp_globals.lock);
 				return ENOTSOCK;
 			}
-			socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-			assert( socket_data );
+			socket_data = (tcp_socket_data_ref) socket->specific_data;
+			assert(socket_data);
 
 //			uint8_t * data = socket_data->addr;
-//			printf( "addr %d of %x %x %x %x-%x %x %x %x-%x %x %x %x-%x %x %x %x\n", socket_data->addrlen, data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ], data[ 8 ], data[ 9 ], data[ 10 ], data[ 11 ], data[ 12 ], data[ 13 ], data[ 14 ], data[ 15 ] );
-
-			ERROR_CODE = socket_port_add( & tcp_globals.sockets, listening_port, socket, ( const char * ) socket_data->addr, socket_data->addrlen );
-			assert( socket == socket_port_find( & tcp_globals.sockets, listening_port, ( const char * ) socket_data->addr, socket_data->addrlen ));
-			//ERROR_CODE = socket_bind_free_port( & tcp_globals.sockets, socket, TCP_FREE_PORTS_START, TCP_FREE_PORTS_END, tcp_globals.last_used_port );
+//			printf("addr %d of %x %x %x %x-%x %x %x %x-%x %x %x %x-%x %x %x %x\n", socket_data->addrlen, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15]);
+
+			ERROR_CODE = socket_port_add(&tcp_globals.sockets, listening_port, socket, (const char *) socket_data->addr, socket_data->addrlen);
+			assert(socket == socket_port_find(&tcp_globals.sockets, listening_port, (const char *) socket_data->addr, socket_data->addrlen));
+			//ERROR_CODE = socket_bind_free_port(&tcp_globals.sockets, socket, TCP_FREE_PORTS_START, TCP_FREE_PORTS_END, tcp_globals.last_used_port);
 			//tcp_globals.last_used_port = socket->port;
-//			printf("bound %d\n", socket->port );
-			fibril_rwlock_write_unlock( & tcp_globals.lock );
-			if( ERROR_CODE != EOK ){
-				socket_destroy( tcp_globals.net_phone, socket->socket_id, socket_data->local_sockets, & tcp_globals.sockets, tcp_free_socket_data );
-				return tcp_release_and_return( packet, ERROR_CODE );
+//			printf("bound %d\n", socket->port);
+			fibril_rwlock_write_unlock(&tcp_globals.lock);
+			if(ERROR_CODE != EOK){
+				socket_destroy(tcp_globals.net_phone, socket->socket_id, socket_data->local_sockets, &tcp_globals.sockets, tcp_free_socket_data);
+				return tcp_release_and_return(packet, ERROR_CODE);
 			}
 
 			socket_data->state = TCP_SOCKET_LISTEN;
-			socket_data->next_incoming = ntohl( header->sequence_number ) + 1;
+			socket_data->next_incoming = ntohl(header->sequence_number) + 1;
 			// release additional packets
-			next_packet = pq_detach( packet );
-			if( next_packet ){
-				pq_release( tcp_globals.net_phone, packet_get_id( next_packet ));
+			next_packet = pq_detach(packet);
+			if(next_packet){
+				pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
 			}
 			// trim if longer than the header
-			if(( packet_get_data_length( packet ) > sizeof( * header ))
-			&& ERROR_OCCURRED( packet_trim( packet, 0, packet_get_data_length( packet ) - sizeof( * header )))){
-				socket_destroy( tcp_globals.net_phone, socket->socket_id, socket_data->local_sockets, & tcp_globals.sockets, tcp_free_socket_data );
-				return tcp_release_and_return( packet, ERROR_CODE );
-			}
-			tcp_prepare_operation_header( socket, socket_data, header, 1, 0 );
-			if( ERROR_OCCURRED( tcp_queue_packet( socket, socket_data, packet, 1 ))){
-				socket_destroy( tcp_globals.net_phone, socket->socket_id, socket_data->local_sockets, & tcp_globals.sockets, tcp_free_socket_data );
+			if((packet_get_data_length(packet) > sizeof(*header))
+				&& ERROR_OCCURRED(packet_trim(packet, 0, packet_get_data_length(packet) - sizeof(*header)))){
+				socket_destroy(tcp_globals.net_phone, socket->socket_id, socket_data->local_sockets, &tcp_globals.sockets, tcp_free_socket_data);
+				return tcp_release_and_return(packet, ERROR_CODE);
+			}
+			tcp_prepare_operation_header(socket, socket_data, header, 1, 0);
+			if(ERROR_OCCURRED(tcp_queue_packet(socket, socket_data, packet, 1))){
+				socket_destroy(tcp_globals.net_phone, socket->socket_id, socket_data->local_sockets, &tcp_globals.sockets, tcp_free_socket_data);
 				return ERROR_CODE;
 			}
-			packet = tcp_get_packets_to_send( socket, socket_data );
-//			printf("send %d\n", packet_get_id( packet ));
-			if( ! packet ){
-				socket_destroy( tcp_globals.net_phone, socket->socket_id, socket_data->local_sockets, & tcp_globals.sockets, tcp_free_socket_data );
+			packet = tcp_get_packets_to_send(socket, socket_data);
+//			printf("send %d\n", packet_get_id(packet));
+			if(! packet){
+				socket_destroy(tcp_globals.net_phone, socket->socket_id, socket_data->local_sockets, &tcp_globals.sockets, tcp_free_socket_data);
 				return EINVAL;
 			}else{
 				socket_data->state = TCP_SOCKET_SYN_RECEIVED;
 //				printf("unlock\n");
-				fibril_rwlock_write_unlock( socket_data->local_lock );
+				fibril_rwlock_write_unlock(socket_data->local_lock);
 				// send the packet
-				tcp_send_packets( socket_data->device_id, packet );
+				tcp_send_packets(socket_data->device_id, packet);
 				return EOK;
 			}
 		}
 	}
-	return tcp_release_and_return( packet, EINVAL );
-}
-
-int	tcp_process_syn_received( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet ){
+	return tcp_release_and_return(packet, EINVAL);
+}
+
+int tcp_process_syn_received(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet){
 	ERROR_DECLARE;
 
-	socket_core_ref		listening_socket;
-	tcp_socket_data_ref	listening_socket_data;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
-	assert( header );
-	assert( packet );
+	socket_core_ref listening_socket;
+	tcp_socket_data_ref listening_socket_data;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
+	assert(header);
+	assert(packet);
 
 	printf("syn_rec\n");
-	if( header->acknowledge ){
+	if(header->acknowledge){
 		// process acknowledgement
-		tcp_process_acknowledgement( socket, socket_data, header );
-
-		socket_data->next_incoming = ntohl( header->sequence_number );// + 1;
-		pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+		tcp_process_acknowledgement(socket, socket_data, header);
+
+		socket_data->next_incoming = ntohl(header->sequence_number);// + 1;
+		pq_release(tcp_globals.net_phone, packet_get_id(packet));
 		socket_data->state = TCP_SOCKET_ESTABLISHED;
-		listening_socket = socket_cores_find( socket_data->local_sockets, socket_data->listening_socket_id );
-		if( listening_socket ){
-			listening_socket_data = ( tcp_socket_data_ref ) listening_socket->specific_data;
-			assert( listening_socket_data );
+		listening_socket = socket_cores_find(socket_data->local_sockets, socket_data->listening_socket_id);
+		if(listening_socket){
+			listening_socket_data = (tcp_socket_data_ref) listening_socket->specific_data;
+			assert(listening_socket_data);
 
 			// queue the received packet
-			if( ! ERROR_OCCURRED( dyn_fifo_push( & listening_socket->accepted, ( -1 * socket->socket_id ), listening_socket_data->backlog ))){
+			if(! ERROR_OCCURRED(dyn_fifo_push(&listening_socket->accepted, (-1 * socket->socket_id), listening_socket_data->backlog))){
 				// notify the destination socket
-				async_msg_5( socket->phone, NET_SOCKET_ACCEPTED, ( ipcarg_t ) listening_socket->socket_id, socket_data->data_fragment_size, TCP_HEADER_SIZE, 0, ( ipcarg_t ) socket->socket_id );
-				fibril_rwlock_write_unlock( socket_data->local_lock );
+				async_msg_5(socket->phone, NET_SOCKET_ACCEPTED, (ipcarg_t) listening_socket->socket_id, socket_data->data_fragment_size, TCP_HEADER_SIZE, 0, (ipcarg_t) socket->socket_id);
+				fibril_rwlock_write_unlock(socket_data->local_lock);
 				return EOK;
 			}
@@ -912,43 +914,43 @@
 
 		// create the notification packet
-		ERROR_PROPAGATE( tcp_create_notification_packet( & packet, socket, socket_data, 0, 1 ));
+		ERROR_PROPAGATE(tcp_create_notification_packet(&packet, socket, socket_data, 0, 1));
 
 		// send the packet
-		ERROR_PROPAGATE( tcp_queue_packet( socket, socket_data, packet, 1 ));
+		ERROR_PROPAGATE(tcp_queue_packet(socket, socket_data, packet, 1));
 
 		// flush packets
-		packet = tcp_get_packets_to_send( socket, socket_data );
-		fibril_rwlock_write_unlock( socket_data->local_lock );
-		if( packet ){
+		packet = tcp_get_packets_to_send(socket, socket_data);
+		fibril_rwlock_write_unlock(socket_data->local_lock);
+		if(packet){
 			// send the packet
-			tcp_send_packets( socket_data->device_id, packet );
+			tcp_send_packets(socket_data->device_id, packet);
 		}
 		return EOK;
 	}else{
-		return tcp_release_and_return( packet, EINVAL );
+		return tcp_release_and_return(packet, EINVAL);
 	}
 	return EINVAL;
 }
 
-void tcp_process_acknowledgement( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header ){
-	size_t		number;
-	size_t		length;
-	packet_t	packet;
-	packet_t	next;
-	packet_t	acknowledged = NULL;
-	uint32_t	old;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
-	assert( header );
-
-	if( header->acknowledge ){
-		number = ntohl( header->acknowledgement_number );
+void tcp_process_acknowledgement(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header){
+	size_t number;
+	size_t length;
+	packet_t packet;
+	packet_t next;
+	packet_t acknowledged = NULL;
+	uint32_t old;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
+	assert(header);
+
+	if(header->acknowledge){
+		number = ntohl(header->acknowledgement_number);
 		// if more data acknowledged
-		if( number != socket_data->expected ){
+		if(number != socket_data->expected){
 			old = socket_data->expected;
-			if( IS_IN_INTERVAL_OVERFLOW( old, socket_data->fin_outgoing, number )){
-				switch( socket_data->state ){
+			if(IS_IN_INTERVAL_OVERFLOW(old, socket_data->fin_outgoing, number)){
+				switch(socket_data->state){
 					case TCP_SOCKET_FIN_WAIT_1:
 						socket_data->state = TCP_SOCKET_FIN_WAIT_2;
@@ -957,5 +959,5 @@
 					case TCP_SOCKET_CLOSING:
 						// fin acknowledged - release the socket in another fibril
-						tcp_prepare_timeout( tcp_release_after_timeout, socket, socket_data, 0, TCP_SOCKET_TIME_WAIT, NET_DEFAULT_TCP_TIME_WAIT_TIMEOUT, true );
+						tcp_prepare_timeout(tcp_release_after_timeout, socket, socket_data, 0, TCP_SOCKET_TIME_WAIT, NET_DEFAULT_TCP_TIME_WAIT_TIMEOUT, true);
 						break;
 					default:
@@ -964,6 +966,6 @@
 			}
 			// update the treshold if higher than set
-			if( number + ntohs( header->window ) > socket_data->expected + socket_data->treshold ){
-				socket_data->treshold = number + ntohs( header->window ) - socket_data->expected;
+			if(number + ntohs(header->window) > socket_data->expected + socket_data->treshold){
+				socket_data->treshold = number + ntohs(header->window) - socket_data->expected;
 			}
 			// set new expected sequence number
@@ -971,65 +973,65 @@
 			socket_data->expected_count = 1;
 			packet = socket_data->outgoing;
-			while( pq_get_order( packet, & number, & length ) == EOK ){
-				if( IS_IN_INTERVAL_OVERFLOW(( uint32_t ) old, ( uint32_t )( number + length ), ( uint32_t ) socket_data->expected )){
-					next = pq_detach( packet );
-					if( packet == socket_data->outgoing ){
+			while(pq_get_order(packet, &number, &length) == EOK){
+				if(IS_IN_INTERVAL_OVERFLOW((uint32_t) old, (uint32_t)(number + length), (uint32_t) socket_data->expected)){
+					next = pq_detach(packet);
+					if(packet == socket_data->outgoing){
 						socket_data->outgoing = next;
 					}
 					// add to acknowledged or release
-					if( pq_add( & acknowledged, packet, 0, 0 ) != EOK ){
-						pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+					if(pq_add(&acknowledged, packet, 0, 0) != EOK){
+						pq_release(tcp_globals.net_phone, packet_get_id(packet));
 					}
 					packet = next;
-				}else if( old < socket_data->expected ){
+				}else if(old < socket_data->expected){
 					break;
 				}
 			}
 			// release acknowledged
-			if( acknowledged ){
-				pq_release( tcp_globals.net_phone, packet_get_id( acknowledged ));
+			if(acknowledged){
+				pq_release(tcp_globals.net_phone, packet_get_id(acknowledged));
 			}
 			return;
 		// if the same as the previous time
-		}else if( number == socket_data->expected ){
+		}else if(number == socket_data->expected){
 			// increase the counter
 			++ socket_data->expected_count;
-			if( socket_data->expected_count == TCP_FAST_RETRANSMIT_COUNT ){
+			if(socket_data->expected_count == TCP_FAST_RETRANSMIT_COUNT){
 				socket_data->expected_count = 1;
 				// TODO retransmit lock
-				//tcp_retransmit_packet( socket, socket_data, number );
-			}
-		}
-	}
-}
-
-int tcp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+				//tcp_retransmit_packet(socket, socket_data, number);
+			}
+		}
+	}
+}
+
+int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
-	packet_t	packet;
-
-	assert( call );
-	assert( answer );
-	assert( answer_count );
-
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+	packet_t packet;
+
+	assert(call);
+	assert(answer);
+	assert(answer_count);
+
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case NET_TL_RECEIVED:
-			//fibril_rwlock_read_lock( & tcp_globals.lock );
-			if( ! ERROR_OCCURRED( packet_translate( tcp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){
-				ERROR_CODE = tcp_received_msg( IPC_GET_DEVICE( call ), packet, SERVICE_TCP, IPC_GET_ERROR( call ));
-			}
-			//fibril_rwlock_read_unlock( & tcp_globals.lock );
+			//fibril_rwlock_read_lock(&tcp_globals.lock);
+			if(! ERROR_OCCURRED(packet_translate(tcp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+				ERROR_CODE = tcp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_TCP, IPC_GET_ERROR(call));
+			}
+			//fibril_rwlock_read_unlock(&tcp_globals.lock);
 			return ERROR_CODE;
 		case IPC_M_CONNECT_TO_ME:
-			return tcp_process_client_messages( callid, * call );
+			return tcp_process_client_messages(callid, * call);
 	}
 	return ENOTSUP;
 }
 
-void tcp_refresh_socket_data( tcp_socket_data_ref socket_data ){
-	assert( socket_data );
-
-	bzero( socket_data, sizeof( * socket_data ));
+void tcp_refresh_socket_data(tcp_socket_data_ref socket_data){
+	assert(socket_data);
+
+	bzero(socket_data, sizeof(*socket_data));
 	socket_data->state = TCP_SOCKET_INITIAL;
 	socket_data->device_id = DEVICE_INVALID_ID;
@@ -1043,26 +1045,26 @@
 }
 
-void tcp_initialize_socket_data( tcp_socket_data_ref socket_data ){
-	assert( socket_data );
-
-	tcp_refresh_socket_data( socket_data );
-	fibril_mutex_initialize( & socket_data->operation.mutex );
-	fibril_condvar_initialize( & socket_data->operation.condvar );
+void tcp_initialize_socket_data(tcp_socket_data_ref socket_data){
+	assert(socket_data);
+
+	tcp_refresh_socket_data(socket_data);
+	fibril_mutex_initialize(&socket_data->operation.mutex);
+	fibril_condvar_initialize(&socket_data->operation.condvar);
 	socket_data->data_fragment_size = MAX_TCP_FRAGMENT_SIZE;
 }
 
-int tcp_process_client_messages( ipc_callid_t callid, ipc_call_t call ){
-	int						res;
-	bool					keep_on_going = true;
-	socket_cores_t			local_sockets;
-	int						app_phone = IPC_GET_PHONE( & call );
-	struct sockaddr *		addr;
-	size_t					addrlen;
-	fibril_rwlock_t			lock;
-	ipc_call_t				answer;
-	int						answer_count;
-	tcp_socket_data_ref		socket_data;
-	socket_core_ref			socket;
-	packet_dimension_ref	packet_dimension;
+int tcp_process_client_messages(ipc_callid_t callid, ipc_call_t call){
+	int res;
+	bool keep_on_going = true;
+	socket_cores_t local_sockets;
+	int app_phone = IPC_GET_PHONE(&call);
+	struct sockaddr * addr;
+	size_t addrlen;
+	fibril_rwlock_t lock;
+	ipc_call_t answer;
+	int answer_count;
+	tcp_socket_data_ref socket_data;
+	socket_core_ref socket;
+	packet_dimension_ref packet_dimension;
 
 	/*
@@ -1070,106 +1072,112 @@
 	 *  - Answer the first IPC_M_CONNECT_ME_TO call.
 	 */
-	ipc_answer_0( callid, EOK );
-
-	socket_cores_initialize( & local_sockets );
-	fibril_rwlock_initialize( & lock );
-
-	while( keep_on_going ){
+	res = EOK;
+	answer_count = 0;
+
+	socket_cores_initialize(&local_sockets);
+	fibril_rwlock_initialize(&lock);
+
+	while(keep_on_going){
+
+		// answer the call
+		answer_call(callid, res, &answer, answer_count);
+
 		// refresh data
-		refresh_answer( & answer, & answer_count );
-
-		callid = async_get_call( & call );
-//		printf( "message %d\n", IPC_GET_METHOD( * call ));
-
-		switch( IPC_GET_METHOD( call )){
+		refresh_answer(&answer, &answer_count);
+
+		// get the next call
+		callid = async_get_call(&call);
+
+		// process the call
+		switch(IPC_GET_METHOD(call)){
 			case IPC_M_PHONE_HUNGUP:
 				keep_on_going = false;
-				res = EOK;
+				res = EHANGUP;
 				break;
 			case NET_SOCKET:
-				socket_data = ( tcp_socket_data_ref ) malloc( sizeof( * socket_data ));
-				if( ! socket_data ){
+				socket_data = (tcp_socket_data_ref) malloc(sizeof(*socket_data));
+				if(! socket_data){
 					res = ENOMEM;
 				}else{
-					tcp_initialize_socket_data( socket_data );
-					socket_data->local_lock = & lock;
-					socket_data->local_sockets = & local_sockets;
-					fibril_rwlock_write_lock( & lock );
-					* SOCKET_SET_SOCKET_ID( answer ) = SOCKET_GET_SOCKET_ID( call );
-					res = socket_create( & local_sockets, app_phone, socket_data, SOCKET_SET_SOCKET_ID( answer ));
-					fibril_rwlock_write_unlock( & lock );
-					if( res == EOK ){
-						if( tl_get_ip_packet_dimension( tcp_globals.ip_phone, & tcp_globals.dimensions, DEVICE_INVALID_ID, & packet_dimension ) == EOK ){
-							* SOCKET_SET_DATA_FRAGMENT_SIZE( answer ) = (( packet_dimension->content < socket_data->data_fragment_size ) ? packet_dimension->content : socket_data->data_fragment_size );
+					tcp_initialize_socket_data(socket_data);
+					socket_data->local_lock = &lock;
+					socket_data->local_sockets = &local_sockets;
+					fibril_rwlock_write_lock(&lock);
+					*SOCKET_SET_SOCKET_ID(answer) = SOCKET_GET_SOCKET_ID(call);
+					res = socket_create(&local_sockets, app_phone, socket_data, SOCKET_SET_SOCKET_ID(answer));
+					fibril_rwlock_write_unlock(&lock);
+					if(res == EOK){
+						if(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
+							*SOCKET_SET_DATA_FRAGMENT_SIZE(answer) = ((packet_dimension->content < socket_data->data_fragment_size) ? packet_dimension->content : socket_data->data_fragment_size);
 						}
-//						* SOCKET_SET_DATA_FRAGMENT_SIZE( answer ) = MAX_TCP_FRAGMENT_SIZE;
-						* SOCKET_SET_HEADER_SIZE( answer ) = TCP_HEADER_SIZE;
+//						*SOCKET_SET_DATA_FRAGMENT_SIZE(answer) = MAX_TCP_FRAGMENT_SIZE;
+						*SOCKET_SET_HEADER_SIZE(answer) = TCP_HEADER_SIZE;
 						answer_count = 3;
 					}else{
-						free( socket_data );
+						free(socket_data);
 					}
 				}
 				break;
 			case NET_SOCKET_BIND:
-				res = data_receive(( void ** ) & addr, & addrlen );
-				if( res == EOK ){
-					fibril_rwlock_write_lock( & tcp_globals.lock );
-					fibril_rwlock_write_lock( & lock );
-					res = socket_bind( & local_sockets, & tcp_globals.sockets, SOCKET_GET_SOCKET_ID( call ), addr, addrlen, TCP_FREE_PORTS_START, TCP_FREE_PORTS_END, tcp_globals.last_used_port );
-					if( res == EOK ){
-						socket = socket_cores_find( & local_sockets, SOCKET_GET_SOCKET_ID( call ));
-						if( socket ){
-							socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-							assert( socket_data );
+				res = data_receive((void **) &addr, &addrlen);
+				if(res == EOK){
+					fibril_rwlock_write_lock(&tcp_globals.lock);
+					fibril_rwlock_write_lock(&lock);
+					res = socket_bind(&local_sockets, &tcp_globals.sockets, SOCKET_GET_SOCKET_ID(call), addr, addrlen, TCP_FREE_PORTS_START, TCP_FREE_PORTS_END, tcp_globals.last_used_port);
+					if(res == EOK){
+						socket = socket_cores_find(&local_sockets, SOCKET_GET_SOCKET_ID(call));
+						if(socket){
+							socket_data = (tcp_socket_data_ref) socket->specific_data;
+							assert(socket_data);
 							socket_data->state = TCP_SOCKET_LISTEN;
 						}
 					}
-					fibril_rwlock_write_unlock( & lock );
-					fibril_rwlock_write_unlock( & tcp_globals.lock );
-					free( addr );
+					fibril_rwlock_write_unlock(&lock);
+					fibril_rwlock_write_unlock(&tcp_globals.lock);
+					free(addr);
 				}
 				break;
 			case NET_SOCKET_LISTEN:
-				fibril_rwlock_read_lock( & tcp_globals.lock );
-//				fibril_rwlock_write_lock( & tcp_globals.lock );
-				fibril_rwlock_write_lock( & lock );
-				res = tcp_listen_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ), SOCKET_GET_BACKLOG( call ));
-				fibril_rwlock_write_unlock( & lock );
-//				fibril_rwlock_write_unlock( & tcp_globals.lock );
-				fibril_rwlock_read_unlock( & tcp_globals.lock );
+				fibril_rwlock_read_lock(&tcp_globals.lock);
+//				fibril_rwlock_write_lock(&tcp_globals.lock);
+				fibril_rwlock_write_lock(&lock);
+				res = tcp_listen_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_BACKLOG(call));
+				fibril_rwlock_write_unlock(&lock);
+//				fibril_rwlock_write_unlock(&tcp_globals.lock);
+				fibril_rwlock_read_unlock(&tcp_globals.lock);
 				break;
 			case NET_SOCKET_CONNECT:
-				res = data_receive(( void ** ) & addr, & addrlen );
-				if( res == EOK ){
+				res = data_receive((void **) &addr, &addrlen);
+				if(res == EOK){
 					// the global lock may be released in the tcp_connect_message() function
-					fibril_rwlock_write_lock( & tcp_globals.lock );
-					fibril_rwlock_write_lock( & lock );
-					res = tcp_connect_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ), addr, addrlen );
-					if( res != EOK ){
-						fibril_rwlock_write_unlock( & lock );
-						fibril_rwlock_write_unlock( & tcp_globals.lock );
-						free( addr );
+					fibril_rwlock_write_lock(&tcp_globals.lock);
+					fibril_rwlock_write_lock(&lock);
+					res = tcp_connect_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), addr, addrlen);
+					if(res != EOK){
+						fibril_rwlock_write_unlock(&lock);
+						fibril_rwlock_write_unlock(&tcp_globals.lock);
+						free(addr);
 					}
 				}
 				break;
 			case NET_SOCKET_ACCEPT:
-				fibril_rwlock_read_lock( & tcp_globals.lock );
-				fibril_rwlock_write_lock( & lock );
-				res = tcp_accept_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ), SOCKET_GET_NEW_SOCKET_ID( call ), SOCKET_SET_DATA_FRAGMENT_SIZE( answer ), & addrlen );
-				fibril_rwlock_write_unlock( & lock );
-				fibril_rwlock_read_unlock( & tcp_globals.lock );
-				if( res > 0 ){
-					* SOCKET_SET_SOCKET_ID( answer ) = res;
-					* SOCKET_SET_ADDRESS_LENGTH( answer ) = addrlen;
+				fibril_rwlock_read_lock(&tcp_globals.lock);
+				fibril_rwlock_write_lock(&lock);
+				res = tcp_accept_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_NEW_SOCKET_ID(call), SOCKET_SET_DATA_FRAGMENT_SIZE(answer), &addrlen);
+				fibril_rwlock_write_unlock(&lock);
+				fibril_rwlock_read_unlock(&tcp_globals.lock);
+				if(res > 0){
+					*SOCKET_SET_SOCKET_ID(answer) = res;
+					*SOCKET_SET_ADDRESS_LENGTH(answer) = addrlen;
 					answer_count = 3;
 				}
 				break;
 			case NET_SOCKET_SEND:
-				fibril_rwlock_read_lock( & tcp_globals.lock );
-				fibril_rwlock_write_lock( & lock );
-				res = tcp_send_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ), SOCKET_GET_DATA_FRAGMENTS( call ), SOCKET_SET_DATA_FRAGMENT_SIZE( answer ), SOCKET_GET_FLAGS( call ));
-				if( res != EOK ){
-					fibril_rwlock_write_unlock( & lock );
-					fibril_rwlock_read_unlock( & tcp_globals.lock );
+				fibril_rwlock_read_lock(&tcp_globals.lock);
+				fibril_rwlock_write_lock(&lock);
+				res = tcp_send_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_DATA_FRAGMENTS(call), SOCKET_SET_DATA_FRAGMENT_SIZE(answer), SOCKET_GET_FLAGS(call));
+				if(res != EOK){
+					fibril_rwlock_write_unlock(&lock);
+					fibril_rwlock_read_unlock(&tcp_globals.lock);
 				}else{
 					answer_count = 2;
@@ -1177,26 +1185,26 @@
 				break;
 			case NET_SOCKET_SENDTO:
-				res = data_receive(( void ** ) & addr, & addrlen );
-				if( res == EOK ){
-					fibril_rwlock_read_lock( & tcp_globals.lock );
-					fibril_rwlock_write_lock( & lock );
-					res = tcp_send_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ), SOCKET_GET_DATA_FRAGMENTS( call ), SOCKET_SET_DATA_FRAGMENT_SIZE( answer ), SOCKET_GET_FLAGS( call ));
-					if( res != EOK ){
-						fibril_rwlock_write_unlock( & lock );
-						fibril_rwlock_read_unlock( & tcp_globals.lock );
+				res = data_receive((void **) &addr, &addrlen);
+				if(res == EOK){
+					fibril_rwlock_read_lock(&tcp_globals.lock);
+					fibril_rwlock_write_lock(&lock);
+					res = tcp_send_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_DATA_FRAGMENTS(call), SOCKET_SET_DATA_FRAGMENT_SIZE(answer), SOCKET_GET_FLAGS(call));
+					if(res != EOK){
+						fibril_rwlock_write_unlock(&lock);
+						fibril_rwlock_read_unlock(&tcp_globals.lock);
 					}else{
 						answer_count = 2;
 					}
-					free( addr );
+					free(addr);
 				}
 				break;
 			case NET_SOCKET_RECV:
-				fibril_rwlock_read_lock( & tcp_globals.lock );
-				fibril_rwlock_write_lock( & lock );
-				res = tcp_recvfrom_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ), SOCKET_GET_FLAGS( call ), NULL );
-				fibril_rwlock_write_unlock( & lock );
-				fibril_rwlock_read_unlock( & tcp_globals.lock );
-				if( res > 0 ){
-					* SOCKET_SET_READ_DATA_LENGTH( answer ) = res;
+				fibril_rwlock_read_lock(&tcp_globals.lock);
+				fibril_rwlock_write_lock(&lock);
+				res = tcp_recvfrom_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_FLAGS(call), NULL);
+				fibril_rwlock_write_unlock(&lock);
+				fibril_rwlock_read_unlock(&tcp_globals.lock);
+				if(res > 0){
+					*SOCKET_SET_READ_DATA_LENGTH(answer) = res;
 					answer_count = 1;
 					res = EOK;
@@ -1204,12 +1212,12 @@
 				break;
 			case NET_SOCKET_RECVFROM:
-				fibril_rwlock_read_lock( & tcp_globals.lock );
-				fibril_rwlock_write_lock( & lock );
-				res = tcp_recvfrom_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ), SOCKET_GET_FLAGS( call ), & addrlen );
-				fibril_rwlock_write_unlock( & lock );
-				fibril_rwlock_read_unlock( & tcp_globals.lock );
-				if( res > 0 ){
-					* SOCKET_SET_READ_DATA_LENGTH( answer ) = res;
-					* SOCKET_SET_ADDRESS_LENGTH( answer ) = addrlen;
+				fibril_rwlock_read_lock(&tcp_globals.lock);
+				fibril_rwlock_write_lock(&lock);
+				res = tcp_recvfrom_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_FLAGS(call), &addrlen);
+				fibril_rwlock_write_unlock(&lock);
+				fibril_rwlock_read_unlock(&tcp_globals.lock);
+				if(res > 0){
+					*SOCKET_SET_READ_DATA_LENGTH(answer) = res;
+					*SOCKET_SET_ADDRESS_LENGTH(answer) = addrlen;
 					answer_count = 3;
 					res = EOK;
@@ -1217,10 +1225,10 @@
 				break;
 			case NET_SOCKET_CLOSE:
-				fibril_rwlock_write_lock( & tcp_globals.lock );
-				fibril_rwlock_write_lock( & lock );
-				res = tcp_close_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ));
-				if( res != EOK ){
-					fibril_rwlock_write_unlock( & lock );
-					fibril_rwlock_write_unlock( & tcp_globals.lock );
+				fibril_rwlock_write_lock(&tcp_globals.lock);
+				fibril_rwlock_write_lock(&lock);
+				res = tcp_close_message(&local_sockets, SOCKET_GET_SOCKET_ID(call));
+				if(res != EOK){
+					fibril_rwlock_write_unlock(&lock);
+					fibril_rwlock_write_unlock(&tcp_globals.lock);
 				}
 				break;
@@ -1231,58 +1239,54 @@
 				break;
 		}
-
-//		printf( "res = %d\n", res );
-
-		answer_call( callid, res, & answer, answer_count );
 	}
 
 	printf("release\n");
 	// release all local sockets
-	socket_cores_release( tcp_globals.net_phone, & local_sockets, & tcp_globals.sockets, tcp_free_socket_data );
+	socket_cores_release(tcp_globals.net_phone, &local_sockets, &tcp_globals.sockets, tcp_free_socket_data);
 
 	return EOK;
 }
 
-int tcp_timeout( void * data ){
-	tcp_timeout_ref		timeout = data;
-	int					keep_write_lock = false;
-	socket_core_ref		socket;
-	tcp_socket_data_ref	socket_data;
-
-	assert( timeout );
+int tcp_timeout(void * data){
+	tcp_timeout_ref timeout = data;
+	int keep_write_lock = false;
+	socket_core_ref socket;
+	tcp_socket_data_ref socket_data;
+
+	assert(timeout);
 
 	// sleep the given timeout
-	async_usleep( timeout->timeout );
+	async_usleep(timeout->timeout);
 	// lock the globals
-	if( timeout->globals_read_only ){
-		fibril_rwlock_read_lock( & tcp_globals.lock );
+	if(timeout->globals_read_only){
+		fibril_rwlock_read_lock(&tcp_globals.lock);
 	}else{
-		fibril_rwlock_write_lock( & tcp_globals.lock );
+		fibril_rwlock_write_lock(&tcp_globals.lock);
 	}
 	// find the pending operation socket
-	socket = socket_port_find( & tcp_globals.sockets, timeout->port, timeout->key, timeout->key_length );
-	if( socket && ( socket->socket_id == timeout->socket_id )){
-		socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-		assert( socket_data );
-		if( socket_data->local_sockets == timeout->local_sockets ){
-			fibril_rwlock_write_lock( socket_data->local_lock );
-			if( timeout->sequence_number ){
+	socket = socket_port_find(&tcp_globals.sockets, timeout->port, timeout->key, timeout->key_length);
+	if(socket && (socket->socket_id == timeout->socket_id)){
+		socket_data = (tcp_socket_data_ref) socket->specific_data;
+		assert(socket_data);
+		if(socket_data->local_sockets == timeout->local_sockets){
+			fibril_rwlock_write_lock(socket_data->local_lock);
+			if(timeout->sequence_number){
 				// increase the timeout counter;
 				++ socket_data->timeout_count;
-				if( socket_data->timeout_count == TCP_MAX_TIMEOUTS ){
+				if(socket_data->timeout_count == TCP_MAX_TIMEOUTS){
 					// TODO release as connection lost
-					//tcp_refresh_socket_data( socket_data );
-				}
-				// retransmit
-				// TODO enable retransmit
-				//tcp_retransmit_packet( socket, socket_data, timeout->sequence_number );
-				fibril_rwlock_write_unlock( socket_data->local_lock );
+					//tcp_refresh_socket_data(socket_data);
+				}else{
+					// retransmit
+					tcp_retransmit_packet(socket, socket_data, timeout->sequence_number);
+				}
+				fibril_rwlock_write_unlock(socket_data->local_lock);
 			}else{
-				fibril_mutex_lock( & socket_data->operation.mutex );
+				fibril_mutex_lock(&socket_data->operation.mutex);
 				// set the timeout operation result if state not changed
-				if( socket_data->state == timeout->state ){
+				if(socket_data->state == timeout->state){
 					socket_data->operation.result = ETIMEOUT;
 					// notify the main fibril
-					fibril_condvar_signal( & socket_data->operation.condvar );
+					fibril_condvar_signal(&socket_data->operation.condvar);
 					// keep the global write lock
 					keep_write_lock = true;
@@ -1290,91 +1294,95 @@
 					// operation is ok, do nothing
 					// unlocking from now on, so the unlock order does not matter...
-					fibril_rwlock_write_unlock( socket_data->local_lock );
-				}
-				fibril_mutex_unlock( & socket_data->operation.mutex );
+					fibril_rwlock_write_unlock(socket_data->local_lock);
+				}
+				fibril_mutex_unlock(&socket_data->operation.mutex);
 			}
 		}
 	}
 	// unlock only if no socket
-	if( timeout->globals_read_only ){
-		fibril_rwlock_read_unlock( & tcp_globals.lock );
-	}else if( ! keep_write_lock ){
+	if(timeout->globals_read_only){
+		fibril_rwlock_read_unlock(&tcp_globals.lock);
+	}else if(! keep_write_lock){
 		// release if not desired
-		fibril_rwlock_write_unlock( & tcp_globals.lock );
+		fibril_rwlock_write_unlock(&tcp_globals.lock);
 	}
 	// release the timeout structure
-	free( timeout );
+	free(timeout);
 	return EOK;
 }
 
-int tcp_release_after_timeout( void * data ){
-	tcp_timeout_ref		timeout = data;
-	socket_core_ref		socket;
-	tcp_socket_data_ref	socket_data;
-	fibril_rwlock_t *	local_lock;
-
-	assert( timeout );
+int tcp_release_after_timeout(void * data){
+	tcp_timeout_ref timeout = data;
+	socket_core_ref socket;
+	tcp_socket_data_ref socket_data;
+	fibril_rwlock_t * local_lock;
+
+	assert(timeout);
 
 	// sleep the given timeout
-	async_usleep( timeout->timeout );
+	async_usleep(timeout->timeout);
 	// lock the globals
-	fibril_rwlock_write_lock( & tcp_globals.lock );
+	fibril_rwlock_write_lock(&tcp_globals.lock);
 	// find the pending operation socket
-	socket = socket_port_find( & tcp_globals.sockets, timeout->port, timeout->key, timeout->key_length );
-	if( socket && ( socket->socket_id == timeout->socket_id )){
-		socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-		assert( socket_data );
-		if( socket_data->local_sockets == timeout->local_sockets ){
+	socket = socket_port_find(&tcp_globals.sockets, timeout->port, timeout->key, timeout->key_length);
+	if(socket && (socket->socket_id == timeout->socket_id)){
+		socket_data = (tcp_socket_data_ref) socket->specific_data;
+		assert(socket_data);
+		if(socket_data->local_sockets == timeout->local_sockets){
 			local_lock = socket_data->local_lock;
-			fibril_rwlock_write_lock( local_lock );
-			socket_destroy( tcp_globals.net_phone, timeout->socket_id, timeout->local_sockets, & tcp_globals.sockets, tcp_free_socket_data );
-			fibril_rwlock_write_unlock( local_lock );
+			fibril_rwlock_write_lock(local_lock);
+			socket_destroy(tcp_globals.net_phone, timeout->socket_id, timeout->local_sockets, &tcp_globals.sockets, tcp_free_socket_data);
+			fibril_rwlock_write_unlock(local_lock);
 		}
 	}
 	// unlock the globals
-	fibril_rwlock_write_unlock( & tcp_globals.lock );
+	fibril_rwlock_write_unlock(&tcp_globals.lock);
 	// release the timeout structure
-	free( timeout );
+	free(timeout);
 	return EOK;
 }
 
-void tcp_retransmit_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number ){
-	packet_t	packet;
-	packet_t	copy;
-	size_t		data_length;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
+void tcp_retransmit_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number){
+	packet_t packet;
+	packet_t copy;
+	size_t data_length;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
 
 	// sent packet?
-	packet = pq_find( socket_data->outgoing, sequence_number );
-	printf("retransmit %d\n", packet_get_id( packet ));
-	if( packet ){
-		pq_get_order( packet, NULL, & data_length );
-		copy = tcp_prepare_copy( socket, socket_data, packet, data_length, sequence_number );
-		fibril_rwlock_write_unlock( socket_data->local_lock );
-//		printf( "r send %d\n", packet_get_id( packet ));
-		if( copy ){
-			tcp_send_packets( socket_data->device_id, copy );
+	packet = pq_find(socket_data->outgoing, sequence_number);
+	printf("retransmit %d\n", packet_get_id(packet));
+	if(packet){
+		pq_get_order(packet, NULL, &data_length);
+		copy = tcp_prepare_copy(socket, socket_data, packet, data_length, sequence_number);
+		fibril_rwlock_write_unlock(socket_data->local_lock);
+//		printf("r send %d\n", packet_get_id(packet));
+		if(copy){
+			tcp_send_packets(socket_data->device_id, copy);
 		}
 	}else{
-		fibril_rwlock_write_unlock( socket_data->local_lock );
-	}
-}
-
-int tcp_listen_message( socket_cores_ref local_sockets, int socket_id, int backlog ){
-	socket_core_ref		socket;
-	tcp_socket_data_ref	socket_data;
-
-	assert( local_sockets );
-
-	if( backlog < 0 ) return EINVAL;
+		fibril_rwlock_write_unlock(socket_data->local_lock);
+	}
+}
+
+int tcp_listen_message(socket_cores_ref local_sockets, int socket_id, int backlog){
+	socket_core_ref socket;
+	tcp_socket_data_ref socket_data;
+
+	assert(local_sockets);
+
+	if(backlog < 0){
+		return EINVAL;
+	}
 	// find the socket
-	socket = socket_cores_find( local_sockets, socket_id );
-	if( ! socket ) return ENOTSOCK;
+	socket = socket_cores_find(local_sockets, socket_id);
+	if(! socket){
+		return ENOTSOCK;
+	}
 	// get the socket specific data
-	socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-	assert( socket_data );
+	socket_data = (tcp_socket_data_ref) socket->specific_data;
+	assert(socket_data);
 	// set the backlog
 	socket_data->backlog = backlog;
@@ -1382,21 +1390,23 @@
 }
 
-int tcp_connect_message( socket_cores_ref local_sockets, int socket_id, struct sockaddr * addr, socklen_t addrlen ){
+int tcp_connect_message(socket_cores_ref local_sockets, int socket_id, struct sockaddr * addr, socklen_t addrlen){
 	ERROR_DECLARE;
 
-	socket_core_ref			socket;
-
-	assert( local_sockets );
-	assert( addr );
-	assert( addrlen > 0 );
+	socket_core_ref socket;
+
+	assert(local_sockets);
+	assert(addr);
+	assert(addrlen > 0);
 
 	// find the socket
-	socket = socket_cores_find( local_sockets, socket_id );
-	if( ! socket ) return ENOTSOCK;
-	if( ERROR_OCCURRED( tcp_connect_core( socket, local_sockets, addr, addrlen ))){
-		tcp_free_socket_data( socket );
+	socket = socket_cores_find(local_sockets, socket_id);
+	if(! socket){
+		return ENOTSOCK;
+	}
+	if(ERROR_OCCURRED(tcp_connect_core(socket, local_sockets, addr, addrlen))){
+		tcp_free_socket_data(socket);
 		// unbind if bound
-		if( socket->port > 0 ){
-			socket_ports_exclude( & tcp_globals.sockets, socket->port );
+		if(socket->port > 0){
+			socket_ports_exclude(&tcp_globals.sockets, socket->port);
 			socket->port = 0;
 		}
@@ -1405,58 +1415,58 @@
 }
 
-int tcp_connect_core( socket_core_ref socket, socket_cores_ref local_sockets, struct sockaddr * addr, socklen_t addrlen ){
+int tcp_connect_core(socket_core_ref socket, socket_cores_ref local_sockets, struct sockaddr * addr, socklen_t addrlen){
 	ERROR_DECLARE;
 
-	tcp_socket_data_ref		socket_data;
-	packet_t				packet;
-
-	assert( socket );
-	assert( addr );
-	assert( addrlen > 0 );
+	tcp_socket_data_ref socket_data;
+	packet_t packet;
+
+	assert(socket);
+	assert(addr);
+	assert(addrlen > 0);
 
 	// get the socket specific data
-	socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
-	if(( socket_data->state != TCP_SOCKET_INITIAL )
-	&& (( socket_data->state != TCP_SOCKET_LISTEN ) || ( socket->port <= 0 ))){
+	socket_data = (tcp_socket_data_ref) socket->specific_data;
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
+	if((socket_data->state != TCP_SOCKET_INITIAL)
+		&& ((socket_data->state != TCP_SOCKET_LISTEN) || (socket->port <= 0))){
 		return EINVAL;
 	}
 	// get the destination port
-	ERROR_PROPAGATE( tl_get_address_port( addr, addrlen, & socket_data->dest_port ));
-	if( socket->port <= 0 ){
+	ERROR_PROPAGATE(tl_get_address_port(addr, addrlen, &socket_data->dest_port));
+	if(socket->port <= 0){
 		// try to find a free port
-		ERROR_PROPAGATE( socket_bind_free_port( & tcp_globals.sockets, socket, TCP_FREE_PORTS_START, TCP_FREE_PORTS_END, tcp_globals.last_used_port ));
+		ERROR_PROPAGATE(socket_bind_free_port(&tcp_globals.sockets, socket, TCP_FREE_PORTS_START, TCP_FREE_PORTS_END, tcp_globals.last_used_port));
 		// set the next port as the search starting port number
 		tcp_globals.last_used_port = socket->port;
 	}
-	ERROR_PROPAGATE( ip_get_route_req( tcp_globals.ip_phone, IPPROTO_TCP, addr, addrlen, & socket_data->device_id, & socket_data->pseudo_header, & socket_data->headerlen ));
+	ERROR_PROPAGATE(ip_get_route_req(tcp_globals.ip_phone, IPPROTO_TCP, addr, addrlen, &socket_data->device_id, &socket_data->pseudo_header, &socket_data->headerlen));
 
 	// create the notification packet
-	ERROR_PROPAGATE( tcp_create_notification_packet( & packet, socket, socket_data, 1, 0 ));
+	ERROR_PROPAGATE(tcp_create_notification_packet(&packet, socket, socket_data, 1, 0));
 
 	// unlock the globals and wait for an operation
-	fibril_rwlock_write_unlock( & tcp_globals.lock );
+	fibril_rwlock_write_unlock(&tcp_globals.lock);
 
 	socket_data->addr = addr;
 	socket_data->addrlen = addrlen;
 	// send the packet
-	if( ERROR_OCCURRED( tcp_queue_packet( socket, socket_data, packet, 1 ))
-	|| ERROR_OCCURRED( tcp_prepare_timeout( tcp_timeout, socket, socket_data, 0, TCP_SOCKET_INITIAL, NET_DEFAULT_TCP_INITIAL_TIMEOUT, false ))){
+	if(ERROR_OCCURRED(tcp_queue_packet(socket, socket_data, packet, 1))
+		|| ERROR_OCCURRED(tcp_prepare_timeout(tcp_timeout, socket, socket_data, 0, TCP_SOCKET_INITIAL, NET_DEFAULT_TCP_INITIAL_TIMEOUT, false))){
 		socket_data->addr = NULL;
 		socket_data->addrlen = 0;
-		fibril_rwlock_write_lock( & tcp_globals.lock );
+		fibril_rwlock_write_lock(&tcp_globals.lock);
 	}else{
-		packet = tcp_get_packets_to_send( socket, socket_data );
-		if( packet ){
-			fibril_mutex_lock( & socket_data->operation.mutex );
-			fibril_rwlock_write_unlock( socket_data->local_lock );
+		packet = tcp_get_packets_to_send(socket, socket_data);
+		if(packet){
+			fibril_mutex_lock(&socket_data->operation.mutex);
+			fibril_rwlock_write_unlock(socket_data->local_lock);
 			// send the packet
-			printf( "connecting %d\n", packet_get_id( packet ));
-			tcp_send_packets( socket_data->device_id, packet );
+			printf("connecting %d\n", packet_get_id(packet));
+			tcp_send_packets(socket_data->device_id, packet);
 			// wait for a reply
-			fibril_condvar_wait( & socket_data->operation.condvar, & socket_data->operation.mutex );
+			fibril_condvar_wait(&socket_data->operation.condvar, &socket_data->operation.mutex);
 			ERROR_CODE = socket_data->operation.result;
-			if( ERROR_CODE != EOK ){
+			if(ERROR_CODE != EOK){
 				socket_data->addr = NULL;
 				socket_data->addrlen = 0;
@@ -1469,5 +1479,5 @@
 	}
 
-	fibril_mutex_unlock( & socket_data->operation.mutex );
+	fibril_mutex_unlock(&socket_data->operation.mutex);
 
 	// return the result
@@ -1475,24 +1485,26 @@
 }
 
-int tcp_queue_prepare_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length ){
+int tcp_queue_prepare_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length){
 	ERROR_DECLARE;
 
-	tcp_header_ref	header;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
+	tcp_header_ref header;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
 
 	// get tcp header
-	header = ( tcp_header_ref ) packet_get_data( packet );
-	if( ! header ) return NO_DATA;
-	header->destination_port = htons( socket_data->dest_port );
-	header->source_port = htons( socket->port );
-	header->sequence_number = htonl( socket_data->next_outgoing );
-	if( ERROR_OCCURRED( packet_set_addr( packet, NULL, ( uint8_t * ) socket_data->addr, socket_data->addrlen ))){
-		return tcp_release_and_return( packet, EINVAL );
+	header = (tcp_header_ref) packet_get_data(packet);
+	if(! header){
+		return NO_DATA;
+	}
+	header->destination_port = htons(socket_data->dest_port);
+	header->source_port = htons(socket->port);
+	header->sequence_number = htonl(socket_data->next_outgoing);
+	if(ERROR_OCCURRED(packet_set_addr(packet, NULL, (uint8_t *) socket_data->addr, socket_data->addrlen))){
+		return tcp_release_and_return(packet, EINVAL);
 	}
 	// remember the outgoing FIN
-	if( header->finalize ){
+	if(header->finalize){
 		socket_data->fin_outgoing = socket_data->next_outgoing;
 	}
@@ -1500,15 +1512,15 @@
 }
 
-int	tcp_queue_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length ){
+int tcp_queue_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length){
 	ERROR_DECLARE;
 
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
-
-	ERROR_PROPAGATE( tcp_queue_prepare_packet( socket, socket_data, packet, data_length ));
-
-	if( ERROR_OCCURRED( pq_add( & socket_data->outgoing, packet, socket_data->next_outgoing, data_length ))){
-		return tcp_release_and_return( packet, ERROR_CODE );
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
+
+	ERROR_PROPAGATE(tcp_queue_prepare_packet(socket, socket_data, packet, data_length));
+
+	if(ERROR_OCCURRED(pq_add(&socket_data->outgoing, packet, socket_data->next_outgoing, data_length))){
+		return tcp_release_and_return(packet, ERROR_CODE);
 	}
 	socket_data->next_outgoing += data_length;
@@ -1516,39 +1528,39 @@
 }
 
-packet_t tcp_get_packets_to_send( socket_core_ref socket, tcp_socket_data_ref socket_data ){
+packet_t tcp_get_packets_to_send(socket_core_ref socket, tcp_socket_data_ref socket_data){
 	ERROR_DECLARE;
 
-	packet_t		packet;
-	packet_t		copy;
-	packet_t		sending = NULL;
-	packet_t		previous = NULL;
-	size_t			data_length;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
-
-	packet = pq_find( socket_data->outgoing, socket_data->last_outgoing + 1 );
-	while( packet ){
-		pq_get_order( packet, NULL, & data_length );
+	packet_t packet;
+	packet_t copy;
+	packet_t sending = NULL;
+	packet_t previous = NULL;
+	size_t data_length;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
+
+	packet = pq_find(socket_data->outgoing, socket_data->last_outgoing + 1);
+	while(packet){
+		pq_get_order(packet, NULL, &data_length);
 		// send only if fits into the window
 		// respecting the possible overflow
-		if( IS_IN_INTERVAL_OVERFLOW(( uint32_t ) socket_data->last_outgoing, ( uint32_t )( socket_data->last_outgoing + data_length ), ( uint32_t )( socket_data->expected + socket_data->treshold ))){
-			copy = tcp_prepare_copy( socket, socket_data, packet, data_length, socket_data->last_outgoing + 1 );
-			if( ! copy ){
+		if(IS_IN_INTERVAL_OVERFLOW((uint32_t) socket_data->last_outgoing, (uint32_t)(socket_data->last_outgoing + data_length), (uint32_t)(socket_data->expected + socket_data->treshold))){
+			copy = tcp_prepare_copy(socket, socket_data, packet, data_length, socket_data->last_outgoing + 1);
+			if(! copy){
 				return sending;
 			}
-			if( ! sending ){
+			if(! sending){
 				sending = copy;
 			}else{
-				if( ERROR_OCCURRED( pq_insert_after( previous, copy ))){
-					pq_release( tcp_globals.net_phone, packet_get_id( copy ));
+				if(ERROR_OCCURRED(pq_insert_after(previous, copy))){
+					pq_release(tcp_globals.net_phone, packet_get_id(copy));
 					return sending;
 				}
 			}
 			previous = copy;
-			packet = pq_next( packet );
+			packet = pq_next(packet);
 			// overflow occurred ?
-			if(( ! packet ) && ( socket_data->last_outgoing > socket_data->next_outgoing )){
+			if((! packet) && (socket_data->last_outgoing > socket_data->next_outgoing)){
 				printf("gpts overflow\n");
 				// continue from the beginning
@@ -1563,45 +1575,45 @@
 }
 
-packet_t tcp_send_prepare_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number ){
+packet_t tcp_send_prepare_packet(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number){
 	ERROR_DECLARE;
 
-	tcp_header_ref	header;
-	uint32_t		checksum;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
+	tcp_header_ref header;
+	uint32_t checksum;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
 
 	// adjust the pseudo header
-	if( ERROR_OCCURRED( ip_client_set_pseudo_header_data_length( socket_data->pseudo_header, socket_data->headerlen, packet_get_data_length( packet )))){
-		pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+	if(ERROR_OCCURRED(ip_client_set_pseudo_header_data_length(socket_data->pseudo_header, socket_data->headerlen, packet_get_data_length(packet)))){
+		pq_release(tcp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
 
 	// get the header
-	header = ( tcp_header_ref ) packet_get_data( packet );
-	if( ! header ){
-		pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+	header = (tcp_header_ref) packet_get_data(packet);
+	if(! header){
+		pq_release(tcp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
-	assert( ntohl( header->sequence_number ) == sequence_number );
+	assert(ntohl(header->sequence_number) == sequence_number);
 
 	// adjust the header
-	if( socket_data->next_incoming ){
-		header->acknowledgement_number = htonl( socket_data->next_incoming );
+	if(socket_data->next_incoming){
+		header->acknowledgement_number = htonl(socket_data->next_incoming);
 		header->acknowledge = 1;
 	}
-	header->window = htons( socket_data->window );
+	header->window = htons(socket_data->window);
 
 	// checksum
 	header->checksum = 0;
-	checksum = compute_checksum( 0, socket_data->pseudo_header, socket_data->headerlen );
-	checksum = compute_checksum( checksum, ( uint8_t * ) packet_get_data( packet ), packet_get_data_length( packet ));
-	header->checksum = htons( flip_checksum( compact_checksum( checksum )));
+	checksum = compute_checksum(0, socket_data->pseudo_header, socket_data->headerlen);
+	checksum = compute_checksum(checksum, (uint8_t *) packet_get_data(packet), packet_get_data_length(packet));
+	header->checksum = htons(flip_checksum(compact_checksum(checksum)));
 	// prepare the packet
-	if( ERROR_OCCURRED( ip_client_prepare_packet( packet, IPPROTO_TCP, 0, 0, 0, 0 ))
+	if(ERROR_OCCURRED(ip_client_prepare_packet(packet, IPPROTO_TCP, 0, 0, 0, 0))
 	// prepare the timeout
-	|| ERROR_OCCURRED( tcp_prepare_timeout( tcp_timeout, socket, socket_data, sequence_number, socket_data->state, socket_data->timeout, true ))){
-		pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+		|| ERROR_OCCURRED(tcp_prepare_timeout(tcp_timeout, socket, socket_data, sequence_number, socket_data->state, socket_data->timeout, true))){
+		pq_release(tcp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
@@ -1609,54 +1621,58 @@
 }
 
-packet_t tcp_prepare_copy( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number ){
-	packet_t		copy;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
+packet_t tcp_prepare_copy(socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length, size_t sequence_number){
+	packet_t copy;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
 
 	// make a copy of the packet
-	copy = packet_get_copy( tcp_globals.net_phone, packet );
-	if( ! copy ) return NULL;
-
-	return tcp_send_prepare_packet( socket, socket_data, copy, data_length, sequence_number );
-}
-
-void tcp_send_packets( device_id_t device_id, packet_t packet ){
-	packet_t	next;
-
-	while( packet ){
-		next = pq_detach( packet );
-		ip_send_msg( tcp_globals.ip_phone, device_id, packet, SERVICE_TCP, 0 );
+	copy = packet_get_copy(tcp_globals.net_phone, packet);
+	if(! copy){
+		return NULL;
+	}
+
+	return tcp_send_prepare_packet(socket, socket_data, copy, data_length, sequence_number);
+}
+
+void tcp_send_packets(device_id_t device_id, packet_t packet){
+	packet_t next;
+
+	while(packet){
+		next = pq_detach(packet);
+		ip_send_msg(tcp_globals.ip_phone, device_id, packet, SERVICE_TCP, 0);
 		packet = next;
 	}
 }
 
-void tcp_prepare_operation_header( socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, int synchronize, int finalize ){
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
-	assert( header );
-
-	bzero( header, sizeof( * header ));
-	header->source_port = htons( socket->port );
-	header->source_port = htons( socket_data->dest_port );
-	header->header_length = TCP_COMPUTE_HEADER_LENGTH( sizeof( * header ));
+void tcp_prepare_operation_header(socket_core_ref socket, tcp_socket_data_ref socket_data, tcp_header_ref header, int synchronize, int finalize){
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
+	assert(header);
+
+	bzero(header, sizeof(*header));
+	header->source_port = htons(socket->port);
+	header->source_port = htons(socket_data->dest_port);
+	header->header_length = TCP_COMPUTE_HEADER_LENGTH(sizeof(*header));
 	header->synchronize = synchronize;
 	header->finalize = finalize;
 }
 
-int tcp_prepare_timeout( int ( * timeout_function )( void * tcp_timeout_t ), socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number, tcp_socket_state_t state, suseconds_t timeout, int globals_read_only ){
-	tcp_timeout_ref	operation_timeout;
-	fid_t			fibril;
-
-	assert( socket );
-	assert( socket_data );
-	assert( socket->specific_data == socket_data );
+int tcp_prepare_timeout(int (*timeout_function)(void * tcp_timeout_t), socket_core_ref socket, tcp_socket_data_ref socket_data, size_t sequence_number, tcp_socket_state_t state, suseconds_t timeout, int globals_read_only){
+	tcp_timeout_ref operation_timeout;
+	fid_t fibril;
+
+	assert(socket);
+	assert(socket_data);
+	assert(socket->specific_data == socket_data);
 
 	// prepare the timeout with key bundle structure
-	operation_timeout = malloc( sizeof( * operation_timeout ) + socket->key_length + 1 );
-	if( ! operation_timeout ) return ENOMEM;
-	bzero( operation_timeout, sizeof( * operation_timeout ));
+	operation_timeout = malloc(sizeof(*operation_timeout) + socket->key_length + 1);
+	if(! operation_timeout){
+		return ENOMEM;
+	}
+	bzero(operation_timeout, sizeof(*operation_timeout));
 	operation_timeout->globals_read_only = globals_read_only;
 	operation_timeout->port = socket->port;
@@ -1668,118 +1684,130 @@
 
 	// copy the key
-	operation_timeout->key = (( char * ) operation_timeout ) + sizeof( * operation_timeout );
+	operation_timeout->key = ((char *) operation_timeout) + sizeof(*operation_timeout);
 	operation_timeout->key_length = socket->key_length;
-	memcpy( operation_timeout->key, socket->key, socket->key_length );
-	operation_timeout->key[ operation_timeout->key_length ] = '\0';
+	memcpy(operation_timeout->key, socket->key, socket->key_length);
+	operation_timeout->key[operation_timeout->key_length] = '\0';
 
 	// prepare the timeouting thread
-	fibril = fibril_create( timeout_function, operation_timeout );
-	if( ! fibril ){
-		free( operation_timeout );
+	fibril = fibril_create(timeout_function, operation_timeout);
+	if(! fibril){
+		free(operation_timeout);
 		return EPARTY;
 	}
-//	fibril_mutex_lock( & socket_data->operation.mutex );
+//	fibril_mutex_lock(&socket_data->operation.mutex);
 	// start the timeouting fibril
-	fibril_add_ready( fibril );
+	fibril_add_ready(fibril);
 	//socket_data->state = state;
 	return EOK;
 }
 
-int tcp_recvfrom_message( socket_cores_ref local_sockets, int socket_id, int flags, size_t * addrlen ){
+int tcp_recvfrom_message(socket_cores_ref local_sockets, int socket_id, int flags, size_t * addrlen){
 	ERROR_DECLARE;
 
-	socket_core_ref		socket;
-	tcp_socket_data_ref	socket_data;
-	int					packet_id;
-	packet_t			packet;
-	size_t				length;
-
-	assert( local_sockets );
+	socket_core_ref socket;
+	tcp_socket_data_ref socket_data;
+	int packet_id;
+	packet_t packet;
+	size_t length;
+
+	assert(local_sockets);
 
 	// find the socket
-	socket = socket_cores_find( local_sockets, socket_id );
-	if( ! socket ) return ENOTSOCK;
+	socket = socket_cores_find(local_sockets, socket_id);
+	if(! socket){
+		return ENOTSOCK;
+	}
 	// get the socket specific data
-	if( ! socket->specific_data ) return NO_DATA;
-	socket_data = ( tcp_socket_data_ref ) socket->specific_data;
+	if(! socket->specific_data){
+		return NO_DATA;
+	}
+	socket_data = (tcp_socket_data_ref) socket->specific_data;
 
 	// check state
-	if(( socket_data->state != TCP_SOCKET_ESTABLISHED ) && ( socket_data->state != TCP_SOCKET_CLOSE_WAIT )){
+	if((socket_data->state != TCP_SOCKET_ESTABLISHED) && (socket_data->state != TCP_SOCKET_CLOSE_WAIT)){
 		return ENOTCONN;
 	}
 
 	// send the source address if desired
-	if( addrlen ){
-		ERROR_PROPAGATE( data_reply( socket_data->addr, socket_data->addrlen ));
-		* addrlen = socket_data->addrlen;
+	if(addrlen){
+		ERROR_PROPAGATE(data_reply(socket_data->addr, socket_data->addrlen));
+		*addrlen = socket_data->addrlen;
 	}
 
 	// get the next received packet
-	packet_id = dyn_fifo_value( & socket->received );
-	if( packet_id < 0 ) return NO_DATA;
-	ERROR_PROPAGATE( packet_translate( tcp_globals.net_phone, & packet, packet_id ));
+	packet_id = dyn_fifo_value(&socket->received);
+	if(packet_id < 0){
+		return NO_DATA;
+	}
+	ERROR_PROPAGATE(packet_translate(tcp_globals.net_phone, &packet, packet_id));
 
 	// reply the packets
-	ERROR_PROPAGATE( socket_reply_packets( packet, & length ));
+	ERROR_PROPAGATE(socket_reply_packets(packet, &length));
 
 	// release the packet
-	dyn_fifo_pop( & socket->received );
-	pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+	dyn_fifo_pop(&socket->received);
+	pq_release(tcp_globals.net_phone, packet_get_id(packet));
 	// return the total length
-	return ( int ) length;
-}
-
-int tcp_send_message( socket_cores_ref local_sockets, int socket_id, int fragments, size_t * data_fragment_size, int flags ){
+	return (int) length;
+}
+
+int tcp_send_message(socket_cores_ref local_sockets, int socket_id, int fragments, size_t * data_fragment_size, int flags){
 	ERROR_DECLARE;
 
-	socket_core_ref			socket;
-	tcp_socket_data_ref		socket_data;
-	packet_dimension_ref	packet_dimension;
-	packet_t				packet;
-	size_t					total_length;
-	tcp_header_ref			header;
-	int						index;
-	int						result;
-
-	assert( local_sockets );
-	assert( data_fragment_size );
+	socket_core_ref socket;
+	tcp_socket_data_ref socket_data;
+	packet_dimension_ref packet_dimension;
+	packet_t packet;
+	size_t total_length;
+	tcp_header_ref header;
+	int index;
+	int result;
+
+	assert(local_sockets);
+	assert(data_fragment_size);
 
 	// find the socket
-	socket = socket_cores_find( local_sockets, socket_id );
-	if( ! socket ) return ENOTSOCK;
+	socket = socket_cores_find(local_sockets, socket_id);
+	if(! socket){
+		return ENOTSOCK;
+	}
 	// get the socket specific data
-	if( ! socket->specific_data ) return NO_DATA;
-	socket_data = ( tcp_socket_data_ref ) socket->specific_data;
+	if(! socket->specific_data){
+		return NO_DATA;
+	}
+	socket_data = (tcp_socket_data_ref) socket->specific_data;
 
 	// check state
-	if(( socket_data->state != TCP_SOCKET_ESTABLISHED ) && ( socket_data->state != TCP_SOCKET_CLOSE_WAIT )){
+	if((socket_data->state != TCP_SOCKET_ESTABLISHED) && (socket_data->state != TCP_SOCKET_CLOSE_WAIT)){
 		return ENOTCONN;
 	}
 
-	ERROR_PROPAGATE( tl_get_ip_packet_dimension( tcp_globals.ip_phone, & tcp_globals.dimensions, socket_data->device_id, & packet_dimension ));
-
-	* data_fragment_size = (( packet_dimension->content < socket_data->data_fragment_size ) ? packet_dimension->content : socket_data->data_fragment_size );
-
-	for( index = 0; index < fragments; ++ index ){
+	ERROR_PROPAGATE(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension));
+
+	*data_fragment_size = ((packet_dimension->content < socket_data->data_fragment_size) ? packet_dimension->content : socket_data->data_fragment_size);
+
+	for(index = 0; index < fragments; ++ index){
 		// read the data fragment
-		result = tl_socket_read_packet_data( tcp_globals.net_phone, & packet, TCP_HEADER_SIZE, packet_dimension, socket_data->addr, socket_data->addrlen );
-		if( result < 0 ) return result;
-		total_length = ( size_t ) result;
+		result = tl_socket_read_packet_data(tcp_globals.net_phone, &packet, TCP_HEADER_SIZE, packet_dimension, socket_data->addr, socket_data->addrlen);
+		if(result < 0){
+			return result;
+		}
+		total_length = (size_t) result;
 		// prefix the tcp header
-		header = PACKET_PREFIX( packet, tcp_header_t );
-		if( ! header ){
-			return tcp_release_and_return( packet, ENOMEM );
-		}
-		tcp_prepare_operation_header( socket, socket_data, header, 0, 0 );
-		ERROR_PROPAGATE( tcp_queue_packet( socket, socket_data, packet, 0 ));
+		header = PACKET_PREFIX(packet, tcp_header_t);
+		if(! header){
+			return tcp_release_and_return(packet, ENOMEM);
+		}
+		tcp_prepare_operation_header(socket, socket_data, header, 0, 0);
+		ERROR_PROPAGATE(tcp_queue_packet(socket, socket_data, packet, 0));
 	}
 
 	// flush packets
-	packet = tcp_get_packets_to_send( socket, socket_data );
-	fibril_rwlock_write_unlock( socket_data->local_lock );
-	fibril_rwlock_read_unlock( & tcp_globals.lock );
-	if( packet ){
+	packet = tcp_get_packets_to_send(socket, socket_data);
+	fibril_rwlock_write_unlock(socket_data->local_lock);
+	fibril_rwlock_read_unlock(&tcp_globals.lock);
+	if(packet){
 		// send the packet
-		tcp_send_packets( socket_data->device_id, packet );
+		tcp_send_packets(socket_data->device_id, packet);
 	}
 
@@ -1787,20 +1815,22 @@
 }
 
-int tcp_close_message( socket_cores_ref local_sockets, int socket_id ){
+int tcp_close_message(socket_cores_ref local_sockets, int socket_id){
 	ERROR_DECLARE;
 
-	socket_core_ref			socket;
-	tcp_socket_data_ref		socket_data;
-	packet_t				packet;
+	socket_core_ref socket;
+	tcp_socket_data_ref socket_data;
+	packet_t packet;
 
 	// find the socket
-	socket = socket_cores_find( local_sockets, socket_id );
-	if( ! socket ) return ENOTSOCK;
+	socket = socket_cores_find(local_sockets, socket_id);
+	if(! socket){
+		return ENOTSOCK;
+	}
 	// get the socket specific data
-	socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-	assert( socket_data );
+	socket_data = (tcp_socket_data_ref) socket->specific_data;
+	assert(socket_data);
 
 	// check state
-	switch( socket_data->state ){
+	switch(socket_data->state){
 		case TCP_SOCKET_ESTABLISHED:
 			socket_data->state = TCP_SOCKET_FIN_WAIT_1;
@@ -1812,7 +1842,7 @@
 		default:
 			// just destroy
-			if( ! ERROR_OCCURRED( socket_destroy( tcp_globals.net_phone, socket_id, local_sockets, & tcp_globals.sockets, tcp_free_socket_data ))){
-				fibril_rwlock_write_unlock( socket_data->local_lock );
-				fibril_rwlock_write_unlock( & tcp_globals.lock );
+			if(! ERROR_OCCURRED(socket_destroy(tcp_globals.net_phone, socket_id, local_sockets, &tcp_globals.sockets, tcp_free_socket_data))){
+				fibril_rwlock_write_unlock(socket_data->local_lock);
+				fibril_rwlock_write_unlock(&tcp_globals.lock);
 			}
 			return ERROR_CODE;
@@ -1822,109 +1852,117 @@
 
 	// create the notification packet
-	ERROR_PROPAGATE( tcp_create_notification_packet( & packet, socket, socket_data, 0, 1 ));
+	ERROR_PROPAGATE(tcp_create_notification_packet(&packet, socket, socket_data, 0, 1));
 
 	// send the packet
-	ERROR_PROPAGATE( tcp_queue_packet( socket, socket_data, packet, 1 ));
+	ERROR_PROPAGATE(tcp_queue_packet(socket, socket_data, packet, 1));
 
 	// flush packets
-	packet = tcp_get_packets_to_send( socket, socket_data );
-	fibril_rwlock_write_unlock( socket_data->local_lock );
-	fibril_rwlock_write_unlock( & tcp_globals.lock );
-	if( packet ){
+	packet = tcp_get_packets_to_send(socket, socket_data);
+	fibril_rwlock_write_unlock(socket_data->local_lock);
+	fibril_rwlock_write_unlock(&tcp_globals.lock);
+	if(packet){
 		// send the packet
-		tcp_send_packets( socket_data->device_id, packet );
+		tcp_send_packets(socket_data->device_id, packet);
 	}
 	return EOK;
 }
 
-int tcp_create_notification_packet( packet_t * packet, socket_core_ref socket, tcp_socket_data_ref socket_data, int synchronize, int finalize ){
+int tcp_create_notification_packet(packet_t * packet, socket_core_ref socket, tcp_socket_data_ref socket_data, int synchronize, int finalize){
 	ERROR_DECLARE;
 
-	packet_dimension_ref	packet_dimension;
-	tcp_header_ref			header;
-
-	assert( packet );
+	packet_dimension_ref packet_dimension;
+	tcp_header_ref header;
+
+	assert(packet);
 
 	// get the device packet dimension
-	ERROR_PROPAGATE( tl_get_ip_packet_dimension( tcp_globals.ip_phone, & tcp_globals.dimensions, socket_data->device_id, & packet_dimension ));
+	ERROR_PROPAGATE(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension));
 	// get a new packet
-	* packet = packet_get_4( tcp_globals.net_phone, TCP_HEADER_SIZE, packet_dimension->addr_len, packet_dimension->prefix, packet_dimension->suffix );
-	if( ! * packet ) return ENOMEM;
+	*packet = packet_get_4(tcp_globals.net_phone, TCP_HEADER_SIZE, packet_dimension->addr_len, packet_dimension->prefix, packet_dimension->suffix);
+	if(! * packet){
+		return ENOMEM;
+	}
 	// allocate space in the packet
-	header = PACKET_SUFFIX( * packet, tcp_header_t );
-	if( ! header ){
-		tcp_release_and_return( * packet, ENOMEM );
-	}
-
-	tcp_prepare_operation_header( socket, socket_data, header, synchronize, finalize );
+	header = PACKET_SUFFIX(*packet, tcp_header_t);
+	if(! header){
+		tcp_release_and_return(*packet, ENOMEM);
+	}
+
+	tcp_prepare_operation_header(socket, socket_data, header, synchronize, finalize);
 	return EOK;
 }
 
-int tcp_accept_message( socket_cores_ref local_sockets, int socket_id, int new_socket_id, size_t * data_fragment_size, size_t * addrlen ){
+int tcp_accept_message(socket_cores_ref local_sockets, int socket_id, int new_socket_id, size_t * data_fragment_size, size_t * addrlen){
 	ERROR_DECLARE;
 
-	socket_core_ref		accepted;
-	socket_core_ref		socket;
-	tcp_socket_data_ref	socket_data;
-	packet_dimension_ref	packet_dimension;
-
-	assert( local_sockets );
-	assert( data_fragment_size );
-	assert( addrlen );
+	socket_core_ref accepted;
+	socket_core_ref socket;
+	tcp_socket_data_ref socket_data;
+	packet_dimension_ref packet_dimension;
+
+	assert(local_sockets);
+	assert(data_fragment_size);
+	assert(addrlen);
 
 	// find the socket
-	socket = socket_cores_find( local_sockets, socket_id );
-	if( ! socket ) return ENOTSOCK;
+	socket = socket_cores_find(local_sockets, socket_id);
+	if(! socket){
+		return ENOTSOCK;
+	}
 	// get the socket specific data
-	socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-	assert( socket_data );
+	socket_data = (tcp_socket_data_ref) socket->specific_data;
+	assert(socket_data);
 
 	// check state
-	if( socket_data->state != TCP_SOCKET_LISTEN ){
+	if(socket_data->state != TCP_SOCKET_LISTEN){
 		return EINVAL;
 	}
 
 	do{
-		socket_id = dyn_fifo_value( & socket->accepted );
-		if( socket_id < 0 ) return ENOTSOCK;
+		socket_id = dyn_fifo_value(&socket->accepted);
+		if(socket_id < 0){
+			return ENOTSOCK;
+		}
 		socket_id *= -1;
 
-		accepted = socket_cores_find( local_sockets, socket_id );
-		if( ! accepted ) return ENOTSOCK;
+		accepted = socket_cores_find(local_sockets, socket_id);
+		if(! accepted){
+			return ENOTSOCK;
+		}
 		// get the socket specific data
-		socket_data = ( tcp_socket_data_ref ) accepted->specific_data;
-		assert( socket_data );
+		socket_data = (tcp_socket_data_ref) accepted->specific_data;
+		assert(socket_data);
 		// TODO can it be in another state?
-		if( socket_data->state == TCP_SOCKET_ESTABLISHED ){
-			ERROR_PROPAGATE( data_reply( socket_data->addr, socket_data->addrlen ));
-			ERROR_PROPAGATE( tl_get_ip_packet_dimension( tcp_globals.ip_phone, & tcp_globals.dimensions, socket_data->device_id, & packet_dimension ));
-			* addrlen = socket_data->addrlen;
-			* data_fragment_size = (( packet_dimension->content < socket_data->data_fragment_size ) ? packet_dimension->content : socket_data->data_fragment_size );
-			if( new_socket_id > 0 ){
-				ERROR_PROPAGATE( socket_cores_update( local_sockets, accepted->socket_id, new_socket_id ));
+		if(socket_data->state == TCP_SOCKET_ESTABLISHED){
+			ERROR_PROPAGATE(data_reply(socket_data->addr, socket_data->addrlen));
+			ERROR_PROPAGATE(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension));
+			*addrlen = socket_data->addrlen;
+			*data_fragment_size = ((packet_dimension->content < socket_data->data_fragment_size) ? packet_dimension->content : socket_data->data_fragment_size);
+			if(new_socket_id > 0){
+				ERROR_PROPAGATE(socket_cores_update(local_sockets, accepted->socket_id, new_socket_id));
 				accepted->socket_id = new_socket_id;
 			}
 		}
-		dyn_fifo_pop( & socket->accepted );
-	}while( socket_data->state != TCP_SOCKET_ESTABLISHED );
-	printf("ret accept %d\n", accepted->socket_id );
+		dyn_fifo_pop(&socket->accepted);
+	}while(socket_data->state != TCP_SOCKET_ESTABLISHED);
+	printf("ret accept %d\n", accepted->socket_id);
 	return accepted->socket_id;
 }
 
-void tcp_free_socket_data( socket_core_ref socket ){
-	tcp_socket_data_ref		socket_data;
-
-	assert( socket );
-
-	printf( "destroy_socket %d\n", socket->socket_id );
+void tcp_free_socket_data(socket_core_ref socket){
+	tcp_socket_data_ref socket_data;
+
+	assert(socket);
+
+	printf("destroy_socket %d\n", socket->socket_id);
 
 	// get the socket specific data
-	socket_data = ( tcp_socket_data_ref ) socket->specific_data;
-	assert( socket_data );
+	socket_data = (tcp_socket_data_ref) socket->specific_data;
+	assert(socket_data);
 	//free the pseudo header
-	if( socket_data->pseudo_header ){
-		if( socket_data->headerlen ){
+	if(socket_data->pseudo_header){
+		if(socket_data->headerlen){
 			printf("d pseudo\n");
-			free( socket_data->pseudo_header );
+			free(socket_data->pseudo_header);
 			socket_data->headerlen = 0;
 		}
@@ -1933,8 +1971,8 @@
 	socket_data->headerlen = 0;
 	// free the address
-	if( socket_data->addr ){
-		if( socket_data->addrlen ){
+	if(socket_data->addr){
+		if(socket_data->addrlen){
 			printf("d addr\n");
-			free( socket_data->addr );
+			free(socket_data->addr);
 			socket_data->addrlen = 0;
 		}
@@ -1944,6 +1982,6 @@
 }
 
-int	tcp_release_and_return( packet_t packet, int result ){
-	pq_release( tcp_globals.net_phone, packet_get_id( packet ));
+int tcp_release_and_return(packet_t packet, int result){
+	pq_release(tcp_globals.net_phone, packet_get_id(packet));
 	return result;
 }
Index: uspace/srv/net/tl/tcp/tcp.h
===================================================================
--- uspace/srv/net/tl/tcp/tcp.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/tcp/tcp.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -150,11 +150,11 @@
 	/** Operation result.
 	 */
-	int					result;
+	int result;
 	/** Safety lock.
 	 */
-	fibril_mutex_t		mutex;
+	fibril_mutex_t mutex;
 	/** Operation result signaling.
 	 */
-	fibril_condvar_t	condvar;
+	fibril_condvar_t condvar;
 };
 
@@ -164,16 +164,16 @@
 	/** TCP socket state.
 	 */
-	tcp_socket_state_t	state;
+	tcp_socket_state_t state;
 	/** Data fragment size.
 	 *  Sending optimalization.
 	 */
-	size_t			data_fragment_size;
+	size_t data_fragment_size;
 	/** Device identifier.
 	 */
-	device_id_t		device_id;
+	device_id_t device_id;
 	/** Listening backlog.
 	 *  The maximal number of connected but not yet accepted sockets.
 	 */
-	int				backlog;
+	int backlog;
 //	/** Segment size.
 //	 */
@@ -182,41 +182,41 @@
 	 *  Set if this socket is an accepted one.
 	 */
-	int				listening_socket_id;
+	int listening_socket_id;
 	/** Treshold size in bytes.
 	 */
-	size_t			treshold;
+	size_t treshold;
 	/** Window size in bytes.
 	 */
-	size_t			window;
+	size_t window;
 	/** Acknowledgement timeout.
 	 */
-	suseconds_t		timeout;
+	suseconds_t timeout;
 	/** Last acknowledged byte.
 	 */
-	uint32_t		acknowledged;
+	uint32_t acknowledged;
 	/** Next incoming sequence number.
 	 */
-	uint32_t		next_incoming;
+	uint32_t next_incoming;
 	/** Incoming FIN.
 	 */
-	uint32_t		fin_incoming;
+	uint32_t fin_incoming;
 	/** Next outgoing sequence number.
 	 */
-	uint32_t		next_outgoing;
+	uint32_t next_outgoing;
 	/** Last outgoing sequence number.
 	 */
-	uint32_t		last_outgoing;
+	uint32_t last_outgoing;
 	/** Outgoing FIN.
 	 */
-	uint32_t		fin_outgoing;
+	uint32_t fin_outgoing;
 	/** Expected sequence number by the remote host.
 	 *  The sequence number the other host expects.
 	 *  The notification is sent only upon a packet reecival.
 	 */
-	uint32_t		expected;
+	uint32_t expected;
 	/** Expected sequence number counter.
 	 *  Counts the number of received notifications for the same sequence number.
 	 */
-	int				expected_count;
+	int expected_count;
 	/** Incoming packet queue.
 	 *  Packets are buffered until received in the right order.
@@ -225,5 +225,5 @@
 	 *  Packets metric is set as their data length.
 	 */
-	packet_t		incoming;
+	packet_t incoming;
 	/** Outgoing packet queue.
 	 *  Packets are buffered until acknowledged by the remote host in the right order.
@@ -232,23 +232,23 @@
 	 *  Packets metric is set as their data length.
 	 */
-	packet_t		outgoing;
+	packet_t outgoing;
 	/** IP pseudo header.
 	 */
-	ip_pseudo_header_ref	pseudo_header;
+	ip_pseudo_header_ref pseudo_header;
 	/** IP pseudo header length.
 	 */
-	size_t			headerlen;
+	size_t headerlen;
 	/** Remote host address.
 	 */
-	struct sockaddr *	addr;
+	struct sockaddr * addr;
 	/** Remote host address length.
 	 */
-	socklen_t			addrlen;
+	socklen_t addrlen;
 	/** Remote host port.
 	 */
-	uint16_t			dest_port;
+	uint16_t dest_port;
 	/** Parent local sockets.
 	 */
-	socket_cores_ref	local_sockets;
+	socket_cores_ref local_sockets;
 	/** Local sockets safety lock.
 	 *  May be locked for writing while holding the global lock for reading when changing the local sockets only.
@@ -258,12 +258,12 @@
 	 *  @see tcp_globals:lock
 	 */
-	fibril_rwlock_t *	local_lock;
+	fibril_rwlock_t * local_lock;
 	/** Pending operation data.
 	 */
-	tcp_operation_t		operation;
+	tcp_operation_t operation;
 	/** Timeouts in a row counter.
 	 *  If TCP_MAX_TIMEOUTS is reached, the connection is lost.
 	 */
-	int					timeout_count;
+	int timeout_count;
 };
 
@@ -273,24 +273,24 @@
 	/** Networking module phone.
 	 */
-	int				net_phone;
+	int net_phone;
 	/** IP module phone.
 	 */
-	int				ip_phone;
+	int ip_phone;
 	/** ICMP module phone.
 	 */
-	int				icmp_phone;
+	int icmp_phone;
 	/** Last used free port.
 	 */
-	int				last_used_port;
+	int last_used_port;
 	/** Active sockets.
 	 */
-	socket_ports_t	sockets;
+	socket_ports_t sockets;
 	/** Device packet dimensions.
 	 */
-	packet_dimensions_t	dimensions;
+	packet_dimensions_t dimensions;
 	/** Safety lock.
 	 *  Write lock is used only for adding or removing socket ports.
 	 */
-	fibril_rwlock_t	lock;
+	fibril_rwlock_t lock;
 };
 
Index: uspace/srv/net/tl/tcp/tcp_header.h
===================================================================
--- uspace/srv/net/tl/tcp/tcp_header.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/tcp/tcp_header.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -43,15 +43,15 @@
 /** TCP header size in bytes.
  */
-#define TCP_HEADER_SIZE			sizeof( tcp_header_t )
+#define TCP_HEADER_SIZE			sizeof(tcp_header_t)
 
 /** Returns the actual TCP header length in bytes.
  *  @param[in] header The TCP packet header.
  */
-#define TCP_HEADER_LENGTH( header )		(( header )->header_length * 4u )
+#define TCP_HEADER_LENGTH(header)		((header)->header_length * 4u)
 
 /** Returns the TCP header length.
  *  @param[in] length The TCP header length in bytes.
  */
-#define TCP_COMPUTE_HEADER_LENGTH( length )		(( uint8_t ) (( length ) / 4u ))
+#define TCP_COMPUTE_HEADER_LENGTH(length)		((uint8_t) ((length) / 4u))
 
 /** Type definition of the transmission datagram header.
@@ -90,17 +90,17 @@
 	/** The source port number.
 	 */
-	uint16_t	source_port;
+	uint16_t source_port;
 	/** The destination port number.
 	 */
-	uint16_t	destination_port;
+	uint16_t destination_port;
 	/** The sequence number of the first data octet in this segment (except when SYN is present).
 	 *  If SYN is present the sequence number is the initial sequence number (ISN) and the first data octet is ISN+1.
 	 */
-	uint32_t	sequence_number;
+	uint32_t sequence_number;
 	/** If the ACK control bit is set this field contains the value of the next sequence number the sender of the segment is expecting to receive.
 	 *  Once a~connection is established this is always sent.
 	 *  @see acknowledge
 	 */
-	uint32_t	acknowledgement_number;
+	uint32_t acknowledgement_number;
 #ifdef ARCH_IS_BIG_ENDIAN
 	/** The number of 32~bit words in the TCP Header.
@@ -108,19 +108,19 @@
 	 *  The TCP header (even one including options) is an integral number of 32~bits long.
 	 */
-	uint8_t	header_length:4;
+	uint8_t header_length:4;
 	/** Four bits reserved for future use.
 	 *  Must be zero.
 	 */
-	uint8_t	reserved1:4;
+	uint8_t reserved1:4;
 #else
 	/** Four bits reserved for future use.
 	 *  Must be zero.
 	 */
-	uint8_t	reserved1:4;
+	uint8_t reserved1:4;
 	/** The number of 32~bit words in the TCP Header.
 	 *  This indicates where the data begins.
 	 *  The TCP header (even one including options) is an integral number of 32~bits long.
 	 */
-	uint8_t	header_length:4;
+	uint8_t header_length:4;
 #endif
 #ifdef ARCH_IS_BIG_ENDIAN
@@ -128,55 +128,55 @@
 	 *  Must be zero.
 	 */
-	uint8_t	reserved2:2;
+	uint8_t reserved2:2;
 	/** Urgent Pointer field significant.
 	 *  @see tcp_header:urgent_pointer
 	 */
-	uint8_t	urgent:1;
+	uint8_t urgent:1;
 	/** Acknowledgment field significant
 	 *  @see tcp_header:acknowledgement_number
 	 */
-	uint8_t	acknowledge:1;
+	uint8_t acknowledge:1;
 	/** Push function.
 	 */
-	uint8_t	push:1;
+	uint8_t push:1;
 	/** Reset the connection.
 	 */
-	uint8_t	reset:1;
+	uint8_t reset:1;
 	/** Synchronize the sequence numbers.
 	 */
-	uint8_t	synchronize:1;
+	uint8_t synchronize:1;
 	/** No more data from the sender.
 	 */
-	uint8_t	finalize:1;
+	uint8_t finalize:1;
 #else
 	/** No more data from the sender.
 	 */
-	uint8_t	finalize:1;
+	uint8_t finalize:1;
 	/** Synchronize the sequence numbers.
 	 */
-	uint8_t	synchronize:1;
+	uint8_t synchronize:1;
 	/** Reset the connection.
 	 */
-	uint8_t	reset:1;
+	uint8_t reset:1;
 	/** Push function.
 	 */
-	uint8_t	push:1;
+	uint8_t push:1;
 	/** Acknowledgment field significant.
 	 *  @see tcp_header:acknowledgement_number
 	 */
-	uint8_t	acknowledge:1;
+	uint8_t acknowledge:1;
 	/** Urgent Pointer field significant.
 	 *  @see tcp_header:urgent_pointer
 	 */
-	uint8_t	urgent:1;
+	uint8_t urgent:1;
 	/** Two bits reserved for future use.
 	 *  Must be zero.
 	 */
-	uint8_t	reserved2:2;
+	uint8_t reserved2:2;
 #endif
 	/** The number of data octets beginning with the one indicated in the acknowledgment field which the sender of this segment is willing to accept.
 	 *  @see tcp_header:acknowledge
 	 */
-	uint16_t	window;
+	uint16_t window;
 	/** The checksum field is the 16~bit one's complement of the one's complement sum of all 16~bit words in the header and text.
 	 *  If a~segment contains an odd number of header and text octets to be checksummed, the last octet is padded on the right with zeros to form a~16~bit word for checksum purposes.
@@ -188,5 +188,5 @@
 	 *  If the computed checksum is zero, it is transmitted as all ones (the equivalent in one's complement arithmetic).
 	 */
-	uint16_t	checksum;
+	uint16_t checksum;
 	/** This field communicates the current value of the urgent pointer as a~positive offset from the sequence number in this segment.
 	 *  The urgent pointer points to the sequence number of the octet following the urgent data.
@@ -194,5 +194,5 @@
 	 *  @see tcp_header:urgent
 	 */
-	uint16_t	urgent_pointer;
+	uint16_t urgent_pointer;
 } __attribute__ ((packed));
 
@@ -202,8 +202,8 @@
 	/** Option type.
 	 */
-	uint8_t		type;
+	uint8_t type;
 	/** Option length.
 	 */
-	uint8_t		length;
+	uint8_t length;
 };
 
@@ -215,8 +215,8 @@
 	 *  @see TCPOPT_MAX_SEGMENT_SIZE_LENGTH
 	 */
-	tcp_option_t	option;
+	tcp_option_t option;
 	/** Maximum segment size in bytes.
 	 */
-	uint16_t		max_segment_size;
+	uint16_t max_segment_size;
 } __attribute__ ((packed));
 
Index: uspace/srv/net/tl/tcp/tcp_module.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp_module.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/tcp/tcp_module.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -63,5 +63,5 @@
  *  @see NAME
  */
-void	module_print_name( void );
+void module_print_name(void);
 
 /** Starts the TCP module.
@@ -72,5 +72,5 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int	module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
 /** Processes the TCP message.
@@ -82,5 +82,5 @@
  *  @returns Other error codes as defined for the tcp_message() function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** TCP module global data.
@@ -88,18 +88,18 @@
 extern tcp_globals_t	tcp_globals;
 
-void module_print_name( void ){
-	printf( "%s", NAME );
+void module_print_name(void){
+	printf("%s", NAME);
 }
 
-int module_start( async_client_conn_t client_connection ){
+int module_start(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ipcarg_t	phonehash;
+	ipcarg_t phonehash;
 
-	async_set_client_connection( client_connection );
-	tcp_globals.net_phone = net_connect_module( SERVICE_NETWORKING );
-	ERROR_PROPAGATE( pm_init());
-	if( ERROR_OCCURRED( tcp_initialize( client_connection ))
-	|| ERROR_OCCURRED( REGISTER_ME( SERVICE_TCP, & phonehash ))){
+	async_set_client_connection(client_connection);
+	tcp_globals.net_phone = net_connect_module(SERVICE_NETWORKING);
+	ERROR_PROPAGATE(pm_init());
+	if(ERROR_OCCURRED(tcp_initialize(client_connection))
+		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_TCP, &phonehash))){
 		pm_destroy();
 		return ERROR_CODE;
@@ -112,6 +112,6 @@
 }
 
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	return tcp_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return tcp_message(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/tl/tcp/tcp_module.h
===================================================================
--- uspace/srv/net/tl/tcp/tcp_module.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/tcp/tcp_module.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -47,5 +47,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	tcp_initialize( async_client_conn_t client_connection );
+int tcp_initialize(async_client_conn_t client_connection);
 
 /** Processes the TCP message.
@@ -59,5 +59,5 @@
  *  @see IS_NET_TCP_MESSAGE()
  */
-int	tcp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/tl/tl_common.c
===================================================================
--- uspace/srv/net/tl/tl_common.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/tl_common.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -55,21 +55,27 @@
 #include "tl_common.h"
 
-DEVICE_MAP_IMPLEMENT( packet_dimensions, packet_dimension_t );
-
-int tl_get_address_port( const struct sockaddr * addr, int addrlen, uint16_t * port ){
-	const struct sockaddr_in *	address_in;
-	const struct sockaddr_in6 *	address_in6;
-
-	if(( addrlen <= 0 ) || (( size_t ) addrlen < sizeof( struct sockaddr ))) return EINVAL;
-	switch( addr->sa_family ){
+DEVICE_MAP_IMPLEMENT(packet_dimensions, packet_dimension_t);
+
+int tl_get_address_port(const struct sockaddr * addr, int addrlen, uint16_t * port){
+	const struct sockaddr_in * address_in;
+	const struct sockaddr_in6 * address_in6;
+
+	if((addrlen <= 0) || ((size_t) addrlen < sizeof(struct sockaddr))){
+		return EINVAL;
+	}
+	switch(addr->sa_family){
 		case AF_INET:
-			if( addrlen != sizeof( struct sockaddr_in )) return EINVAL;
-			address_in = ( struct sockaddr_in * ) addr;
-			* port = ntohs( address_in->sin_port );
+			if(addrlen != sizeof(struct sockaddr_in)){
+				return EINVAL;
+			}
+			address_in = (struct sockaddr_in *) addr;
+			*port = ntohs(address_in->sin_port);
 			break;
 		case AF_INET6:
-			if( addrlen != sizeof( struct sockaddr_in6 )) return EINVAL;
-			address_in6 = ( struct sockaddr_in6 * ) addr;
-			* port = ntohs( address_in6->sin6_port );
+			if(addrlen != sizeof(struct sockaddr_in6)){
+				return EINVAL;
+			}
+			address_in6 = (struct sockaddr_in6 *) addr;
+			*port = ntohs(address_in6->sin6_port);
 			break;
 		default:
@@ -79,21 +85,25 @@
 }
 
-int tl_get_ip_packet_dimension( int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension ){
+int tl_get_ip_packet_dimension(int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension){
 	ERROR_DECLARE;
 
-	if( ! packet_dimension ) return EBADMEM;
-
-	* packet_dimension = packet_dimensions_find( packet_dimensions, device_id );
-	if( ! * packet_dimension ){
+	if(! packet_dimension){
+		return EBADMEM;
+	}
+
+	*packet_dimension = packet_dimensions_find(packet_dimensions, device_id);
+	if(! * packet_dimension){
 		// ask for and remember them if not found
-		* packet_dimension = malloc( sizeof( ** packet_dimension ));
-		if( ! * packet_dimension ) return ENOMEM;
-		if( ERROR_OCCURRED( ip_packet_size_req( ip_phone, device_id, * packet_dimension ))){
-			free( * packet_dimension );
+		*packet_dimension = malloc(sizeof(** packet_dimension));
+		if(! * packet_dimension){
+			return ENOMEM;
+		}
+		if(ERROR_OCCURRED(ip_packet_size_req(ip_phone, device_id, * packet_dimension))){
+			free(*packet_dimension);
 			return ERROR_CODE;
 		}
-		ERROR_CODE = packet_dimensions_add( packet_dimensions, device_id, * packet_dimension );
-		if( ERROR_CODE < 0 ){
-			free( * packet_dimension );
+		ERROR_CODE = packet_dimensions_add(packet_dimensions, device_id, * packet_dimension);
+		if(ERROR_CODE < 0){
+			free(*packet_dimension);
 			return ERROR_CODE;
 		}
@@ -102,17 +112,19 @@
 }
 
-int tl_update_ip_packet_dimension( packet_dimensions_ref packet_dimensions, device_id_t device_id, size_t content ){
-	packet_dimension_ref	packet_dimension;
-
-	packet_dimension = packet_dimensions_find( packet_dimensions, device_id );
-	if( ! packet_dimension ) return ENOENT;
+int tl_update_ip_packet_dimension(packet_dimensions_ref packet_dimensions, device_id_t device_id, size_t content){
+	packet_dimension_ref packet_dimension;
+
+	packet_dimension = packet_dimensions_find(packet_dimensions, device_id);
+	if(! packet_dimension){
+		return ENOENT;
+	}
 	packet_dimension->content = content;
-	if( device_id != DEVICE_INVALID_ID ){
-		packet_dimension = packet_dimensions_find( packet_dimensions, DEVICE_INVALID_ID );
-		if( packet_dimension ){
-			if( packet_dimension->content >= content ){
+	if(device_id != DEVICE_INVALID_ID){
+		packet_dimension = packet_dimensions_find(packet_dimensions, DEVICE_INVALID_ID);
+		if(packet_dimension){
+			if(packet_dimension->content >= content){
 				packet_dimension->content = content;
 			}else{
-				packet_dimensions_exclude( packet_dimensions, DEVICE_INVALID_ID );
+				packet_dimensions_exclude(packet_dimensions, DEVICE_INVALID_ID);
 			}
 		}
@@ -121,22 +133,30 @@
 }
 
-int tl_set_address_port( struct sockaddr * addr, int addrlen, uint16_t port ){
-	struct sockaddr_in *	address_in;
-	struct sockaddr_in6 *	address_in6;
-	size_t					length;
-
-	if( addrlen < 0 ) return EINVAL;
-	length = ( size_t ) addrlen;
-	if( length < sizeof( struct sockaddr )) return EINVAL;
-	switch( addr->sa_family ){
+int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port){
+	struct sockaddr_in * address_in;
+	struct sockaddr_in6 * address_in6;
+	size_t length;
+
+	if(addrlen < 0){
+		return EINVAL;
+	}
+	length = (size_t) addrlen;
+	if(length < sizeof(struct sockaddr)){
+		return EINVAL;
+	}
+	switch(addr->sa_family){
 		case AF_INET:
-			if( length != sizeof( struct sockaddr_in )) return EINVAL;
-			address_in = ( struct sockaddr_in * ) addr;
-			address_in->sin_port = htons( port );
+			if(length != sizeof(struct sockaddr_in)){
+				return EINVAL;
+			}
+			address_in = (struct sockaddr_in *) addr;
+			address_in->sin_port = htons(port);
 			return EOK;
 		case AF_INET6:
-			if( length != sizeof( struct sockaddr_in6 )) return EINVAL;
-			address_in6 = ( struct sockaddr_in6 * ) addr;
-			address_in6->sin6_port = htons( port );
+			if(length != sizeof(struct sockaddr_in6)){
+				return EINVAL;
+			}
+			address_in6 = (struct sockaddr_in6 *) addr;
+			address_in6->sin6_port = htons(port);
 			return EOK;
 		default:
@@ -145,54 +165,60 @@
 }
 
-int tl_prepare_icmp_packet( int packet_phone, int icmp_phone, packet_t packet, services_t error ){
-	packet_t	next;
-	uint8_t *	src;
-	int			length;
+int tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet, services_t error){
+	packet_t next;
+	uint8_t * src;
+	int length;
 
 	// detach the first packet and release the others
-	next = pq_detach( packet );
-	if( next ){
-		pq_release( packet_phone, packet_get_id( next ));
-	}
-	length = packet_get_addr( packet, & src, NULL );
-	if(( length > 0 )
-	&& ( ! error )
-	&& ( icmp_phone >= 0 )
+	next = pq_detach(packet);
+	if(next){
+		pq_release(packet_phone, packet_get_id(next));
+	}
+	length = packet_get_addr(packet, &src, NULL);
+	if((length > 0)
+		&& (! error)
+		&& (icmp_phone >= 0)
 	// set both addresses to the source one (avoids the source address deletion before setting the destination one)
-	&& ( packet_set_addr( packet, src, src, ( size_t ) length ) == EOK )){
+		&& (packet_set_addr(packet, src, src, (size_t) length) == EOK)){
 		return EOK;
 	}else{
-		pq_release( packet_phone, packet_get_id( packet ));
+		pq_release(packet_phone, packet_get_id(packet));
 	}
 	return ENOENT;
 }
 
-int tl_socket_read_packet_data( int packet_phone, packet_ref packet, size_t prefix, const packet_dimension_ref dimension, const struct sockaddr * addr, socklen_t addrlen ){
+int tl_socket_read_packet_data(int packet_phone, packet_ref packet, size_t prefix, const packet_dimension_ref dimension, const struct sockaddr * addr, socklen_t addrlen){
 	ERROR_DECLARE;
 
-	ipc_callid_t	callid;
-	size_t			length;
-	void *			data;
-
-	if( ! dimension ) return EINVAL;
+	ipc_callid_t callid;
+	size_t length;
+	void * data;
+
+	if(! dimension){
+		return EINVAL;
+	}
 	// get the data length
-	if( ! async_data_write_receive( & callid, & length )) return EINVAL;
+	if(! async_data_write_receive(&callid, &length)){
+		return EINVAL;
+	}
 	// get a new packet
-	* packet = packet_get_4( packet_phone, length, dimension->addr_len, prefix + dimension->prefix, dimension->suffix );
-	if( ! packet ) return ENOMEM;
+	*packet = packet_get_4(packet_phone, length, dimension->addr_len, prefix + dimension->prefix, dimension->suffix);
+	if(! packet){
+		return ENOMEM;
+	}
 	// allocate space in the packet
-	data = packet_suffix( * packet, length );
-	if( ! data ){
-		pq_release( packet_phone, packet_get_id( * packet ));
+	data = packet_suffix(*packet, length);
+	if(! data){
+		pq_release(packet_phone, packet_get_id(*packet));
 		return ENOMEM;
 	}
 	// read the data into the packet
-	if( ERROR_OCCURRED( async_data_write_finalize( callid, data, length ))
+	if(ERROR_OCCURRED(async_data_write_finalize(callid, data, length))
 	// set the packet destination address
-	|| ERROR_OCCURRED( packet_set_addr( * packet, NULL, ( uint8_t * ) addr, addrlen ))){
-		pq_release( packet_phone, packet_get_id( * packet ));
+		|| ERROR_OCCURRED(packet_set_addr(*packet, NULL, (uint8_t *) addr, addrlen))){
+		pq_release(packet_phone, packet_get_id(*packet));
 		return ERROR_CODE;
 	}
-	return ( int ) length;
+	return (int) length;
 }
 
Index: uspace/srv/net/tl/tl_common.h
===================================================================
--- uspace/srv/net/tl/tl_common.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/tl_common.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -48,5 +48,5 @@
  *  @see device.h
  */
-DEVICE_MAP_DECLARE( packet_dimensions, packet_dimension_t );
+DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t);
 
 /** Gets the address port.
@@ -59,5 +59,5 @@
  *  @returns EAFNOSUPPORT if the address family is not supported.
  */
-int	tl_get_address_port( const struct sockaddr * addr, int addrlen, uint16_t * port );
+int tl_get_address_port(const struct sockaddr * addr, int addrlen, uint16_t * port);
 
 /** Gets IP packet dimensions.
@@ -74,5 +74,5 @@
  *  @returns Other codes as defined for the ip_packet_size_req() function.
  */
-int	tl_get_ip_packet_dimension( int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension );
+int tl_get_ip_packet_dimension(int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension);
 
 /** Updates IP device packet dimensions cache.
@@ -83,5 +83,5 @@
  *  @returns ENOENT if the packet dimension is not cached.
  */
-int	tl_update_ip_packet_dimension( packet_dimensions_ref packet_dimensions, device_id_t device_id, size_t content );
+int tl_update_ip_packet_dimension(packet_dimensions_ref packet_dimensions, device_id_t device_id, size_t content);
 
 /** Sets the address port.
@@ -94,5 +94,5 @@
  *  @returns EAFNOSUPPORT if the address family is not supported.
  */
-int	tl_set_address_port( struct sockaddr * addr, int addrlen, uint16_t port );
+int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port);
 
 /** Prepares the packet for ICMP error notification.
@@ -106,5 +106,5 @@
  *  @returns ENOENT if no packet may be sent.
  */
-int	tl_prepare_icmp_packet( int packet_phone, int icmp_phone, packet_t packet, services_t error );
+int tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet, services_t error);
 
 /** Receives data from the socket into a packet.
@@ -120,5 +120,5 @@
  *  @returns Other error codes as defined for the async_data_read_finalize() function.
  */
-int	tl_socket_read_packet_data( int packet_phone, packet_ref packet, size_t prefix, const packet_dimension_ref dimension, const struct sockaddr * addr, socklen_t addrlen );
+int tl_socket_read_packet_data(int packet_phone, packet_ref packet, size_t prefix, const packet_dimension_ref dimension, const struct sockaddr * addr, socklen_t addrlen);
 
 #endif
Index: uspace/srv/net/tl/udp/udp.c
===================================================================
--- uspace/srv/net/tl/udp/udp.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/udp/udp.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -104,5 +104,5 @@
  *  @returns Other error codes as defined for the udp_process_packet() function.
  */
-int	udp_received_msg( device_id_t device_id, packet_t packet, services_t receiver, services_t error );
+int udp_received_msg(device_id_t device_id, packet_t packet, services_t receiver, services_t error);
 
 /** Processes the received UDP packet queue.
@@ -121,5 +121,5 @@
  *  @returns Other error codes as defined for the ip_client_process_packet() function.
  */
-int udp_process_packet( device_id_t device_id, packet_t packet, services_t error );
+int udp_process_packet(device_id_t device_id, packet_t packet, services_t error);
 
 /** Releases the packet and returns the result.
@@ -128,5 +128,5 @@
  *  @return The result parameter.
  */
-int	udp_release_and_return( packet_t packet, int result );
+int udp_release_and_return(packet_t packet, int result);
 
 /** @name Socket messages processing functions
@@ -141,5 +141,5 @@
  *  @see socket.h
  */
-int udp_process_client_messages( ipc_callid_t callid, ipc_call_t call );
+int udp_process_client_messages(ipc_callid_t callid, ipc_call_t call);
 
 /** Sends data from the socket to the remote address.
@@ -164,5 +164,5 @@
  *  @returns Other error codes as defined for the ip_send_msg() function.
  */
-int udp_sendto_message( socket_cores_ref local_sockets, int socket_id, const struct sockaddr * addr, socklen_t addrlen, int fragments, size_t * data_fragment_size, int flags );
+int udp_sendto_message(socket_cores_ref local_sockets, int socket_id, const struct sockaddr * addr, socklen_t addrlen, int fragments, size_t * data_fragment_size, int flags);
 
 /** Receives data to the socket.
@@ -181,5 +181,5 @@
  *  @returns Other error codes as defined for the data_reply() function.
  */
-int	udp_recvfrom_message( socket_cores_ref local_sockets, int socket_id, int flags, size_t * addrlen );
+int udp_recvfrom_message(socket_cores_ref local_sockets, int socket_id, int flags, size_t * addrlen);
 
 /*@}*/
@@ -189,54 +189,54 @@
 udp_globals_t	udp_globals;
 
-int udp_initialize( async_client_conn_t client_connection ){
+int udp_initialize(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	measured_string_t	names[] = {{ str_dup("UDP_CHECKSUM_COMPUTING"), 22 }, { str_dup("UDP_AUTOBINDING"), 15 }};
-	measured_string_ref	configuration;
-	size_t				count = sizeof( names ) / sizeof( measured_string_t );
-	char *				data;
-
-	fibril_rwlock_initialize( & udp_globals.lock );
-	fibril_rwlock_write_lock( & udp_globals.lock );
-	udp_globals.icmp_phone = icmp_connect_module( SERVICE_ICMP, ICMP_CONNECT_TIMEOUT );
-	udp_globals.ip_phone = ip_bind_service( SERVICE_IP, IPPROTO_UDP, SERVICE_UDP, client_connection, udp_received_msg );
-	if( udp_globals.ip_phone < 0 ){
+	measured_string_t names[] = {{str_dup("UDP_CHECKSUM_COMPUTING"), 22}, {str_dup("UDP_AUTOBINDING"), 15}};
+	measured_string_ref configuration;
+	size_t count = sizeof(names) / sizeof(measured_string_t);
+	char * data;
+
+	fibril_rwlock_initialize(&udp_globals.lock);
+	fibril_rwlock_write_lock(&udp_globals.lock);
+	udp_globals.icmp_phone = icmp_connect_module(SERVICE_ICMP, ICMP_CONNECT_TIMEOUT);
+	udp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_UDP, SERVICE_UDP, client_connection, udp_received_msg);
+	if(udp_globals.ip_phone < 0){
 		return udp_globals.ip_phone;
 	}
 	// read default packet dimensions
-	ERROR_PROPAGATE( ip_packet_size_req( udp_globals.ip_phone, -1, & udp_globals.packet_dimension ));
-	ERROR_PROPAGATE( socket_ports_initialize( & udp_globals.sockets ));
-	if( ERROR_OCCURRED( packet_dimensions_initialize( & udp_globals.dimensions ))){
-		socket_ports_destroy( & udp_globals.sockets );
+	ERROR_PROPAGATE(ip_packet_size_req(udp_globals.ip_phone, -1, &udp_globals.packet_dimension));
+	ERROR_PROPAGATE(socket_ports_initialize(&udp_globals.sockets));
+	if(ERROR_OCCURRED(packet_dimensions_initialize(&udp_globals.dimensions))){
+		socket_ports_destroy(&udp_globals.sockets);
 		return ERROR_CODE;
 	}
-	udp_globals.packet_dimension.prefix += sizeof( udp_header_t );
-	udp_globals.packet_dimension.content -= sizeof( udp_header_t );
+	udp_globals.packet_dimension.prefix += sizeof(udp_header_t);
+	udp_globals.packet_dimension.content -= sizeof(udp_header_t);
 	udp_globals.last_used_port = UDP_FREE_PORTS_START - 1;
 	// get configuration
 	udp_globals.checksum_computing = NET_DEFAULT_UDP_CHECKSUM_COMPUTING;
 	udp_globals.autobinding = NET_DEFAULT_UDP_AUTOBINDING;
-	configuration = & names[ 0 ];
-	ERROR_PROPAGATE( net_get_conf_req( udp_globals.net_phone, & configuration, count, & data ));
-	if( configuration ){
-		if( configuration[ 0 ].value ){
-			udp_globals.checksum_computing = ( configuration[ 0 ].value[ 0 ] == 'y' );
-		}
-		if( configuration[ 1 ].value ){
-			udp_globals.autobinding = ( configuration[ 1 ].value[ 0 ] == 'y' );
-		}
-		net_free_settings( configuration, data );
-	}
-	fibril_rwlock_write_unlock( & udp_globals.lock );
+	configuration = &names[0];
+	ERROR_PROPAGATE(net_get_conf_req(udp_globals.net_phone, &configuration, count, &data));
+	if(configuration){
+		if(configuration[0].value){
+			udp_globals.checksum_computing = (configuration[0].value[0] == 'y');
+		}
+		if(configuration[1].value){
+			udp_globals.autobinding = (configuration[1].value[0] == 'y');
+		}
+		net_free_settings(configuration, data);
+	}
+	fibril_rwlock_write_unlock(&udp_globals.lock);
 	return EOK;
 }
 
-int	udp_received_msg( device_id_t device_id, packet_t packet, services_t receiver, services_t error ){
-	int	result;
-
-	fibril_rwlock_write_lock( & udp_globals.lock );
-	result = udp_process_packet( device_id, packet, error );
-	if( result != EOK ){
-		fibril_rwlock_write_unlock( & udp_globals.lock );
+int udp_received_msg(device_id_t device_id, packet_t packet, services_t receiver, services_t error){
+	int result;
+
+	fibril_rwlock_write_lock(&udp_globals.lock);
+	result = udp_process_packet(device_id, packet, error);
+	if(result != EOK){
+		fibril_rwlock_write_unlock(&udp_globals.lock);
 	}
 
@@ -244,73 +244,73 @@
 }
 
-int udp_process_packet( device_id_t device_id, packet_t packet, services_t error ){
+int udp_process_packet(device_id_t device_id, packet_t packet, services_t error){
 	ERROR_DECLARE;
 
-	size_t			length;
-	size_t			offset;
-	int				result;
-	udp_header_ref	header;
-	socket_core_ref	socket;
-	packet_t		next_packet;
-	size_t			total_length;
-	uint32_t		checksum;
-	int				fragments;
-	packet_t		tmp_packet;
-	icmp_type_t		type;
-	icmp_code_t		code;
-	ip_pseudo_header_ref	ip_header;
-	struct sockaddr *		src;
-	struct sockaddr *		dest;
-	packet_dimension_ref	packet_dimension;
-
-	if( error ){
-		switch( error ){
+	size_t length;
+	size_t offset;
+	int result;
+	udp_header_ref header;
+	socket_core_ref socket;
+	packet_t next_packet;
+	size_t total_length;
+	uint32_t checksum;
+	int fragments;
+	packet_t tmp_packet;
+	icmp_type_t type;
+	icmp_code_t code;
+	ip_pseudo_header_ref ip_header;
+	struct sockaddr * src;
+	struct sockaddr * dest;
+	packet_dimension_ref packet_dimension;
+
+	if(error){
+		switch(error){
 			case SERVICE_ICMP:
 				// ignore error
-				// length = icmp_client_header_length( packet );
+				// length = icmp_client_header_length(packet);
 				// process error
-				result = icmp_client_process_packet( packet, & type, & code, NULL, NULL );
-				if( result < 0 ){
-					return udp_release_and_return( packet, result );
+				result = icmp_client_process_packet(packet, &type, &code, NULL, NULL);
+				if(result < 0){
+					return udp_release_and_return(packet, result);
 				}
-				length = ( size_t ) result;
-				if( ERROR_OCCURRED( packet_trim( packet, length, 0 ))){
-					return udp_release_and_return( packet, ERROR_CODE );
+				length = (size_t) result;
+				if(ERROR_OCCURRED(packet_trim(packet, length, 0))){
+					return udp_release_and_return(packet, ERROR_CODE);
 				}
 				break;
 			default:
-				return udp_release_and_return( packet, ENOTSUP );
+				return udp_release_and_return(packet, ENOTSUP);
 		}
 	}
 	// TODO process received ipopts?
-	result = ip_client_process_packet( packet, NULL, NULL, NULL, NULL, NULL );
-	if( result < 0 ){
-		return udp_release_and_return( packet, result );
-	}
-	offset = ( size_t ) result;
-
-	length = packet_get_data_length( packet );
-	if( length <= 0 ){
-		return udp_release_and_return( packet, EINVAL );
-	}
-	if( length < UDP_HEADER_SIZE + offset ){
-		return udp_release_and_return( packet, NO_DATA );
+	result = ip_client_process_packet(packet, NULL, NULL, NULL, NULL, NULL);
+	if(result < 0){
+		return udp_release_and_return(packet, result);
+	}
+	offset = (size_t) result;
+
+	length = packet_get_data_length(packet);
+	if(length <= 0){
+		return udp_release_and_return(packet, EINVAL);
+	}
+	if(length < UDP_HEADER_SIZE + offset){
+		return udp_release_and_return(packet, NO_DATA);
 	}
 
 	// trim all but UDP header
-	if( ERROR_OCCURRED( packet_trim( packet, offset, 0 ))){
-		return udp_release_and_return( packet, ERROR_CODE );
+	if(ERROR_OCCURRED(packet_trim(packet, offset, 0))){
+		return udp_release_and_return(packet, ERROR_CODE);
 	}
 
 	// get udp header
-	header = ( udp_header_ref ) packet_get_data( packet );
-	if( ! header ){
-		return udp_release_and_return( packet, NO_DATA );
+	header = (udp_header_ref) packet_get_data(packet);
+	if(! header){
+		return udp_release_and_return(packet, NO_DATA);
 	}
 	// find the destination socket
-	socket = socket_port_find( & udp_globals.sockets, ntohs( header->destination_port ), SOCKET_MAP_KEY_LISTENING, 0 );
-	if( ! socket ){
-		if( tl_prepare_icmp_packet( udp_globals.net_phone, udp_globals.icmp_phone, packet, error ) == EOK ){
-			icmp_destination_unreachable_msg( udp_globals.icmp_phone, ICMP_PORT_UNREACH, 0, packet );
+	socket = socket_port_find(&udp_globals.sockets, ntohs(header->destination_port), SOCKET_MAP_KEY_LISTENING, 0);
+	if(! socket){
+		if(tl_prepare_icmp_packet(udp_globals.net_phone, udp_globals.icmp_phone, packet, error) == EOK){
+			icmp_destination_unreachable_msg(udp_globals.icmp_phone, ICMP_PORT_UNREACH, 0, packet);
 		}
 		return EADDRNOTAVAIL;
@@ -320,17 +320,17 @@
 	next_packet = packet;
 	fragments = 0;
-	total_length = ntohs( header->total_length );
+	total_length = ntohs(header->total_length);
 	// compute header checksum if set
-	if( header->checksum && ( ! error )){
-		result = packet_get_addr( packet, ( uint8_t ** ) & src, ( uint8_t ** ) & dest );
-		if( result <= 0 ){
-			return udp_release_and_return( packet, result );
-		}
-		if( ERROR_OCCURRED( ip_client_get_pseudo_header( IPPROTO_UDP, src, result, dest, result, total_length, & ip_header, & length ))){
-			return udp_release_and_return( packet, ERROR_CODE );
+	if(header->checksum && (! error)){
+		result = packet_get_addr(packet, (uint8_t **) &src, (uint8_t **) &dest);
+		if(result <= 0){
+			return udp_release_and_return(packet, result);
+		}
+		if(ERROR_OCCURRED(ip_client_get_pseudo_header(IPPROTO_UDP, src, result, dest, result, total_length, &ip_header, &length))){
+			return udp_release_and_return(packet, ERROR_CODE);
 		}else{
-			checksum = compute_checksum( 0, ip_header, length );
+			checksum = compute_checksum(0, ip_header, length);
 			// the udp header checksum will be added with the first fragment later
-			free( ip_header );
+			free(ip_header);
 		}
 	}else{
@@ -341,21 +341,21 @@
 	do{
 		++ fragments;
-		length = packet_get_data_length( next_packet );
-		if( length <= 0 ){
-			return udp_release_and_return( packet, NO_DATA );
-		}
-		if( total_length < length ){
-			if( ERROR_OCCURRED( packet_trim( next_packet, 0, length - total_length ))){
-				return udp_release_and_return( packet, ERROR_CODE );
+		length = packet_get_data_length(next_packet);
+		if(length <= 0){
+			return udp_release_and_return(packet, NO_DATA);
+		}
+		if(total_length < length){
+			if(ERROR_OCCURRED(packet_trim(next_packet, 0, length - total_length))){
+				return udp_release_and_return(packet, ERROR_CODE);
 			}
 			// add partial checksum if set
-			if( header->checksum ){
-				checksum = compute_checksum( checksum, packet_get_data( packet ), packet_get_data_length( packet ));
+			if(header->checksum){
+				checksum = compute_checksum(checksum, packet_get_data(packet), packet_get_data_length(packet));
 			}
 			// relese the rest of the packet fragments
-			tmp_packet = pq_next( next_packet );
-			while( tmp_packet ){
-				next_packet = pq_detach( tmp_packet );
-				pq_release( udp_globals.net_phone, packet_get_id( tmp_packet ));
+			tmp_packet = pq_next(next_packet);
+			while(tmp_packet){
+				next_packet = pq_detach(tmp_packet);
+				pq_release(udp_globals.net_phone, packet_get_id(tmp_packet));
 				tmp_packet = next_packet;
 			}
@@ -365,15 +365,15 @@
 		total_length -= length;
 		// add partial checksum if set
-		if( header->checksum ){
-			checksum = compute_checksum( checksum, packet_get_data( packet ), packet_get_data_length( packet ));
-		}
-	}while(( next_packet = pq_next( next_packet )) && ( total_length > 0 ));
+		if(header->checksum){
+			checksum = compute_checksum(checksum, packet_get_data(packet), packet_get_data_length(packet));
+		}
+	}while((next_packet = pq_next(next_packet)) && (total_length > 0));
 
 	// check checksum
-	if( header->checksum ){
-		if( flip_checksum( compact_checksum( checksum )) != IP_CHECKSUM_ZERO ){
-			if( tl_prepare_icmp_packet( udp_globals.net_phone, udp_globals.icmp_phone, packet, error ) == EOK ){
+	if(header->checksum){
+		if(flip_checksum(compact_checksum(checksum)) != IP_CHECKSUM_ZERO){
+			if(tl_prepare_icmp_packet(udp_globals.net_phone, udp_globals.icmp_phone, packet, error) == EOK){
 				// checksum error ICMP
-				icmp_parameter_problem_msg( udp_globals.icmp_phone, ICMP_PARAM_POINTER, (( size_t ) (( void * ) & header->checksum )) - (( size_t ) (( void * ) header )), packet );
+				icmp_parameter_problem_msg(udp_globals.icmp_phone, ICMP_PARAM_POINTER, ((size_t) ((void *) &header->checksum)) - ((size_t) ((void *) header)), packet);
 			}
 			return EINVAL;
@@ -382,45 +382,43 @@
 
 	// queue the received packet
-	if( ERROR_OCCURRED( dyn_fifo_push( & socket->received, packet_get_id( packet ), SOCKET_MAX_RECEIVED_SIZE ))
-	|| ERROR_OCCURRED( tl_get_ip_packet_dimension( udp_globals.ip_phone, & udp_globals.dimensions, device_id, & packet_dimension ))){
-		return udp_release_and_return( packet, ERROR_CODE );
+	if(ERROR_OCCURRED(dyn_fifo_push(&socket->received, packet_get_id(packet), SOCKET_MAX_RECEIVED_SIZE))
+		|| ERROR_OCCURRED(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, device_id, &packet_dimension))){
+		return udp_release_and_return(packet, ERROR_CODE);
 	}
 
 	// notify the destination socket
-	fibril_rwlock_write_unlock( & udp_globals.lock );
-	async_msg_5( socket->phone, NET_SOCKET_RECEIVED, ( ipcarg_t ) socket->socket_id, packet_dimension->content, 0, 0, ( ipcarg_t ) fragments );
-/*	fibril_rwlock_write_unlock( & udp_globals.lock );
-	async_msg_5( socket->phone, NET_SOCKET_RECEIVED, ( ipcarg_t ) socket->socket_id, 0, 0, 0, ( ipcarg_t ) fragments );
-*/	return EOK;
-}
-
-int udp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
+	fibril_rwlock_write_unlock(&udp_globals.lock);
+	async_msg_5(socket->phone, NET_SOCKET_RECEIVED, (ipcarg_t) socket->socket_id, packet_dimension->content, 0, 0, (ipcarg_t) fragments);
+	return EOK;
+}
+
+int udp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
-	packet_t	packet;
-
-	* answer_count = 0;
-	switch( IPC_GET_METHOD( * call )){
+	packet_t packet;
+
+	*answer_count = 0;
+	switch(IPC_GET_METHOD(*call)){
 		case NET_TL_RECEIVED:
-			if( ! ERROR_OCCURRED( packet_translate( udp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){
-				ERROR_CODE = udp_received_msg( IPC_GET_DEVICE( call ), packet, SERVICE_UDP, IPC_GET_ERROR( call ));
+			if(! ERROR_OCCURRED(packet_translate(udp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+				ERROR_CODE = udp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_UDP, IPC_GET_ERROR(call));
 			}
 			return ERROR_CODE;
 		case IPC_M_CONNECT_TO_ME:
-			return udp_process_client_messages( callid, * call );
+			return udp_process_client_messages(callid, * call);
 	}
 	return ENOTSUP;
 }
 
-int udp_process_client_messages( ipc_callid_t callid, ipc_call_t call ){
-	int						res;
-	bool					keep_on_going = true;
-	socket_cores_t			local_sockets;
-	int						app_phone = IPC_GET_PHONE( & call );
-	struct sockaddr *		addr;
-	size_t					addrlen;
-	ipc_call_t				answer;
-	int						answer_count;
-	packet_dimension_ref	packet_dimension;
+int udp_process_client_messages(ipc_callid_t callid, ipc_call_t call){
+	int res;
+	bool keep_on_going = true;
+	socket_cores_t local_sockets;
+	int app_phone = IPC_GET_PHONE(&call);
+	struct sockaddr * addr;
+	size_t addrlen;
+	ipc_call_t answer;
+	int answer_count;
+	packet_dimension_ref packet_dimension;
 
 	/*
@@ -428,63 +426,69 @@
 	 *  - Answer the first IPC_M_CONNECT_TO_ME call.
 	 */
-	ipc_answer_0( callid, EOK );
+	res = EOK;
+	answer_count = 0;
 
 	// The client connection is only in one fibril and therefore no additional locks are needed.
 
-	socket_cores_initialize( & local_sockets );
-
-	while( keep_on_going ){
+	socket_cores_initialize(&local_sockets);
+
+	while(keep_on_going){
+
+		// answer the call
+		answer_call(callid, res, &answer, answer_count);
+
 		// refresh data
-		refresh_answer( & answer, & answer_count );
-
-		callid = async_get_call( & call );
-//		printf( "message %d\n", IPC_GET_METHOD( * call ));
-
-		switch( IPC_GET_METHOD( call )){
+		refresh_answer(&answer, &answer_count);
+
+		// get the next call
+		callid = async_get_call(&call);
+
+		// process the call
+		switch(IPC_GET_METHOD(call)){
 			case IPC_M_PHONE_HUNGUP:
 				keep_on_going = false;
-				res = EOK;
+				res = EHANGUP;
 				break;
 			case NET_SOCKET:
-				* SOCKET_SET_SOCKET_ID( answer ) = SOCKET_GET_SOCKET_ID( call );
-				res = socket_create( & local_sockets, app_phone, NULL, SOCKET_SET_SOCKET_ID( answer ));
-				if( res == EOK ){
-					if( tl_get_ip_packet_dimension( udp_globals.ip_phone, & udp_globals.dimensions, DEVICE_INVALID_ID, & packet_dimension ) == EOK ){
-						* SOCKET_SET_DATA_FRAGMENT_SIZE( answer ) = packet_dimension->content;
+				*SOCKET_SET_SOCKET_ID(answer) = SOCKET_GET_SOCKET_ID(call);
+				res = socket_create(&local_sockets, app_phone, NULL, SOCKET_SET_SOCKET_ID(answer));
+				if(res == EOK){
+					if(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
+						*SOCKET_SET_DATA_FRAGMENT_SIZE(answer) = packet_dimension->content;
 					}
-//					* SOCKET_SET_DATA_FRAGMENT_SIZE( answer ) = MAX_UDP_FRAGMENT_SIZE;
-					* SOCKET_SET_HEADER_SIZE( answer ) = UDP_HEADER_SIZE;
+//					*SOCKET_SET_DATA_FRAGMENT_SIZE(answer) = MAX_UDP_FRAGMENT_SIZE;
+					*SOCKET_SET_HEADER_SIZE(answer) = UDP_HEADER_SIZE;
 					answer_count = 3;
 				}
 				break;
 			case NET_SOCKET_BIND:
-				res = data_receive(( void ** ) & addr, & addrlen );
-				if( res == EOK ){
-					fibril_rwlock_write_lock( & udp_globals.lock );
-					res = socket_bind( & local_sockets, & udp_globals.sockets, SOCKET_GET_SOCKET_ID( call ), addr, addrlen, UDP_FREE_PORTS_START, UDP_FREE_PORTS_END, udp_globals.last_used_port );
-					fibril_rwlock_write_unlock( & udp_globals.lock );
-					free( addr );
+				res = data_receive((void **) &addr, &addrlen);
+				if(res == EOK){
+					fibril_rwlock_write_lock(&udp_globals.lock);
+					res = socket_bind(&local_sockets, &udp_globals.sockets, SOCKET_GET_SOCKET_ID(call), addr, addrlen, UDP_FREE_PORTS_START, UDP_FREE_PORTS_END, udp_globals.last_used_port);
+					fibril_rwlock_write_unlock(&udp_globals.lock);
+					free(addr);
 				}
 				break;
 			case NET_SOCKET_SENDTO:
-				res = data_receive(( void ** ) & addr, & addrlen );
-				if( res == EOK ){
-					fibril_rwlock_write_lock( & udp_globals.lock );
-					res = udp_sendto_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ), addr, addrlen, SOCKET_GET_DATA_FRAGMENTS( call ), SOCKET_SET_DATA_FRAGMENT_SIZE( answer ), SOCKET_GET_FLAGS( call ));
-					if( res != EOK ){
-						fibril_rwlock_write_unlock( & udp_globals.lock );
+				res = data_receive((void **) &addr, &addrlen);
+				if(res == EOK){
+					fibril_rwlock_write_lock(&udp_globals.lock);
+					res = udp_sendto_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), addr, addrlen, SOCKET_GET_DATA_FRAGMENTS(call), SOCKET_SET_DATA_FRAGMENT_SIZE(answer), SOCKET_GET_FLAGS(call));
+					if(res != EOK){
+						fibril_rwlock_write_unlock(&udp_globals.lock);
 					}else{
 						answer_count = 2;
 					}
-					free( addr );
+					free(addr);
 				}
 				break;
 			case NET_SOCKET_RECVFROM:
-				fibril_rwlock_write_lock( & udp_globals.lock );
-				res = udp_recvfrom_message( & local_sockets, SOCKET_GET_SOCKET_ID( call ), SOCKET_GET_FLAGS( call ), & addrlen );
-				fibril_rwlock_write_unlock( & udp_globals.lock );
-				if( res > 0 ){
-					* SOCKET_SET_READ_DATA_LENGTH( answer ) = res;
-					* SOCKET_SET_ADDRESS_LENGTH( answer ) = addrlen;
+				fibril_rwlock_write_lock(&udp_globals.lock);
+				res = udp_recvfrom_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_FLAGS(call), &addrlen);
+				fibril_rwlock_write_unlock(&udp_globals.lock);
+				if(res > 0){
+					*SOCKET_SET_READ_DATA_LENGTH(answer) = res;
+					*SOCKET_SET_ADDRESS_LENGTH(answer) = addrlen;
 					answer_count = 3;
 					res = EOK;
@@ -492,7 +496,7 @@
 				break;
 			case NET_SOCKET_CLOSE:
-				fibril_rwlock_write_lock( & udp_globals.lock );
-				res = socket_destroy( udp_globals.net_phone, SOCKET_GET_SOCKET_ID( call ), & local_sockets, & udp_globals.sockets, NULL );
-				fibril_rwlock_write_unlock( & udp_globals.lock );
+				fibril_rwlock_write_lock(&udp_globals.lock);
+				res = socket_destroy(udp_globals.net_phone, SOCKET_GET_SOCKET_ID(call), &local_sockets, &udp_globals.sockets, NULL);
+				fibril_rwlock_write_unlock(&udp_globals.lock);
 				break;
 			case NET_SOCKET_GETSOCKOPT:
@@ -502,49 +506,47 @@
 				break;
 		}
-
-//		printf( "res = %d\n", res );
-
-		answer_call( callid, res, & answer, answer_count );
 	}
 
 	// release all local sockets
-	socket_cores_release( udp_globals.net_phone, & local_sockets, & udp_globals.sockets, NULL );
-
-	return EOK;
-}
-
-int udp_sendto_message( socket_cores_ref local_sockets, int socket_id, const struct sockaddr * addr, socklen_t addrlen, int fragments, size_t * data_fragment_size, int flags ){
+	socket_cores_release(udp_globals.net_phone, &local_sockets, &udp_globals.sockets, NULL);
+
+	return res;
+}
+
+int udp_sendto_message(socket_cores_ref local_sockets, int socket_id, const struct sockaddr * addr, socklen_t addrlen, int fragments, size_t * data_fragment_size, int flags){
 	ERROR_DECLARE;
 
-	socket_core_ref			socket;
-	packet_t				packet;
-	packet_t				next_packet;
-	udp_header_ref			header;
-	int						index;
-	size_t					total_length;
-	int						result;
-	uint16_t				dest_port;
-	uint32_t				checksum;
-	ip_pseudo_header_ref	ip_header;
-	size_t					headerlen;
-	device_id_t				device_id;
-	packet_dimension_ref	packet_dimension;
-
-	ERROR_PROPAGATE( tl_get_address_port( addr, addrlen, & dest_port ));
-
-	socket = socket_cores_find( local_sockets, socket_id );
-	if( ! socket ) return ENOTSOCK;
-
-	if(( socket->port <= 0 ) && udp_globals.autobinding ){
+	socket_core_ref socket;
+	packet_t packet;
+	packet_t next_packet;
+	udp_header_ref header;
+	int index;
+	size_t total_length;
+	int result;
+	uint16_t dest_port;
+	uint32_t checksum;
+	ip_pseudo_header_ref ip_header;
+	size_t headerlen;
+	device_id_t device_id;
+	packet_dimension_ref packet_dimension;
+
+	ERROR_PROPAGATE(tl_get_address_port(addr, addrlen, &dest_port));
+
+	socket = socket_cores_find(local_sockets, socket_id);
+	if(! socket){
+		return ENOTSOCK;
+	}
+
+	if((socket->port <= 0) && udp_globals.autobinding){
 		// bind the socket to a random free port if not bound
 //		do{
 			// try to find a free port
-//			fibril_rwlock_read_unlock( & udp_globals.lock );
-//			fibril_rwlock_write_lock( & udp_globals.lock );
+//			fibril_rwlock_read_unlock(&udp_globals.lock);
+//			fibril_rwlock_write_lock(&udp_globals.lock);
 			// might be changed in the meantime
-//			if( socket->port <= 0 ){
-				if( ERROR_OCCURRED( socket_bind_free_port( & udp_globals.sockets, socket, UDP_FREE_PORTS_START, UDP_FREE_PORTS_END, udp_globals.last_used_port ))){
-//					fibril_rwlock_write_unlock( & udp_globals.lock );
-//					fibril_rwlock_read_lock( & udp_globals.lock );
+//			if(socket->port <= 0){
+				if(ERROR_OCCURRED(socket_bind_free_port(&udp_globals.sockets, socket, UDP_FREE_PORTS_START, UDP_FREE_PORTS_END, udp_globals.last_used_port))){
+//					fibril_rwlock_write_unlock(&udp_globals.lock);
+//					fibril_rwlock_read_lock(&udp_globals.lock);
 					return ERROR_CODE;
 				}
@@ -552,134 +554,139 @@
 				udp_globals.last_used_port = socket->port;
 //			}
-//			fibril_rwlock_write_unlock( & udp_globals.lock );
-//			fibril_rwlock_read_lock( & udp_globals.lock );
+//			fibril_rwlock_write_unlock(&udp_globals.lock);
+//			fibril_rwlock_read_lock(&udp_globals.lock);
 			// might be changed in the meantime
-//		}while( socket->port <= 0 );
-	}
-
-	if( udp_globals.checksum_computing ){
-		if( ERROR_OCCURRED( ip_get_route_req( udp_globals.ip_phone, IPPROTO_UDP, addr, addrlen, & device_id, & ip_header, & headerlen ))){
-			return udp_release_and_return( packet, ERROR_CODE );
+//		}while(socket->port <= 0);
+	}
+
+	if(udp_globals.checksum_computing){
+		if(ERROR_OCCURRED(ip_get_route_req(udp_globals.ip_phone, IPPROTO_UDP, addr, addrlen, &device_id, &ip_header, &headerlen))){
+			return udp_release_and_return(packet, ERROR_CODE);
 		}
 		// get the device packet dimension
-//		ERROR_PROPAGATE( tl_get_ip_packet_dimension( udp_globals.ip_phone, & udp_globals.dimensions, device_id, & packet_dimension ));
+//		ERROR_PROPAGATE(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, device_id, &packet_dimension));
 	}
 //	}else{
 		// do not ask all the time
-		ERROR_PROPAGATE( ip_packet_size_req( udp_globals.ip_phone, -1, & udp_globals.packet_dimension ));
-		packet_dimension = & udp_globals.packet_dimension;
+		ERROR_PROPAGATE(ip_packet_size_req(udp_globals.ip_phone, -1, &udp_globals.packet_dimension));
+		packet_dimension = &udp_globals.packet_dimension;
 //	}
 
 	// read the first packet fragment
-	result = tl_socket_read_packet_data( udp_globals.net_phone, & packet, UDP_HEADER_SIZE, packet_dimension, addr, addrlen );
-	if( result < 0 ) return result;
-	total_length = ( size_t ) result;
-	if( udp_globals.checksum_computing ){
-		checksum = compute_checksum( 0, packet_get_data( packet ), packet_get_data_length( packet ));
+	result = tl_socket_read_packet_data(udp_globals.net_phone, &packet, UDP_HEADER_SIZE, packet_dimension, addr, addrlen);
+	if(result < 0){
+		return result;
+	}
+	total_length = (size_t) result;
+	if(udp_globals.checksum_computing){
+		checksum = compute_checksum(0, packet_get_data(packet), packet_get_data_length(packet));
 	}else{
 		checksum = 0;
 	}
 	// prefix the udp header
-	header = PACKET_PREFIX( packet, udp_header_t );
-	if( ! header ){
-		return udp_release_and_return( packet, ENOMEM );
-	}
-	bzero( header, sizeof( * header ));
+	header = PACKET_PREFIX(packet, udp_header_t);
+	if(! header){
+		return udp_release_and_return(packet, ENOMEM);
+	}
+	bzero(header, sizeof(*header));
 	// read the rest of the packet fragments
-	for( index = 1; index < fragments; ++ index ){
-		result = tl_socket_read_packet_data( udp_globals.net_phone, & next_packet, 0, packet_dimension, addr, addrlen );
-		if( result < 0 ){
-			return udp_release_and_return( packet, result );
-		}
-		if( ERROR_OCCURRED( pq_add( & packet, next_packet, index, 0 ))){
-			return udp_release_and_return( packet, ERROR_CODE );
-		}
-		total_length += ( size_t ) result;
-		if( udp_globals.checksum_computing ){
-			checksum = compute_checksum( checksum, packet_get_data( next_packet ), packet_get_data_length( next_packet ));
+	for(index = 1; index < fragments; ++ index){
+		result = tl_socket_read_packet_data(udp_globals.net_phone, &next_packet, 0, packet_dimension, addr, addrlen);
+		if(result < 0){
+			return udp_release_and_return(packet, result);
+		}
+		if(ERROR_OCCURRED(pq_add(&packet, next_packet, index, 0))){
+			return udp_release_and_return(packet, ERROR_CODE);
+		}
+		total_length += (size_t) result;
+		if(udp_globals.checksum_computing){
+			checksum = compute_checksum(checksum, packet_get_data(next_packet), packet_get_data_length(next_packet));
 		}
 	}
 	// set the udp header
-	header->source_port = htons(( socket->port > 0 ) ? socket->port : 0 );
-	header->destination_port = htons( dest_port );
-	header->total_length = htons( total_length + sizeof( * header ));
+	header->source_port = htons((socket->port > 0) ? socket->port : 0);
+	header->destination_port = htons(dest_port);
+	header->total_length = htons(total_length + sizeof(*header));
 	header->checksum = 0;
-	if( udp_globals.checksum_computing ){
-//		if( ERROR_OCCURRED( ip_get_route_req( udp_globals.ip_phone, IPPROTO_UDP, addr, addrlen, & device_id, & ip_header, & headerlen ))){
-//			return udp_release_and_return( packet, ERROR_CODE );
-//		}
-		if( ERROR_OCCURRED( ip_client_set_pseudo_header_data_length( ip_header, headerlen, total_length + UDP_HEADER_SIZE))){
-			free( ip_header );
-			return udp_release_and_return( packet, ERROR_CODE );
-		}
-		checksum = compute_checksum( checksum, ip_header, headerlen );
-		checksum = compute_checksum( checksum, ( uint8_t * ) header, sizeof( * header ));
-		header->checksum = htons( flip_checksum( compact_checksum( checksum )));
-		free( ip_header );
+	if(udp_globals.checksum_computing){
+		// update the pseudo header
+		if(ERROR_OCCURRED(ip_client_set_pseudo_header_data_length(ip_header, headerlen, total_length + UDP_HEADER_SIZE))){
+			free(ip_header);
+			return udp_release_and_return(packet, ERROR_CODE);
+		}
+		// finish the checksum computation
+		checksum = compute_checksum(checksum, ip_header, headerlen);
+		checksum = compute_checksum(checksum, (uint8_t *) header, sizeof(*header));
+		header->checksum = htons(flip_checksum(compact_checksum(checksum)));
+		free(ip_header);
 	}else{
 		device_id = DEVICE_INVALID_ID;
 	}
 	// prepare the first packet fragment
-	if( ERROR_OCCURRED( ip_client_prepare_packet( packet, IPPROTO_UDP, 0, 0, 0, 0 ))){
-		return udp_release_and_return( packet, ERROR_CODE );
+	if(ERROR_OCCURRED(ip_client_prepare_packet(packet, IPPROTO_UDP, 0, 0, 0, 0))){
+		return udp_release_and_return(packet, ERROR_CODE);
 	}
 	// send the packet
-	fibril_rwlock_write_unlock( & udp_globals.lock );
-	ip_send_msg( udp_globals.ip_phone, device_id, packet, SERVICE_UDP, 0 );
+	fibril_rwlock_write_unlock(&udp_globals.lock);
+	ip_send_msg(udp_globals.ip_phone, device_id, packet, SERVICE_UDP, 0);
 	return EOK;
 }
 
-int udp_recvfrom_message( socket_cores_ref local_sockets, int socket_id, int flags, size_t * addrlen ){
+int udp_recvfrom_message(socket_cores_ref local_sockets, int socket_id, int flags, size_t * addrlen){
 	ERROR_DECLARE;
 
-	socket_core_ref	socket;
-	int				packet_id;
-	packet_t		packet;
-	udp_header_ref	header;
-	struct sockaddr *	addr;
-	size_t			length;
-	uint8_t *		data;
-	int				result;
+	socket_core_ref socket;
+	int packet_id;
+	packet_t packet;
+	udp_header_ref header;
+	struct sockaddr * addr;
+	size_t length;
+	uint8_t * data;
+	int result;
 
 	// find the socket
-	socket = socket_cores_find( local_sockets, socket_id );
-	if( ! socket ) return ENOTSOCK;
+	socket = socket_cores_find(local_sockets, socket_id);
+	if(! socket){
+		return ENOTSOCK;
+	}
 	// get the next received packet
-	packet_id = dyn_fifo_value( & socket->received );
-	if( packet_id < 0 ) return NO_DATA;
-	ERROR_PROPAGATE( packet_translate( udp_globals.net_phone, & packet, packet_id ));
+	packet_id = dyn_fifo_value(&socket->received);
+	if(packet_id < 0){
+		return NO_DATA;
+	}
+	ERROR_PROPAGATE(packet_translate(udp_globals.net_phone, &packet, packet_id));
 	// get udp header
-	data = packet_get_data( packet );
-	if( ! data ){
-		pq_release( udp_globals.net_phone, packet_id );
+	data = packet_get_data(packet);
+	if(! data){
+		pq_release(udp_globals.net_phone, packet_id);
 		return NO_DATA;
 	}
-	header = ( udp_header_ref ) data;
+	header = (udp_header_ref) data;
 
 	// set the source address port
-	result = packet_get_addr( packet, ( uint8_t ** ) & addr, NULL );
-	if( ERROR_OCCURRED( tl_set_address_port( addr, result, ntohs( header->source_port )))){
-		pq_release( udp_globals.net_phone, packet_id );
+	result = packet_get_addr(packet, (uint8_t **) &addr, NULL);
+	if(ERROR_OCCURRED(tl_set_address_port(addr, result, ntohs(header->source_port)))){
+		pq_release(udp_globals.net_phone, packet_id);
 		return ERROR_CODE;
 	}
-	* addrlen = ( size_t ) result;
+	*addrlen = (size_t) result;
 	// send the source address
-	ERROR_PROPAGATE( data_reply( addr, * addrlen ));
+	ERROR_PROPAGATE(data_reply(addr, * addrlen));
 
 	// trim the header
-	ERROR_PROPAGATE( packet_trim( packet, UDP_HEADER_SIZE, 0 ));
+	ERROR_PROPAGATE(packet_trim(packet, UDP_HEADER_SIZE, 0));
 
 	// reply the packets
-	ERROR_PROPAGATE( socket_reply_packets( packet, & length ));
+	ERROR_PROPAGATE(socket_reply_packets(packet, &length));
 
 	// release the packet
-	dyn_fifo_pop( & socket->received );
-	pq_release( udp_globals.net_phone, packet_get_id( packet ));
+	dyn_fifo_pop(&socket->received);
+	pq_release(udp_globals.net_phone, packet_get_id(packet));
 	// return the total length
-	return ( int ) length;
-}
-
-int	udp_release_and_return( packet_t packet, int result ){
-	pq_release( udp_globals.net_phone, packet_get_id( packet ));
+	return (int) length;
+}
+
+int udp_release_and_return(packet_t packet, int result){
+	pq_release(udp_globals.net_phone, packet_get_id(packet));
 	return result;
 }
Index: uspace/srv/net/tl/udp/udp.h
===================================================================
--- uspace/srv/net/tl/udp/udp.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/udp/udp.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -54,32 +54,32 @@
 	/** Networking module phone.
 	 */
-	int				net_phone;
+	int net_phone;
 	/** IP module phone.
 	 */
-	int				ip_phone;
+	int ip_phone;
 	/** ICMP module phone.
 	 */
-	int				icmp_phone;
+	int icmp_phone;
 	/** Packet dimension.
 	 */
-	packet_dimension_t	packet_dimension;
+	packet_dimension_t packet_dimension;
 	/** Indicates whether UDP checksum computing is enabled.
 	 */
-	int				checksum_computing;
+	int checksum_computing;
 	/** Indicates whether UDP autobnding on send is enabled.
 	 */
-	int				autobinding;
+	int autobinding;
 	/** Last used free port.
 	 */
-	int				last_used_port;
+	int last_used_port;
 	/** Active sockets.
 	 */
-	socket_ports_t	sockets;
+	socket_ports_t sockets;
 	/** Device packet dimensions.
 	 */
-	packet_dimensions_t	dimensions;
+	packet_dimensions_t dimensions;
 	/** Safety lock.
 	 */
-	fibril_rwlock_t	lock;
+	fibril_rwlock_t lock;
 };
 
Index: uspace/srv/net/tl/udp/udp_header.h
===================================================================
--- uspace/srv/net/tl/udp/udp_header.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/udp/udp_header.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -43,5 +43,5 @@
 /** UDP header size in bytes.
  */
-#define UDP_HEADER_SIZE			sizeof( udp_header_t )
+#define UDP_HEADER_SIZE			sizeof(udp_header_t)
 
 /** Type definition of the user datagram header.
@@ -61,12 +61,12 @@
 	 *  If not used, a value of zero is inserted.
 	 */
-	uint16_t	source_port;
+	uint16_t source_port;
 	/** Destination port has a meaning within the context of a particular internet destination address.
 	 */
-	uint16_t	destination_port;
+	uint16_t destination_port;
 	/** Length is the length in octets of this user datagram including this header and the data.
 	 *  This means the minimum value of the length is eight.
 	 */
-	uint16_t	total_length;
+	uint16_t total_length;
 	/** Checksum is the 16-bit one's complement of the one's complement sum of a pseudo header of information from the IP header, the UDP header, and the data, padded with zero octets at the end (if necessary) to make a multiple of two octets.
 	 *  The pseudo header conceptually prefixed to the UDP header contains the source address, the destination address, the protocol, and the UDP length.
@@ -75,5 +75,5 @@
 	 *  An all zero transmitted checksum value means that the transmitter generated no checksum (for debugging or for higher level protocols that don't care).
 	 */
-	uint16_t	checksum;
+	uint16_t checksum;
 } __attribute__ ((packed));
 
Index: uspace/srv/net/tl/udp/udp_module.c
===================================================================
--- uspace/srv/net/tl/udp/udp_module.c	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/udp/udp_module.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -61,5 +61,5 @@
  *  @see NAME
  */
-void	module_print_name( void );
+void module_print_name(void);
 
 /** Starts the UDP module.
@@ -70,5 +70,5 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int	module_start( async_client_conn_t client_connection );
+int module_start(async_client_conn_t client_connection);
 
 /** Processes the UDP message.
@@ -80,5 +80,5 @@
  *  @returns Other error codes as defined for the udp_message() function.
  */
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 /** UDP module global data.
@@ -86,21 +86,21 @@
 extern udp_globals_t	udp_globals;
 
-void module_print_name( void ){
-	printf( "%s", NAME );
+void module_print_name(void){
+	printf("%s", NAME);
 }
 
-int module_start( async_client_conn_t client_connection ){
+int module_start(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
-	ipcarg_t	phonehash;
+	ipcarg_t phonehash;
 
-	async_set_client_connection( client_connection );
-	udp_globals.net_phone = net_connect_module( SERVICE_NETWORKING );
-	if( udp_globals.net_phone < 0 ){
+	async_set_client_connection(client_connection);
+	udp_globals.net_phone = net_connect_module(SERVICE_NETWORKING);
+	if(udp_globals.net_phone < 0){
 		return udp_globals.net_phone;
 	}
-	ERROR_PROPAGATE( pm_init());
-	if( ERROR_OCCURRED( udp_initialize( client_connection ))
-	|| ERROR_OCCURRED( REGISTER_ME( SERVICE_UDP, & phonehash ))){
+	ERROR_PROPAGATE(pm_init());
+	if(ERROR_OCCURRED(udp_initialize(client_connection))
+		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_UDP, &phonehash))){
 		pm_destroy();
 		return ERROR_CODE;
@@ -113,6 +113,6 @@
 }
 
-int	module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-	return udp_message( callid, call, answer, answer_count );
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return udp_message(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/tl/udp/udp_module.h
===================================================================
--- uspace/srv/net/tl/udp/udp_module.h	(revision b5cbff48576a057d15deb2e28751ec635d099719)
+++ uspace/srv/net/tl/udp/udp_module.h	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -47,5 +47,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int	udp_initialize( async_client_conn_t client_connection );
+int udp_initialize(async_client_conn_t client_connection);
 
 /** Processes the UDP message.
@@ -59,5 +59,5 @@
  *  @see IS_NET_UDP_MESSAGE()
  */
-int	udp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
+int udp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
