Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
System Manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
system
System Manager
Commits
744def76
Commit
744def76
authored
10 months ago
by
Amin Ben Romdhane
Browse files
Options
Downloads
Patches
Plain Diff
Added support for NetworkProperties Object
parent
12df8404
No related branches found
No related tags found
No related merge requests found
Pipeline
#179719
passed
10 months ago
Stage: static_code_analysis
Changes
4
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/Makefile
+5
-0
5 additions, 0 deletions
src/Makefile
src/deviceinfo.c
+8
-0
8 additions, 0 deletions
src/deviceinfo.c
src/network.c
+118
-0
118 additions, 0 deletions
src/network.c
src/network.h
+17
-0
17 additions, 0 deletions
src/network.h
with
148 additions
and
0 deletions
src/Makefile
+
5
−
0
View file @
744def76
...
@@ -37,6 +37,11 @@ OBJS += reboots.o
...
@@ -37,6 +37,11 @@ OBJS += reboots.o
PROG_CFLAGS
+=
-DSYSMNGR_REBOOTS
PROG_CFLAGS
+=
-DSYSMNGR_REBOOTS
endif
endif
ifeq
($(SYSMNGR_NETWORK_PROPERTIES),y)
OBJS
+=
network.o
PROG_CFLAGS
+=
-DSYSMNGR_NETWORK_PROPERTIES
endif
ifeq
($(SYSMNGR_VENDOR_EXTENSIONS),y)
ifeq
($(SYSMNGR_VENDOR_EXTENSIONS),y)
PROG_CFLAGS
+=
-DSYSMNGR_VENDOR_EXTENSIONS
PROG_CFLAGS
+=
-DSYSMNGR_VENDOR_EXTENSIONS
endif
endif
...
...
This diff is collapsed.
Click to expand it.
src/deviceinfo.c
+
8
−
0
View file @
744def76
...
@@ -35,6 +35,10 @@
...
@@ -35,6 +35,10 @@
#include
"supported_dm.h"
#include
"supported_dm.h"
#endif
#endif
#ifdef SYSMNGR_NETWORK_PROPERTIES
#include
"network.h"
#endif
/*************************************************************
/*************************************************************
* GET & SET PARAM
* GET & SET PARAM
**************************************************************/
**************************************************************/
...
@@ -238,6 +242,10 @@ DMOBJ tDeviceInfoObj[] = {
...
@@ -238,6 +242,10 @@ DMOBJ tDeviceInfoObj[] = {
{
"ProcessStatus"
,
&
DMREAD
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
tDeviceInfoProcessStatusObj
,
tDeviceInfoProcessStatusParams
,
NULL
,
BBFDM_BOTH
},
{
"ProcessStatus"
,
&
DMREAD
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
tDeviceInfoProcessStatusObj
,
tDeviceInfoProcessStatusParams
,
NULL
,
BBFDM_BOTH
},
#endif
#endif
#ifdef SYSMNGR_NETWORK_PROPERTIES
{
"NetworkProperties"
,
&
DMREAD
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
tDeviceInfoNetworkPropertiesParams
,
NULL
,
BBFDM_BOTH
},
#endif
#ifdef SYSMNGR_SUPPORTED_DATA_MODEL
#ifdef SYSMNGR_SUPPORTED_DATA_MODEL
{
"SupportedDataModel"
,
&
DMREAD
,
NULL
,
NULL
,
NULL
,
browseDeviceInfoSupportedDataModelInst
,
NULL
,
NULL
,
NULL
,
tDeviceInfoSupportedDataModelParams
,
NULL
,
BBFDM_CWMP
},
{
"SupportedDataModel"
,
&
DMREAD
,
NULL
,
NULL
,
NULL
,
browseDeviceInfoSupportedDataModelInst
,
NULL
,
NULL
,
NULL
,
tDeviceInfoSupportedDataModelParams
,
NULL
,
BBFDM_CWMP
},
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
src/network.c
0 → 100644
+
118
−
0
View file @
744def76
/*
* Copyright (C) 2024 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
*
*/
#include
"utils.h"
#define TCP_WMEM_PATH "/proc/sys/net/ipv4/tcp_wmem"
#define TCP_CONGESTION_CONTROL_PATH "/proc/sys/net/ipv4/tcp_available_congestion_control"
/*************************************************************
* COMMON FUNCTIONS
**************************************************************/
static
int
read_file_content
(
const
char
*
file_path
,
char
*
buffer
,
size_t
buffer_size
)
{
int
fd
=
open
(
file_path
,
O_RDONLY
);
if
(
fd
==
-
1
)
return
-
1
;
ssize_t
bytes_read
=
read
(
fd
,
buffer
,
buffer_size
-
1
);
if
(
bytes_read
==
-
1
)
{
close
(
fd
);
return
-
1
;
}
buffer
[
bytes_read
]
=
'\0'
;
// Null-terminate the buffer
close
(
fd
);
return
0
;
}
static
int
read_tcp_write_memory_limits
(
int
*
min_size
,
int
*
default_size
,
int
*
max_size
)
{
char
buffer
[
128
]
=
{
0
};
// Read TCP memory settings
if
(
read_file_content
(
TCP_WMEM_PATH
,
buffer
,
sizeof
(
buffer
))
==
-
1
)
return
-
1
;
// Parse the memory sizes from the file contents
if
(
sscanf
(
buffer
,
"%d %d %d"
,
min_size
,
default_size
,
max_size
)
!=
3
)
return
-
1
;
return
0
;
}
static
int
get_supported_congestion_controls
(
char
*
output
,
size_t
output_size
)
{
const
char
*
delim
=
" "
;
char
*
token
,
buffer
[
128
];
size_t
pos
=
0
;
// Read available congestion control algorithms
if
(
read_file_content
(
TCP_CONGESTION_CONTROL_PATH
,
buffer
,
sizeof
(
buffer
))
==
-
1
)
return
-
1
;
// Parse the supported algorithms and store them in the output buffer
token
=
strtok
(
buffer
,
delim
);
while
(
token
!=
NULL
)
{
if
(
strstr
(
token
,
"reno"
))
pos
+=
snprintf
(
&
output
[
pos
],
output_size
-
pos
,
"Reno,"
);
else
if
(
strstr
(
token
,
"cubic"
))
pos
+=
snprintf
(
&
output
[
pos
],
output_size
-
pos
,
"Cubic,"
);
else
if
(
strstr
(
token
,
"newreno"
))
pos
+=
snprintf
(
&
output
[
pos
],
output_size
-
pos
,
"New Reno,"
);
else
if
(
strstr
(
token
,
"vegas"
))
pos
+=
snprintf
(
&
output
[
pos
],
output_size
-
pos
,
"Vegas,"
);
else
if
(
strstr
(
token
,
"tahoe"
))
pos
+=
snprintf
(
&
output
[
pos
],
output_size
-
pos
,
"Tahoe,"
);
token
=
strtok
(
NULL
,
delim
);
}
// Remove the trailing comma, if any
if
(
pos
>
0
)
output
[
pos
-
1
]
=
'\0'
;
return
0
;
}
/*************************************************************
* GET & SET PARAM
**************************************************************/
static
int
get_DeviceInfoNetworkProperties_MaxTCPWindowSize
(
char
*
refparam
,
struct
dmctx
*
ctx
,
void
*
data
,
char
*
instance
,
char
**
value
)
{
int
min
=
0
,
def
=
0
,
max
=
0
;
int
res
=
read_tcp_write_memory_limits
(
&
min
,
&
def
,
&
max
);
dmasprintf
(
value
,
"%d"
,
!
res
?
max
:
0
);
return
0
;
}
static
int
get_DeviceInfoNetworkProperties_TCPImplementation
(
char
*
refparam
,
struct
dmctx
*
ctx
,
void
*
data
,
char
*
instance
,
char
**
value
)
{
char
list
[
256
]
=
{
0
};
int
res
=
get_supported_congestion_controls
(
list
,
sizeof
(
list
));
*
value
=
dmstrdup
(
!
res
?
list
:
""
);
return
0
;
}
/**********************************************************************************************************************************
* OBJ & LEAF DEFINITION
***********************************************************************************************************************************/
/* *** Device.DeviceInfo.NetworkProperties. *** */
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
},
{
0
}
};
This diff is collapsed.
Click to expand it.
src/network.h
0 → 100644
+
17
−
0
View file @
744def76
/*
* Copyright (C) 2024 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
*
*/
#ifndef __NETWORK_H
#define __NETWORK_H
extern
DMLEAF
tDeviceInfoNetworkPropertiesParams
[];
#endif //__NETWORK_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment