libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
fix_to_links_main_impl.hpp
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright © 2017 by J.M.McGuiness, isimud@hussar.me.uk
3
**
4
** This library is free software; you can redistribute it and/or
5
** modify it under the terms of the GNU Lesser General Public
6
** License as published by the Free Software Foundation; either
7
** version 2.1 of the License, or (at your option) any later version.
8
**
9
** This library is distributed in the hope that it will be useful,
10
** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
** Lesser General Public License for more details.
13
**
14
** You should have received a copy of the GNU Lesser General Public
15
** License along with this library; if not, write to the Free Software
16
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*/
18
19
namespace
isimud
{
namespace
ISIMUD_VER_NAMESPACE
{
namespace
exchanges
{
20
21
inline
int
22
fix_to_links
::
main
(
int
argc
,
char
const
*
const
*
argv
)
noexcept
(
true
) {
23
return
base_t
::
main
<
link_t
>(
24
argc
,
25
argv
,
26
BATSBOE
::
create_program_options
<
exchanges
::
BATSBOE
::
EU
::
v1
::
link_t
<
exchanges
::
FIX
::
v5_0sp2
::
MsgTypes
>>(
27
BATSBOE
::
create_program_options
<
exchanges
::
BATSBOE
::
US
::
v1
::
link_t
<
exchanges
::
FIX
::
v5_0sp2
::
MsgTypes
>>(
28
MIT
::
create_program_options
<
exchanges
::
MIT
::
BIT
::
link_t
<
exchanges
::
FIX
::
v5_0sp2
::
MsgTypes
>>(
29
MIT
::
create_program_options
<
exchanges
::
MIT
::
JSE
::
link_t
<
exchanges
::
FIX
::
v5_0sp2
::
MsgTypes
>>(
30
MIT
::
create_program_options
<
exchanges
::
MIT
::
LSE
::
link_t
<
exchanges
::
FIX
::
v5_0sp2
::
MsgTypes
>>(
31
MIT
::
create_program_options
<
exchanges
::
MIT
::
OSLO
::
link_t
<
exchanges
::
FIX
::
v5_0sp2
::
MsgTypes
>>(
32
MIT
::
create_program_options
<
exchanges
::
MIT
::
TRQ
::
link_t
<
exchanges
::
FIX
::
v5_0sp2
::
MsgTypes
>>(
33
create_program_options
()
34
)
35
)
36
)
37
)
38
)
39
)
40
),
41
[](
boost
::
program_options
::
variables_map
const
&
vm
) {
42
using
conn_pol_t
=
typename
link_t
::
exchg_link_t
::
conn_pol_t
;
43
using
ref_data_t
=
typename
link_t
::
client_link_t
::
proc_rules_t
::
ref_data
;
44
using
exchange_msg_details_t
=
typename
link_t
::
exchange_msg_details_t
;
45
46
auto
const
MIC_code_gen
=[]() {
47
std
::
ostringstream
ss
;
48
common
::
mic_codes
::
to_stream
<
exchange_msg_details_t
::
MIC_code
>(
ss
);
49
return
ss
.
str
();
50
};
51
std
::
string
const
MIC_code
=
MIC_code_gen
();
52
std
::
ifstream
ref_data_src
(
vm
[(
MIC_code
+
"_ref_data"
).
c_str
()].
as
<
std
::
string
>().
c_str
());
53
const
ref_data_t
ref_data
(
ref_data_src
);
54
55
const
std
::
string
user
(
vm
[(
MIC_code
+
"_username"
).
c_str
()].
as
<
std
::
string
>());
56
typename
exchange_msg_details_t
::
UserName_t
user_conv
{};
57
std
::
memcpy
(
user_conv
.
data
(),
user
.
data
(),
std
::
min
(
user_conv
.
size
(),
user
.
size
()));
58
const
std
::
string
pass
(
vm
[(
MIC_code
+
"_password"
).
c_str
()].
as
<
std
::
string
>());
59
typename
exchange_msg_details_t
::
Password_t
pass_conv
{};
60
std
::
memcpy
(
pass_conv
.
data
(),
pass
.
data
(),
std
::
min
(
pass_conv
.
size
(),
pass
.
size
()));
61
const
std
::
string
new_pass
(
vm
[(
MIC_code
+
"_new_password"
).
c_str
()].
as
<
std
::
string
>());
62
typename
exchange_msg_details_t
::
Password_t
new_pass_conv
{};
63
std
::
memcpy
(
new_pass_conv
.
data
(),
new_pass
.
data
(),
std
::
min
(
new_pass_conv
.
size
(),
new_pass
.
size
()));
64
const
std
::
string
reason
(
vm
[(
MIC_code
+
"_logout_reason"
).
c_str
()].
as
<
std
::
string
>());
65
MIT
::
common
::
Reason_t
reason_conv
{};
66
std
::
memcpy
(
reason_conv
.
data
(),
reason
.
data
(),
std
::
min
(
reason_conv
.
size
(),
reason
.
size
()));
67
return
std
::
make_tuple
(
68
typename
link_t
::
client_link_t
::
ctor_args
{
69
boost
::
asio
::
ip
::
address_v4
::
from_string
(
vm
[
"client_address"
].
as
<
std
::
string
>()),
70
vm
[
"client_port"
].
as
<
unsigned
short
>(),
71
typename
link_t
::
client_link_t
::
proc_rules_t
(
ref_data
)
72
},
73
conn_pol_t
(
74
typename
conn_pol_t
::
gateways_t
(
75
std
::
make_pair
(
boost
::
asio
::
ip
::
address_v4
::
from_string
(
vm
[(
MIC_code
+
"_primary_gateway_address"
).
c_str
()].
as
<
std
::
string
>()),
vm
[(
MIC_code
+
"_primary_gateway_port"
).
c_str
()].
as
<
unsigned
short
>()),
76
std
::
make_pair
(
boost
::
asio
::
ip
::
address_v4
::
from_string
(
vm
[(
MIC_code
+
"_secondary_gateway_address"
).
c_str
()].
as
<
std
::
string
>()),
vm
[(
MIC_code
+
"_secondary_gateway_port"
).
c_str
()].
as
<
unsigned
short
>())
77
),
78
typename
conn_pol_t
::
logon_args_t
{
79
user_conv
,
80
pass_conv
,
81
new_pass_conv
82
},
83
MIT
::
common
::
logoff_args_t
{
84
reason_conv
85
}
86
),
87
typename
link_t
::
exchg_to_client_proc_rules_t
(
ref_data
)
88
);
89
}
90
);
91
}
92
93
} } }
isimud
exchanges
links
fix_to_links_main_impl.hpp
Generated on Tue May 11 2021 17:31:50 for libjmmcg by
1.9.2