Basic working module

After these changes the module can snet messages and the outbox is working.
Isn' complete at the moment but wanted to share to work already done.