Quick draft of the API server

Following BSD principle - no typedefs (except for func pointers). Rationale: not hiding stuff behind typedef, reader doesn't wander what is certain foo_t actually means.