UM C API  6.16
Source code for lbmmonfmtpb.h
/*
All of the documentation and software included in this and any
other Informatica Inc. Ultra Messaging Releases
Copyright (C) Informatica Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted only as covered by the terms of a
valid software license agreement with Informatica Inc.
(C) Copyright 2004,2022 Informatica Inc. All Rights Reserved.
THE SOFTWARE IS PROVIDED "AS IS" AND INFORMATICA DISCLAIMS ALL WARRANTIES
EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. INFORMATICA DOES NOT WARRANT THAT USE OF THE SOFTWARE WILL BE
UNINTERRUPTED OR ERROR-FREE. INFORMATICA SHALL NOT, UNDER ANY CIRCUMSTANCES, BE
LIABLE TO LICENSEE FOR LOST PROFITS, CONSEQUENTIAL, INCIDENTAL, SPECIAL OR
INDIRECT DAMAGES ARISING OUT OF OR RELATED TO THIS AGREEMENT OR THE
TRANSACTIONS CONTEMPLATED HEREUNDER, EVEN IF INFORMATICA HAS BEEN APPRISED OF
THE LIKELIHOOD OF SUCH DAMAGES.
*/
#ifndef LBMMONFMTPB_H
#define LBMMONFMTPB_H
#include <stdlib.h>
#ifdef _WIN32
#include <winsock2.h>
#endif
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus */
#define LBMMON_FORMAT_PB_VERSION_1 1
#define LBMMON_FORMAT_PB_VERSION_CURRENT LBMMON_FORMAT_PB_VERSION_1
/*! \brief Return a pointer to the LBMMON_FORMAT_PB module structure.
\return Pointer to LBMMON_FORMAT_PB.
*/
LBMExpDLL const lbmmon_format_func_t * lbmmon_format_pb_module(void);
/*! \brief Initialize the PB format module.
\param FormatClientData A pointer which may be filled in
(by this function)
with a pointer to format-specific client data.
\param FormatOptions The FormatOptions argument originally passed to
lbmmon_sctl_create() or lbmmon_rctl_create().
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_format_pb_init(void * * FormatClientData,
const void * FormatOptions);
/*! \brief Function to apply options to a format module at startup or
dynamically to a running system.
\param FormatClientData A pointer to format-specific client data as
returned by the ::lbmmon_format_init_t function.
\param FormatOptions A pointer to data containing options in the
same format as specified by config options.
\return Zero if successful, -1 otherwise.
*/
LBMExpDLL int lbmmon_format_pb_apply_format_options(void * FormatClientData,
const void * FormatOptions);
/*! \brief Function to populate a buffer with the default filter options.
\param FormatClientData A pointer to format-specific client data.
\param FormatOptions A pointer to a buffer to receive the default filter options.
\param Size The maximum allowed size of the FormatOptions buffer.
\return Zero if successful, -1 otherwise.
*/
LBMExpDLL int lbmmon_format_pb_default_filter_options(void * FormatClientData,
char * FormatOptions,
size_t Size);
/*! \brief Function to populate a buffer with the default store filter options.
\param FormatOptions A pointer to a buffer to receive the default store filter options.
\param Size The maximum allowed size of the FormatOptions buffer.
\return Zero if successful, -1 otherwise.
*/
LBMExpDLL int lbmmon_format_pb_default_store_filter_options(char * FormatOptions,
size_t Size);
/*! \brief Serialize an ::lbm_rcv_transport_stats_t structure to PB.
\param Destination A pointer to a buffer to receive the serialized format
of the ::lbm_rcv_transport_stats_t statistics.
\param Size A pointer to a \c size_t.
On entry,
it contains the maximum allowed size of the serialized statistics.
On exit,
it must contain the actual size of the serialized statistics.
\param ModuleID A pointer to an \c unsigned \c short,
into which the module may write a module identification value.
This value is included in the transmitted packet,
and may be used by the receiver to verify and differentiate between
different version of the module (and thus the format of the data it expects).
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
from which to take packet attributes.
\param Statistics A pointer to an ::lbm_rcv_transport_stats_t structure
to be serialized.
\param FormatClientData A pointer to format-specific client data.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_rcv_format_pb_serialize(char * Destination,
size_t * Size,
unsigned short * ModuleID,
const lbmmon_packet_attributes_t * Attributes,
const lbm_rcv_transport_stats_t * Statistics,
void * FormatClientData);
/*! \brief Serialize an ::lbm_src_transport_stats_t structure to PB.
\param Destination A pointer to a buffer to receive the serialized format
of the ::lbm_src_transport_stats_t statistics.
\param Size A pointer to a \c size_t.
On entry,
it contains the maximum allowed size of the serialized statistics.
On exit,
it must contain the actual size of the serialized statistics.
\param ModuleID A pointer to an \c unsigned \c short,
into which the module may write a module identification value.
This value is included in the transmitted packet,
and may be used by the receiver to verify and differentiate between
different version of the module (and thus the format of the data it expects).
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
from which to take packet attributes.
\param Statistics A pointer to an ::lbm_src_transport_stats_t structure to be
serialized.
\param FormatClientData A pointer to format-specific client data.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_src_format_pb_serialize(char * Destination,
size_t * Size,
unsigned short * ModuleID,
const lbmmon_packet_attributes_t * Attributes,
const lbm_src_transport_stats_t * Statistics,
void * FormatClientData);
/*! \brief Serialize an ::lbm_event_queue_stats_t structure to PB.
\param Destination A pointer to a buffer to receive the serialized format
of the ::lbm_event_queue_stats_t statistics.
\param Size A pointer to a \c size_t.
On entry,
it contains the maximum allowed size of the serialized statistics.
On exit,
it must contain the actual size of the serialized statistics.
\param ModuleID A pointer to an \c unsigned \c short,
into which the module may write a module identification value.
This value is included in the transmitted packet,
and may be used by the receiver to verify and differentiate between
different version of the module (and thus the format of the data it expects).
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
from which to take packet attributes.
\param Statistics A pointer to an ::lbm_event_queue_stats_t structure
to be serialized.
\param FormatClientData A pointer to format-specific client data.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_evq_format_pb_serialize(char * Destination,
size_t * Size,
unsigned short * ModuleID,
const lbmmon_packet_attributes_t * Attributes,
const lbm_event_queue_stats_t * Statistics,
void * FormatClientData);
/*! \brief Serialize an ::lbm_context_stats_t structure to PB.
\param Destination A pointer to a buffer to receive the serialized format
of the ::lbm_context_stats_t statistics.
\param Size A pointer to a \c size_t.
On entry,
it contains the maximum allowed size of the serialized statistics.
On exit,
it must contain the actual size of the serialized statistics.
\param ModuleID A pointer to an \c unsigned \c short,
into which the module may write a module identification value.
This value is included in the transmitted packet,
and may be used by the receiver to verify and differentiate between
different version of the module (and thus the format of the data it expects).
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
from which to take packet attributes.
\param Statistics A pointer to an ::lbm_context_stats_t structure
to be serialized.
\param FormatClientData A pointer to format-specific client data.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_ctx_format_pb_serialize(char * Destination,
size_t * Size,
unsigned short * ModuleID,
const lbmmon_packet_attributes_t * Attributes,
const lbm_context_stats_t * Statistics,
void * FormatClientData);
/*! \brief Deserialize a buffer from PB into an ::lbm_rcv_transport_stats_t structure.
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
for storing the deserialized packet attributes.
\param Statistics A pointer to an ::lbm_rcv_transport_stats_t structure into
which the data is deserialized.
\param Source A pointer to a buffer containing the serialized data.
\param Length The length of the serialized data.
\param ModuleID The module ID received in the packet.
It may be used to verify and differentiate between different version of
the module (and thus the format of the data it expects).
\param FormatClientData A pointer to format-specific client data.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the deserialized data will not be delivered to the application.
*/
LBMExpDLL int lbmmon_rcv_format_pb_deserialize(lbmmon_packet_attributes_t * Attributes,
lbm_rcv_transport_stats_t * Statistics,
const char * Source,
size_t Length,
unsigned short ModuleID,
void * FormatClientData);
/*! \brief Deserialize a buffer from PB into an ::lbm_src_transport_stats_t structure.
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
for storing the deserialized packet attributes.
\param Statistics A pointer to an ::lbm_src_transport_stats_t structure
into which the data is deserialized.
\param Source A pointer to a buffer containing the serialized data.
\param Length The length of the serialized data.
\param ModuleID The module ID received in the packet.
It may be used to verify and differentiate between different version of
the module (and thus the format of the data it expects).
\param FormatClientData A pointer to format-specific client data.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the deserialized data will not be delivered to the application.
*/
LBMExpDLL int lbmmon_src_format_pb_deserialize(lbmmon_packet_attributes_t * Attributes,
lbm_src_transport_stats_t * Statistics,
const char * Source,
size_t Length,
unsigned short ModuleID,
void * FormatClientData);
/*! \brief Deserialize a buffer from PB into an ::lbm_event_queue_stats_t structure.
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
for storing the deserialized packet attributes.
\param Statistics A pointer to an ::lbm_event_queue_stats_t structure into
which the data is deserialized.
\param Source A pointer to a buffer containing the serialized data.
\param Length The length of the serialized data.
\param ModuleID The module ID received in the packet.
It may be used to verify and differentiate between different version of
the module (and thus the format of the data it expects).
\param FormatClientData A pointer to format-specific client data.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the deserialized data will not be delivered to the application.
*/
LBMExpDLL int lbmmon_evq_format_pb_deserialize(lbmmon_packet_attributes_t * Attributes,
lbm_event_queue_stats_t * Statistics,
const char * Source,
size_t Length,
unsigned short ModuleID,
void * FormatClientData);
/*! \brief Deserialize a buffer from PB into an ::lbm_context_stats_t structure.
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
for storing the deserialized packet attributes.
\param Statistics A pointer to an ::lbm_context_stats_t structure into
which the data is deserialized.
\param Source A pointer to a buffer containing the serialized data.
\param Length The length of the serialized data.
\param ModuleID The module ID received in the packet.
It may be used to verify and differentiate between different version of
the module (and thus the format of the data it expects).
\param FormatClientData A pointer to format-specific client data.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the deserialized data will not be delivered to the application.
*/
LBMExpDLL int lbmmon_ctx_format_pb_deserialize(lbmmon_packet_attributes_t * Attributes,
lbm_context_stats_t * Statistics,
const char * Source,
size_t Length,
unsigned short ModuleID,
void * FormatClientData);
/*! \brief Serialize receiver topic statistics.
\param Destination A pointer to a buffer to receive the serialized format
of the lbm_context_stats_t statistics.
\param Size A pointer to a \c size_t.
On entry,
it will contain the maximum allowed size of the serialized statistics.
On exit,
it must contain the actual size of the serialized statistics.
\param ModuleID A pointer to an \c unsigned \c short,
into which the module may write a module identification value.
This value is included in the transmitted packet,
and may be used by the receiver to verify and differentiate between
different version of the module (and thus the format of the data it expects).
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
from which to take packet attributes.
\param Topic A NUL-terminated string containing the topic.
\param SourceCount The number of sources in the \a Sources array.
\param Sources An array of ::lbm_rcv_topic_stats_t structures containing
the sources to which the receiver is joined.
\param FormatClientData A pointer to format-specific client data as
returned by the ::lbmmon_format_init_t function.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_rcv_topic_format_pb_serialize(char * Destination,
size_t * Size,
unsigned short * ModuleID,
const lbmmon_packet_attributes_t * Attributes,
const char * Topic,
lbm_ulong_t SourceCount,
const lbm_rcv_topic_stats_t * Sources,
void * FormatClientData);
/*! \brief Deserialize a buffer into an ::lbm_rcv_topic_stats_t structure.
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
for storing the deserialized packet attributes.
\param Count A pointer to an integer containing the number of elements in the
\a Statistics array. On exit, it will contain the actual number of elements parsed.
\param Statistics An array of ::lbm_rcv_topic_stats_t elements into which is written the
actual deserialized data.
\param Source A pointer to a buffer containing the serialized data.
\param Length The length of the serialized data.
\param ModuleID The module ID received in the packet.
It may be used to verify and differentiate between different version of
the module (and thus the format of the data it expects).
\param FormatClientData A pointer to format-specific client data as
returned by the ::lbmmon_format_init_t function.
\return Zero if successful, -2 if \a Count is not large enough for all elements, -1 otherwise.
If -2 is returned, \a Count will contain the number of elements required.
If -1 is returned,
the deserialized data will not be delivered to the application.
*/
LBMExpDLL int lbmmon_rcv_topic_format_pb_deserialize(lbmmon_packet_attributes_t * Attributes,
size_t * Count,
lbm_rcv_topic_stats_t * Statistics,
const char * Source,
size_t Length,
unsigned short ModuleID,
void * FormatClientData);
/*! \brief Serialize wildcard receiver statistics.
\param Destination A pointer to a buffer to receive the serialized format
of the lbm_wildcard_rcv_stats_t statistics.
\param Size A pointer to a \c size_t.
On entry,
it will contain the maximum allowed size of the serialized statistics.
On exit,
it must contain the actual size of the serialized statistics.
\param ModuleID A pointer to an \c unsigned \c short,
into which the module may write a module identification value.
This value is included in the transmitted packet,
and may be used by the receiver to verify and differentiate between
different version of the module (and thus the format of the data it expects).
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
from which to take packet attributes.
\param Statistics A pointer to an lbm_wildcard_rcv_stats_t structure to
be serialized.
\param FormatClientData A pointer to format-specific client data as
returned by the ::lbmmon_format_init_t function.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_wildcard_rcv_format_pb_serialize(char * Destination,
size_t * Size,
unsigned short * ModuleID,
const lbmmon_packet_attributes_t * Attributes,
const lbm_wildcard_rcv_stats_t * Statistics,
void * FormatClientData);
/*! \brief Deserialize a buffer into an ::lbm_wildcard_rcv_stats_t structure.
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
for storing the deserialized packet attributes.
\param Statistics A pointer to an lbm_wildcard_rcv_stats_t structure into
which the data is deserialized.
\param Source A pointer to a buffer containing the serialized data.
\param Length The length of the serialized data.
\param ModuleID The module ID received in the packet.
It may be used to verify and differentiate between different version of
the module (and thus the format of the data it expects).
\param FormatClientData A pointer to format-specific client data as
returned by the ::lbmmon_format_init_t function.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the deserialized data will not be delivered to the application.
*/
LBMExpDLL int lbmmon_wildcard_rcv_format_pb_deserialize(lbmmon_packet_attributes_t * Attributes,
lbm_wildcard_rcv_stats_t * Statistics,
const char * Source,
size_t Length,
unsigned short ModuleID,
void * FormatClientData);
/*! \brief Serialize an ::Lbmmon__UMPMonMsg structure to PB.
\param Destination A pointer to a buffer to receive the serialized format
of the ::Lbmmon__UMPMonMsg statistics.
\param Size A pointer to a \c size_t.
On entry,
it contains the maximum allowed size of the serialized statistics.
On exit,
it must contain the actual size of the serialized statistics.
\param ModuleID A pointer to an \c unsigned \c short,
into which the module may write a module identification value.
This value is included in the transmitted packet,
and may be used by the receiver to verify and differentiate between
different version of the module (and thus the format of the data it expects).
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
from which to take packet attributes.
\param StoreMsg A pointer to an ::Lbmmon__UMPMonMsg structure
to be serialized.
\param Action If 1, return size of packed message only.
If 0, pack the message and copy into the buffer.
\param FormatClientData A pointer to format-specific client data as
returned by the ::lbmmon_format_init_t function.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_store_format_pb_serialize(char * Destination,
size_t * Size,
unsigned short * ModuleID,
const lbmmon_packet_attributes_t * Attributes,
Lbmmon__UMPMonMsg * StoreMsg,
int Action,
void * FormatClientData);
/*! \brief Deserialize a buffer into an ::Lbmmon__UMPMonMsg5 structure.
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
for storing the deserialized packet attributes.
\param StoreMsg A pointer to a pointer to an Lbmmon__UMPMonMsg
structure into which the data is deserialized.
\param Source A pointer to a buffer containing the serialized data.
\param Length The length of the serialized data.
\param ModuleID The module ID received in the packet.
It may be used to verify and differentiate between different version of
the module (and thus the format of the data it expects).
\param FormatClientData A pointer to format-specific client data as
returned by the ::lbmmon_format_init_t function.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the deserialized data will not be delivered to the application.
*/
LBMExpDLL int lbmmon_store_format_pb_deserialize(lbmmon_packet_attributes_t * Attributes,
Lbmmon__UMPMonMsg ** StoreMsg,
const char * Source,
size_t Length,
unsigned short ModuleID,
void * FormatClientData);
/*! \brief Function to return the store filter options from a format module.
\param FormatOptions The FormatOptions associated with the store's context.
\return A string containing the store filter options.
*/
LBMExpDLL char * lbmmon_store_format_pb_filter_options(const char * FormatOptions);
/*! \brief Function to free an unpacked Lbmmon__UMPMonMsg structure.
\param StoreMsg A pointer to a pointer to an Lbmmon__UMPMonMsg
structure into which the data was deserialized.
\return Zero if successful, -1 otherwise.
*/
LBMExpDLL int lbmmon_store_free_unpacked(Lbmmon__UMPMonMsg * StoreMsg);
/*! \brief Serialize an ::Lbmmon__DROMonMsg structure to PB.
\param Destination A pointer to a buffer to receive the serialized format
of the ::Lbmmon__DROMonMsg statistics.
\param Size A pointer to a \c size_t.
On entry,
it contains the maximum allowed size of the serialized statistics.
On exit,
it must contain the actual size of the serialized statistics.
\param ModuleID A pointer to an \c unsigned \c short,
into which the module may write a module identification value.
This value is included in the transmitted packet,
and may be used by the receiver to verify and differentiate between
different version of the module (and thus the format of the data it expects).
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
from which to take packet attributes.
\param GatewayMsg A pointer to an ::Lbmmon__DROMonMsg structure
to be serialized.
\param FormatClientData A pointer to format-specific client data as
returned by the ::lbmmon_format_init_t function.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_gateway_format_pb_serialize(char * Destination,
size_t * Size,
unsigned short * ModuleID,
const lbmmon_packet_attributes_t * Attributes,
Lbmmon__DROMonMsg * GatewayMsg,
void * FormatClientData);
/*! \brief Deserialize a buffer into an ::Lbmmon__DROMonMsg structure.
\param Attributes A pointer to a lbmmon_packet_attributes_t structure
for storing the deserialized packet attributes.
\param GatewayMsg A pointer to a pointer to an Lbmmon__DROMonMsg
structure into which the data is deserialized.
\param Source A pointer to a buffer containing the serialized data.
\param Length The length of the serialized data.
\param ModuleID The module ID received in the packet.
It may be used to verify and differentiate between different version of
the module (and thus the format of the data it expects).
\param FormatClientData A pointer to format-specific client data as
returned by the ::lbmmon_format_init_t function.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the deserialized data will not be delivered to the application.
*/
LBMExpDLL int lbmmon_gateway_format_pb_deserialize(lbmmon_packet_attributes_t * Attributes,
Lbmmon__DROMonMsg ** GatewayMsg,
const char * Source,
size_t Length,
unsigned short ModuleID,
void * FormatClientData);
/*! \brief Function to free an unpacked Lbmmon__DROMonMsg structure.
\param GatewayMsg A pointer to a pointer to an Lbmmon__DROMonMsg
structure into which the data was deserialized.
\return Zero if successful, -1 otherwise.
*/
LBMExpDLL int lbmmon_gateway_free_unpacked(Lbmmon__DROMonMsg * GatewayMsg);
/*! \brief Finish PB format module processing.
\param FormatClientData A pointer to format-specific client data.
\return Zero if successful, -1 otherwise.
If -1 is returned,
the serialized data will not be sent.
*/
LBMExpDLL int lbmmon_format_pb_finish(void * FormatClientData);
/*! \brief Return a messages describing the last error encountered.
\return A string containing a description of the last error encountered by the module.
*/
LBMExpDLL const char * lbmmon_format_pb_errmsg(void);
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#endif