#ifdef __VOS__
#define _POSIX_C_SOURCE 200112L
#include <sys/time.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <time.h>
#include <limits.h>
#include <errno.h>
#include <ctype.h>
#ifdef _WIN32
#define strcasecmp stricmp
#define snprintf _snprintf
#else
#endif
#if defined(__TANDEM)
#include <strings.h>
#endif
#include "lbmmon_int.h"
#include "lbmcommon.h"
#include "mullog.h"
#include "lbmconf.h"
#include "lbmmon_store_filter_options.h"
LBM_GNU_PRAGMA(GCC diagnostic ignored "-Wpedantic")
#include "gen/ums_mon_filters.pb-c.h"
LBM_GNU_PRAGMA_RESET()
{
lbmmon_format_pb_init,
lbmmon_format_pb_apply_format_options,
lbmmon_rcv_format_pb_serialize,
lbmmon_src_format_pb_serialize,
lbmmon_rcv_format_pb_deserialize,
lbmmon_src_format_pb_deserialize,
lbmmon_format_pb_finish,
lbmmon_format_pb_errmsg,
lbmmon_evq_format_pb_serialize,
lbmmon_evq_format_pb_deserialize,
lbmmon_ctx_format_pb_serialize,
lbmmon_ctx_format_pb_deserialize,
lbmmon_rcv_topic_format_pb_serialize,
lbmmon_rcv_topic_format_pb_deserialize,
lbmmon_wildcard_rcv_format_pb_serialize,
lbmmon_wildcard_rcv_format_pb_deserialize,
lbmmon_store_format_pb_serialize,
lbmmon_store_format_pb_deserialize,
lbmmon_store_format_pb_filter_options,
lbmmon_store_free_unpacked,
lbmmon_gateway_format_pb_serialize,
lbmmon_gateway_format_pb_deserialize,
lbmmon_gateway_free_unpacked
};
typedef struct
{
int mPassthrough;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__TCP mRcvTcpFilter;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__LBTRM mRcvLbtrmFilter;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__LBTRU mRcvLbtruFilter;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__LBTIPC mRcvLbtipcFilter;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__LBTSMX mRcvLbtsmxFilter;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__TCP mSrcTcpFilter;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__LBTRM mSrcLbtrmFilter;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__LBTRU mSrcLbtruFilter;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__LBTIPC mSrcLbtipcFilter;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__LBTSMX mSrcLbtsmxFilter;
Lbmmon_Filter__UMSMonMsg__Stats__EventQueue mEventQueueFilter;
Lbmmon_Filter__UMSMonMsg__Stats__Context mContextFilter;
Lbmmon_FilterMessage ** filters;
} lbmmon_format_pb_t;
#define LBMMON_NUM_FILTER_MSGS 12
static char ErrorString[LBM_CONFIG_MAX_LINE_LEN];
static void lbmmon_format_pb_report_allocation_error(size_t Size)
{
snprintf(ErrorString, sizeof(ErrorString), "Unable to allocate %u bytes", (unsigned)Size);
}
{
return (&LBMMON_FORMAT_PB);
}
int typeFor(char * type_name)
{
int type = 0;
if (strcasecmp(type_name, "LBMMON_FORMAT_FILTER_OFF") == 0) {
} else if (strcasecmp(type_name, "LBMMON_FORMAT_FILTER_ON") == 0) {
} else if (strcasecmp(type_name, "LBMMON_FORMAT_FILTER_EQ") == 0) {
} else if (strcasecmp(type_name, "LBMMON_FORMAT_FILTER_NE") == 0) {
} else if (strcasecmp(type_name, "LBMMON_FORMAT_FILTER_LT") == 0) {
} else if (strcasecmp(type_name, "LBMMON_FORMAT_FILTER_GT") == 0) {
} else {
return (-1);
}
return type;
}
int lbmmon_apply_filter(char * message, const ProtobufCMessageDescriptor *descriptor, char *key, char *value)
{
size_t message_len;
char name[LBMMON_MAX_LEN];
char *last;
int i;
char * typeString = NULL;
char * valueString = NULL;
int type = 0;
if (descriptor == NULL) {
snprintf(ErrorString, sizeof(ErrorString), "[lbmmon_apply_filter] Descriptor was NULL.\n");
return (-1);
}
message_len = strlen(descriptor->name);
if (strncasecmp(descriptor->name, key, message_len) == 0) {
strncpy(name, &key[message_len + 1], LBMMON_MAX_LEN);
MUL_DEBUG(LBM_DEBUG_LBMMON, ("[lbmmon_apply_filter] Key[%s] Value[%s] \n", name, value));
for (i = 0; i < descriptor->n_fields; i++) {
if (strcasecmp(name, descriptor->fields[i].name) == 0) {
typeString = mul_strtok_r(value, "(", &last);
if (typeString == NULL) {
snprintf(ErrorString, sizeof(ErrorString), "[lbmmon_apply_filter] Invalid option for %s given Value[%s]\n", key, value);
return (-1);
}
type = typeFor(typeString);
if (type == -1) {
snprintf(ErrorString, sizeof(ErrorString), "[lbmmon_apply_filter] Invalid option for %s given Value[%s]\n", key, value);
return (-1);
}
valueString = mul_strtok_r(0, ")", &last);
snprintf(ErrorString, sizeof(ErrorString), "[lbmmon_apply_filter] Value %s must be in the form %s(number);\n", typeString, typeString);
return (-1);
}
switch (descriptor->fields[i].type)
{
case PROTOBUF_C_TYPE_UINT64:
case PROTOBUF_C_TYPE_INT64:
case PROTOBUF_C_TYPE_SINT64:
case PROTOBUF_C_TYPE_SFIXED64:
case PROTOBUF_C_TYPE_FIXED64:
{
lbmmon_filter_uint64_t * filter = ((lbmmon_filter_uint64_t *)(message + descriptor->fields[i].offset));
filter->type = type;
if (valueString != NULL) {
if ((lbm_conf_parse_uint64(&filter->value, valueString) !=
LBM_OK)) {
snprintf(ErrorString, sizeof(ErrorString), "[lbmmon_apply_filter] Value %s must be a 64-bit number in the form %s(number);\n", valueString, typeString);
return (-1);
}
} else {
filter->value = 0;
}
MUL_DEBUG(LBM_DEBUG_LBMMON, ("[lbmmon_apply_filter] filter.type[%d] filter.value[%lu] \n", filter->type, filter->value));
return (1);
}
case PROTOBUF_C_TYPE_UINT32:
case PROTOBUF_C_TYPE_INT32:
case PROTOBUF_C_TYPE_SINT32:
case PROTOBUF_C_TYPE_SFIXED32:
case PROTOBUF_C_TYPE_FIXED32:
case PROTOBUF_C_TYPE_STRING:
{
}
case PROTOBUF_C_TYPE_BYTES:
case PROTOBUF_C_TYPE_FLOAT:
case PROTOBUF_C_TYPE_DOUBLE:
case PROTOBUF_C_TYPE_BOOL:
case PROTOBUF_C_TYPE_ENUM:
case PROTOBUF_C_TYPE_MESSAGE:
{
}
}
snprintf(ErrorString, sizeof(ErrorString), "[lbmmon_apply_filter] Invalid Key %s Value %s\n", key, value);
return (-1);
}
}
}
return (0);
}
int lbmmon_format_pb_apply_format_options(void * FormatClientData, const void * FormatOptions)
{
lbmmon_format_pb_t * data = FormatClientData;
const char * ptr = (const char *)FormatOptions;
char key[LBMMON_MAX_LEN];
char value[LBMMON_MAX_LEN];
{
if (strcasecmp(key, "passthrough") == 0)
{
if (strcasecmp(value, "off") == 0) {
} else if (strcasecmp(value, "on") == 0) {
} else if (strcasecmp(value, "convert") == 0) {
} else {
strncpy(ErrorString, "Value must be \"off\", \"on\" or \"convert\" for monitor format option \"passthrough\".", sizeof(ErrorString));
return (-1);
}
} else {
int i = 0;
int rc;
for (i = 0; i < LBMMON_NUM_FILTER_MSGS; i++) {
rc = lbmmon_apply_filter((char *)(data->filters[i]), data->filters[i]->base.descriptor, key, value);
if (rc == 1) {
break;
}
if (rc == -1) {
return (-1);
}
}
}
}
return (0);
}
int lbmmon_format_pb_init(void * * FormatClientData, const void * FormatOptions)
{
lbmmon_format_pb_t * data;
char format_options_file[LBMMON_MAX_LEN];
char * FormatOptionsBuffer = NULL;
char key[LBMMON_MAX_LEN];
char value[LBMMON_MAX_LEN];
const char * ptr = (const char *)FormatOptions;
memset(ErrorString, 0, sizeof(ErrorString));
*FormatClientData = NULL;
data = malloc(sizeof(lbmmon_format_pb_t));
if (data == NULL)
{
lbmmon_format_pb_report_allocation_error(sizeof(lbmmon_format_pb_t));
return (-1);
}
data->filters = malloc(sizeof(Lbmmon_FilterMessage *) * LBMMON_NUM_FILTER_MSGS);
if (data->filters == NULL)
{
lbmmon_format_pb_report_allocation_error(sizeof(sizeof(Lbmmon_FilterMessage *) * LBMMON_NUM_FILTER_MSGS));
return (-1);
}
lbmmon_filter__umsmon_msg__stats__receiver_transport__tcp__init(&(data->mRcvTcpFilter));
lbmmon_filter__umsmon_msg__stats__receiver_transport__lbtrm__init(&(data->mRcvLbtrmFilter));
lbmmon_filter__umsmon_msg__stats__receiver_transport__lbtru__init(&(data->mRcvLbtruFilter));
lbmmon_filter__umsmon_msg__stats__receiver_transport__lbtipc__init(&(data->mRcvLbtipcFilter));
lbmmon_filter__umsmon_msg__stats__receiver_transport__lbtsmx__init(&(data->mRcvLbtsmxFilter));
lbmmon_filter__umsmon_msg__stats__source_transport__tcp__init(&(data->mSrcTcpFilter));
lbmmon_filter__umsmon_msg__stats__source_transport__lbtrm__init(&(data->mSrcLbtrmFilter));
lbmmon_filter__umsmon_msg__stats__source_transport__lbtru__init(&(data->mSrcLbtruFilter));
lbmmon_filter__umsmon_msg__stats__source_transport__lbtipc__init(&(data->mSrcLbtipcFilter));
lbmmon_filter__umsmon_msg__stats__source_transport__lbtsmx__init(&(data->mSrcLbtsmxFilter));
lbmmon_filter__umsmon_msg__stats__event_queue__init(&(data->mEventQueueFilter));
lbmmon_filter__umsmon_msg__stats__context__init(&(data->mContextFilter));
data->filters[0] = (Lbmmon_FilterMessage *)&(data->mRcvTcpFilter);
data->filters[1] = (Lbmmon_FilterMessage *)&(data->mRcvLbtrmFilter);
data->filters[2] = (Lbmmon_FilterMessage *)&(data->mRcvLbtruFilter);
data->filters[3] = (Lbmmon_FilterMessage *)&(data->mRcvLbtipcFilter);
data->filters[4] = (Lbmmon_FilterMessage *)&(data->mRcvLbtsmxFilter);
data->filters[5] = (Lbmmon_FilterMessage *)&(data->mSrcTcpFilter);
data->filters[6] = (Lbmmon_FilterMessage *)&(data->mSrcLbtrmFilter);
data->filters[7] = (Lbmmon_FilterMessage *)&(data->mSrcLbtruFilter);
data->filters[8] = (Lbmmon_FilterMessage *)&(data->mSrcLbtipcFilter);
data->filters[9] = (Lbmmon_FilterMessage *)&(data->mSrcLbtsmxFilter);
data->filters[10] = (Lbmmon_FilterMessage *)&(data->mEventQueueFilter);
data->filters[11] = (Lbmmon_FilterMessage *)&(data->mContextFilter);
memset(format_options_file, 0, sizeof(format_options_file));
{
if (strcasecmp(key, "filters") == 0)
{
strncpy(format_options_file, value, sizeof(format_options_file));
free(data->filters);
free(data);
return -1;
}
if (lbmmon_format_pb_apply_format_options(data, (const char *)FormatOptionsBuffer) != 0) {
free(FormatOptionsBuffer);
free(data->filters);
free(data);
return -1;
}
free(FormatOptionsBuffer);
}
}
if (lbmmon_format_pb_apply_format_options(data, (const char *)FormatOptions) != 0) {
free(data->filters);
free(data);
return -1;
}
*FormatClientData = (void *)data;
return (0);
}
int lbmmon_format_pb_default_filter_options(void * FormatClientData, char * Destination, size_t Size)
{
lbmmon_format_pb_t * data = FormatClientData;
const ProtobufCMessageDescriptor *descriptor;
int i, j = 0;
char work[LBMMON_MAX_LEN];
char lbmmon_filter_options_prologue[] =
"# LBM filter option settings\n"
"# LBMMON_FORMAT_FILTER_OFF - include field in message(default)\n"
"# LBMMON_FORMAT_FILTER_ON - exclude field from message\n"
"# LBMMON_FORMAT_FILTER_EQ(numeric value) - exclude field from message when field == value\n"
"# LBMMON_FORMAT_FILTER_NE(numeric value) - exclude field from message field != value\n"
"# LBMMON_FORMAT_FILTER_LT(numeric value) - exclude field from message field < value\n"
"# LBMMON_FORMAT_FILTER_GT(numeric value) - exclude field from message field > value\n"
"#\n"
"# LBM default filter options\n"
;
if ((data == NULL) || (data->filters == NULL)) {
return (-1);
}
strncpy(Destination, lbmmon_filter_options_prologue, Size);
for (i = 0; i < LBMMON_NUM_FILTER_MSGS; i++) {
if (data->filters[i] == NULL) {
return (-1);
}
descriptor = data->filters[i]->base.descriptor;
for (j = 0; j < descriptor->n_fields; j++) {
snprintf(work, sizeof(work), "%s.%s=LBMMON_FORMAT_FILTER_OFF;\n", descriptor->name, descriptor->fields[j].name);
if ((strlen(Destination) + strlen(work) + 1) > Size) {
snprintf(ErrorString, sizeof(ErrorString), "[lbmmon_format_pb_default_filter_options] Destination buffer too small. Buffer is %lu but need %lu.\n",
Size, strlen(Destination) + strlen(work));
return (-1);
}
strncat(Destination, work, Size - strlen(Destination) - 1);
}
}
return 0;
}
void lbmmon_store_free_msg_filter_option_strings(Lbmmon__UMPMonMsg *store_msg) {
ProtobufCMessageDescriptor *base_descriptor = (ProtobufCMessageDescriptor *)store_msg->base.descriptor;
int i;
for (i = 0; i < base_descriptor->n_fields; ++i) {
if (base_descriptor->fields[i].type == PROTOBUF_C_TYPE_STRING) {
unsigned int *opt = (unsigned int *)(store_msg->base.unknown_fields);
char *regex_t_ptr;
char *p = (char *)(store_msg);
p += base_descriptor->fields[i].offset;
regex_t_ptr = *(char **)p;
#if defined(LBM_HAS_REGEX_H)
regfree((regex_t *)regex_t_ptr);
#endif
free(regex_t_ptr);
}
else {
char *p = (char *)(store_msg);
p += base_descriptor->fields[i].offset;
if (*(char **)p != NULL) {
free(*(char **)p);
}
}
}
}
}
}
void lbmmon_store_init_filter_options(store_filter_t *store_filter_options) {
}
void lbmmon_store_free_filter_options(store_filter_t *store_filter_options) {
STORE_FREE_FILTER_OPTIONS(store_filter_options, configs);
STORE_FREE_FILTER_OPTIONS(store_filter_options, pattern_config);
STORE_FREE_FILTER_OPTIONS(store_filter_options, topic_config);
STORE_FREE_FILTER_OPTIONS(store_filter_options, repo_config);
STORE_FREE_FILTER_OPTIONS(store_filter_options, rcv_config);
STORE_FREE_FILTER_OPTIONS(store_filter_options, stats);
STORE_FREE_FILTER_OPTIONS(store_filter_options, smart_heap_stat);
STORE_FREE_FILTER_OPTIONS(store_filter_options, src_repo_stat);
STORE_FREE_FILTER_OPTIONS(store_filter_options, src_disk_stat);
STORE_FREE_FILTER_OPTIONS(store_filter_options, rcv_stat);
}
int lbmmon_list_field_names(ProtobufCMessageDescriptor *msg_descriptor, char * default_filter_options_buffer, size_t default_filter_options_buffer_size) {
int field_idx;
char field_name_default[LBMMON_MAX_LEN];
for (field_idx = 0; field_idx < msg_descriptor->n_fields; ++field_idx) {
if (msg_descriptor->fields[field_idx].type != PROTOBUF_C_TYPE_MESSAGE) {
snprintf(field_name_default, sizeof(field_name_default), "%s.%s=LBMMON_FORMAT_FILTER_OFF;\n", &msg_descriptor->name[7], msg_descriptor->fields[field_idx].name);
if ((strlen(default_filter_options_buffer) + strlen(field_name_default) + 1) > default_filter_options_buffer_size) {
snprintf(ErrorString, sizeof(ErrorString), "[lbmmon_list_field_names] Destination buffer too small. Buffer is %lu but need %lu.\n",
default_filter_options_buffer_size, strlen(default_filter_options_buffer) + strlen(field_name_default));
return (-1);
}
strncat(default_filter_options_buffer, field_name_default, default_filter_options_buffer_size);
}
else
if (lbmmon_list_field_names((ProtobufCMessageDescriptor *)msg_descriptor->fields[field_idx].descriptor, default_filter_options_buffer, default_filter_options_buffer_size) == -1) {
return (-1);
}
}
return 0;
}
int lbmmon_format_pb_default_store_filter_options(char * Destination, size_t Size)
{
char lbmmon_store_filter_options_prologue[] =
"\n"
"# Store filter option settings\n"
"# LBMMON_FORMAT_FILTER_OFF - include field in message(default)\n"
"# LBMMON_FORMAT_FILTER_ON - exclude field from message\n"
"# LBMMON_FORMAT_FILTER_EQ(numeric value) - exclude field from message when field == value\n"
"# LBMMON_FORMAT_FILTER_NE(numeric value) - exclude field from message field != value\n"
"# LBMMON_FORMAT_FILTER_LT(numeric value) - exclude field from message field < value\n"
"# LBMMON_FORMAT_FILTER_GT(numeric value) - exclude field from message field > value\n"
"# LBMMON_FORMAT_SELECT_EQ(numeric value) - send message when field == value\n"
"# LBMMON_FORMAT_SELECT_NE(numeric value) - send message when field != value\n"
"# LBMMON_FORMAT_SELECT_LT(numeric value) - send message when field < value\n"
"# LBMMON_FORMAT_SELECT_GT(numeric value) - send message when field > value\n"
"# LBMMON_FORMAT_SELECT_MATCH(string) - send message with an exact string match\n"
"# LBMMON_FORMAT_SELECT_MATCH_REGX(regx string) - send message with a regular expression string match\n"
"#\n"
"# Store default filter options\n"
;
store_filter_t *store_filter_options;
LBM_MALLOC(store_filter_options, sizeof(store_filter_t));
memset(store_filter_options, 0, sizeof(store_filter_t));
lbmmon_store_init_filter_options(store_filter_options);
if ((strlen(Destination) + strlen(lbmmon_store_filter_options_prologue) + 1) > Size) {
snprintf(ErrorString, sizeof(ErrorString), "[lbmmon_format_pb_default_store_filter_options] Destination buffer too small. Buffer is %lu but need %lu.\n",
Size, strlen(Destination) + strlen(lbmmon_store_filter_options_prologue));
return (-1);
}
strcat(Destination, lbmmon_store_filter_options_prologue);
if (lbmmon_list_field_names((ProtobufCMessageDescriptor *)store_filter_options->configs->base.descriptor, Destination, Size - 1) != 0) {
return -1;
}
if (lbmmon_list_field_names((ProtobufCMessageDescriptor *)store_filter_options->stats->base.descriptor, Destination, Size - 1) != 0) {
return -1;
}
lbmmon_store_free_filter_options(store_filter_options);
free(store_filter_options);
return 0;
}
char * lbmmon_store_format_pb_filter_options(const char * FormatOptions)
{
char key[LBMMON_MAX_LEN];
char value[LBMMON_MAX_LEN];
const char * ptr = (const char *)FormatOptions;
char * store_filters = NULL;
int store_filter_size = 0;
const ProtobufCMessageDescriptor *store_descriptor = &lbmmon__umpmon_msg__descriptor;
{
if (strcasecmp(key, "filters") == 0)
{
char format_options_file[LBMMON_MAX_LEN];
char * FormatOptionsBuffer;
char * tmp_buf;
strncpy(format_options_file, value, sizeof(format_options_file));
if (store_filters != NULL) {
free(store_filters);
}
return NULL;
}
tmp_buf = lbmmon_store_format_pb_filter_options((const char *)FormatOptionsBuffer);
if (tmp_buf != NULL) {
if (store_filters == NULL) {
store_filter_size = strlen(tmp_buf + 1) * 2;
store_filters = malloc(store_filter_size);
if (store_filters == NULL)
{
lbmmon_format_pb_report_allocation_error(store_filter_size);
return NULL;
}
strncpy(store_filters, tmp_buf, store_filter_size);
} else {
if ((strlen(tmp_buf) + strlen(store_filters)) > store_filter_size) {
char * new_buf;
store_filter_size = (strlen(tmp_buf) + strlen(store_filters)) * 2;
new_buf = malloc(store_filter_size);
if (new_buf == NULL)
{
lbmmon_format_pb_report_allocation_error(store_filter_size);
return NULL;
}
strncpy(new_buf, store_filters, store_filter_size);
free(store_filters);
store_filters = new_buf;
}
strncat(store_filters, tmp_buf, sizeof(store_filter_size) - strlen(store_filters) - 1);
}
free(tmp_buf);
}
free(FormatOptionsBuffer);
}
else if (strncasecmp(key, store_descriptor->short_name, strlen(store_descriptor->short_name)) == 0){
if (store_filters == NULL) {
store_filter_size = 1000 * LBM_CONFIG_MAX_LINE_LEN;
store_filters = malloc(store_filter_size);
if (store_filters == NULL)
{
lbmmon_format_pb_report_allocation_error(store_filter_size);
return NULL;
}
memset(store_filters, 0, store_filter_size);
}
if (strlen(store_filters) + LBM_CONFIG_MAX_LINE_LEN >= store_filter_size)
{
char * new_buf;
store_filter_size *= 2;
new_buf = malloc(store_filter_size);
if (new_buf == NULL)
{
lbmmon_format_pb_report_allocation_error(store_filter_size);
return NULL;
}
strncpy(new_buf, store_filters, store_filter_size);
free(store_filters);
store_filters = new_buf;
}
snprintf(store_filters + strlen(store_filters), store_filter_size, "%s=%s;", key, value);
}
}
return store_filters;
}
void lbmmon_attributes_format_pb_serialize(Lbmmon__UMMonAttributes *AttributeBlock,
const lbmmon_packet_attributes_t * Attributes)
{
struct in_addr addr;
AttributeBlock->sender_ipv4_address = inet_ntoa(addr);
AttributeBlock->timestamp = time(NULL);
if ((Attributes->
mFlags & PACKET_ATTRIBUTES_FLAG_APPSOURCE_ID) != 0) {
}
AttributeBlock->object_id = (uint64_t)Attributes->
mObjectID;
AttributeBlock->process_id = Attributes->
mProcessID;
AttributeBlock->domain_id = Attributes->
mDomainID;
if ((Attributes->
mFlags & PACKET_ATTRIBUTES_FLAG_CTXINST) != 0) {
AttributeBlock->context_instance.len = LBM_CONTEXT_INSTANCE_BLOCK_SZ;
}
}
int lbmmon_rcv_format_pb_serialize(char * Destination, size_t * Size, unsigned short * ModuleID,
{
lbmmon_format_pb_t * fmt = (lbmmon_format_pb_t *)FormatClientData;
Lbmmon__UMSMonMsg lbmmon_msg = LBMMON__UMSMON_MSG__INIT;
Lbmmon__UMMonAttributes attributes = LBMMON__UMMON_ATTRIBUTES__INIT;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__TCP filter_tcp = fmt->mRcvTcpFilter;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__LBTRM filter_lbtrm = fmt->mRcvLbtrmFilter;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__LBTRU filter_lbtru = fmt->mRcvLbtruFilter;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__LBTIPC filter_lbtipc = fmt->mRcvLbtipcFilter;
Lbmmon_Filter__UMSMonMsg__Stats__ReceiverTransport__LBTSMX filter_lbtsmx = fmt->mRcvLbtsmxFilter;
if ((Destination == NULL) || (Size == NULL) || (*Size == 0) || (Statistics == NULL))
{
return (-1);
}
lbmmon_attributes_format_pb_serialize(&attributes, Attributes);
lbmmon_msg.attributes = &attributes;
lbmmon_msg.stats = &lbmmon_msg_stats;
lbmmon_msg_stats.n_receiver_transports = 1;
lbmmon_msg_stats.receiver_transports = &msg_ptr;
msg.source_string = (
char *)Statistics->
source;
switch (Statistics->
type)
{
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_TCP;
LBMMON_UINT64_SET(filter_tcp, tcp, Statistics->
transport.
tcp, bytes_rcved);
LBMMON_UINT64_SET(filter_tcp, tcp, Statistics->
transport.
tcp, lbm_msgs_rcved);
LBMMON_UINT64_SET(filter_tcp, tcp, Statistics->
transport.
tcp, lbm_msgs_no_topic_rcved);
LBMMON_UINT64_SET(filter_tcp, tcp, Statistics->
transport.
tcp, lbm_reqs_rcved);
msg.tcp = &tcp;
break;
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTRM;
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, msgs_rcved);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, bytes_rcved);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, nak_pckts_sent);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, naks_sent);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, lost);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, ncfs_ignored);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, ncfs_shed);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, ncfs_rx_delay);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, ncfs_unknown);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, nak_stm_min);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, nak_stm_mean);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, nak_stm_max);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, nak_tx_min);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, nak_tx_mean);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, nak_tx_max);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, duplicate_data);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, unrecovered_txw);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, unrecovered_tmo);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, lbm_msgs_rcved);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, lbm_msgs_no_topic_rcved);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, lbm_reqs_rcved);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, dgrams_dropped_size);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, dgrams_dropped_type);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, dgrams_dropped_version);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, dgrams_dropped_hdr);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, dgrams_dropped_other);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, out_of_order);
msg.lbtrm = &lbtrm;
break;
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTRU;
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, msgs_rcved);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, bytes_rcved);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, nak_pckts_sent);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, naks_sent);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, lost);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, ncfs_ignored);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, ncfs_shed);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, ncfs_rx_delay);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, ncfs_unknown);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, nak_stm_min);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, nak_stm_mean);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, nak_stm_max);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, nak_tx_min);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, nak_tx_mean);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, nak_tx_max);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, duplicate_data);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, unrecovered_txw);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, unrecovered_tmo);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, lbm_msgs_rcved);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, lbm_msgs_no_topic_rcved);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, lbm_reqs_rcved);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, dgrams_dropped_size);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, dgrams_dropped_type);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, dgrams_dropped_version);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, dgrams_dropped_hdr);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, dgrams_dropped_other);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, dgrams_dropped_sid);
msg.lbtru = &lbtru;
break;
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTIPC;
LBMMON_UINT64_SET(filter_lbtipc, lbtipc, Statistics->
transport.
lbtipc, msgs_rcved);
LBMMON_UINT64_SET(filter_lbtipc, lbtipc, Statistics->
transport.
lbtipc, bytes_rcved);
LBMMON_UINT64_SET(filter_lbtipc, lbtipc, Statistics->
transport.
lbtipc, lbm_msgs_rcved);
LBMMON_UINT64_SET(filter_lbtipc, lbtipc, Statistics->
transport.
lbtipc, lbm_msgs_no_topic_rcved);
LBMMON_UINT64_SET(filter_lbtipc, lbtipc, Statistics->
transport.
lbtipc, lbm_reqs_rcved);
msg.lbtipc = &lbtipc;
break;
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTSMX;
LBMMON_UINT64_SET(filter_lbtsmx, lbtsmx, Statistics->
transport.
lbtsmx, msgs_rcved);
LBMMON_UINT64_SET(filter_lbtsmx, lbtsmx, Statistics->
transport.
lbtsmx, bytes_rcved);
LBMMON_UINT64_SET(filter_lbtsmx, lbtsmx, Statistics->
transport.
lbtsmx, lbm_msgs_rcved);
LBMMON_UINT64_SET(filter_lbtsmx, lbtsmx, Statistics->
transport.
lbtsmx, lbm_msgs_no_topic_rcved);
msg.lbtsmx = &lbtsmx;
break;
default:
strncpy(ErrorString, "Unknown LBM transport type", sizeof(ErrorString));
return (-1);
}
*Size = lbmmon__umsmon_msg__get_packed_size(&lbmmon_msg);
lbmmon__umsmon_msg__pack(&lbmmon_msg, (
lbm_uint8_t *)Destination);
return (0);
}
int lbmmon_src_format_pb_serialize(char * Destination, size_t * Size, unsigned short * ModuleID,
{
lbmmon_format_pb_t * fmt = (lbmmon_format_pb_t *)FormatClientData;
Lbmmon__UMSMonMsg lbmmon_msg = LBMMON__UMSMON_MSG__INIT;
Lbmmon__UMMonAttributes attributes = LBMMON__UMMON_ATTRIBUTES__INIT;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__TCP filter_tcp = fmt->mSrcTcpFilter;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__LBTRM filter_lbtrm = fmt->mSrcLbtrmFilter;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__LBTRU filter_lbtru = fmt->mSrcLbtruFilter;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__LBTIPC filter_lbtipc = fmt->mSrcLbtipcFilter;
Lbmmon_Filter__UMSMonMsg__Stats__SourceTransport__LBTSMX filter_lbtsmx = fmt->mSrcLbtsmxFilter;
if ((Destination == NULL) || (Size == NULL) || (*Size == 0) || (Statistics == NULL))
{
return (-1);
}
lbmmon_attributes_format_pb_serialize(&attributes, Attributes);
lbmmon_msg.attributes = &attributes;
lbmmon_msg.stats = &lbmmon_msg_stats;
lbmmon_msg_stats.n_source_transports = 1;
lbmmon_msg_stats.source_transports = &msg_ptr;
msg.source_string = (
char *)Statistics->
source;
switch (Statistics->
type)
{
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__SOURCE_TRANSPORT__TRANSPORT_TYPE_TCP;
LBMMON_UINT64_SET(filter_tcp, tcp, Statistics->
transport.
tcp, num_clients);
LBMMON_UINT64_SET(filter_tcp, tcp, Statistics->
transport.
tcp, bytes_buffered);
msg.tcp = &tcp;
break;
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__SOURCE_TRANSPORT__TRANSPORT_TYPE_LBTRM;
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, msgs_sent);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, bytes_sent);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, txw_msgs);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, txw_bytes);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, nak_pckts_rcved);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, naks_rcved);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, naks_ignored);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, naks_shed);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, naks_rx_delay_ignored);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, rxs_sent);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, rctlr_data_msgs);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, rctlr_rx_msgs);
LBMMON_UINT64_SET(filter_lbtrm, lbtrm, Statistics->
transport.
lbtrm, rx_bytes_sent);
msg.lbtrm = &lbtrm;
break;
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__SOURCE_TRANSPORT__TRANSPORT_TYPE_LBTRU;
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, msgs_sent);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, bytes_sent);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, nak_pckts_rcved);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, naks_rcved);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, naks_ignored);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, naks_shed);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, naks_rx_delay_ignored);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, rxs_sent);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, num_clients);
LBMMON_UINT64_SET(filter_lbtru, lbtru, Statistics->
transport.
lbtru, rx_bytes_sent);
msg.lbtru = &lbtru;
break;
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTIPC;
LBMMON_UINT64_SET(filter_lbtipc, lbtipc, Statistics->
transport.
lbtipc, num_clients);
LBMMON_UINT64_SET(filter_lbtipc, lbtipc, Statistics->
transport.
lbtipc, msgs_sent);
LBMMON_UINT64_SET(filter_lbtipc, lbtipc, Statistics->
transport.
lbtipc, bytes_sent);
msg.lbtipc = &lbtipc;
break;
msg.transport_type_case = LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTSMX;
LBMMON_UINT64_SET(filter_lbtsmx, lbtsmx, Statistics->
transport.
lbtsmx, num_clients);
LBMMON_UINT64_SET(filter_lbtsmx, lbtsmx, Statistics->
transport.
lbtsmx, msgs_sent);
LBMMON_UINT64_SET(filter_lbtsmx, lbtsmx, Statistics->
transport.
lbtsmx, bytes_sent);
msg.lbtsmx = &lbtsmx;
break;
default:
strncpy(ErrorString, "Unknown LBM transport type", sizeof(ErrorString));
return (-1);
}
*Size = lbmmon__umsmon_msg__get_packed_size(&lbmmon_msg);
lbmmon__umsmon_msg__pack(&lbmmon_msg, (
lbm_uint8_t *)Destination);
return (0);
}
int lbmmon_evq_format_pb_serialize(char * Destination, size_t * Size, unsigned short * ModuleID,
{
lbmmon_format_pb_t * fmt = (lbmmon_format_pb_t *)FormatClientData;
Lbmmon__UMSMonMsg lbmmon_msg = LBMMON__UMSMON_MSG__INIT;
Lbmmon_Filter__UMSMonMsg__Stats__EventQueue filter_msg = fmt->mEventQueueFilter;
Lbmmon__UMMonAttributes attributes = LBMMON__UMMON_ATTRIBUTES__INIT;
if ((Destination == NULL) || (Size == NULL) || (*Size == 0) || (Statistics == NULL))
{
return (-1);
}
lbmmon_attributes_format_pb_serialize(&attributes, Attributes);
lbmmon_msg.attributes = &attributes;
lbmmon_msg.stats = &lbmmon_msg_stats;
lbmmon_msg_stats.n_event_queues = 1;
lbmmon_msg_stats.event_queues = &msg_ptr;
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), data_msgs);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), data_msgs_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), data_msgs_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), data_msgs_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), data_msgs_svc_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), resp_msgs);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), resp_msgs_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), resp_msgs_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), resp_msgs_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), resp_msgs_svc_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), topicless_im_msgs);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), topicless_im_msgs_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), topicless_im_msgs_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), topicless_im_msgs_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), topicless_im_msgs_svc_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), wrcv_msgs);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), wrcv_msgs_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), wrcv_msgs_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), wrcv_msgs_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), wrcv_msgs_svc_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), io_events);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), io_events_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), io_events_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), io_events_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), io_events_svc_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), timer_events);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), timer_events_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), timer_events_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), timer_events_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), timer_events_svc_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), source_events);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), source_events_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), source_events_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), source_events_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), source_events_svc_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), unblock_events);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), unblock_events_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), cancel_events);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), cancel_events_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), cancel_events_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), cancel_events_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), cancel_events_svc_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), context_source_events);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), context_source_events_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), context_source_events_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), context_source_events_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), context_source_events_svc_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), events);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), events_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), age_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), age_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), age_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), callback_events);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), callback_events_tot);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), callback_events_svc_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), callback_events_svc_mean);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), callback_events_svc_max);
*Size = lbmmon__umsmon_msg__get_packed_size(&lbmmon_msg);
lbmmon__umsmon_msg__pack(&lbmmon_msg, (
lbm_uint8_t *)Destination);
return (0);
}
int lbmmon_ctx_format_pb_serialize(char * Destination, size_t * Size, unsigned short * ModuleID,
{
lbmmon_format_pb_t * fmt = (lbmmon_format_pb_t *)FormatClientData;
Lbmmon__UMSMonMsg lbmmon_msg = LBMMON__UMSMON_MSG__INIT;
Lbmmon_Filter__UMSMonMsg__Stats__Context filter_msg = fmt->mContextFilter;
Lbmmon__UMMonAttributes attributes = LBMMON__UMMON_ATTRIBUTES__INIT;
if ((Destination == NULL) || (Size == NULL) || (*Size == 0) || (Statistics == NULL))
{
return (-1);
}
lbmmon_attributes_format_pb_serialize(&attributes, Attributes);
lbmmon_msg.attributes = &attributes;
lbmmon_msg.stats = &lbmmon_msg_stats;
lbmmon_msg_stats.context = &msg;
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_dgrams_sent);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_bytes_sent);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_dgrams_rcved);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_bytes_rcved);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_dgrams_dropped_ver);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_dgrams_dropped_type);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_dgrams_dropped_malformed);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_dgrams_send_failed);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_src_topics);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_rcv_topics);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), tr_rcv_unresolved_topics);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), lbtrm_unknown_msgs_rcved);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), lbtru_unknown_msgs_rcved);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), send_blocked);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), send_would_block);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), resp_blocked);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), resp_would_block);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), uim_dup_msgs_rcved);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), uim_msgs_no_stream_rcved);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), fragments_lost);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), fragments_unrecoverably_lost);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), rcv_cb_svc_time_min);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), rcv_cb_svc_time_max);
LBMMON_UINT64_SET(filter_msg, msg, (*Statistics), rcv_cb_svc_time_mean);
*Size = lbmmon__umsmon_msg__get_packed_size(&lbmmon_msg);
lbmmon__umsmon_msg__pack(&lbmmon_msg, (
lbm_uint8_t *)Destination);
return (0);
}
int lbmmon_rcv_topic_format_pb_serialize(char * Destination, size_t * Size, unsigned short * ModuleID,
{
Lbmmon__UMSMonMsg lbmmon_msg = LBMMON__UMSMON_MSG__INIT;
Lbmmon__UMMonAttributes attributes = LBMMON__UMMON_ATTRIBUTES__INIT;
char **otid_strings = NULL;
int idx;
size_t packed_size;
if ((Destination == NULL) || (Size == NULL) || (*Size == 0))
{
return (-1);
}
lbmmon_attributes_format_pb_serialize(&attributes, Attributes);
lbmmon_msg.attributes = &attributes;
lbmmon_msg.events = &lbmmon_msg_events;
lbmmon_msg_events.n_receiver_topics = 1;
lbmmon_msg_events.receiver_topics = &msg_ptr;
msg.topic = (char *)Topic;
if (SourceCount > 0)
{
if (sources == NULL)
{
return (-1);
}
otid_strings = malloc(sizeof(char *) * SourceCount);
if (otid_strings == NULL)
{
lbmmon_format_pb_report_allocation_error(sizeof(char *) * SourceCount);
free(sources);
return (-1);
}
for (idx = 0; idx < SourceCount; ++idx)
{
if (sources[idx] == NULL)
{
free(otid_strings);
free(sources);
return (-1);
}
lbmmon__umsmon_msg__events__receiver_topic__source__init(sources[idx]);
sources[idx]->source_string = (char *)Sources[idx].source;
otid_strings[idx] = malloc((LBM_OTID_BLOCK_SZ * 2) + 1);
if (otid_strings[idx] == NULL)
{
lbmmon_format_pb_report_allocation_error(LBM_OTID_BLOCK_SZ);
free(sources);
free(otid_strings);
return (-1);
}
strcpy(otid_strings[idx], (char *)mul_hexdump((const char *)Sources[idx].otid, LBM_OTID_BLOCK_SZ));
sources[idx]->otid = otid_strings[idx];
sources[idx]->topic_idx = Sources[idx].
topic_idx;
sources[idx]->source_state = Sources[idx].
flags;
}
msg.n_sources = SourceCount;
msg.sources = sources;
}
packed_size = lbmmon__umsmon_msg__get_packed_size(&lbmmon_msg);
if (packed_size > *Size) {
snprintf(ErrorString, sizeof(ErrorString), "[LBMMON] Unable to send monitoring message that is larger than the maximum allowed size of %lu (size=%lu).\n",
*Size, packed_size);
return (-1);
}
*Size = packed_size;
lbmmon__umsmon_msg__pack(&lbmmon_msg, (
lbm_uint8_t *)Destination);
for (idx = 0; idx < SourceCount; ++idx)
{
free(sources[idx]);
free(otid_strings[idx]);
}
free(sources);
free(otid_strings);
return (0);
}
int lbmmon_wildcard_rcv_format_pb_serialize(char * Destination, size_t * Size, unsigned short * ModuleID,
{
Lbmmon__UMSMonMsg lbmmon_msg = LBMMON__UMSMON_MSG__INIT;
Lbmmon__UMMonAttributes attributes = LBMMON__UMMON_ATTRIBUTES__INIT;
size_t packed_size;
if ((Destination == NULL) || (Size == NULL) || (*Size == 0) || (Statistics == NULL))
{
return (-1);
}
lbmmon_attributes_format_pb_serialize(&attributes, Attributes);
lbmmon_msg.attributes = &attributes;
lbmmon_msg.events = &lbmmon_msg_events;
lbmmon_msg_events.n_wildcard_receivers = 1;
lbmmon_msg_events.wildcard_receivers = &msg_ptr;
msg.pattern = (
char *)Statistics->
pattern;
msg.type = Statistics->
type;
packed_size = lbmmon__umsmon_msg__get_packed_size(&lbmmon_msg);
if (packed_size > *Size) {
snprintf(ErrorString, sizeof(ErrorString), "[LBMMON] Unable to send monitoring message that is larger than the maximum allowed size of %lu (size=%lu).\n",
*Size, packed_size);
return (-1);
}
*Size = packed_size;
lbmmon__umsmon_msg__pack(&lbmmon_msg, (
lbm_uint8_t *)Destination);
return (0);
}
int lbmmon_store_format_pb_serialize(char * Destination, size_t * Size, unsigned short * ModuleID,
{
Lbmmon__UMMonAttributes attributes = LBMMON__UMMON_ATTRIBUTES__INIT;
size_t packed_size;
{
return (-1);
}
lbmmon_attributes_format_pb_serialize(&attributes, Attributes);
StoreMsg->attributes = &attributes;
packed_size = lbmmon__umpmon_msg__get_packed_size(StoreMsg);
*Size = packed_size;
return (0);
}
if (packed_size > *Size) {
snprintf(ErrorString, sizeof(ErrorString), "[LBMMON] Unable to send monitoring message for store \"%s\" that is larger than the maximum allowed size of %lu (size=%lu).\n",
attributes.application_id, *Size, packed_size);
return (-1);
}
*Size = packed_size;
lbmmon__umpmon_msg__pack(StoreMsg, (
lbm_uint8_t *)Destination);
return (0);
}
int lbmmon_gateway_format_pb_serialize(char * Destination, size_t * Size, unsigned short * ModuleID,
{
Lbmmon__UMMonAttributes attributes = LBMMON__UMMON_ATTRIBUTES__INIT;
size_t packed_size;
if ((Destination == NULL) || (Size == NULL) || (*Size == 0) || (GatewayMsg == NULL))
{
return (-1);
}
lbmmon_attributes_format_pb_serialize(&attributes, Attributes);
GatewayMsg->attributes = &attributes;
packed_size = lbmmon__dromon_msg__get_packed_size(GatewayMsg);
if (packed_size > *Size) {
snprintf(ErrorString, sizeof(ErrorString), "[LBMMON] Unable to send monitoring message that is larger than the maximum allowed size of %lu (size=%lu).\n",
*Size, packed_size);
return (-1);
}
*Size = packed_size;
lbmmon__dromon_msg__pack(GatewayMsg, (
lbm_uint8_t *)Destination);
return (0);
}
{
struct in_addr addr;
mul_inet_aton(attributes->sender_ipv4_address, &addr);
Attributes->
mObjectID = attributes->object_id;
if (attributes->context_instance.len > 0){
memcpy(Attributes->
mContextInstance, attributes->context_instance.data, LBM_CONTEXT_INSTANCE_BLOCK_SZ);
}
Attributes->
mDomainID = attributes->domain_id;
}
const char * Source, size_t Length, unsigned short ModuleID, void * FormatClientData)
{
unsigned char modid;
lbmmon_format_pb_t * format_options;
Lbmmon__UMSMonMsg *lbmmon_msg = NULL;
if ((Statistics == NULL) || (Source == NULL) || (*Source == '\0') || (Length == 0) || (FormatClientData == NULL))
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
{
snprintf(ErrorString, sizeof(ErrorString), "Invalid module ID %u", (unsigned)modid);
}
format_options = (lbmmon_format_pb_t *)FormatClientData;
{
}
lbmmon_msg = lbmmon__umsmon_msg__unpack(NULL, Length, (
lbm_uint8_t *)Source);
if ((lbmmon_msg == NULL) || (lbmmon_msg->attributes == NULL) || (lbmmon_msg->stats == NULL) ||
(lbmmon_msg->stats->receiver_transports == NULL) || (lbmmon_msg->stats->n_receiver_transports != 1))
{
snprintf(ErrorString, sizeof(ErrorString), "Error unpacking incoming receiver transport stats message\n");
}
lbmmon_attributes_format_pb_deserialize(Attributes, lbmmon_msg->attributes);
msg = *(lbmmon_msg->stats->receiver_transports);
strncpy(Statistics->
source, msg->source_string,
sizeof(Statistics->
source));
switch (msg->transport_type_case)
{
case LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_TCP:
tcp = msg->tcp;
break;
case LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTRM:
lbtrm = msg->lbtrm;
break;
case LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTRU:
lbtru = msg->lbtru;
break;
case LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTIPC:
lbtipc = msg->lbtipc;
break;
case LBMMON__UMSMON_MSG__STATS__RECEIVER_TRANSPORT__TRANSPORT_TYPE_LBTSMX:
lbtsmx = msg->lbtsmx;
break;
default:
strncpy(ErrorString, "Invalid LBM transport type", sizeof(ErrorString));
}
lbmmon__umsmon_msg__free_unpacked(lbmmon_msg, NULL);
}
const char * Source, size_t Length, unsigned short ModuleID, void * FormatClientData)
{
unsigned char modid;
lbmmon_format_pb_t * format_options;
Lbmmon__UMSMonMsg *lbmmon_msg = NULL;
if ((Statistics == NULL) || (Source == NULL) || (*Source == '\0') || (Length == 0) || (FormatClientData == NULL))
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
{
snprintf(ErrorString, sizeof(ErrorString), "Invalid module ID %u", (unsigned)modid);
}
format_options = (lbmmon_format_pb_t *)FormatClientData;
{
}
lbmmon_msg = lbmmon__umsmon_msg__unpack(NULL, Length, (
lbm_uint8_t *)Source);
if ((lbmmon_msg == NULL) || (lbmmon_msg->attributes == NULL) || (lbmmon_msg->stats == NULL) ||
(lbmmon_msg->stats->source_transports == NULL) || (lbmmon_msg->stats->n_source_transports != 1))
{
snprintf(ErrorString, sizeof(ErrorString), "Error unpacking incoming source transport stats message\n");
}
lbmmon_attributes_format_pb_deserialize(Attributes, lbmmon_msg->attributes);
msg = *(lbmmon_msg->stats->source_transports);
strncpy(Statistics->
source, msg->source_string,
sizeof(Statistics->
source));
MUL_DEBUG(LBM_DEBUG_LBMMON, (
"lbmmon_src_format_pb_deserialize (%s) (%d) (%d)\n", Statistics->
source, msg->transport_type_case, Length));
switch (msg->transport_type_case)
{
case LBMMON__UMSMON_MSG__STATS__SOURCE_TRANSPORT__TRANSPORT_TYPE_TCP:
tcp = msg->tcp;
break;
case LBMMON__UMSMON_MSG__STATS__SOURCE_TRANSPORT__TRANSPORT_TYPE_LBTRM:
lbtrm = msg->lbtrm;
break;
case LBMMON__UMSMON_MSG__STATS__SOURCE_TRANSPORT__TRANSPORT_TYPE_LBTRU:
lbtru = msg->lbtru;
break;
case LBMMON__UMSMON_MSG__STATS__SOURCE_TRANSPORT__TRANSPORT_TYPE_LBTIPC:
lbtipc = msg->lbtipc;
break;
case LBMMON__UMSMON_MSG__STATS__SOURCE_TRANSPORT__TRANSPORT_TYPE_LBTSMX:
lbtsmx = msg->lbtsmx;
break;
default:
strncpy(ErrorString, "Invalid LBM transport type", sizeof(ErrorString));
}
lbmmon__umsmon_msg__free_unpacked(lbmmon_msg, NULL);
}
const char * Source, size_t Length, unsigned short ModuleID, void * FormatClientData)
{
unsigned char modid;
lbmmon_format_pb_t * format_options;
Lbmmon__UMSMonMsg *lbmmon_msg = NULL;
if ((Statistics == NULL) || (Source == NULL) || (*Source == '\0') || (Length == 0) || (FormatClientData == NULL))
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
{
snprintf(ErrorString, sizeof(ErrorString), "Invalid module ID %u", (unsigned)modid);
}
format_options = (lbmmon_format_pb_t *)FormatClientData;
{
}
lbmmon_msg = lbmmon__umsmon_msg__unpack(NULL, Length, (
lbm_uint8_t *)Source);
if ((lbmmon_msg == NULL) || (lbmmon_msg->attributes == NULL) || (lbmmon_msg->stats == NULL) ||
(lbmmon_msg->stats->event_queues == NULL) || (lbmmon_msg->stats->n_event_queues != 1))
{
snprintf(ErrorString, sizeof(ErrorString), "Error unpacking incoming event queue stats message\n");
}
lbmmon_attributes_format_pb_deserialize(Attributes, lbmmon_msg->attributes);
msg = *(lbmmon_msg->stats->event_queues);
Statistics->
events = msg->events;
Statistics->
age_min = msg->age_min;
Statistics->
age_max = msg->age_max;
lbmmon__umsmon_msg__free_unpacked(lbmmon_msg, NULL);
}
const char * Source, size_t Length, unsigned short ModuleID, void * FormatClientData)
{
unsigned char modid;
lbmmon_format_pb_t * format_options;
Lbmmon__UMSMonMsg *lbmmon_msg = NULL;
if ((Statistics == NULL) || (Source == NULL) || (*Source == '\0') || (Length == 0) || (FormatClientData == NULL))
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
{
snprintf(ErrorString, sizeof(ErrorString), "Invalid module ID %u", (unsigned)modid);
}
format_options = (lbmmon_format_pb_t *)FormatClientData;
{
}
lbmmon_msg = lbmmon__umsmon_msg__unpack(NULL, Length, (
lbm_uint8_t *)Source);
if ((lbmmon_msg == NULL) || (lbmmon_msg->attributes == NULL) || (lbmmon_msg->stats == NULL) ||
(lbmmon_msg->stats->context == NULL))
{
snprintf(ErrorString, sizeof(ErrorString), "Error unpacking incoming context stats message\n");
}
lbmmon_attributes_format_pb_deserialize(Attributes, lbmmon_msg->attributes);
msg = lbmmon_msg->stats->context;
lbmmon__umsmon_msg__free_unpacked(lbmmon_msg, NULL);
}
size_t Length, unsigned short ModuleID, void * FormatClientData)
{
unsigned char modid;
lbmmon_format_pb_t * format_options;
Lbmmon__UMSMonMsg *lbmmon_msg = NULL;
size_t idx;
char topic[LBM_MSG_MAX_TOPIC_LEN + 1];
size_t src_count;
if ((Count == NULL) || (*Count == 0) || (Statistics == NULL) || (Source == NULL) ||
(*Source == '\0') || (Length == 0) || (FormatClientData == NULL))
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
{
snprintf(ErrorString, sizeof(ErrorString), "Invalid module ID %u", (unsigned)modid);
}
format_options = (lbmmon_format_pb_t *)FormatClientData;
{
}
lbmmon_msg = lbmmon__umsmon_msg__unpack(NULL, Length, (
lbm_uint8_t *)Source);
if ((lbmmon_msg == NULL) || (lbmmon_msg->attributes == NULL) || (lbmmon_msg->events == NULL) ||
(lbmmon_msg->events->receiver_topics == NULL) || (lbmmon_msg->events->n_receiver_topics != 1))
{
snprintf(ErrorString, sizeof(ErrorString), "Error unpacking incoming receiver topic stats message\n");
}
lbmmon_attributes_format_pb_deserialize(Attributes, lbmmon_msg->attributes);
msg = *(lbmmon_msg->events->receiver_topics);
strncpy(topic, msg->topic, sizeof(topic));
src_count = msg->n_sources;
if (*Count < src_count)
{
*Count = src_count;
}
if (src_count == 0)
{
strncpy(Statistics[0].topic, topic, sizeof(Statistics[idx].topic));
src_count = 1;
} else {
for (idx = 0; idx < src_count; ++idx)
{
size_t count;
char * pos;
strncpy(Statistics[idx].topic, topic, sizeof(Statistics[idx].topic));
Statistics[idx].
flags = msg->sources[idx]->source_state;
strncpy(Statistics[idx].source, msg->sources[idx]->source_string,
sizeof(Statistics[idx].
source));
pos = msg->sources[idx]->otid;
for (count = 0; count < LBM_OTID_BLOCK_SZ; count++) {
sscanf(pos, "%2hhx", &Statistics[idx].otid[count]);
pos += 2;
}
Statistics[idx].
topic_idx = msg->sources[idx]->topic_idx;
Statistics[idx].
timestamp_sec = msg->sources[idx]->timestamp_sec;
}
}
lbmmon__umsmon_msg__free_unpacked(lbmmon_msg, NULL);
*Count = src_count;
}
const char * Source, size_t Length, unsigned short ModuleID, void * FormatClientData)
{
unsigned char modid;
lbmmon_format_pb_t * format_options;
Lbmmon__UMSMonMsg *lbmmon_msg = NULL;
if ((Statistics == NULL) || (Source == NULL) || (*Source == '\0') || (Length == 0) || (FormatClientData == NULL))
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
{
snprintf(ErrorString, sizeof(ErrorString), "Invalid module ID %u", (unsigned)modid);
}
format_options = (lbmmon_format_pb_t *)FormatClientData;
{
}
lbmmon_msg = lbmmon__umsmon_msg__unpack(NULL, Length, (
lbm_uint8_t *)Source);
if ((lbmmon_msg == NULL) || (lbmmon_msg->attributes == NULL) || (lbmmon_msg->events == NULL) ||
(lbmmon_msg->events->wildcard_receivers == NULL) || (lbmmon_msg->events->n_wildcard_receivers != 1))
{
snprintf(ErrorString, sizeof(ErrorString), "Error unpacking incoming wildcard stats message\n");
}
lbmmon_attributes_format_pb_deserialize(Attributes, lbmmon_msg->attributes);
msg = *(lbmmon_msg->events->wildcard_receivers);
strncpy(Statistics->
pattern, msg->pattern,
sizeof(Statistics->
pattern));
lbmmon__umsmon_msg__free_unpacked(lbmmon_msg, NULL);
}
const char * Source, size_t Length, unsigned short ModuleID, void * FormatClientData)
{
Lbmmon__UMPMonMsg *msg = NULL;
unsigned char modid;
lbmmon_format_pb_t * format_options;
if ((StoreMsg == NULL) || (Source == NULL) || (*Source == '\0') || (Length == 0) || (FormatClientData == NULL))
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
{
strncpy(ErrorString, "Invalid module ID", sizeof(ErrorString));
}
format_options = (lbmmon_format_pb_t *)FormatClientData;
{
}
msg = lbmmon__umpmon_msg__unpack(NULL, Length, (
lbm_uint8_t *)Source);
if (msg == NULL)
{
snprintf(ErrorString, sizeof(ErrorString), "Error unpacking incoming UME store lbmmon message\n");
}
lbmmon_attributes_format_pb_deserialize(Attributes, msg->attributes);
*StoreMsg = msg;
}
int lbmmon_store_free_unpacked(Lbmmon__UMPMonMsg * StoreMsg)
{
if (StoreMsg == NULL)
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
lbmmon__umpmon_msg__free_unpacked(StoreMsg, NULL);
}
const char * Source, size_t Length, unsigned short ModuleID, void * FormatClientData)
{
Lbmmon__DROMonMsg *msg = NULL;
unsigned char modid;
lbmmon_format_pb_t * format_options;
if ((GatewayMsg == NULL) || (Source == NULL) || (*Source == '\0') || (Length == 0) || (FormatClientData == NULL))
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
{
strncpy(ErrorString, "Invalid module ID", sizeof(ErrorString));
}
format_options = (lbmmon_format_pb_t *)FormatClientData;
{
}
msg = lbmmon__dromon_msg__unpack(NULL, Length, (
lbm_uint8_t *)Source);
if (msg == NULL)
{
snprintf(ErrorString, sizeof(ErrorString), "Error unpacking incoming UME gateway lbmmon message\n");
}
lbmmon_attributes_format_pb_deserialize(Attributes, msg->attributes);
*GatewayMsg = msg;
}
int lbmmon_gateway_free_unpacked(Lbmmon__DROMonMsg * GatewayMsg)
{
if (GatewayMsg == NULL)
{
strncpy(ErrorString, "Invalid parameter", sizeof(ErrorString));
}
lbmmon__dromon_msg__free_unpacked(GatewayMsg, NULL);
}
int lbmmon_format_pb_finish(void * FormatClientData)
{
if (FormatClientData != NULL)
{
lbmmon_format_pb_t * data = (lbmmon_format_pb_t *)FormatClientData;
free(data->filters);
free(data);
}
return (0);
}
const char * lbmmon_format_pb_errmsg(void)
{
return (ErrorString);
}