Merge branch 'porttrigger_bbf_plugin' into 'devel'

Draft: porttrigger: added bbf plugin for porttrigger

See merge request feed/iopsys!888
This commit is contained in:
Amit Kumar 2025-12-06 02:04:50 +00:00 committed by IOPSYS Dev
commit cf121cda3c
No known key found for this signature in database
7 changed files with 1353 additions and 0 deletions

54
porttrigger/Makefile Normal file
View file

@ -0,0 +1,54 @@
#
# Copyright (C) 2021-2023 IOPSYS Software Solutions AB
#
include $(TOPDIR)/rules.mk
PKG_NAME:=porttrigger
PKG_VERSION:=1.0.0
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
LOCAL_DEV:=1
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/porttrigger.git
PKG_SOURCE_VERSION:=
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
include ../bbfdm/bbfdm.mk
define Package/porttrigger
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Port Trigger Daemon
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api
endef
define Package/porttrigger/description
Manage port trigger
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) -rf ./porttrigger/* $(PKG_BUILD_DIR)/
endef
endif
define Package/porttrigger/install
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/porttrigger $(1)/etc/init.d/
$(INSTALL_DATA) ./files/etc/config/porttrigger $(1)/etc/config/
$(call BbfdmInstallPlugin,$(1),$(PKG_BUILD_DIR)/bbf_plugin/libporttrigger.so)
endef
$(eval $(call BuildPackage,porttrigger))

View file

@ -0,0 +1 @@
#port trigger uci file

View file

View file

@ -0,0 +1,19 @@
CC=gcc
PLUGIN = bbf_plugin
PROG_CFLAGS = $(CFLAGS) -Wall -Werror -fstrict-aliasing
PROG_LDFLAGS = $(LDFLAGS)
PROG_LIBS += -luci -ljson-c -lblobmsg_json
%.o: %.c
(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $<
.PHONY: all clean
all:
$(MAKE) -C ./bbf_plugin
clean:
rm -rf *.o *.so

View file

@ -0,0 +1,21 @@
LIB_PORTTRIGGER := libporttrigger.so
OBJS := bbf_plugin_nat.o
LIB_CFLAGS = $(CFLAGS) -Wall -Werror -fstrict-aliasing
LIB_LDFLAGS = $(LDFLAGS)
FPIC := -fPIC
.PHONY: all
%.o: %.c
$(CC) $(LIB_CFLAGS) $(FPIC) -c -o $@ $<
all: $(LIB_PORTTRIGGER)
$(LIB_PORTTRIGGER): $(OBJS)
$(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^
clean:
rm -f *.o $(LIB_PORTTRIGGER)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,24 @@
/*
* 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: Imen BHIRI <imen.bhiri@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __NAT_H
#define __NAT_H
#include "libbbfdm-api/dmcommon.h"
extern DMOBJ tDeviceNATPortTriggerObj[];
extern DMLEAF tDeviceNATPortTriggerParams[];
extern DMOBJ tNATPortTriggerObj[];
extern DMLEAF tNATPortTriggerParams[];
extern DMLEAF tNATPortTriggerRuleParams[];
#endif