1 /**
2  * Copyright: (c) 2015-2017, Milofon Project.
3  * License: Subject to the terms of the BSD license, as written in the included LICENSE.txt file.
4  * Author: <m.galanin@milofon.org> Maksim Galanin
5  * Date: 2018-01-28
6  */
7 
8 module dango.service.protocol;
9 
10 public
11 {
12     import dango.service.protocol.core : RpcServerProtocol, RpcClientProtocol,
13            RpcException, createEmptyErrorByCode, createErrorByCode, ErrorCode, RpcError;
14 }
15 
16 private
17 {
18     import poodinis : DependencyContainer, ApplicationContext,
19            newInstance;
20     import dango.system.container : registerByName;
21 
22     import dango.service.protocol.jsonrpc : JsonRpcServerProtocol, JsonRpcClientProtocol;
23     import dango.service.protocol.simple : SimpleRpcServerProtocol, SimpleRpcClientProtocol;
24 }
25 
26 
27 class ProtocolContext : ApplicationContext
28 {
29     override void registerDependencies(shared(DependencyContainer) container)
30     {
31         container.registerByName!(RpcServerProtocol, JsonRpcServerProtocol)("jsonrpc").newInstance;
32         container.registerByName!(RpcServerProtocol, SimpleRpcServerProtocol)("simple").newInstance;
33 
34         container.registerByName!(RpcClientProtocol, JsonRpcClientProtocol)("jsonrpc").newInstance;
35         container.registerByName!(RpcClientProtocol, SimpleRpcClientProtocol)("simple").newInstance;
36     }
37 }