dxFeed Graal CXX API
Loading...
Searching...
No Matches
api.h
Go to the documentation of this file.
1// Copyright (c) 2024 Devexperts LLC.
2// SPDX-License-Identifier: MPL-2.0
3
4#ifndef DXFEED_NATIVE_API_H_INCLUDED
5#define DXFEED_NATIVE_API_H_INCLUDED
6
7#ifdef __cplusplus
8# include <cstddef>
9# include <cstdint>
10
11extern "C" {
12#else
13# include <stddef.h>
14# include <stdint.h>
15#endif
16
17#define DXFC_OUT
18
19/**
20 * @file
21 * @brief dxFeed Native C API enums, structs and functions declarations
22 */
23
24/**
25 * @brief List of error codes.
26 */
27typedef enum dxfc_error_code_t {
28 /**
29 * @brief OK.
30 */
32 /**
33 * @brief dxFeed Graal Native API error.
34 */
36
37 /// The error returned if the current operation cannot be completed.
39} dxfc_error_code_t;
40
41/**
42 * Sets the system property indicated by the specified key.
43 *
44 * @param key The name of the system property (UTF-8 string).
45 * @param value The value of the system property (UTF-8 string).
46 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
47 */
48dxfc_error_code_t dxfc_system_set_property(const char *key, const char *value);
49
50/**
51 * Gets the system property indicated by the specified key.
52 *
53 * The buffer must be allocated in advance. If the system property value does not fit into the buffer, it will be
54 * truncated. The buffer should be large enough to the \0 at the end.
55 * Invalid UTF-8 characters resulting from a string that does not fit in the buffer will be discarded.
56 *
57 * @param key The name of the system property (UTF-8 string)
58 * @param[out] buffer The buffer to store the system property (UTF-8 string)
59 * @param buffer_size The buffer's size.
60 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
61 */
62dxfc_error_code_t dxfc_system_get_property(const char *key, DXFC_OUT char *buffer, size_t buffer_size);
63
64/**
65 * Represents the role of endpoint that was specified during its @ref dxfc_dxendpoint_create() "creation".
66 */
68 /**
69 * `FEED` endpoint connects to the remote data feed provider and is optimized for real-time or
70 * delayed data processing (<b>this is a default role</b>). dxfc_dxendpoint_get_feed() function
71 * returns feed object that subscribes to the remote data feed provider and receives events from it.
72 * When event processing threads cannot keep up (don't have enough CPU time), data is dynamically conflated to
73 * minimize latency between received events and their processing time.
74 *
75 * This endpoint is automatically connected to the configured data feed.
76 */
78
79 /**
80 * `ON_DEMAND_FEED` endpoint is similar to ::DXFC_DXENDPOINT_ROLE_FEED, but it is designed to be used with
81 * dxfc_on_demand_service_t for historical data replay only.
82 *
83 * `ON_DEMAND_FEED` endpoint cannot be connected to an ordinary data feed at all.
84 */
86
87 /**
88 * `STREAM_FEED` endpoint is similar to ::DXFC_DXENDPOINT_ROLE_FEED and also connects to the remote data feed
89 * provider, but is designed for bulk parsing of data from files. dxfc_dxendpoint_get_feed() function returns feed
90 * object that subscribes to the data from the opened files and receives events from them. Events from the files are
91 * not conflated, are not skipped, and are processed as fast as possible. Note, that in this role,
92 * dxfc_dxfeed_get_last_event() function does not work.
93 */
95
96 /**
97 * `PUBLISHER` endpoint connects to the remote publisher hub (also known as multiplexor) or
98 * creates a publisher on the local host. dxfc_dxendpoint_get_publisher() function returns
99 * a publisher object that publishes events to all connected feeds.
100 * Note, that in this role, dxfc_dxfeed_get_last_event() function does not work and
101 * time-series subscription is not supported.
102 *
103 * This endpoint is automatically connected to the configured data feed.
104 */
106
107 /**
108 * `STREAM_PUBLISHER` endpoint is similar to ::DXFC_DXENDPOINT_ROLE_PUBLISHER and also connects to the remote
109 * publisher hub, but is designed for bulk publishing of data. dxfc_dxendpoint_get_publisher() function returns a
110 * publisher object that publishes events to all connected feeds. Published events are not conflated, are not
111 * skipped, and are processed as fast as possible. Note, that in this role, dxfc_dxfeed_get_last_event() function
112 * does not work and time-series subscription is not supported.
113 */
115
116 /**
117 * `LOCAL_HUB` endpoint is a local hub without ability to establish network connections.
118 * Events that are published via @ref dxfc_dxendpoint_get_publisher() "publisher" are delivered to local
119 * @ref dxfc_dxendpoint_get_feed() "feed" only.
120 */
122} dxfc_dxendpoint_role_t;
123
124/**
125 * Represents the current state of endpoint.
126 */
128 /**
129 * Endpoint was created by is not connected to remote endpoints.
130 */
132
133 /**
134 * The @ref dxfc_dxendpoint_connect() "connect" function was called to establish connection to
135 * remove endpoint, but connection is not actually established yet or was lost.
136 */
138
139 /**
140 * The connection to remote endpoint is established.
141 */
143
144 /**
145 * Endpoint was @ref dxfc_dxendpoint_close() "closed".
146 */
148} dxfc_dxendpoint_state_t;
149
150/**
151 * The endpoint current state change listener
152 *
153 * @see dxfc_dxendpoint_add_state_change_listener()
154 * @see dxfc_dxendpoint_remove_state_change_listener()
155 */
156typedef void (*dxfc_dxendpoint_state_change_listener)(dxfc_dxendpoint_state_t old_state,
157 dxfc_dxendpoint_state_t new_state, void *user_data);
158
159/**
160 * The simple key-value structure that represents an endpoint's property
161 */
163 /// The property's key
164 const char *key;
165 /// The property's value
166 const char *value;
167} dxfc_dxendpoint_property_t;
168
169/**
170 * The dxFeed endpoint handle. It is used for searching, adding endpoints to the "registry", deleting endpoints from
171 * the "registry" and calling functions associated with a particular endpoint.
172 *
173 * The "registry" is responsible for neatly closing resources, shutting down work, and freeing up memory on shutdown.
174 * This can be forced by calling the dxfc_dxendpoint_free() function.
175 */
176typedef void *dxfc_dxendpoint_t;
177
178/**
179 * The dxFeed endpoint's builder handle. It is used for searching, adding builders to the "registry", deleting builders
180 * from the "registry" and calling functions associated with a particular builder.
181 *
182 * The "registry" is responsible for neatly closing resources, shutting down work, and freeing up memory on shutdown.
183 * This can be forced by calling the dxfc_dxendpoint_builder_free() function.
184 */
186
187/**
188 * The dxFeed handle.
189 */
190typedef void *dxfc_dxfeed_t;
191
192/**
193 * The dxFeed publisher handle.
194 */
195typedef void *dxfc_dxpublisher_t;
196
197/**
198 * Creates new dxFeed endpoint's builder instance.
199 * Use dxfc_dxendpoint_builder_build to build an instance of dxFeed endpoint when all configuration properties were set.
200 *
201 * @param[out] builder The created endpoint's builder.
202 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
203 */
205
206/**
207 * Sets role for the created dxFeed endpoint.
208 * Default role is @ref DXFC_DXENDPOINT_ROLE_FEED "FEED".
209 *
210 * @param builder The endpoint's builder
211 * @param role The endpoint's role
212 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
213 */
214dxfc_error_code_t dxfc_dxendpoint_builder_with_role(dxfc_dxendpoint_builder_t builder, dxfc_dxendpoint_role_t role);
215
216/**
217 * Changes name that is used to distinguish multiple endpoints
218 * in the same process (GraalVM Isolate) in logs and in other diagnostic means.
219 *
220 * @param builder The endpoint's builder
221 * @param name The endpoint's name
222 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
223 */
224dxfc_error_code_t dxfc_dxendpoint_builder_with_name(dxfc_dxendpoint_builder_t builder, const char *name);
225
226/**
227 * Sets the specified property. Unsupported properties are ignored.
228 *
229 * @param builder The endpoint's builder
230 * @param key The endpoint's property key
231 * @param value The endpoint's property value
232 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
233 */
234dxfc_error_code_t dxfc_dxendpoint_builder_with_property(dxfc_dxendpoint_builder_t builder, const char *key,
235 const char *value);
236
237/**
238 * Sets all supported properties from the provided properties object.
239 *
240 * @param builder The endpoint's builder
241 * @param properties The endpoint's properties
242 * @param size The size of the endpoint's properties
243 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
244 */
246 const dxfc_dxendpoint_property_t **properties, size_t size);
247
248/**
249 * Checks if a property is supported
250 *
251 * @param builder The endpoint's builder
252 * @param key The property's key to be checked for support
253 * @param[out] supports `1` if the corresponding property key is supported.
254 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
255 */
256dxfc_error_code_t dxfc_dxendpoint_builder_supports_property(dxfc_dxendpoint_builder_t builder, const char *key,
257 DXFC_OUT int *supports);
258
259/**
260 * Builds the new dxFeed endpoint instance.
261 *
262 * @param builder The endpoint's builder
263 * @param user_data User data that will be passed to the endpoint's state transition listeners.
264 * @param[out] endpoint The created endpoint
265 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
266 */
267dxfc_error_code_t dxfc_dxendpoint_builder_build(dxfc_dxendpoint_builder_t builder, void *user_data,
268 DXFC_OUT dxfc_dxendpoint_t *endpoint);
269
270/**
271 * Removes a builder from the registry.
272 *
273 * @param builder The endpoint's builder
274 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
275 */
277
278/**
279 * Returns a default application-wide singleton instance of dxFeed endpoint with a @ref DXFC_DXENDPOINT_ROLE_FEED "FEED"
280 * role. Most applications use only a single data-source and should rely on this function to get one. This function
281 * creates an endpoint on the first use with a default configuration. You can provide configuration via system
282 * properties.
283 *
284 * This is a shortcut to
285 * ```c
286 * dxfc_dxendpoint_t endpoint;
287 *
288 * dxfc_dxendpoint_get_instance2(DXFC_DXENDPOINT_ROLE_FEED, user_data, &endpoint);
289 * ```
290 *
291 * @param user_data User data that will be passed to the endpoint's state transition listeners.
292 * @param[out] endpoint The created endpoint
293 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
294 */
295dxfc_error_code_t dxfc_dxendpoint_get_instance(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint);
296
297/**
298 * Returns a default application-wide singleton instance of DXEndpoint for a specific role.
299 * Most applications use only a single data-source and should rely on this function to get one.
300 * This function creates an endpoint with the corresponding role on the first use with a default
301 * configuration.
302 * You can provide configuration via system properties.
303 *
304 * The configuration does not have to include an address. You can use @ref dxfc_dxendpoint_connect()
305 * "connect(endpoint, address)" and dxfc_dxendpoint_disconnect() functions on the instance that is returned by this
306 * function to programmatically
307 * establish and tear-down connection to a user-provided address.
308 *
309 * If you need a fully programmatic configuration and/or multiple endpoints of the same role in your
310 * application, then create a custom instance of dxFeed endpoint with dxfc_dxendpoint_new_builder() function, configure
311 * it, and use dxfc_dxendpoint_builder_build() function.
312 *
313 * @param role The role of dxFeed endpoint instance
314 * @param user_data User data that will be passed to the endpoint's state transition listeners.
315 * @param[out] endpoint The created endpoint
316 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
317 */
318dxfc_error_code_t dxfc_dxendpoint_get_instance2(dxfc_dxendpoint_role_t role, void *user_data,
319 DXFC_OUT dxfc_dxendpoint_t *endpoint);
320
321/**
322 * Creates an endpoint with @ref DXFC_DXENDPOINT_ROLE_FEED "FEED" role.
323 * The result of this function is the same as <b>`dxfc_dxendpoint_create2(DXFC_DXENDPOINT_ROLE_FEED, user_data,
324 * &endpoint)`</b>. This is a shortcut to
325 * ```c
326 * dxfc_dxendpoint_builder_t builder;
327 * dxfc_dxendpoint_t endpoint;
328 *
329 * dxfc_dxendpoint_new_builder(&builder);
330 * dxfc_dxendpoint_builder_build(builder, user_data, &endpoint);
331 * ```
332 *
333 * @param user_data User data that will be passed to the endpoint's state transition listeners.
334 * @param[out] endpoint The created endpoint
335 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
336 */
337dxfc_error_code_t dxfc_dxendpoint_create(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint);
338
339/**
340 * Creates an endpoint with a specified role.
341 * This is a shortcut to
342 * ```c
343 * dxfc_dxendpoint_builder_t builder;
344 * dxfc_dxendpoint_t endpoint;
345 *
346 * dxfc_dxendpoint_new_builder(&builder);
347 * dxfc_dxendpoint_builder_with_role(builder, role);
348 * dxfc_dxendpoint_builder_build(builder, user_data, &endpoint);
349 * ```
350 *
351 * @param role The role of dxFeed endpoint instance
352 * @param user_data User data that will be passed to the endpoint's state transition listeners.
353 * @param[out] endpoint The created endpoint
354 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
355 */
356dxfc_error_code_t dxfc_dxendpoint_create2(dxfc_dxendpoint_role_t role, void *user_data,
357 DXFC_OUT dxfc_dxendpoint_t *endpoint);
358
359/**
360 * Closes this endpoint. All network connection are terminated as with dxfc_dxendpoint_disconnect() function and no
361 * further connections can be established.
362 *
363 * The endpoint @ref dxfc_dxendpoint_get_state() "state" immediately becomes @ref DXFC_DXENDPOINT_STATE_CLOSED "CLOSED".
364 * All resources associated with this endpoint are released.
365 *
366 * @param endpoint The dxFeed endpoint to close
367 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
368 */
369dxfc_error_code_t dxfc_dxendpoint_close(dxfc_dxendpoint_t endpoint);
370
371/**
372 * Closes this endpoint and wait until all pending data processing tasks are completed.
373 * This function performs the same actions as dxfc_dxendpoint_close(), but also awaits
374 * termination of all outstanding data processing tasks. It is designed to be used
375 * with @ref DXFC_DXENDPOINT_ROLE_STREAM_FEED "STREAM_FEED" role after dxfc_dxendpoint_await_not_connected() function
376 * returns to make sure that file was completely processed.
377 *
378 * <p><b>This function is blocking.</b>
379 *
380 * @param endpoint The dxFeed endpoint
381 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
382 */
384
385/**
386 * Returns the role of this endpoint.
387 *
388 * @param endpoint The dxFeed endpoint
389 * @param[out] role The role of this endpoint
390 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
391 */
392dxfc_error_code_t dxfc_dxendpoint_get_role(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_role_t *role);
393
394/**
395 * Changes user name for this endpoint.
396 * This function shall be called before @ref dxfc_dxendpoint_connect() "connect" together
397 * with @ref dxfc_dxendpoint_password() "password" to configure service access credentials.
398 *
399 * @param endpoint The dxFeed endpoint
400 * @param user The user name
401 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
402 */
403dxfc_error_code_t dxfc_dxendpoint_user(dxfc_dxendpoint_t endpoint, const char *user);
404
405/**
406 * Changes password for this endpoint.
407 * This function shall be called before @ref dxfc_dxendpoint_connect() "connect" together
408 * with @ref dxfc_dxendpoint_user() "user" to configure service access credentials.
409 *
410 * @param endpoint The dxFeed endpoint
411 * @param password The user password
412 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
413 */
414dxfc_error_code_t dxfc_dxendpoint_password(dxfc_dxendpoint_t endpoint, const char *password);
415
416/**
417 * Connects to the specified remote address. Previously established connections are closed if
418 * the new address is different from the old one.
419 * This function does nothing if address does not change or if this endpoint is @ref DXFC_DXENDPOINT_STATE_CLOSED
420 * "CLOSED". The endpoint @ref dxfc_dxendpoint_get_state() "state" immediately becomes @ref
421 * DXFC_DXENDPOINT_STATE_CONNECTING "CONNECTING" otherwise.
422 *
423 * <p> The address string is provided with the market data vendor agreement.
424 * Use "demo.dxfeed.com:7300" for a demo quote feed.
425 *
426 * <p> The simplest address strings have the following format:
427 * * `host:port` to establish a TCP/IP connection.
428 * * `:port` to listen for a TCP/IP connection with a plain socket connector (good for up to a
429 * few hundred of connections).
430 *
431 * <p>For premium services access credentials must be configured before invocation of `connect` function
432 * using @ref dxfc_dxendpoint_user() "user" and @ref dxfc_dxendpoint_password() "password" functions.
433 *
434 * <p> <b>This function does not wait until connection actually gets established</b>. The actual connection
435 * establishment happens asynchronously after the invocation of this function. However, this function waits until
436 * notification about state transition from DXFC_DXENDPOINT_STATE_NOT_CONNECTED to DXFC_DXENDPOINT_STATE_CONNECTING gets
437 * processed by all listeners.
438 *
439 * [Javadoc.](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/api/DXEndpoint.html#connect-java.lang.String-)
440 *
441 * @param endpoint The dxFeed endpoint
442 * @param address The data source address
443 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
444 */
445dxfc_error_code_t dxfc_dxendpoint_connect(dxfc_dxendpoint_t endpoint, const char *address);
446
447/**
448 * Terminates all established network connections and initiates connecting again with the same address.
449 *
450 * <p>The effect of the function is alike to invoking dxfc_dxendpoint_disconnect() and dxfc_dxendpoint_connect()
451 * with the current address, but internal resources used for connections may be reused by implementation.
452 * TCP connections with multiple target addresses will try switch to an alternative address, configured
453 * reconnect timeouts will apply.
454 *
455 * <p><b>Note:</b> The function will not connect endpoint that was not initially connected with
456 * dxfc_dxendpoint_connect() function or was disconnected with dxfc_dxendpoint_disconnect() function.
457 *
458 * <p>The function initiates a short-path way for reconnecting, so whether observers will have a chance to see
459 * an intermediate state DXFC_DXENDPOINT_STATE_NOT_CONNECTED depends on the implementation.
460 *
461 * @param endpoint The dxFeed endpoint to reconnect
462 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
463 */
464dxfc_error_code_t dxfc_dxendpoint_reconnect(dxfc_dxendpoint_t endpoint);
465
466/**
467 * Terminates all remote network connections.
468 * This function does nothing if this endpoint is @ref DXFC_DXENDPOINT_STATE_CLOSED "CLOSED".
469 * The endpoint @ref dxfc_dxendpoint_get_state() "state" immediately becomes @ref DXFC_DXENDPOINT_STATE_NOT_CONNECTED
470 * "NOT_CONNECTED" otherwise.
471 *
472 * <p>This function does not release all resources that are associated with this endpoint.
473 * Use dxfc_dxendpoint_disconnect() function to release all resources.
474 *
475 * @param endpoint The dxFeed endpoint to disconnect
476 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
477 */
478dxfc_error_code_t dxfc_dxendpoint_disconnect(dxfc_dxendpoint_t endpoint);
479
480/**
481 * Terminates all remote network connections and clears stored data.
482 * This function does nothing if this endpoint is @ref DXFC_DXENDPOINT_STATE_CLOSED "CLOSED".
483 * The endpoint @ref dxfc_dxendpoint_get_state() "state" immediately becomes @ref DXFC_DXENDPOINT_STATE_NOT_CONNECTED
484 * "NOT_CONNECTED" otherwise.
485 *
486 * <p>This function does not release all resources that are associated with this endpoint.
487 * Use dxfc_dxendpoint_close() function to release all resources.
488 *
489 * @param endpoint The dxFeed endpoint
490 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
491 */
493
494/**
495 * Waits until this endpoint stops processing data (becomes quiescent).
496 * This is important when writing data to file via "tape:..." connector to make sure that
497 * all published data was written before closing this endpoint.
498 *
499 * @param endpoint The dxFeed endpoint
500 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
501 */
502dxfc_error_code_t dxfc_dxendpoint_await_processed(dxfc_dxendpoint_t endpoint);
503
504/**
505 * Waits while this endpoint @ref dxfc_dxendpoint_get_state() "state" becomes @ref DXFC_DXENDPOINT_STATE_NOT_CONNECTED
506 * "NOT_CONNECTED" or
507 * @ref DXFC_DXENDPOINT_STATE_CLOSED "CLOSED". It is a signal that any files that were opened with
508 * @ref dxfc_dxendpoint_connect() "dxfc_dxendpoint_connect(endpoint, \"file:...\")" function were finished reading, but
509 * not necessary were completely processed by the corresponding subscription listeners. Use
510 * dxfc_dxendpoint_and_await_termination() after this function returns to make sure that all processing has completed.
511 *
512 * <p><b>This function is blocking.</b>
513 *
514 * @param endpoint The dxFeed endpoint
515 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
516 */
518
519/**
520 * Returns the state of this endpoint.
521 *
522 * @param endpoint The dxFeed endpoint
523 * @param[out] state The state of this endpoint
524 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
525 */
526dxfc_error_code_t dxfc_dxendpoint_get_state(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_state_t *state);
527
528/**
529 * Adds listener that is notified about changes in @ref dxfc_dxendpoint_get_state() "state" property.
530 *
531 * <p>Installed listener can be removed by dxfc_dxendpoint_remove_state_change_listener() function.
532 *
533 * @param endpoint The dxFeed endpoint
534 * @param listener The listener to add
535 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
536 */
539
540/**
541 * Removes listener that is notified about changes in @ref dxfc_dxendpoint_get_state() "state" property.
542 * It removes the listener that was previously installed with dxfc_dxendpoint_add_state_change_listener() function.
543 *
544 * @param endpoint The dxFeed endpoint
545 * @param listener The listener to remove
546 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
547 */
550
551/**
552 *
553 * @param endpoint The dxFeed endpoint
554 * @param[out] feed
555 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
556 */
557dxfc_error_code_t dxfc_dxendpoint_get_feed(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxfeed_t *feed);
558
559/**
560 *
561 * @param endpoint The dxFeed endpoint
562 * @param[out] publisher
563 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
564 */
565dxfc_error_code_t dxfc_dxendpoint_get_publisher(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxpublisher_t *publisher);
566
567/**
568 * Removes the dxFeed endpoint from the registry.
569 * @param endpoint The dxFeed endpoint to remove
570 * @return DXFC_EC_SUCCESS - if the operation was successful; otherwise - DXFC_EC_ERROR.
571 */
572dxfc_error_code_t dxfc_dxendpoint_free(dxfc_dxendpoint_t endpoint);
573
574#ifdef __cplusplus
575}
576#endif
577
578#endif // DXFEED_NATIVE_API_H_INCLUDED
#define DXFCPP_END_NAMESPACE
Definition Conf.hpp:54
#define DXFCPP_BEGIN_NAMESPACE
Definition Conf.hpp:51
dxfc_error_code_t dxfc_dxendpoint_create2(dxfc_dxendpoint_role_t role, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Creates an endpoint with a specified role.
Definition DXEndpoint.cpp:827
dxfc_error_code_t dxfc_dxendpoint_get_feed(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxfeed_t *feed)
Definition DXEndpoint.cpp:1103
dxfc_error_code_t dxfc_dxendpoint_builder_with_role(dxfc_dxendpoint_builder_t builder, dxfc_dxendpoint_role_t role)
Sets role for the created dxFeed endpoint.
Definition DXEndpoint.cpp:625
dxfc_error_code_t dxfc_dxendpoint_await_not_connected(dxfc_dxendpoint_t endpoint)
Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.
Definition DXEndpoint.cpp:1020
dxfc_error_code_t dxfc_dxendpoint_password(dxfc_dxendpoint_t endpoint, const char *password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:918
void * dxfc_dxendpoint_builder_t
The dxFeed endpoint's builder handle.
Definition api.h:185
dxfc_error_code_t dxfc_dxendpoint_get_instance2(dxfc_dxendpoint_role_t role, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Returns a default application-wide singleton instance of DXEndpoint for a specific role.
Definition DXEndpoint.cpp:782
dxfc_dxendpoint_state_t
Represents the current state of endpoint.
Definition api.h:127
@ DXFC_DXENDPOINT_STATE_CLOSED
Endpoint was closed.
Definition api.h:147
@ DXFC_DXENDPOINT_STATE_NOT_CONNECTED
Endpoint was created by is not connected to remote endpoints.
Definition api.h:131
@ DXFC_DXENDPOINT_STATE_CONNECTING
The connect function was called to establish connection to remove endpoint, but connection is not act...
Definition api.h:137
@ DXFC_DXENDPOINT_STATE_CONNECTED
The connection to remote endpoint is established.
Definition api.h:142
dxfc_error_code_t dxfc_dxendpoint_disconnect_and_clear(dxfc_dxendpoint_t endpoint)
Terminates all remote network connections and clears stored data.
Definition DXEndpoint.cpp:986
dxfc_error_code_t dxfc_dxendpoint_create(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Creates an endpoint with FEED role.
Definition DXEndpoint.cpp:805
#define DXFC_OUT
Definition api.h:17
dxfc_error_code_t dxfc_dxendpoint_builder_with_name(dxfc_dxendpoint_builder_t builder, const char *name)
Changes name that is used to distinguish multiple endpoints in the same process (GraalVM Isolate) in ...
Definition DXEndpoint.cpp:642
void * dxfc_dxendpoint_t
The dxFeed endpoint handle.
Definition api.h:176
dxfc_error_code_t dxfc_dxendpoint_reconnect(dxfc_dxendpoint_t endpoint)
Terminates all established network connections and initiates connecting again with the same address.
Definition DXEndpoint.cpp:952
dxfc_error_code_t dxfc_dxendpoint_builder_build(dxfc_dxendpoint_builder_t builder, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Builds the new dxFeed endpoint instance.
Definition DXEndpoint.cpp:719
dxfc_error_code_t
List of error codes.
Definition api.h:27
@ DXFC_EC_ERROR
The error returned if the current operation cannot be completed.
Definition api.h:38
@ DXFC_EC_SUCCESS
OK.
Definition api.h:31
@ DXFC_EC_G_ERR
dxFeed Graal Native API error.
Definition api.h:35
dxfc_error_code_t dxfc_system_set_property(const char *key, const char *value)
Sets the system property indicated by the specified key.
Definition System.cpp:69
dxfc_error_code_t dxfc_system_get_property(const char *key, DXFC_OUT char *buffer, size_t buffer_size)
Gets the system property indicated by the specified key.
dxfc_error_code_t dxfc_dxendpoint_builder_supports_property(dxfc_dxendpoint_builder_t builder, const char *key, DXFC_OUT int *supports)
Checks if a property is supported.
Definition DXEndpoint.cpp:702
dxfc_error_code_t dxfc_dxendpoint_close(dxfc_dxendpoint_t endpoint)
Closes this endpoint.
Definition DXEndpoint.cpp:850
dxfc_error_code_t dxfc_dxendpoint_user(dxfc_dxendpoint_t endpoint, const char *user)
Changes user name for this endpoint.
Definition DXEndpoint.cpp:901
dxfc_error_code_t dxfc_dxendpoint_remove_state_change_listener(dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
Removes listener that is notified about changes in state property.
Definition DXEndpoint.cpp:1080
void(* dxfc_dxendpoint_state_change_listener)(dxfc_dxendpoint_state_t old_state, dxfc_dxendpoint_state_t new_state, void *user_data)
The endpoint current state change listener.
Definition api.h:156
dxfc_error_code_t dxfc_dxendpoint_get_publisher(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxpublisher_t *publisher)
Definition DXEndpoint.cpp:1108
dxfc_error_code_t dxfc_dxendpoint_get_state(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_state_t *state)
Returns the state of this endpoint.
Definition DXEndpoint.cpp:1037
dxfc_error_code_t dxfc_dxendpoint_builder_free(dxfc_dxendpoint_builder_t builder)
Removes a builder from the registry.
Definition DXEndpoint.cpp:748
dxfc_dxendpoint_role_t
Represents the role of endpoint that was specified during its creation.
Definition api.h:67
@ DXFC_DXENDPOINT_ROLE_PUBLISHER
PUBLISHER endpoint connects to the remote publisher hub (also known as multiplexor) or creates a publ...
Definition api.h:105
@ DXFC_DXENDPOINT_ROLE_STREAM_FEED
STREAM_FEED endpoint is similar to DXFC_DXENDPOINT_ROLE_FEED and also connects to the remote data fee...
Definition api.h:94
@ DXFC_DXENDPOINT_ROLE_FEED
FEED endpoint connects to the remote data feed provider and is optimized for real-time or delayed dat...
Definition api.h:77
@ DXFC_DXENDPOINT_ROLE_STREAM_PUBLISHER
STREAM_PUBLISHER endpoint is similar to DXFC_DXENDPOINT_ROLE_PUBLISHER and also connects to the remot...
Definition api.h:114
@ DXFC_DXENDPOINT_ROLE_LOCAL_HUB
LOCAL_HUB endpoint is a local hub without ability to establish network connections.
Definition api.h:121
@ DXFC_DXENDPOINT_ROLE_ON_DEMAND_FEED
ON_DEMAND_FEED endpoint is similar to DXFC_DXENDPOINT_ROLE_FEED, but it is designed to be used with d...
Definition api.h:85
void * dxfc_dxpublisher_t
The dxFeed publisher handle.
Definition api.h:195
dxfc_error_code_t dxfc_dxendpoint_builder_with_properties(dxfc_dxendpoint_builder_t builder, const dxfc_dxendpoint_property_t **properties, size_t size)
Sets all supported properties from the provided properties object.
Definition DXEndpoint.cpp:675
dxfc_error_code_t dxfc_dxendpoint_connect(dxfc_dxendpoint_t endpoint, const char *address)
Connects to the specified remote address.
Definition DXEndpoint.cpp:935
dxfc_error_code_t dxfc_dxendpoint_new_builder(DXFC_OUT dxfc_dxendpoint_builder_t *builder)
Creates new dxFeed endpoint's builder instance.
Definition DXEndpoint.cpp:609
void * dxfc_dxfeed_t
The dxFeed handle.
Definition api.h:190
dxfc_error_code_t dxfc_dxendpoint_close_and_await_termination(dxfc_dxendpoint_t endpoint)
Closes this endpoint and wait until all pending data processing tasks are completed.
Definition DXEndpoint.cpp:867
dxfc_error_code_t dxfc_dxendpoint_get_instance(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Returns a default application-wide singleton instance of dxFeed endpoint with a FEED role.
Definition DXEndpoint.cpp:760
dxfc_error_code_t dxfc_dxendpoint_disconnect(dxfc_dxendpoint_t endpoint)
Terminates all remote network connections.
Definition DXEndpoint.cpp:969
dxfc_error_code_t dxfc_dxendpoint_add_state_change_listener(dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
Adds listener that is notified about changes in state property.
Definition DXEndpoint.cpp:1054
dxfc_error_code_t dxfc_dxendpoint_free(dxfc_dxendpoint_t endpoint)
Removes the dxFeed endpoint from the registry.
Definition DXEndpoint.cpp:1113
dxfc_error_code_t dxfc_dxendpoint_get_role(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_role_t *role)
Returns the role of this endpoint.
Definition DXEndpoint.cpp:884
dxfc_error_code_t dxfc_dxendpoint_await_processed(dxfc_dxendpoint_t endpoint)
Waits until this endpoint stops processing data (becomes quiescent).
Definition DXEndpoint.cpp:1003
dxfc_error_code_t dxfc_dxendpoint_builder_with_property(dxfc_dxendpoint_builder_t builder, const char *key, const char *value)
Sets the specified property.
Definition DXEndpoint.cpp:658
The simple key-value structure that represents an endpoint's property.
Definition api.h:162
const char * key
The property's key.
Definition api.h:164
const char * value
The property's value.
Definition api.h:166