Move Device.Bridging. to bridgemngr

This commit is contained in:
Amin Ben Romdhane 2024-05-03 14:52:04 +02:00
parent 058778371d
commit 90f58787c5
9 changed files with 28 additions and 2944 deletions

View file

@ -110,5 +110,6 @@ All supported tools are presented in this file[BBFDM Tools](./tools/README.md)
| Device.QoS. | qosmngr | https://dev.iopsys.eu/hal/qosmngr.git |
| Device.SSH. | sshmngr | https://dev.iopsys.eu/network/sshmngr.git |
| Device.USB. | usbmngr | https://dev.iopsys.eu/system/usbmngr.git |
| Device.Bridging. | bridgemngr | https://dev.iopsys.eu/network/bridgemngr.git |
| Device.X_IOPSYS_EU_IGMP. | mcastmngr | https://dev.iopsys.eu/hal/mcastmngr.git |
| Device.X_IOPSYS_EU_MLD. | mcastmngr | https://dev.iopsys.eu/hal/mcastmngr.git |

View file

@ -876,16 +876,20 @@ char *get_value_by_reference(struct dmctx *ctx, char *value)
char *pch = NULL, *spch = NULL, *val = NULL;
char buf[MAX_DM_PATH * 4] = {0};
char buf_val[MAX_DM_PATH * 4] = {0};
bool path_resolved = false;
bool is_list = false;
int pos = 0;
if (DM_STRLEN(value) == 0 || !DM_LSTRSTR(value, "=="))
return value;
DM_STRNCPY(buf, value, sizeof(buf));
if (DM_STRCHR(buf, '&'))
is_list = true;
buf_val[0] = 0;
for (pch = strtok_r(buf, ",", &spch); pch; pch = strtok_r(NULL, ",", &spch)) {
for (pch = strtok_r(buf, is_list ? "&" : ",", &spch); pch; pch = strtok_r(NULL, is_list ? "&" : ",", &spch)) {
char path[MAX_DM_PATH] = {0};
char key_name[256], key_value[256];
regmatch_t pmatch[2];
@ -916,13 +920,15 @@ char *get_value_by_reference(struct dmctx *ctx, char *value)
adm_entry_get_reference_param(ctx, path, key_value, &val);
if (DM_STRLEN(val)) {
path_resolved = true;
snprintf(buf_val, sizeof(buf_val), "%s", val);
break;
pos += snprintf(&buf_val[pos], sizeof(buf_val) - pos, "%s,", val);
if (!is_list) // Requested value is not list
break;
}
}
if (path_resolved) {
if (DM_STRLEN(buf_val)) {
buf_val[pos - 1] = 0;
return dmstrdup(buf_val);
}

File diff suppressed because it is too large Load diff

View file

@ -1,40 +0,0 @@
/*
* Copyright (C) 2019 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: Anis Ellouze <anis.ellouze@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __BRIDGING_H
#define __BRIDGING_H
#include "libbbfdm-api/dmcommon.h"
struct bridge_port_args
{
struct uci_section *bridge_sec;
struct uci_section *bridge_dmmap_sec;
struct uci_section *bridge_port_sec;
struct uci_section *bridge_port_dmmap_sec;
bool is_management_port;
char *br_inst;
};
extern DMOBJ tBridgingObj[];
extern DMLEAF tBridgingParams[];
extern DMOBJ tBridgingBridgeObj[];
extern DMLEAF tBridgingBridgeParams[];
extern DMLEAF tBridgingBridgeSTPParams[];
extern DMLEAF tBridgingBridgeVLANParams[];
extern DMLEAF tBridgingBridgePortParams[];
extern DMLEAF tBridgingBridgeVLANPortParams[];
extern DMOBJ tBridgingBridgePortObj[];
extern DMLEAF tBridgingBridgePortStatsParams[];
extern DMLEAF tBridgingProviderBridgeParams[];
#endif

View file

@ -14,7 +14,6 @@
#include "deviceinfo.h"
#include "upnp.h"
#include "ip.h"
#include "bridging.h"
#include "wifi.h"
#include "nat.h"
#include "ppp.h"
@ -80,7 +79,6 @@ DMOBJ tDeviceObj[] = {
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoObj, tDeviceInfoParams, NULL, BBFDM_BOTH, NULL},
{"UPnP", &DMREAD, NULL, NULL, "file:/etc/init.d/ssdpd", NULL, NULL, NULL, tUPnPObj, NULL, NULL, BBFDM_BOTH, NULL},
{"WiFi", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiObj, tWiFiParams, NULL, BBFDM_BOTH, NULL},
{"Bridging", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tBridgingObj, tBridgingParams, NULL, BBFDM_BOTH, NULL},
{"IP", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tIPObj, tIPParams, NULL, BBFDM_BOTH, NULL},
{"NAT", &DMREAD, NULL, NULL, "file:/etc/config/firewall", NULL, NULL, NULL, tNATObj, tNATParams, NULL, BBFDM_BOTH, NULL},
{"PPP", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/ppp.sh,/etc/config/network", NULL, NULL, NULL, tPPPObj, tPPPParams, NULL, BBFDM_BOTH, NULL},

View file

@ -1,59 +0,0 @@
/*
* Copyright (C) 2021 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 Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#include "dmlayer.h"
#include "bridging.h"
struct bridge_port_args
{
struct uci_section *bridge_sec;
struct uci_section *bridge_dmmap_sec;
struct uci_section *bridge_port_sec;
struct uci_section *bridge_port_dmmap_sec;
bool is_management_port;
char *br_inst;
};
static int get_BridgingBridgePort_Egress_PriorityRegeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
bridging___get_priority_list(((struct bridge_port_args *)data)->bridge_port_sec, "egress_qos_mapping", data, value);
return 0;
}
static int set_BridgingBridgePort_Egress_PriorityRegeneration(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *type = NULL;
switch (action) {
case VALUECHECK:
if (bbfdm_validate_unsignedInt_list(ctx, value, 8, 8, -1, RANGE_ARGS{{"0","7"}}, 1))
return FAULT_9007;
dmuci_get_value_by_section_string(((struct bridge_port_args *)data)->bridge_port_sec, "type", &type);
if (((struct bridge_port_args *)data)->is_management_port || DM_STRLEN(type) == 0)
return FAULT_9007;
return 0;
case VALUESET:
bridging___set_priority_list(((struct bridge_port_args *)data)->bridge_port_sec, "egress_qos_mapping", data, value);
return 0;
}
return 0;
}
/**********************************************************************************************************************************
* OBJ & PARAM DEFINITION
***********************************************************************************************************************************/
DMLEAF tIOPSYS_BridgingBridgePortParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
{BBF_VENDOR_PREFIX"EgressPriorityRegeneration", &DMWRITE, DMT_STRING, get_BridgingBridgePort_Egress_PriorityRegeneration, set_BridgingBridgePort_Egress_PriorityRegeneration, BBFDM_BOTH},
{0}
};

View file

@ -1,19 +0,0 @@
/*
* Copyright (C) 2021 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 Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __IOPSYS_BRIDGING_H
#define __IOPSYS_BRIDGING_H
#include "libbbfdm-api/dmcommon.h"
extern DMLEAF tIOPSYS_BridgingBridgePortParams[];
#endif //__IOPSYS_BRIDGING_H

View file

@ -11,7 +11,6 @@
#include "device.h"
#include "deviceinfo.h"
#include "bridging.h"
#include "ip.h"
#include "wifi.h"
#include "extension.h"
@ -19,7 +18,6 @@
DM_MAP_OBJ tDynamicObj[] = {
/* parentobj, nextobject, parameter */
{"Device.DeviceInfo.", NULL, tIOPSYS_DeviceInfoParams},
{"Device.Bridging.Bridge.{i}.Port.{i}.", NULL, tIOPSYS_BridgingBridgePortParams},
{"Device.WiFi.AccessPoint.{i}.", NULL, tIOPSYS_WiFiAccessPointParams},
{0}
};

View file

@ -92,7 +92,7 @@
"proto": "git",
"version": "devel",
"extra_dependencies": [
"-lcrypt"
"-lcrypt"
],
"dm_files": [
"src/users.c"
@ -136,8 +136,8 @@
"version": "devel",
"dm_files": [
"src/dhcpmngr.c",
"src/dhcpv4.c",
"src/dhcpv6.c"
"src/dhcpv4.c",
"src/dhcpv6.c"
]
},
{
@ -200,21 +200,15 @@
"repo": "https://dev.iopsys.eu/hal/dslmngr.git",
"proto": "git",
"dm_files": [
"bbf_plugin/dsl.c",
"bbf_plugin/fast.c",
"bbf_plugin/atm.c",
"bbf_plugin/ptm.c",
"bbf_plugin/plugin.c"
]
"bbf_plugin/*.c"
]
},
{
"repo": "https://dev.iopsys.eu/hal/ethmngr.git",
"proto": "git",
"version": "devel",
"dm_files": [
"bbf_plugin/ethernet.c",
"bbf_plugin/vendor_ethernet.c",
"bbf_plugin/dmlayer.c"
"bbf_plugin/*.c"
]
},
{
@ -224,6 +218,14 @@
"dm_files": [
"src/datamodel.c"
]
},
{
"repo": "https://dev.iopsys.eu/network/bridgemngr.git",
"proto": "git",
"version": "devel",
"dm_files": [
"src/*.c"
]
}
],
"output": {
@ -238,4 +240,4 @@
"output_dir": "./out",
"output_file_prefix": "datamodel"
}
}
}