From 49d9497d1880cb35c4869b3edd70a12a505b706b Mon Sep 17 00:00:00 2001
From: Suvendhu Hansa <suvendhu.hansa@iopsys.eu>
Date: Mon, 24 Feb 2025 18:11:19 +0530
Subject: [PATCH] Move Device.GatewayInfo to gateway-info package

---
 libbbfdm/device.c      |  2 --
 libbbfdm/gatewayinfo.c | 60 ------------------------------------------
 libbbfdm/gatewayinfo.h | 20 --------------
 3 files changed, 82 deletions(-)
 delete mode 100644 libbbfdm/gatewayinfo.c
 delete mode 100644 libbbfdm/gatewayinfo.h

diff --git a/libbbfdm/device.c b/libbbfdm/device.c
index dcb980f3a..7fe1f5908 100644
--- a/libbbfdm/device.c
+++ b/libbbfdm/device.c
@@ -13,7 +13,6 @@
 #include "device.h"
 #include "lanconfigsecurity.h"
 #include "security.h"
-#include "gatewayinfo.h"
 #include "schedules.h"
 
 /*************************************************************
@@ -95,7 +94,6 @@ DMOBJ tDMRootObj[] = {
 {"LANConfigSecurity", &DMREAD, NULL, NULL, "file:/etc/config/users", NULL, NULL, NULL, NULL, tLANConfigSecurityParams, NULL, BBFDM_BOTH},
 {"Schedules", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tSchedulesObj, tSchedulesParams, NULL, BBFDM_BOTH},
 {"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tSecurityObj, tSecurityParams, NULL, BBFDM_CWMP},
-{"GatewayInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tGatewayInfoParams, NULL, BBFDM_CWMP},
 {0}
 };
 
diff --git a/libbbfdm/gatewayinfo.c b/libbbfdm/gatewayinfo.c
deleted file mode 100644
index f6d004656..000000000
--- a/libbbfdm/gatewayinfo.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2022 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: Suvendhu Hansa <suvendhu.hansa@iopsys.eu>
- */
-
-#include "gatewayinfo.h"
-
-static int get_manufacturer_oui(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
-{
-	dmuci_get_option_value_string_varstate("icwmp", "gatewayinfo", "oui", value);
-	if (*value[0] == '\0') {
-		dmuci_get_option_value_string("cwmp", "cpe", "manufacturer_oui", value);
-		if (*value[0] == '\0')
-			db_get_value_string("device", "deviceinfo", "ManufacturerOUI", value);
-	}
-
-	return 0;
-}
-
-static int get_product_class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
-{
-	dmuci_get_option_value_string_varstate("icwmp", "gatewayinfo", "class", value);
-	if (*value[0] == '\0') {
-		dmuci_get_option_value_string("cwmp", "cpe", "product_class", value);
-		if (*value[0] == '\0')
-			db_get_value_string("device", "deviceinfo", "ProductClass", value);
-	}
-
-	return 0;
-}
-
-static int get_serial_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
-{
-	dmuci_get_option_value_string_varstate("icwmp", "gatewayinfo", "serial", value);
-	if (*value[0] == '\0') {
-		dmuci_get_option_value_string("cwmp", "cpe", "serial_number", value);
-		if (*value[0] == '\0')
-			db_get_value_string("device", "deviceinfo", "SerialNumber", value);
-	}
-
-	return 0;
-}
-
-/**********************************************************************************************************************************
-*                                            OBJ & PARAM DEFINITION
-***********************************************************************************************************************************/
-/* *** Device.GatewayInfo. *** */
-DMLEAF tGatewayInfoParams[] = {
-/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
-{"ManufacturerOUI", &DMREAD, DMT_STRING, get_manufacturer_oui, NULL, BBFDM_CWMP},
-{"ProductClass", &DMREAD, DMT_STRING, get_product_class, NULL, BBFDM_CWMP},
-{"SerialNumber", &DMREAD, DMT_STRING, get_serial_number, NULL, BBFDM_CWMP},
-{0}
-};
-
diff --git a/libbbfdm/gatewayinfo.h b/libbbfdm/gatewayinfo.h
deleted file mode 100644
index 6e7b5d71a..000000000
--- a/libbbfdm/gatewayinfo.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2022 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 Suvendhu Hansa <suvendhu.hansa@iopsys.eu>
- *
- */
-
-#ifndef __GATEWAYINFO_H
-#define __GATEWAYINFO_H
-
-#include "libbbfdm-api/legacy/dmcommon.h"
-
-extern DMLEAF tGatewayInfoParams[];
-
-#endif
-
-- 
GitLab