Move RPC dispatching out of RPCHandler.

* Extract handler routing into a separate table.
* Name anonymous structs and enums, replace booleans by enums.
* Use binary search instead of linear to dispatch.