XROAD
fix_utils.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <common/xroad_string.h>
#include <common/xroad_date.h>
#include <sys/time.h>
Include dependency graph for fix_utils.h:

Go to the source code of this file.

Enumerations

enum  fix_utils_time_res_t { fix_utils_time_res_seconds = 0 , fix_utils_time_res_milliseconds = 1 , fix_utils_time_res_microseconds = 2 , fix_utils_time_res_nanoseconds = 3 }
 

Functions

 xroad_str_decl (fix_utils_time, 27u)
 
uint32_t fix_utils_msg_type_to_id (xroad_str_t msg_type)
 
xroad_str_t fix_utils_id_to_msg_type (uint32_t id)
 
int32_t fix_utils_str_exists (xroad_str_t l, xroad_str_t s)
 
int32_t fix_utils_check_multiple_str (xroad_str_t l, xroad_str_t s)
 
void fix_utils_etou (int64_t ts, fix_utils_time_t *t, fix_utils_time_res_t resolution)
 
xroad_errno_t fix_utils_utoe (xroad_str_t u, int64_t *e)
 
xroad_errno_t fix_utils_dtoe (xroad_str_t d, bool is_local, uint64_t *u)
 
xroad_errno_t fix_utils_dtodt (xroad_str_t d, xroad_date_t *dt)
 
xroad_errno_t fix_utils_etod (uint64_t u, bool to_local, fix_utils_time_t *d)
 
xroad_errno_t fix_utils_dttod (xroad_date_t dt, fix_utils_time_t *d)
 
xroad_errno_t fix_utils_etot (uint64_t u, fix_utils_time_t *t, fix_utils_time_res_t res)
 
void fix_utils_msg_destructor (void **msg)
 

Detailed Description

Function Documentation

◆ fix_utils_check_multiple_str()

int32_t fix_utils_check_multiple_str ( xroad_str_t  l,
xroad_str_t  s 
)

try to check if values delimited by space are within string with patterns

Parameters
[in]l- string, where all searched substrings are divided with \001. E.g. AAA\001BBB\001QWE\001
[in]s- searched multiple string. E.g. "ABC", "ABC 123 XYZ", etc
Returns
1 - if s is ok, 0 - none

◆ fix_utils_dtodt()

xroad_errno_t fix_utils_dtodt ( xroad_str_t  d,
xroad_date_t dt 
)

convert UTCDateOnly(LocalMktDate) to xroad_date

Parameters
[in]d- date in format YYYMMDD
[out]dt- date in xroad_date_t format
Returns
XROAD_OK - converted, else conversion failed

◆ fix_utils_dtoe()

xroad_errno_t fix_utils_dtoe ( xroad_str_t  d,
bool  is_local,
uint64_t *  u 
)

convert UTCDateOnly(LocalMktDate) to timestamp

Parameters
[in]d- date in format YYYMMDD
[in]is_local- 1 - date is LocalMktDate, 0 - UTCDateOnly
[out]u- number of seconds since epoc
Returns
XROAD_OK - converted, else conversion failed

◆ fix_utils_dttod()

xroad_errno_t fix_utils_dttod ( xroad_date_t  dt,
fix_utils_time_t *  d 
)

convert xroad_date_t to UTCDateOnly(LocalMktDate)

Parameters
[in]dt- date to convert
[outd - converted UTCDateOnly(LocalMktDate)
Returns
XROAD_OK - converted, else failed

◆ fix_utils_etod()

xroad_errno_t fix_utils_etod ( uint64_t  u,
bool  to_local,
fix_utils_time_t *  d 
)

convert timestamp to UTCDateOnly(LocalMktDate)

Parameters
[in]u- timestamp to convert (EPOC microseconds)
[in]to_local- 1 - convert timestamp to LocalMktData, 0 - to UTCDateOnly
[outd - converted UTCDateOnly(LocalMktDate)
Returns
XROAD_OK - converted, else failed

◆ fix_utils_etot()

xroad_errno_t fix_utils_etot ( uint64_t  u,
fix_utils_time_t *  t,
fix_utils_time_res_t  res 
)

convert timestamp to UTCTimeOnly

Parameters
[in]u- timestamp to convert (EPOC microseconds)
[outt - converted UTCTimeOnly
[in]res- time resolution
Returns
XROAD_OK - converted, else failed

◆ fix_utils_etou()

void fix_utils_etou ( int64_t  ts,
fix_utils_time_t *  t,
fix_utils_time_res_t  resolution 
)

convert epoc timestamp to UTCTimestamp

Parameters
[in]ts- timestamp (in microseconds) to format
[out]t- formatted UTC time
[in]res- time resolution

◆ fix_utils_id_to_msg_type()

xroad_str_t fix_utils_id_to_msg_type ( uint32_t  id)

convert numeric index to MsgType

Parameters
[in]index- numeric index
Returns
MsgType

◆ fix_utils_msg_destructor()

void fix_utils_msg_destructor ( void **  msg)

FIX message destructor

◆ fix_utils_msg_type_to_id()

uint32_t fix_utils_msg_type_to_id ( xroad_str_t  msg_type)

convert string MsgType to numeric index

Parameters
[in]msg_type- message type
Returns
integer index

◆ fix_utils_str_exists()

int32_t fix_utils_str_exists ( xroad_str_t  l,
xroad_str_t  s 
)

try to find sub-string s in string with patterns delimited with \001

Parameters
[in]l- string, where all searched substrings are divided with \001. E.g. AAA\001BBB\001QWE\001
[in]s- searched sub-string
Returns
1 - if s is exists, 0 - none

◆ fix_utils_utoe()

xroad_errno_t fix_utils_utoe ( xroad_str_t  u,
int64_t *  e 
)

convert UTCTimestamp to epoc timestamp

Parameters
[in]u- UTCTimestamp
[out]e- converted value
Returns
XROAD_OK - converted successfully, else conversion failed