XROAD
pos_engine.h
Go to the documentation of this file.
1 #pragma once
6 #include "mdata_proto.h"
7 #include "mdata_aux.h"
8 #include <cache/xroad_objects.h>
9 
10 #ifdef __cplusplus
11 extern "C"
12 {
13 #endif
14 
15 typedef struct pos_subs_info_s pos_subs_info_t;
16 
17 typedef struct
18 {
19  void* ctx;
25  void (*on_pos)(mdata_pos_info_t*, void*);
26 
27  /* *
28  * fired when pos subscribe status arrived
29  * @param[in] - status of subscirbe
30  * @param[in] - subscribe info object
31  * @param[in] - context
32  * */
33  void (*on_subs_state)(xroad_subscribe_status_t status, pos_subs_info_t*, void*);
34 
41  void (*on_feed_state)(xroad_portfolio_t*, xroad_instr_t*, mdata_feed_state_type_t, void*);
42 
44 
45 typedef struct
46 {
47  void* ctx;
53  void (*on_subscribe)(xroad_pos_subscribe_t*, void*);
55 
56 typedef struct pos_engine_s pos_engine_t;
57 
63 pos_engine_t* pos_server_create(xroad_xml_tag_t cfg, pos_engine_callback_t cb);
64 
70 pos_engine_t* pos_client_create(uint32_t throttle_timeout_us,
71  int32_t wait_timeout_us, int32_t heartbeat_int);
77 xroad_errno_t pos_engine_start(pos_engine_t* pos);
78 
83 void pos_engine_stop(pos_engine_t* pos);
84 
89 void pos_engine_destroy(pos_engine_t* pos);
90 
96 xroad_errno_t pos_engine_send(pos_engine_t* pos, mdata_pos_info_t* data);
97 
108 pos_subs_info_t* pos_engine_subscribe(
109  pos_engine_t* mdata, xroad_portfolio_t* portfolio, xroad_instr_t* instr,
110  xroad_timestamp_t from_ts, xroad_timestamp_t till_ts,
111  pos_callback_t cb);
112 
119 xroad_errno_t pos_engine_unsubscribe(pos_engine_t* md, pos_subs_info_t* info);
120 /* *
121  * deactivates pos channel in case of issues wih data feed
122  * @param[in] c - pointer to the pos_engine_t instance
123  * */
124 xroad_errno_t pos_engine_deactivate(pos_engine_t* pos);
125 
126 /* *
127  * activates pos channel and makes feed online
128  * @param[in] c - pointer to the pos_engine_t instance
129  * */
130 xroad_errno_t pos_engine_activate(pos_engine_t* pos);
131 
132 /*
133  * gets current server mdsource (if it's server instance)
134  * @param[in] pos - pos_engine instance
135  * @return mdsource or NULL (if there is no server mdsource)
136  */
137 xroad_mdsource_t* pos_engine_get_source(pos_engine_t* pos);
138 
139 #ifdef __cplusplus
140 }
141 #endif
xroad_errno_t pos_engine_send(pos_engine_t *pos, mdata_pos_info_t *data)
void pos_engine_destroy(pos_engine_t *pos)
xroad_errno_t pos_engine_start(pos_engine_t *pos)
void pos_engine_stop(pos_engine_t *pos)
pos_subs_info_t * pos_engine_subscribe(pos_engine_t *mdata, xroad_portfolio_t *portfolio, xroad_instr_t *instr, xroad_timestamp_t from_ts, xroad_timestamp_t till_ts, pos_callback_t cb)
xroad_errno_t pos_engine_unsubscribe(pos_engine_t *md, pos_subs_info_t *info)
pos_engine_t * pos_client_create(uint32_t throttle_timeout_us, int32_t wait_timeout_us, int32_t heartbeat_int)
pos_engine_t * pos_server_create(xroad_xml_tag_t cfg, pos_engine_callback_t cb)
Definition: mdata_proto.h:265
Definition: pos_engine.h:18
Definition: pos_engine.h:46
CAUTION: do not change this file - it is autogenerated.
xroad_subscribe_status_t
Definition: xroad_objects_types.h:607