| 1 |
#ifndef HV_PROTO_RPC_ROUTER_H_ |
| 2 |
#define HV_PROTO_RPC_ROUTER_H_ |
| 3 |
|
| 4 |
#include "generated/base.pb.h" |
| 5 |
|
| 6 |
typedef void (*protorpc_handler)(const protorpc::Request& req, protorpc::Response* res); |
| 7 |
|
| 8 |
typedef struct { |
| 9 |
const char* method; |
| 10 |
protorpc_handler handler; |
| 11 |
} protorpc_router; |
| 12 |
|
| 13 |
void error_response(protorpc::Response* res, int code, const std::string& message); |
| 14 |
void not_found(const protorpc::Request& req, protorpc::Response* res); |
| 15 |
void bad_request(const protorpc::Request& req, protorpc::Response* res); |
| 16 |
|
| 17 |
void calc_add(const protorpc::Request& req, protorpc::Response* res); |
| 18 |
void calc_sub(const protorpc::Request& req, protorpc::Response* res); |
| 19 |
void calc_mul(const protorpc::Request& req, protorpc::Response* res); |
| 20 |
void calc_div(const protorpc::Request& req, protorpc::Response* res); |
| 21 |
|
| 22 |
void login(const protorpc::Request& req, protorpc::Response* res); |
| 23 |
|
| 24 |
#endif // HV_PROTO_RPC_ROUTER_H_ |