Split daemon/main.cpp into more files

Signed-off-by: Rodrigo Belem <rodrigo.belem@gmail.com>