diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..06dc7f4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,23 @@
+.libs
+.deps
+Makefile.in
+glob:Makefile
+aclocal.m4
+autom4te.cache
+config.h.in
+config.h
+autotools/
+glob:configure
+missing
+glob:*.pc
+glob:*.lo
+glob:*.la
+glob:*.o
+stamp-h1
+depcomp
+install-sh
+libtool
+ltmain.sh
+m4
+doc/html
+configure
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..59878ff
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Copyright © 2011, Nicolas Pouillon, Freebox SAS
+ Contact, questions: sdk@freebox.fr
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..aaefd34
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,4 @@
+2011-10-06 Nicolas Pouillon
+
+ * First public version
+
diff --git a/LICENSE.TXT b/LICENSE.TXT
new file mode 100644
index 0000000..176fcb4
--- /dev/null
+++ b/LICENSE.TXT
@@ -0,0 +1,25 @@
+Copyright © 2011 Freebox SA. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+This software is provided ``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 author or contributors 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.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..ac84b4e
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,9 @@
+
+ACLOCAL_AMFLAGS = -I autotools
+
+noinst_DATA = ChangeLog
+
+SUBDIRS=include src test doc
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = rudp.pc
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..8dbe66e
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,55 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.61])
+AC_INIT([librudp], [0.3], [sdk@freebox.fr])
+AC_CONFIG_MACRO_DIR([autotools])
+AC_CONFIG_AUX_DIR([autotools])
+
+AC_CONFIG_SRCDIR([src/rudp.c])
+AC_CONFIG_HEADERS([config.h])
+
+AM_INIT_AUTOMAKE([1.10 foreign dist-bzip2])
+
+dnl AM_SILENT_RULES([yes])
+
+# Checks for programs.
+AC_PROG_CC
+
+if test "x$GCC" = "xyes"; then
+ GCC_CFLAGS="-Wall -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
+fi
+AC_SUBST(GCC_CFLAGS)
+
+# Initialize libtool
+LT_PREREQ([2.2])
+LT_INIT
+
+# Checks for header files.
+AC_CHECK_HEADERS([stdint.h stdlib.h])
+
+AC_PATH_PROG([mkdoc], [mkdoc])
+AM_CONDITIONAL(HAVE_MKDOC, test x$mkdoc != x)
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_INLINE
+AC_TYPE_UINT32_T
+
+AM_PROG_LIBTOOL
+
+# Checks for libraries.
+PKG_CHECK_MODULES(ELA, ela)
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+
+AC_CONFIG_FILES([
+ rudp.pc
+ Makefile
+ doc/Makefile
+ include/Makefile
+ include/rudp/Makefile
+ src/Makefile
+ test/Makefile
+ ])
+AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..278eb83
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,19 @@
+
+if HAVE_MKDOC
+
+html-local:
+ $(mkdoc) \
+ --conf-file $(srcdir)/mkdoc.conf \
+ --doc-path $(srcdir)/. \
+ -I $(top_srcdir)/include \
+ rudp/compiler.h rudp/error.h rudp/time.h \
+ rudp/list.h rudp/rudp.h rudp/packet.h \
+ rudp/address.h \
+ rudp/endpoint.h rudp/peer.h rudp/client.h \
+ rudp/server.h
+
+
+clean-local:
+ -rm -r html
+
+endif
diff --git a/doc/html_title.tmpl b/doc/html_title.tmpl
new file mode 100644
index 0000000..ccad814
--- /dev/null
+++ b/doc/html_title.tmpl
@@ -0,0 +1,6 @@
+
@@doc_title@@
+@@doc_subtitle@@
+© Freebox,
+ @@doc_author@@,
+ @@doc_date@@
+
diff --git a/doc/mkdoc.conf b/doc/mkdoc.conf
new file mode 100644
index 0000000..06ca10c
--- /dev/null
+++ b/doc/mkdoc.conf
@@ -0,0 +1,13 @@
+@setopt output_filename {liblea}
+@setopt doc_title {Reliable UDP transport library}
+@setopt doc_author {Nicolas Pouillon}
+@setopt show_type_keyword {1}
+@setopt function_overloading {0}
+@setopt hide_internal
+@setopt hide_experimental
+@setopt output_path {.}
+@setopt html_single_js {1}
+@setopt html_embed_css {1}
+@setopt html_css_optimize {1}
+@setopt titled_refs {1}
+@setopt top_file {top.mkdoc}
diff --git a/doc/modules.mkdoc b/doc/modules.mkdoc
new file mode 100644
index 0000000..e69de29
diff --git a/doc/template.mkdoc b/doc/template.mkdoc
new file mode 100644
index 0000000..2514875
--- /dev/null
+++ b/doc/template.mkdoc
@@ -0,0 +1,126 @@
+@c
+@c Default template.mkdoc file for C projects copied by mkdoc
+@c
+
+@c ===== member doc =====
+
+@macro _member_doc id
+ @insert {@id@} decl_warn_sentence
+ @insert {@id@} decl_location_sentence
+ @insert {@id@} decl_homonyms_sentence
+ @insert {@id@} decl_cpp_condition_sentence
+ @insert {@id@} decl_involved_macros_sentence
+
+ @insert {@id@} decl_inline_doc
+ @insert {@id@} decl_content
+ @insert {@id@} see_related_typedefs
+
+ @insert {No documentation available} on_empty_section
+@end macro
+
+@c ===== compound members detail =====
+
+@macro _compound_details id
+
+ @foreach mid {typedef,enum,struct,function,variable,macro} {@id@} {1}
+ @section {} {@mid@}
+ @invoke {@mid@} _member_doc
+ @end section
+ @end foreach
+
+@end macro
+
+@c ===== compound documentation macro for internal use =====
+
+@macro _compound_doc id
+
+ @c short member doc with link to detailed description
+ @insert {@id@} decl_short_desc @exref {Description} {More}
+
+ @ifsymtype {@id@} {module}
+ @section e {Related headers}
+ @insert {header} {1} {@id@} compound_table
+ @end section
+ @end if
+
+ @ifsymtype {@id@} {header}
+ @section e {Header inclusion}
+ @c @insert {@id@} {D} inclusion_diagram
+
+ @c @section e {Included files}
+ @insert {@id@} include_list
+ @c @end section
+
+ @c @section e {Including files}
+ @c @insert {@id@} included_by_list
+ @c @end section
+ @end section
+ @end if
+
+ @section e {Members}
+ @insert {@id@} compound_member_list
+ @end section
+
+ @section e {Description}
+ @insert {@id@} decl_inline_doc
+ @end section
+
+@end macro
+
+@c ===== compound section macro for internal use =====
+
+@macro _compound_section type id name
+
+ @section P {@name@ @type@ reference} {@id@}
+ @invoke {@id@} _compound_doc
+
+ @c change this to specify where member details must be written
+ @c @ifsymtype {@id@} {namespace}
+ @ifsymtype {@id@} {header}
+ @section e {Members detail}
+ @invoke {@id@} _compound_details
+ @end section
+ @end if
+
+ @end section
+
+@end macro
+
+@c ===== compound section with documentation and member details =====
+
+@macro member_section name
+
+ @lookup id {@name@}
+ @section {} {@id@}
+ @invoke {@id@} _member_doc
+ @end section
+ @end lookup
+
+@end macro
+
+@c ===== compound section with documentation and member details =====
+
+@macro compound_section name
+
+ @lookup id mname mtype {@name@}
+ @invoke {@mtype@} {@id@} {@mname@} _compound_section
+ @end lookup
+
+@end macro
+
+@c ===== global scope section with documentation and member details =====
+
+@macro global_scope_doc
+ @invoke {::} _compound_doc
+@end macro
+
+@c ===== documentation sections for all compounds of given types =====
+
+@macro all_compound_sections types scope
+
+ @foreach id name type {@types@} {@scope@} {0}
+ @invoke {@type@} {@id@} {@name@} _compound_section
+ @end foreach
+
+@end macro
+
diff --git a/doc/top.mkdoc b/doc/top.mkdoc
new file mode 100644
index 0000000..c99da7b
--- /dev/null
+++ b/doc/top.mkdoc
@@ -0,0 +1,390 @@
+@include template.mkdoc
+
+@c
+@c Modules definitions
+@c
+
+@moduledef{Errors}
+ @short Common error representation
+ @order 104
+@end moduledef
+
+@moduledef{Master state}
+ @short Master library state
+ @order 105
+@end moduledef
+
+@moduledef{Time}
+ @short Abstract time reference
+ @order 103
+@end moduledef
+
+@moduledef{Address}
+ @short Abstract network address representation
+ @order 102
+@end moduledef
+
+@moduledef{Packet}
+ @short Packet datatypes
+ @order 101
+@end moduledef
+
+@moduledef{Endpoint}
+ @short Input/output endpoint
+ @order 100
+@end moduledef
+
+@moduledef{Peer}
+ @short Peer representation
+ @order 99
+@end moduledef
+
+@moduledef{Client}
+ @short Client implementation
+ @order 98
+@end moduledef
+
+@moduledef{Server}
+ @short Server implementation
+ @order 98
+@end moduledef
+
+@c @moduledef{internal}
+@c @short Internal structures
+@c @order 42
+@c @end moduledef
+
+@insert title
+
+@c
+@c Plain Documentation
+@c
+
+@section H {Overview}
+ Rudp is a library aimed at adding reliability features to UDP.
+
+ @list
+ @item Deliver packets in order
+ @item Mark certain packets as reliable, retransmit them
+ @item Drop unordered packets
+ @item Implement server and client models
+ @end list
+@end section
+
+@section H {Table of contents}
+ @insert toc
+@end section
+
+@section HTP {Objects management}
+ @section {Life cycle}
+ @label {olc}
+ Complex objects of the library have a common live cycle:
+ @list
+ @item Allocation is left to the user.
+ @item Initialization is done with
+ @tt{rudp_}@em{