Skip to content
Snippets Groups Projects
Verified Commit 300cca57 authored by Suvendhu Hansa's avatar Suvendhu Hansa :speech_balloon: Committed by IOPSYS Dev
Browse files

Datamodel Vendor extensions for FD and ActiveConnections

parent 93dfeb49
Branches
No related tags found
1 merge request!19Moved vendor ext from gnx_bbf_ext
Pipeline #189675 passed
......@@ -39,6 +39,9 @@ endif
ifeq ($(SYSMNGR_VENDOR_EXTENSIONS),y)
PROG_CFLAGS += -DSYSMNGR_VENDOR_EXTENSIONS
ifndef CUSTOM_PREFIX
PROG_CFLAGS += -DCUSTOM_PREFIX=\"X_IOPSYS_EU_\"
endif
endif
ifneq ($(filter y,$(SYSMNGR_FIRMWARE_IMAGE) $(SYSMNGR_FWBANK_UBUS_SUPPORT)),)
......
......@@ -226,11 +226,44 @@ static int get_deviceinfo_base_mac_addr(char *refparam, struct dmctx *ctx, void
db_get_value_string("device", "deviceinfo", "BaseMACAddress", value);
return 0;
}
static int get_DeviceInfoFileDescriptors_Used(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char val[32] = {'\0'};
dm_read_sysfs_file("/proc/sys/fs/file-nr", val, sizeof(val));
if ('\0' == val[0]) {
*value = dmstrdup("-1");
} else {
*value = dmstrdup(val);
}
return 0;
}
static int get_DeviceInfoFileDescriptors_MaxAllowed(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char val[32] = {'\0'};
dm_read_sysfs_file("/proc/sys/fs/file-max", val, sizeof(val));
if ('\0' == val[0]) {
*value = dmstrdup("-1");
} else {
*value = dmstrdup(val);
}
return 0;
}
#endif
/**********************************************************************************************************************************
* OBJ & LEAF DEFINITION
***********************************************************************************************************************************/
#ifdef SYSMNGR_VENDOR_EXTENSIONS
DMLEAF tDeviceInfoFileDescriptorsParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
{"Used", &DMREAD, DMT_INT, get_DeviceInfoFileDescriptors_Used, NULL, BBFDM_BOTH},
{"MaxAllowed", &DMREAD, DMT_INT, get_DeviceInfoFileDescriptors_MaxAllowed, NULL, BBFDM_BOTH},
{0}
};
#endif
/* *** Device.DeviceInfo. *** */
DMOBJ tDeviceInfoObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type*/
......@@ -266,6 +299,10 @@ DMOBJ tDeviceInfoObj[] = {
{"TemperatureStatus", &DMREAD, NULL, NULL, "file:/etc/sysmngr/temperature.sh", NULL, NULL, NULL, tDeviceInfoTemperatureStatusObj, tDeviceInfoTemperatureStatusParams, NULL, BBFDM_BOTH},
#endif
#ifdef SYSMNGR_VENDOR_EXTENSIONS
{CUSTOM_PREFIX"FileDescriptors", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoFileDescriptorsParams, NULL, BBFDM_BOTH},
#endif
{0}
};
......@@ -307,7 +344,7 @@ DMLEAF tDeviceInfoParams[] = {
#endif
#ifdef SYSMNGR_VENDOR_EXTENSIONS
{BBF_VENDOR_PREFIX"BaseMACAddress", &DMREAD, DMT_STRING, get_deviceinfo_base_mac_addr, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"BaseMACAddress", &DMREAD, DMT_STRING, get_deviceinfo_base_mac_addr, NULL, BBFDM_BOTH},
#endif
{0}
......
......@@ -106,6 +106,32 @@ static int get_DeviceInfoNetworkProperties_TCPImplementation(char *refparam, str
return 0;
}
#ifdef SYSMNGR_VENDOR_EXTENSIONS
static int get_Connections_MaxConnections(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char val[32] = {'\0'};
dm_read_sysfs_file("/proc/sys/net/netfilter/nf_conntrack_max", val, sizeof(val));
if ('\0' == val[0]) {
*value = dmstrdup("-1");
} else {
*value = dmstrdup(val);
}
return 0;
}
static int get_Connections_ActiveConnections(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char val[32] = {'\0'};
dm_read_sysfs_file("/proc/sys/net/netfilter/nf_conntrack_count", val, sizeof(val));
if ('\0' == val[0]) {
*value = dmstrdup("-1");
} else {
*value = dmstrdup(val);
}
return 0;
}
#endif
/**********************************************************************************************************************************
* OBJ & LEAF DEFINITION
***********************************************************************************************************************************/
......@@ -114,5 +140,11 @@ DMLEAF tDeviceInfoNetworkPropertiesParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type */
{"MaxTCPWindowSize", &DMREAD, DMT_UNINT, get_DeviceInfoNetworkProperties_MaxTCPWindowSize, NULL, BBFDM_BOTH},
{"TCPImplementation", &DMREAD, DMT_STRING, get_DeviceInfoNetworkProperties_TCPImplementation, NULL, BBFDM_BOTH},
#ifdef SYSMNGR_VENDOR_EXTENSIONS
{CUSTOM_PREFIX"MaxConnections", &DMREAD, DMT_INT, get_Connections_MaxConnections, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"ActiveConnections", &DMREAD, DMT_INT, get_Connections_ActiveConnections, NULL, BBFDM_BOTH},
#endif
{0}
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment