Support multiple backends and add alloc backend

It's legacy from when it was called AllocMode. I wanted to rename this and the same in UdpBackend but didn't want to introduce even more changes into this changeset. So I wanted to do that as a separate PR.