1
1
/*
2
- * The contents of this file are subject to the Mozilla Public License Version
3
- * 2.0 (the "License"); you may not use this file except in compliance with
4
- * the License. You may obtain a copy of the License at
5
- * http://www.mozilla.org/MPL/
6
- *
7
- * Software distributed under the License is distributed on an "AS IS" basis,
8
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9
- * for the specific language governing rights and limitations under the
10
- * License.
11
- *
12
- * The Initial Developer of the Original Code is Devexperts LLC.
13
- * Portions created by the Initial Developer are Copyright (C) 2010
14
- * the Initial Developer. All Rights Reserved.
15
- *
16
- * Contributor(s):
17
- *
18
- */
2
+ * The contents of this file are subject to the Mozilla Public License Version
3
+ * 2.0 (the "License"); you may not use this file except in compliance with
4
+ * the License. You may obtain a copy of the License at
5
+ * http://www.mozilla.org/MPL/
6
+ *
7
+ * Software distributed under the License is distributed on an "AS IS" basis,
8
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9
+ * for the specific language governing rights and limitations under the
10
+ * License.
11
+ *
12
+ * The Initial Developer of the Original Code is Devexperts LLC.
13
+ * Portions created by the Initial Developer are Copyright (C) 2010
14
+ * the Initial Developer. All Rights Reserved.
15
+ *
16
+ * Contributor(s):
17
+ *
18
+ */
19
19
20
20
extern " C" {
21
21
#include " AddressesManager.h"
@@ -25,4 +25,134 @@ extern "C" {
25
25
26
26
extern " C" {
27
27
28
+ int dx_am_next_socket_address (dxf_connection_t connection) {
29
+ return dx::AddressesManager::getInstance ()->nextSocketAddress (connection);
30
+ }
31
+
32
+ void dx_am_clear_addresses (dxf_connection_t connection) {
33
+ return dx::AddressesManager::getInstance ()->clearAddresses (connection);
34
+ }
35
+
36
+ int dx_am_is_current_address_tls_enabled (dxf_connection_t connection) {
37
+ return dx::AddressesManager::getInstance ()->isCurrentAddressTlsEnabled (connection);
38
+ }
39
+
40
+ int dx_am_is_current_socket_address_connection_failed (dxf_connection_t connection) {
41
+ return dx::AddressesManager::getInstance ()->isCurrentSocketAddressConnectionFailed (connection);
42
+ }
43
+
44
+ void dx_am_set_current_socket_address_connection_failed (dxf_connection_t connection, int is_connection_failed) {
45
+ return dx::AddressesManager::getInstance ()->setCurrentSocketAddressConnectionFailed (connection,
46
+ is_connection_failed != 0 );
47
+ }
48
+
49
+ const char * dx_am_get_current_address_username (dxf_connection_t connection) {
50
+ thread_local std::string currentAddressUsername{};
51
+
52
+ currentAddressUsername = dx::AddressesManager::getInstance ()->getCurrentAddressUsername (connection);
53
+
54
+ return currentAddressUsername.c_str ();
55
+ }
56
+
57
+ const char * dx_am_get_current_address_password (dxf_connection_t connection) {
58
+ thread_local std::string currentAddressPassword{};
59
+
60
+ currentAddressPassword = dx::AddressesManager::getInstance ()->getCurrentAddressPassword (connection);
61
+
62
+ return currentAddressPassword.c_str ();
63
+ }
64
+
65
+ const char * dx_am_get_current_address_host (dxf_connection_t connection) {
66
+ thread_local std::string currentAddressHost{};
67
+
68
+ currentAddressHost = dx::AddressesManager::getInstance ()->getCurrentAddressHost (connection);
69
+
70
+ return currentAddressHost.c_str ();
71
+ }
72
+
73
+ const char * dx_am_get_current_address_port (dxf_connection_t connection) {
74
+ thread_local std::string currentAddressPort{};
75
+
76
+ currentAddressPort = dx::AddressesManager::getInstance ()->getCurrentAddressPort (connection);
77
+
78
+ return currentAddressPort.c_str ();
79
+ };
80
+
81
+ int dx_ma_get_current_socket_address_info (dxf_connection_t connection, int * address_family, int * address_socket_type,
82
+ int * address_protocol, struct sockaddr * native_socket_address,
83
+ size_t * native_socket_address_length) {
84
+ return dx::AddressesManager::getInstance ()->getCurrentSocketAddressInfo (
85
+ connection, address_family, address_socket_type, address_protocol, native_socket_address,
86
+ native_socket_address_length);
87
+ }
88
+
89
+ const char * dx_am_get_current_address_tls_trust_store (dxf_connection_t connection) {
90
+ thread_local std::string currentAddressTlsTrustStore{};
91
+
92
+ currentAddressTlsTrustStore = dx::AddressesManager::getInstance ()->getCurrentAddressTlsTrustStore (connection);
93
+
94
+ return currentAddressTlsTrustStore.c_str ();
95
+ }
96
+
97
+ const char * dx_am_get_current_address_tls_trust_store_password (dxf_connection_t connection) {
98
+ thread_local std::string currentAddressTlsTrustStorePassword{};
99
+
100
+ currentAddressTlsTrustStorePassword =
101
+ dx::AddressesManager::getInstance ()->getCurrentAddressTlsTrustStorePassword (connection);
102
+
103
+ return currentAddressTlsTrustStorePassword.c_str ();
104
+ }
105
+
106
+ const char * dx_am_get_current_address_tls_key_store (dxf_connection_t connection) {
107
+ thread_local std::string currentAddressTlsKeyStore{};
108
+
109
+ currentAddressTlsKeyStore = dx::AddressesManager::getInstance ()->getCurrentAddressTlsKeyStore (connection);
110
+
111
+ return currentAddressTlsKeyStore.c_str ();
112
+ }
113
+
114
+ const char * dx_am_get_current_address_tls_key_store_password (dxf_connection_t connection) {
115
+ thread_local std::string currentAddressTlsKeyStorePassword{};
116
+
117
+ currentAddressTlsKeyStorePassword =
118
+ dx::AddressesManager::getInstance ()->getCurrentAddressTlsKeyStorePassword (connection);
119
+
120
+ return currentAddressTlsKeyStorePassword.c_str ();
121
+ }
122
+
123
+ #ifdef DXFEED_CODEC_TLS_ENABLED
124
+ void dx_am_set_current_address_tls_trust_store_mem (dxf_connection_t connection, uint8_t * trust_store_mem) {
125
+ dx::AddressesManager::getInstance ()->setCurrentAddressTlsTrustStoreMem (connection, trust_store_mem);
126
+ }
127
+
128
+ void dx_am_set_current_address_tls_trust_store_len (dxf_connection_t connection, size_t trust_store_len) {
129
+ dx::AddressesManager::getInstance ()->setCurrentAddressTlsTrustStoreLen (connection, trust_store_len);
130
+ }
131
+
132
+ void dx_am_set_current_address_tls_key_store_mem (dxf_connection_t connection, uint8_t * key_store_mem) {
133
+ dx::AddressesManager::getInstance ()->setCurrentAddressTlsKeyStoreMem (connection, key_store_mem);
134
+ }
135
+
136
+ void dx_am_set_current_address_tls_key_store_len (dxf_connection_t connection, size_t key_store_len) {
137
+ dx::AddressesManager::getInstance ()->setCurrentAddressTlsKeyStoreLen (connection, key_store_len);
138
+ }
139
+ #endif
140
+
141
+ const char * dx_am_get_current_connected_address (dxf_connection_t connection) {
142
+ thread_local std::string currentConnectedAddress{};
143
+
144
+ currentConnectedAddress = dx::AddressesManager::getInstance ()->getCurrentAddressHost (connection) + " :" +
145
+ dx::AddressesManager::getInstance ()->getCurrentAddressPort (connection);
146
+
147
+ return currentConnectedAddress.c_str ();
148
+ }
149
+
150
+ const char * dx_am_get_current_connected_socket_address (dxf_connection_t connection) {
151
+ thread_local std::string currentConnectedSocketAddress{};
152
+
153
+ currentConnectedSocketAddress = dx::AddressesManager::getInstance ()->getCurrentSocketIpAddress (connection) + " :" +
154
+ dx::AddressesManager::getInstance ()->getCurrentAddressPort (connection);
155
+
156
+ return currentConnectedSocketAddress.c_str ();
157
+ }
28
158
}
0 commit comments