forked from dxFeed/dxfeed-c-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnectionContextData.h
135 lines (116 loc) · 5.29 KB
/
ConnectionContextData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Initial Developer of the Original Code is Devexperts LLC.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*/
/*
* Provides functionality to manage the connection-specific data.
*/
#ifndef CONNECTION_CONTEXT_DATA_H_INCLUDED
#define CONNECTION_CONTEXT_DATA_H_INCLUDED
#include "DXTypes.h"
/* -------------------------------------------------------------------------- */
/*
* Various types
*/
/* -------------------------------------------------------------------------- */
typedef enum {
dx_ccs_begin,
dx_ccs_network = dx_ccs_begin,
dx_ccs_event_subscription,
dx_ccs_record_transcoder,
dx_ccs_data_structures,
dx_ccs_record_buffers,
dx_ccs_server_msg_processor,
dx_ccs_buffered_input,
dx_ccs_buffered_output,
dx_css_connection_impl,
dx_ccs_snapshot_subscription,
dx_ccs_price_level_book,
dx_ccs_regional_book,
dx_ccs_count
} dx_connection_context_subsystem_t;
typedef int (*dx_conn_ctx_subsys_manipulator_t) (dxf_connection_t connection);
/* -------------------------------------------------------------------------- */
/*
* Subsystem initializer/deinitializer macros
*/
/* -------------------------------------------------------------------------- */
#define DX_CONNECTION_SUBSYS_INIT_NAME(subsys_id) \
subsys_id##_init
#define DX_CONNECTION_SUBSYS_INIT_PROTO(subsys_id) \
int DX_CONNECTION_SUBSYS_INIT_NAME(subsys_id) (dxf_connection_t connection)
#define DX_CONNECTION_SUBSYS_DEINIT_NAME(subsys_id) \
subsys_id##_deinit
#define DX_CONNECTION_SUBSYS_DEINIT_PROTO(subsys_id) \
int DX_CONNECTION_SUBSYS_DEINIT_NAME(subsys_id) (dxf_connection_t connection)
#define DX_CONNECTION_SUBSYS_CHECK_NAME(subsys_id) \
subsys_id##_check
#define DX_CONNECTION_SUBSYS_CHECK_PROTO(subsys_id) \
int DX_CONNECTION_SUBSYS_CHECK_NAME(subsys_id) (dxf_connection_t connection)
/* -------------------------------------------------------------------------- */
/*
* Subsystem initializer/deinitializer prototypes
*/
/* -------------------------------------------------------------------------- */
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_network);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_event_subscription);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_record_transcoder);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_data_structures);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_record_buffers);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_server_msg_processor);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_buffered_input);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_buffered_output);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_css_connection_impl);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_snapshot_subscription);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_price_level_book);
DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_regional_book);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_network);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_event_subscription);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_record_transcoder);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_data_structures);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_record_buffers);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_server_msg_processor);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_buffered_input);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_buffered_output);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_css_connection_impl);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_snapshot_subscription);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_price_level_book);
DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_regional_book);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_network);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_event_subscription);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_record_transcoder);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_data_structures);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_record_buffers);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_server_msg_processor);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_buffered_input);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_buffered_output);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_css_connection_impl);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_snapshot_subscription);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_price_level_book);
DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_regional_book);
/* -------------------------------------------------------------------------- */
/*
* Main functions
*/
/* -------------------------------------------------------------------------- */
dxf_connection_t dx_init_connection (void);
int dx_deinit_connection (dxf_connection_t connection);
int dx_can_deinit_connection (dxf_connection_t connection);
void* dx_get_subsystem_data (dxf_connection_t connection, dx_connection_context_subsystem_t subsystem, OUT int* res);
int dx_set_subsystem_data (dxf_connection_t connection, dx_connection_context_subsystem_t subsystem, void* data);
int dx_validate_connection_handle (dxf_connection_t connection, int is_internal);
#endif /* CONNECTION_CONTEXT_DATA_H_INCLUDED */