urlfilter: Use DotSO dm plugin in place of json

This commit is contained in:
Suvendhu Hansa 2024-11-22 20:14:45 +05:30 committed by Vivek Kumar Dutta
parent 4312fa6a16
commit a2522dfff0
2 changed files with 7 additions and 743 deletions

View file

@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=urlfilter
PKG_VERSION:=3.0.1
PKG_VERSION:=3.0.2
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/urlfilter.git
PKG_SOURCE_VERSION:=c11f0f5bc0f73545cbc791e03b4db3b98a6b2b23
PKG_SOURCE_VERSION:=4361d2f615499c71181d839d780f7305f91a7b70
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@ -26,7 +26,8 @@ define Package/urlfilter
SECTION:=utils
CATEGORY:=Utilities
TITLE:=URL filter
DEPENDS:=+libuci +libnetfilter-queue +libnfnetlink +iptables-mod-nfqueue +libpthread +libubox +ubus +conntrack +libbbfdm-api +libcurl +cmph
DEPENDS:=+libuci +libnetfilter-queue +libnfnetlink +iptables-mod-nfqueue +libpthread +libubox +ubus +conntrack +libcurl +cmph
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
endef
define Package/urlfilter/description
@ -38,7 +39,8 @@ define Package/$(PKG_NAME)/config
endef
TARGET_CFLAGS += \
-D_GNU_SOURCE
-D_GNU_SOURCE\
-DBBF_VENDOR_PREFIX=\\\"$(CONFIG_BBF_VENDOR_PREFIX)\\\"
TARGET_LDFLAGS += \
-lcmph
@ -72,10 +74,9 @@ define Package/urlfilter/install
ifeq ($(CONFIG_URLFILTER_INCLUDE_BUNDLES),y)
$(INSTALL_DIR) $(1)/etc/urlfilter
$(INSTALL_DATA) ./files/etc/urlfilter/urlbundles.tar.xz $(1)/etc/urlfilter/
else
endif
$(BBFDM_INSTALL_CORE_PLUGIN) ./files/etc/urlfilter/X_IOPSYS_EU_ParentalControl.json $(1)
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/libparentalcontrol.so $(1) $(PKG_NAME)
endef
$(eval $(call BuildPackage,urlfilter))

View file

@ -1,737 +0,0 @@
{
"json_plugin_version": 2,
"Device.{BBF_VENDOR_PREFIX}ParentalControl.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"description": "This object contains the information about all parental control features.",
"array": false,
"Enable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"description": "Enable or disable ParentalControl on the CPE.",
"mapping": [
{
"type" : "uci",
"uci" : {
"file" : "parentalcontrol",
"section" : {
"type": "globals",
"name": "globals"
},
"option" : {
"name" : "enable"
}
}
}
]
},
"DefaultBundles": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"description": "Comma separated list of default bundles",
"list": {
"datatype": "string"
},
"mapping": [
{
"type" : "ubus",
"ubus" : {
"object" : "urlfilter",
"method" : "default_bundles",
"args" : {},
"key" : "default_bundles"
}
}
]
},
"ProfileNumberOfEntries": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"description": "<<numentries>>",
"mapping": [
{
"type": "uci",
"uci": {
"file": "parentalcontrol",
"section": {
"type": "profile"
},
"option": {
"name": "@Count"
}
}
}
]
},
"URLBundleNumberOfEntries": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"description": "<<numentries>>",
"mapping": [
{
"type": "uci",
"uci": {
"file": "parentalcontrol",
"section": {
"type": "urlbundle"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.{BBF_VENDOR_PREFIX}ParentalControl.URLBundle.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "parentalcontrol",
"section": {
"type": "urlbundle"
},
"dmmapfile": "dmmap_parentalcontrol"
}
}
],
"Name": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"description": "Uniquely identifiable name of the URL bundle instance.",
"datatype": "string",
"range": [
{
"max": 32
}
],
"flags": [
"Unique",
"Linker"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "name"
}
]
},
"DownloadURL": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "download_url"
}
]
},
"CustomURL": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"description": "Comma separated list of URLs.",
"list": {
"datatype": "string"
},
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"list": "custom_url"
}
]
}
},
"Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"description": "Table contain details of the access profiles.",
"uniqueKeys": [
"Name"
],
"access": true,
"array": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "parentalcontrol",
"section": {
"type": "profile"
},
"dmmapfile": "dmmap_parentalcontrol"
}
}
],
"Alias": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "Alias",
"range": [
{
"max": 64
}
],
"flags": [
"unique"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "alias"
}
]
},
"Name": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 64
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "name"
}
]
},
"IconName": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 32
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "icon_name"
}
]
},
"HostList": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"description": "Comma separated list of hostnames or MAC addresses.",
"list": {
"datatype": "string"
},
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"list": "host"
}
]
},
"URLFilterNumberOfEntries": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"description": "<<numentries>>",
"mapping": [
{
"type": "uci",
"uci": {
"file": "parentalcontrol",
"section": {
"type": "profile_urlfilter"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.URLFilter.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "parentalcontrol",
"section": {
"type": "profile_urlfilter"
},
"dmmapfile": "dmmap_parentalcontrol"
}
}
],
"Enable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"description": "Enable or disable this filter instance on the CPE.",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "enable"
}
]
},
"AccessPolicy": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"default": "Deny",
"enumerations": [
"Allow",
"Deny"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "access"
}
]
},
"Order": {
"type": "unsignedInt",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"description": "Priority order of applying the policy",
"datatype": "unsignedInt",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "order"
}
]
},
"FilterText": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"description": "Comma separated list of URL or sub-part of the URL used for filter",
"list": {
"datatype": "string"
},
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"list": "filter_text"
}
]
},
"URLBundleRef": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"flags": [
"Reference"
],
"list": {
"datatype": "string"
},
"description": "Comma separated list of references to URLBundle objects",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"list": "profile_urlbundle",
"linker_obj": "Device.{BBF_VENDOR_PREFIX}ParentalControl.URLBundle.*.Name"
}
]
},
"ScheduleRef": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"flags": [
"Reference"
],
"list": {
"datatype": "string"
},
"description": "Comma separated list of references to the Schedules objects",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"list": "profile_urlfilter_schedule",
"linker_obj": "Device.Schedules.Schedule.[Alias==@list]"
}
]
}
},
"Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.BedTime.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"Enable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "bedtime_enable"
}
]
},
"ScheduleNumberOfEntries": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"type": "uci",
"uci": {
"file": "parentalcontrol",
"section": {
"type": "profile_bedtime_schedule"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.BedTime.Schedule.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "parentalcontrol",
"section": {
"type": "profile_bedtime_schedule"
},
"dmmapfile": "dmmap_parentalcontrol"
}
}
],
"Enable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "enable"
}
]
},
"Alias": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "Alias",
"range": [
{
"max": 64
}
],
"flags": [
"unique"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "alias"
}
]
},
"Name": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"description": "Name of this schedule instance.",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "name"
}
]
},
"Days": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string",
"enumerations": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
]
},
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"list": "day"
}
]
},
"StartTime": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 5
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "start_time"
}
]
},
"EndTime": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 5
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "end_time"
}
]
}
}
},
"Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.InternetBreak.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"Enable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "internet_break_enable"
}
]
},
"ScheduleRef": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"flags": [
"Reference"
],
"list": {
"datatype": "string"
},
"description": "Comma separated list of references to the Schedules object",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"list": "internet_break_schedule",
"linker_obj": "Device.Schedules.Schedule.[Alias==@list]"
}
]
}
}
}
}
}