Files
externals/linux/include/celoxica/gmac_deprecated.h
T
2017-10-04 14:16:02 -04:00

515 lines
20 KiB
C

/****************************************************************
* *
* Copyright (C) 1991-2016 Celoxica Ltd. All rights reserved. *
* *
*****************************************************************
* *
* Project : GMAC *
* Date : *
* File : gmac_deprecated.h *
* Author : SYOUNESS *
* Contributors: *
* *
* Description: *
* Deprecated functions *
* *
****************************************************************/
#ifndef __CELOXICA_GMAC_DEPRECATED_H_
#define __CELOXICA_GMAC_DEPRECATED_H_
#include "gmac.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Deprecated function will be removed in 6 month after their deprecation.
*/
#ifndef GMAC_DEPRECATED
#define GMAC_DEPRECATED __attribute__((deprecated))
#endif
/**
* \ingroup GMAC_UserAPI
* \brief GMAC Multicast Mapping Structure
*
* Used by \ref GMACGetMulticastMappingTable()
*/
typedef struct _GMACMulticastMapping GMACMulticastMapping;
/**
* \ingroup GMAC_UserAPI
* \brief GMAC Multicast Mapping Structure Node
*
* Used by \ref GMACGetMulticastMappingTable()
*/
typedef struct _GMACMulticastMappingNode GMACMulticastMappingNode;
struct _GMACMulticastMappingNode
{
GMACMulticastID MulticastID; /**< \brief Multicast ID */
GMACChannelID ChannelID; /**< \brief Channel ID */
uint32_t IP; /**< \brief IP address of multicast */
uint16_t Port; /**< \brief Port for multicast */
char Plugin[32]; /**< \brief The Plugin used by the Multicast ID */
};
struct _GMACMulticastMapping
{
uint32_t MappingTableSize; /**< \brief Size of the mapping table in bytes */
uint32_t Count; /**< \brief Number of nodes populated. */
GMACMulticastMappingNode MappingTable[]; /**< \brief Table where the multicast map will be stored */
};
/**
* \ingroup GMAC_UserAPI
* \brief Market names
*
* Structure to hold the market names returned by the \ref GMACGetMarketNames
*/
typedef const char *GMACMarketNames[MAX_MARKETS];
/**
* Deprecated
* Replace with
* GMACGetObjProps(GMACH, GMAC_OBJ_SRC_CHANNEL, MulticastID, GMAC_PROP_MARKET_ID, &id,
* GMAC_PROP_MARKET_NAME, NamePtr, NULL);
*
* \ingroup GMAC_DataAPI
* \brief Returns the market ID for a specific multicast
*
* @param GMACH GMAC Handle
* @param MulticastID Multicast
* @param NamePtr Returns the pointer to the market name
* @return Market ID or -1 if there is no market registered on specified multicast
*/
extern int GMACMulticastGetMarketID (GMACHandle *GMACH, GMACMulticastID MulticastID, const char **NamePtr) GMAC_DEPRECATED;
/**
* Deprecated
* Replace with
* GMACGetObjProps(GMACH, GMAC_OBJ_SRC_CHANNEL, MulticastID, GMAC_PROP_MARKET_MARKET_ID, &id,
* GMAC_PROP_MARKET_MARKET_NAME, NamePtr, NULL);
*
* \ingroup GMAC_DataAPI
* \brief Returns the market ID for a specific channel
*
* @param GMACH GMAC Handle
* @param ChannelID the Channel
* @param NamePtr Returns the pointer to the market name
* @return Market ID or -1 if ChannelID invalid or there is no market registered on ChannelID
*/
extern int GMACMulticastGetMarketIDFromChannel (GMACHandle *GMACH, int ChannelID, const char **NamePtr) GMAC_DEPRECATED;
/**
* DEPRECATED
* replaced with
* const char* marketName = NULL;
* GMACGetObjProps(GMACH, GMAC_OBJ_MARKET, MarketID, GMAC_PROP_MARKET_NAME, &marketName, NULL);
* \ingroup GMAC_DataAPI
* \brief Returns the name of market for supplied market id
*
* @param GMACH GMAC Handle
* @param MarketName Pointer where pointer to the name is stored
* @param MarketID Id of the market
* @return GMAC_STATUS_OK or GMAC_STATUS_PARAM_ERROR
*/
extern GMACStatus GMACGetMarket(GMACHandle *GMACH, char **MarketName, uint8_t MarketID) GMAC_DEPRECATED;
/**
* DEPRECATED
* replaced with
* const char* pluginName = NULL;
* GMACGetObjProps(GMACH, GMAC_OBJ_MARKET, MarketID, GMAC_PROP_MARKET_PLUGIN_NAME, &pluginName, NULL);
* \ingroup GMAC_DataAPI
* \brief Returns the name of market plugin for supplied market id
*
* @param GMACH GMAC Handle
* @param MarketPluginName Pointer where pointer to the plugin name is stored
* @param MarketID Id of the market
* @return GMAC_STATUS_OK or GMAC_STATUS_PARAM_ERROR
*/
extern GMACStatus GMACGetMarketPlugin(GMACHandle *GMACH, char **MarketPluginName, uint8_t MarketID) GMAC_DEPRECATED;
/**
* DEPRECATED
* replaced with
* GMACTranscodingType transcodingType = NULL;
* GMACGetObjProps(GMACH, GMAC_OBJ_MARKET, MarketID,GMAC_PROP_MARKET_TRANSCODING_TYPE, &transcodingType, NULL);
* \ingroup GMAC_DataAPI
* \brief Returns the transcoding type
*
* @param GMACH GMAC Handle
* @param MarketID Id of the market
* @param Enc Pointer where function returns the transcoding type
* @return GMAC_STATUS_OK or GMAC_STATUS_PARAM_ERROR
*/
extern GMACStatus GMACMarketGetTranscodingType(GMACHandle *GMACH, uint8_t MarketID, int *Enc) GMAC_DEPRECATED;
/**
* Deprecated
* Replace with
* GMACGetObjProps(GMACH, GMAC_OBJ_SRC_CHANNEL, MulticastID, GMAC_PROP_SRC_CHANNEL_CONFIG_ID, LocalChannelID, NULL);
* \ingroup GMAC_UserAPI
* \brief Returns Channel number from MulticastID
*
* The MulticastID returned in \ref GMACPacketHeader is globally unique, and generated internally
* by GMAC. Call this function to get the LocalChannelId from the MulticastId. The LocalChannelId
* is unique for multicasts of the same type, within the same market. It is the id that is present
* for each channel in the GMAC configuration file. Moreover, it is used to group complementary
* channels (of dirrerent types). For instance, a regular 'updates' channel and a snapshot channel
* would have the same LocalChannelId if they are for the same market segment. The same two channels
* would have different MulticastIds, generated by GMAC and thus not known before runtime.
*
* @param GMACH GMAC Handle
* @param MulticastID Multicast ID returned in \ref GMACPacketHeader
* @param LocalChannelID Pointer where 'channel number' is stored
* @return GMAC_STATUS_OK or GMAC_STATUS_PARAM_ERROR if invalid Channel ID supplied
*/
extern GMACStatus GMACGetLocalChannelID (GMACHandle *GMACH, GMACMulticastID MulticastID, int *LocalChannelID) GMAC_DEPRECATED;
/**
* Deprecated Replace with
* uint32_t count = 0, allocated = 0;
GMACGetObjCount(GMACH, GMAC_OBJ_MARKET, MarketID, GMAC_OBJ_SRC_CHANNEL, &allocated);
GMACObjID* channelIds = calloc(allocated, sizeof(GMACObjID));
GMACGetObjList(GMACH, GMAC_OBJ_MARKET, MarketID, GMAC_OBJ_SRC_CHANNEL, channelIds,
&count, allocated);
for (uint32_t i = 0; i < count; ++i)
{
GMACChannelId configID = UNDEFINED_GMAC_CHANNEL_ID;
GMACGetObjProps(GMACH, GMAC_OBJ_SRC_CHANNEL, channelIds[i], GMAC_PROP_SRC_CHANNEL_CONFIG_ID,
&configID, NULL);
const char* ip = NULL;
uint16_t port;
GMACGetObjProps(GMACH, GMAC_OBJ_SRC_CHANNEL, channelIds[i], GMAC_PROP_SRC_CHANNEL_IP_ADDR,
&ip, GMAC_PROP_SRC_CHANNEL_PORT, &port, NULL);
}
free(channelIds);
* \ingroup GMAC_UserAPI
* \brief Returns the multicast mapping table for a specified market.
*
* This function returns a mapping between MulticastIDs and IP addresses/ports. It can be called after GMACOpen(),
* which ensures that the GMAC configuration has been read and processed. The function allocates the memory for
* the mapping table, for which the address is returned via MulticastMappingPtr. The memory is allocated using
* libc malloc(). It is the user's responsibility to free this memory using a compatible method.
*
* @param H GMAC Handle
* @param MarketID The Market ID of interest for which the multicast mapping table should be populated.
* @param MulticastMappingPtr Address of the multicast mapping table.
* @return GMAC_STATUS_OK on success or GMAC_STATUS_PARAM_ERROR if invalid pointer or handle supplied
*/
extern GMACStatus GMACGetMulticastMappingTable(GMACHandle *H, unsigned MarketID, GMACMulticastMapping **MulticastMappingPtr) GMAC_DEPRECATED;
/**
* Deprecated
* Replace with
* GMACObjId markets[MAX_MARKETS];
* uint32_t count = 0;
* GMACGetObjList(GMACH, GMAC_OBJ_ROOT, 0, GMAC_OBJ_MARKET, markets, &count, MAX_MARKETS);
* for (uint32_t i = 0; i < count; ++i)
* {
* const char* marketName = NULL;
* GMACGetObjProps(GMACH, GMAC_OBJ_MARKET, markets[i], GMAC_PROP_MARKET_NAME, &marketName, NULL);
* }
*
* \ingroup GMAC_UserAPI
* \brief Returns the list of market names
*
* @param GMACH GMAC Handle
* @param MarketNames Pointer to the market names structure
* @return GMAC_STATUS_OK on success
*/
extern GMACStatus GMACGetMarketNames (GMACHandle *GMACH, GMACMarketNames MarketNames) GMAC_DEPRECATED;
/* identify the queue for the channel id or market id */
extern GMACStatus GMACGetQueueWithChannelID (GMACHandle *GMACH, GMACChannelID ChannelID, int *Queue) GMAC_DEPRECATED;
extern GMACStatus GMACGetQueueWithMarketID (GMACHandle *GMACH, int MarketID, int *Queue) GMAC_DEPRECATED;
/**
* Deprecated
* Should be replaced by
* GMACGetObjCount(handle, GMAC_OBJ_ROOT, 0, GMAC_OBJ_SRC_CHANNEL, Count);
* \brief Returns number of open channels
*
* @param H GMAC Handle
* @param Count Channel count
*/
extern void GMACStatsMulticastCount (GMACHandle *H, int *Count) GMAC_DEPRECATED;
/**
* Deprecated
* Should be replaced by
* GMACGetObjCount(handle, GMAC_OBJ_MARKET, MarketID, GMAC_OBJ_SRC_CHANNEL, Count);
*
* \brief Returns number of open multicasts for specific market
*
* @param H GMAC Handle
* @param MarketID Market ID
* @param Count Channel count
* @return GMAC_STATUS_OK on suscess
*/
extern GMACStatus GMACStatsMarketMulticastCount (GMACHandle *H, int MarketID, int *Count) GMAC_DEPRECATED;
/**
* Deprecated
* Replace with GMACGetObjCount(handle, GMAC_OBJ_ROOT, 0, GMAC_OBJ_MARKET, count);
*
* \brief Returns number of markets
* @param H GMAC Handle
* @param Count Market count
*/
extern void GMACStatsMarketCount (GMACHandle *H, int *Count) GMAC_DEPRECATED;
/**
* Deprecated
* Replace with
* GMACGetObjProps(GMACH, GMAC_OBJ_DST_CHANNEL, MulticastID,
* GMAC_PROP_SRC_CHANNEL_ID, &BaseMulticastID,
* GMAC_PROP_SRC_CHANNEL_CONFIG_ID, &LocalChannelID,
* GMAC_PROP_SRC_CHANNEL_ARBITRAGE, &arbitrageType, NULL);
* \ingroup GMAC_UserAPI
* \brief Returns local channel id and arbitration params
*
* @param GMACH GMAC Handle
* @param MulticastID Multicast ID returned in \ref GMACPacketHeader
* @param BaseMulticastID The multicast id where this multicast is redirected to (-1 when not assigned)
* @param LocalChannelID Pointer where 'channel number' is stored
* @param LocalChannelChar 'A' or 'B', or ' ' for no arbitration
* @param LocalChannelMode 0-arbitration off, 1-redundancy, 2-lag
* @return GMAC_STATUS_OK or GMAC_STATUS_PARAM_ERROR if invalid Channel ID supplied
*/
extern GMACStatus GMACGetLocalChannelIDEx (GMACHandle *GMACH, GMACMulticastID MulticastID,
GMACMulticastID *BaseMulticastID, int *LocalChannelID, char *LocalChannelChar, int *ArbitrationMode,
const char **ArbitrationModeDesc) GMAC_DEPRECATED;
/**
* \ingroup GMAC_UserAPI
* \brief GMAC snapshot status
*
* Snapshot status returned by \ref GMACMulticastSnapshotProcess API at the end of the snapshot
*/
typedef enum {
GMAC_SNAPSHOT_OK, /**< \brief The snapshot request has been successful. */
GMAC_SNAPSHOT_TIMEOUT, /**< \brief The user defined timeout has expired. */
GMAC_SNAPSHOT_NOT_FOUND, /**< \brief The specified LiveSequence in the user request is too old. */
GMAC_SNAPSHOT_CYCLE_GAP, /**< \brief There was a gap detected in the snapshot cycle. */
GMAC_SNAPSHOT_MESSAGES_LIMIT_REACHED /**< \brief Internal limit of messages reached. */
} GMACSnapshotStatus;
/**
* \ingroup GMAC_UserAPI
* \brief GMAC snapshot struct
*
* This struct encapsulates GMAC packet data to return matched snapshot data.
*/
typedef struct {
GMACPacketHeader *Header; /**< \brief Packet Header */
int MessageCount; /**< \brief Message Count returned in this struct */
int CycleComplete; /**< \brief Indicator flagging the final packet of snapshot cycle */
uint64_t SyncSequence; /**< \brief Synchonization sequence for live messages */
GMACSnapshotStatus CycleStatus; /**< \brief Snapshot cycle status at end of cycle */
GMACMessageHeader *Messages[]; /**< \brief Messages array returned matching snapshot criteria */
} GMACSnapshotData;
/**
*/
#define GMAC_SNAPSHOT_ALL_SYMBOLS ""
/** DEPRECATED in favor of
* see examples of notice howto implement.
* GMACMulticastRefreshRequest
* GMACMulticastRefreshComplete
*/
GMACStatus GMACMulticastSnapshotRequest (GMACHandle *GMACH, GMACMulticastID MulticastID,
GMACLocalName Symbol, uint64_t LiveSequence, uint32_t TimeoutSec) GMAC_DEPRECATED;
/** DEPRECATED in favor of
* see examples of notice howto implement.
* GMACMulticastRefreshRequest
* GMACMulticastRefreshComplete
*/
GMACStatus GMACMulticastSnapshotProcess (GMACHandle *GMACH, GMACPacketHeader *Header,
GMACSnapshotData **SnapshotData) GMAC_DEPRECATED;
/**
* \brief Used Internally
*/
static inline const GMACPriceFactor* __GMACGetPriceFactor(const GMACPriceFactor* Root, int64_t Price) GMAC_DEPRECATED;
static inline const GMACPriceFactor* __GMACGetPriceFactor(const GMACPriceFactor* Root, int64_t Price __attribute__((unused)))
{
assert(Root);
assert (Root->Denominator != 0);
assert (Root->Numerator != 0);
/*
* Return price factor
*/
return Root;
}
/**
* DEPRECATED NO Replacement
* \ingroup GMAC_UserAPI
* \brief Function to get corrected Price, in fixed point precision
*
* @param PriceFacor The price factor passed in the \ref GMACReferenceHeader
* @param Price The price of order from the GMAC message
* @return Price with \ref GMAC_DECIMAL_PLACES fixed point precision
*/
static inline GMACPrice GMACCorrectPrice(const GMACPriceFactor* PriceFactor, int64_t Price) GMAC_DEPRECATED;
static inline GMACPrice GMACCorrectPrice(const GMACPriceFactor* PriceFactor, int64_t Price)
{
return Price * PriceFactor->PriceDenominator / PriceFactor->PriceNominator;
}
/**
* * DEPRECATED NO Replacement
* \ingroup GMAC_UserAPI
* \brief Function to get corrected Price, in floating point
*
* @param Root The root node from the GMAC message
* @param Price The price of order from the GMAC message
* @return Price with floating point precision
*/
static inline double GMACCorrectPriceFloat(const GMACPriceFactor *PriceFactor, int64_t Price) GMAC_DEPRECATED;
static inline double GMACCorrectPriceFloat(const GMACPriceFactor *PriceFactor, int64_t Price)
{
GMACPrice Px = Price * PriceFactor->PriceDenominator / PriceFactor->PriceNominator;
return (double)Px/((double)GMAC_DECIMAL_FACTOR);
}
/**
* \brief Used internally
*/
static inline int __GMACPriceFactorIsDynamic (const GMACPriceFactor* Root) GMAC_DEPRECATED;
static inline int __GMACPriceFactorIsDynamic (const GMACPriceFactor* Root __attribute__((unused)))
{
return 0;
}
enum
{
TMLOG_ADE_READ, /* \brief Timestamp taken at last ADE read. */
TMLOG_ADE_READ_STATUS_OK, /* \brief Timestamp taken at last ADE read with an OK status return. */
TMLOG_TOTAL
};
/**
* DEPRECATED : NO replacement
* \ingroup GMAC_DataAPI
* \brief Retrieves the last timestamp log for a particular checkpoint.
*
* The function is non-blocking.
*
* @param GMACH GMAC Handle
* @param Queue Id of the HW queue to read from
* @param ID, one of TMLOG_* enumerated values
* @param Timestamp Pointer where the timestamp is to be stored
* @return GMAC_STATUS_OK on success, GMAC_STATUS_PARAM_ERROR for incorrect or missing arguments.
*/
extern GMACStatus GMACGetTimestampLog (GMACHandle *GMACH, int Queue, uint32_t ID, uint64_t *Timestamp) GMAC_DEPRECATED;
/**
* Deprecated in favor of GMACCommand from gmac_command.h
* \ingroup GMAC_UserAPI
*
* \brief Enables or disables the Channel
*
* To disable or enable the channel for a market, you have to call this function.
* It will disable all multicasts for this market which have this LocalChannelID.
*
* @param GMACH GMAC Handle
* @param MarketID Market ID
* @param LocalChannelID where 'channel number' is specified (as in the config file)
* @param Enable to enable the channel
* @param Subscribe to enable or disable IGMP membership on multicast channels
* @return GMAC_STATUS_OK or GMAC_STATUS_PARAM_ERROR if invalid Channel ID supplied
*/
extern GMACStatus GMACChannelEnable(GMACHandle *GMACH, int MarketID, int LocalChannelID, int Enable) GMAC_DEPRECATED;
extern GMACStatus GMACChannelEnableEx(GMACHandle *GMACH, int MarketID, int LocalChannelID, int Enable, int Subscribe) GMAC_DEPRECATED;
/**
* * Deprecated in favor of GMACCommand from gmac_command.h
* \ingroup GMAC_UserAPI
* \brief Enables or disables the Channel specifying channel type
*
* To disable or enable the channel for a market, you have to call this function.
* Both the LocalChannelID and the MulticastType must match
*
* @param GMACH GMAC Handle
* @param MarketID Market ID
* @param LocalChannelID where 'channel number' is specified (as in the config file)
* @param MulticastType the channel type, eg GMAC_MULTICAST_TYPE_SNAPSHOT
* @param Enable to enable the channel
* @param Subscribe to enable or disable IGMP membership on multicast channels
* @return GMAC_STATUS_OK or GMAC_STATUS_PARAM_ERROR if invalid Channel ID/MulticastType supplied
*/
extern GMACStatus GMACChannelEnableByType(GMACHandle *GMACH, int MarketID, int LocalChannelID,
GMACMulticastType MulticastType, int Enable) GMAC_DEPRECATED;
extern GMACStatus GMACChannelEnableByTypeEx(GMACHandle *GMACH, int MarketID, int LocalChannelID,
GMACMulticastType MulticastType, int Enable, int Subscribe) GMAC_DEPRECATED;
/**
* \ingroup GMAC_UserAPI
* \brief Determine the filtering support on the market
*
* Returns the filtering mode supported on the specified market. Please
* note that the filtering has to be enabled in the configuration file
* by using the option <hardware-filtering>.
*
* @param GMACH GMAC Handle
* @param MarketID GMAC Market ID
* @param filteringMode User pointer to the filtering mode enumeration
* @return GMAC_STATUS_OK on success, GMAC_STATUS_NOT_IMPLEMENTED if the market does not support hardware filtering otherwise GMAC_STATUS_PARAM_ERROR
*/
extern GMACStatus GMACFilteringSupportedMode (GMACHandle *GMACH, int MarketID, GMACFilteringMode *filteringMode) GMAC_DEPRECATED;
/**
* \ingroup GMAC_UserAPI
* \brief Commit the filtering parameters and start filtering on the market
*
* Once the filtering is completely set by using \ref GMACFilteringInstrumentRequired the
* filtering can be enabled on the market. Please note once the filtering is enabled it is not allowed
* to add extra instruments on GMAC ITCH and GMAC BATS plugins.
*
* @param GMACH GMAC Handle
* @param MarketID GMAC Market ID
* @return GMAC_STATUS_OK on success, GMAC_STATUS_NOT_IMPLEMENTED if the market does not support hardware filtering otherwise GMAC_STATUS_PARAM_ERROR
*/
extern GMACStatus GMACFilteringEnable (GMACHandle *GMACH, int MarketID) GMAC_DEPRECATED;
/**
* \ingroup GMAC_UserAPI
* \brief Setup instrument filtering list
*
* Adds instrument to the filtering list for the specified market
*
* @param GMACH GMAC Handle
* @param MarketID GMAC Market ID
* @return GMAC_STATUS_OK on success, GMAC_STATUS_NOT_IMPLEMENTED if the market does not support hardware filtering otherwise GMAC_STATUS_PARAM_ERROR
*/
extern GMACStatus GMACFilteringInstrumentRequired (GMACHandle *GMACH, int MarketID, const char* InstrumentID) GMAC_DEPRECATED;
#ifdef __cplusplus
}
#endif
#endif /* __CELOXICA_GMAC_DEPRECATED_H_ */