28 #define CTL_EXPORT __declspec(dllimport) 30 #define CTL_EXPORT extern 34 #ifdef HAVE_STREAMLINK 35 #define HAVE_CLIENT_API 40 #define HAVE_SERVER_API 41 #define HAVE_CLIENT_API 44 #ifdef HAVE_TRANSFORMER 45 #define HAVE_CLIENT_API 46 #define HAVE_SERVER_API 51 #include <sys/types.h> 73 #define FIELD_REQUESTID "RequestID" 74 #define FIELD_PROTOCOL "TradingProtocol" 75 #define FIELD_MSGTYPE "MsgType" 153 #ifdef HAVE_STREAMLINK 161 #ifdef HAVE_CLIENT_API 168 #ifdef HAVE_SERVER_API 210 #ifdef HAVE_TRANSFORMER 211 CTL_EXPORT
ctl_provider *ctl_create_tf_server_provider(
ctl_app_listener *listener,
void *context,
int num_models,
const char *
const *models,
const char *namespacePattern);
212 CTL_EXPORT
ctl_provider *ctl_create_tf_client_provider(
int num_models,
const char *
const *models);
230 CTL_EXPORT
void ctl_provider_set_name(
ctl_provider *provider,
const char *name);
289 CTL_EXPORT
void ctl_free(
void *ptr);
291 CTL_EXPORT
void ctl_set_allocator(
void *(*realloc_func)(
void *ctx,
void *orig,
size_t size),
void (*free_func)(
void *ctx,
void *),
void *ctx);
293 CTL_EXPORT
void *
ctl_realloc(
void *orig,
size_t size);
295 CTL_EXPORT
char *
ctl_strdup(
const char *orig);
296 CTL_EXPORT
void *
ctl_calloc(
size_t nmemb,
size_t size);
CTL_EXPORT void * ctl_realloc(void *orig, size_t size)
Reallocate the supplied memory.
Definition: misc.c:119
struct ctl_channel_s ctl_channel
Opaque handle representing a trade channel.
Definition: ctl.h:65
CTL_EXPORT void * ctl_calloc(size_t nmemb, size_t size)
Allocate and zero an array of elements.
Definition: misc.c:87
CTL_EXPORT const char * ctl_trade_get_protocol(ctl_provider *provider, ctl_channel *channel, ctl_trade *trade)
Get the name of the trade model that is in use for the specified trade.
Definition: api.c:202
CTL_EXPORT void ctl_provider_set_audit_dslog(ctl_provider *provider, ds_log_t *log)
Set the logfile that audit logs will be written to.
Definition: ds_provider.c:255
CTL_EXPORT const char * ctl_tradeevent_get_type(ctl_tradeevent *ev)
Get the type of the trade event.
Definition: tradeevent.c:108
CTL_EXPORT void ctl_set_allocator(void *(*realloc_func)(void *ctx, void *orig, size_t size), void(*free_func)(void *ctx, void *), void *ctx)
Set the allocator that will be used by the library.
Definition: misc.c:52
CTL_EXPORT void ctl_tradeevent_dealloc(ctl_tradeevent *ev)
Free up the trade event.
Definition: tradeevent.c:51
CTL_EXPORT ctl_trade * ctl_channel_create_trade_with_requestid(ctl_provider *provider, ctl_channel *channel, const char *model, const char *requestid)
Create a trade on the specified trade channel.
Definition: api.c:609
CTL_EXPORT ctl_trade * ctl_channel_create_trade(ctl_provider *provider, ctl_channel *channel, const char *model)
Create a trade on the specified trade channel.
Definition: api.c:584
CTL_EXPORT void ctl_trade_set_user_pointer(ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, void *ptr)
Set a user pointer on the ctl_trade object.
Definition: api.c:372
ctl_error
Error codes used by the library.
Definition: ctl.h:82
CTL_EXPORT void ctl_tradeevent_add_field(ctl_tradeevent *ev, const char *name, const char *value)
Add a field to a trade event.
Definition: tradeevent.c:77
CTL_EXPORT char * ctl_channel_tostring(ctl_channel *channel, char *buf, size_t buflen)
Create a string representation of a ctl_channel object.
Definition: tradechannel.c:264
CTL_EXPORT void ctl_trade_set_listener(ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, ctl_trade_listener *listener, void *context)
Set the listener for the specified trade.
Definition: api.c:78
CTL_EXPORT void * ctl_channel_get_user_pointer(ctl_provider *provider, ctl_channel *channel)
Gets the user pointer on the ctl_trade object.
Definition: api.c:460
CTL_EXPORT const char * ctl_trade_get_state(ctl_provider *provider, ctl_channel *channel, ctl_trade *trade)
Get the current state of the specified trade.
Definition: api.c:313
Listener interface that should be registered if you wish to receive notification of trade creation an...
Definition: ctl.h:120
CTL_EXPORT ctl_tradeevent * ctl_trade_create_tradeevent(ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, const char *type)
Create a new trade event.
Definition: api.c:244
CTL_EXPORT void ctl_channel_set_listener(ctl_provider *provider, ctl_channel *channel, ctl_channel_listener *listener, void *context)
Set the listener on the trade channel.
Definition: api.c:40
CTL_EXPORT void ctl_provider_set_use_generic_messages(ctl_provider *provider, int use_generic_messages)
Set whether the Trading provider will use generic messages.
Definition: ds_provider.c:293
void(* ctl_audit_log_cb)(void *ctx, ctl_provider *provider, const char *id, ctl_trade *trade, ctl_tradeevent *ev)
Definition of the function that you should implement to receive audit logging.
Definition: ctl.h:207
Listener interface that should be registered if you wish to receive events for a trade.
Definition: ctl.h:95
CTL_EXPORT void ctl_provider_set_application_listener(ctl_provider *provider, ctl_app_listener *listener, void *context)
Set the application listener for the supplied provider.
Definition: ds_provider.c:238
CTL_EXPORT void ctl_free(void *ptr)
Free the supplied memory block.
Definition: misc.c:138
CTL_EXPORT ctl_error ctl_trade_process_event(ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, ctl_tradeevent *tradeevent)
Process an event for the specified trade.
Definition: api.c:128
CTL_EXPORT void ctl_channel_close(ctl_provider *provider, ctl_channel *channel)
Forcibly close the trade channel.
Definition: api.c:551
struct ctl_tradeevent_s ctl_tradeevent
Opaque handle representing a trade event.
Definition: ctl.h:61
CTL_EXPORT ctl_provider * ctl_create_ds_client_provider(int num_models, const char *const *models)
Create a DataSource client Trading provider.
Definition: ds_provider.c:660
CTL_EXPORT void * ctl_trade_get_user_pointer(ctl_provider *provider, ctl_channel *channel, ctl_trade *trade)
Gets the user pointer on the ctl_trade object.
Definition: api.c:402
struct ctl_provider_s ctl_provider
Opaque handle representing a trading provider.
Definition: ctl.h:67
CTL_EXPORT char const ** ctl_tradeevent_get_fields(ctl_tradeevent *ev, int *num_ptr)
Gets all fields on the trade event.
Definition: tradeevent.c:146
CTL_EXPORT const char * ctl_loglevel_tostring(ctl_loglevel level)
Return a textual description for the given log level.
Definition: misc.c:264
CTL_EXPORT const char * ctl_trade_get_field(ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, const char *fieldname)
Get a field that is stored on the trade.
Definition: api.c:166
CTL_EXPORT char * ctl_tradeevent_tostring(ctl_tradeevent *trade, char *buf, size_t buflen)
Create a string representation of a ctl_tradeevent object.
Definition: tradeevent.c:174
CTL_EXPORT ctl_provider * ctl_create_ds_provider(ctl_app_listener *listener, void *context, int num_models, const char *const *models, const char *namespacePattern)
Create a DataSource trading provider.
Definition: ds_provider.c:166
Listener interface that should be registered to receive notification of tradechannel creation and clo...
Definition: ctl.h:176
CTL_EXPORT const char * ctl_trade_get_requestid(ctl_provider *provider, ctl_channel *channel, ctl_trade *trade)
Get the client generated identifier that is in use for the specified trade.
Definition: api.c:280
CTL_EXPORT void ctl_channel_set_user_pointer(ctl_provider *provider, ctl_channel *channel, void *ptr)
Set a user pointer on the ctl_channel object.
Definition: api.c:434
CTL_EXPORT const char * ctl_error_tostring(ctl_error error)
Return a textual description for the given error code.
Definition: misc.c:299
CTL_EXPORT char * ctl_trade_tostring(ctl_trade *trade, char *buf, size_t buflen)
Create a string representation of a ctl_trade object.
Definition: trade.c:299
CTL_EXPORT const char * ctl_tradeevent_get_field(ctl_tradeevent *ev, const char *name)
Gets the value of a field on the tradeevent.
Definition: tradeevent.c:123
CTL_EXPORT const char * ctl_channel_get_subject(ctl_provider *provider, ctl_channel *channel)
Get the subject of the TradeChannel.
Definition: api.c:523
CTL_EXPORT void ctl_log(ctl_provider *provider, ctl_loglevel level, const char *fmt,...)
Log a message to the logfile for the provider.
Definition: misc.c:192
CTL_EXPORT void ctl_set_log_callback(ctl_provider *provider, ctl_log_cb callback, void *ctx)
Set the log callback function.
Definition: misc.c:174
CTL_EXPORT ctl_provider * ctl_create_sl_provider(streamlink *sl, int num_models, const char *const *models)
Create a StreamLink trading provider.
Definition: sl_provider.c:123
void(* ctl_log_cb)(void *ctx, ctl_loglevel level, const char *fmt, va_list ap)
Callback type for logging.
Definition: ctl.h:286
struct ctl_trade_s ctl_trade
Opaque handle representing a trade.
Definition: ctl.h:57
CTL_EXPORT void ctl_provider_dealloc(ctl_provider *provider)
Deallocate the trading provider.
Definition: api.c:342
CTL_EXPORT const char * ctl_channel_get_username(ctl_provider *provider, ctl_channel *channel)
Get the name of the user that opened the specified channel.
Definition: api.c:492
CTL_EXPORT char * ctl_strdup(const char *orig)
Duplicate the supplied string.
Definition: misc.c:69
ctl_loglevel
Enumeration that represents the available logging levels.
Definition: ctl.h:263
CTL_EXPORT void * ctl_malloc(size_t size)
Allocate a chunk of memory.
Definition: misc.c:106
CTL_EXPORT ctl_channel * ctl_provider_create_channel(ctl_provider *provider, const char *subject, ctl_channel_listener *listener, void *context)
Create a trade channel using the supplied provider.
Definition: ds_provider.c:740
CTL_EXPORT void ctl_provider_set_audit_logger(ctl_provider *provider, ctl_audit_log_cb callback, void *ctx)
Set the callback function for the audit logger.
Definition: ds_provider.c:270