1/*************************************************************************
2 * libjson-rpc-cpp
3 *************************************************************************
4 * @file requesthandlerfactory.cpp
5 * @date 10/23/2014
6 * @author Peter Spiess-Knafl <dev@spiessknafl.at>
7 * @license See attached LICENSE.txt
8 ************************************************************************/
9
10#include "requesthandlerfactory.h"
11#include "rpcprotocolserver12.h"
12#include "rpcprotocolserverv1.h"
13#include "rpcprotocolserverv2.h"
14
15using namespace jsonrpc;
16
17IProtocolHandler *RequestHandlerFactory::createProtocolHandler(serverVersion_t type, IProcedureInvokationHandler &handler) {
18 IProtocolHandler *result = NULL;
19 switch (type) {
20 case JSONRPC_SERVER_V1:
21 result = new RpcProtocolServerV1(handler);
22 break;
23 case JSONRPC_SERVER_V2:
24 result = new RpcProtocolServerV2(handler);
25 break;
26 case JSONRPC_SERVER_V1V2:
27 result = new RpcProtocolServer12(handler);
28 break;
29 }
30 return result;
31}
32