Split RPC out in a package

Signed-off-by: Julien Danjou <julien@danjou.info>