From 2c788565667c33d236c98eb1abd7dd14e832a700 Mon Sep 17 00:00:00 2001 From: xusaiqun Date: Wed, 26 Jun 2019 00:26:25 -0700 Subject: [PATCH] =?UTF-8?q?Mod=20aaa-12=20=E6=8F=8F=E8=BF=B0=EF=BC=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0pdeliv=E6=A8=A1=E5=9D=97=E7=9A=84=E5=8D=95?= =?UTF-8?q?=E6=92=AD=E6=8E=A5=E5=8F=A3=E7=BB=99trace=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E3=80=82=20RCA=EF=BC=9A=20SOL=EF=BC=9A=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=BA=EF=BC=9Axusaiqun=20=E6=A3=80=E8=A7=86=E4=BA=BA?= =?UTF-8?q?=EF=BC=9Axusaiqun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xusaiqun --- Platform/build/user.pdeliv.rcvtest.Makefile | 78 +++++++++++++++++++++ Platform/build/user.pdelivrcv.test.Makefile | 78 +++++++++++++++++++++ Platform/user/ceshi_pde/pdelivery_main.c | 6 +- Platform/user/netlink_uapi/libnetlinku.c | 13 ++-- Platform/user/netlink_uapi/libnetlinku.h | 4 +- Platform/user/pdeliv_u/pdelivery_main.c | 6 +- 6 files changed, 171 insertions(+), 14 deletions(-) create mode 100644 Platform/build/user.pdeliv.rcvtest.Makefile create mode 100644 Platform/build/user.pdelivrcv.test.Makefile diff --git a/Platform/build/user.pdeliv.rcvtest.Makefile b/Platform/build/user.pdeliv.rcvtest.Makefile new file mode 100644 index 000000000..eae31ead2 --- /dev/null +++ b/Platform/build/user.pdeliv.rcvtest.Makefile @@ -0,0 +1,78 @@ +# target name, the target name must have the same name of c source file +TARGET_NAME=pdeliv + +# target +# for linux module driver: KO +# for application: EXE +# for dynamic library: DLL +TARGET_TYPE = EXE + +# target object +# for application: APP +# for device driver: DRV +TARGET_OBJ = APP + +# custom install dir +TARGET_BOX = + +#debug mode or release mode +DEBUG = TRUE + +PLAT_LINUX ?= TRUE +PLAT_ARM64 ?= TRUE + +VPATH = ../user/pdeliv_u + +# source code + +# set the source file, don't used .o because of ... + +COMMON_SRCS = pdelivery_main.c + +# MRS Board Source Files +PLAT_LINUX_SRCS = $(COMMON_SRCS) +PLAT_ARM64_SRCS = $(COMMON_SRCS) + +# gcc CFLAGS +PLAT_ARM64_CFLAGS := -I../../Common -I../user/netlink_uapi +PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS) + + +PLAT_ARM64_LDFLAGS := +PLAT_LINUX_LDFLAGS := $(PLAT_ARM64_LDFLAGS) + +ARM64_LIBS := ./pdeliv-rcvtest-arm64.so +LINUX_LIBS := ./pdeliv-rcvtest-linux.so + + + +ifeq ($(PLAT_ARM64), TRUE) +DEPEND_LIB += ./debug/libnetlinku-arm64.so +USER_CLEAN_ITEMS += ./libnetlinku-arm64.so +endif + +ifeq ($(PLAT_LINUX), TRUE) +DEPEND_LIB += ./debug/libnetlinku-linux.so +USER_CLEAN_ITEMS += ./libnetlinku-linux.so +endif + + +# this line must be at below of thus, because of... +include ../../Common/common.Makefile + +ifneq ($(MAKECMDGOALS), clean) +ifneq ($(MAKECMDGOALS), cleanall) +ifneq ($(notdir $(DEPEND_LIB)), $(wildcard $(DEPEND_LIB))) +$(shell $(CP) $(DEPEND_LIB) ./) +endif +endif +endif + +ifeq ($(MAKECMDGOALS), ) +$(shell find ./ -name "$(TARGET)-*.ko" -delete) +else +ifeq ($(MAKECMDGOALS), all) +$(shell find ./ -name "$(TARGET)-*.ko" -delete) +endif +endif + diff --git a/Platform/build/user.pdelivrcv.test.Makefile b/Platform/build/user.pdelivrcv.test.Makefile new file mode 100644 index 000000000..eae31ead2 --- /dev/null +++ b/Platform/build/user.pdelivrcv.test.Makefile @@ -0,0 +1,78 @@ +# target name, the target name must have the same name of c source file +TARGET_NAME=pdeliv + +# target +# for linux module driver: KO +# for application: EXE +# for dynamic library: DLL +TARGET_TYPE = EXE + +# target object +# for application: APP +# for device driver: DRV +TARGET_OBJ = APP + +# custom install dir +TARGET_BOX = + +#debug mode or release mode +DEBUG = TRUE + +PLAT_LINUX ?= TRUE +PLAT_ARM64 ?= TRUE + +VPATH = ../user/pdeliv_u + +# source code + +# set the source file, don't used .o because of ... + +COMMON_SRCS = pdelivery_main.c + +# MRS Board Source Files +PLAT_LINUX_SRCS = $(COMMON_SRCS) +PLAT_ARM64_SRCS = $(COMMON_SRCS) + +# gcc CFLAGS +PLAT_ARM64_CFLAGS := -I../../Common -I../user/netlink_uapi +PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS) + + +PLAT_ARM64_LDFLAGS := +PLAT_LINUX_LDFLAGS := $(PLAT_ARM64_LDFLAGS) + +ARM64_LIBS := ./pdeliv-rcvtest-arm64.so +LINUX_LIBS := ./pdeliv-rcvtest-linux.so + + + +ifeq ($(PLAT_ARM64), TRUE) +DEPEND_LIB += ./debug/libnetlinku-arm64.so +USER_CLEAN_ITEMS += ./libnetlinku-arm64.so +endif + +ifeq ($(PLAT_LINUX), TRUE) +DEPEND_LIB += ./debug/libnetlinku-linux.so +USER_CLEAN_ITEMS += ./libnetlinku-linux.so +endif + + +# this line must be at below of thus, because of... +include ../../Common/common.Makefile + +ifneq ($(MAKECMDGOALS), clean) +ifneq ($(MAKECMDGOALS), cleanall) +ifneq ($(notdir $(DEPEND_LIB)), $(wildcard $(DEPEND_LIB))) +$(shell $(CP) $(DEPEND_LIB) ./) +endif +endif +endif + +ifeq ($(MAKECMDGOALS), ) +$(shell find ./ -name "$(TARGET)-*.ko" -delete) +else +ifeq ($(MAKECMDGOALS), all) +$(shell find ./ -name "$(TARGET)-*.ko" -delete) +endif +endif + diff --git a/Platform/user/ceshi_pde/pdelivery_main.c b/Platform/user/ceshi_pde/pdelivery_main.c index 34efe52d3..825b8f809 100644 --- a/Platform/user/ceshi_pde/pdelivery_main.c +++ b/Platform/user/ceshi_pde/pdelivery_main.c @@ -36,7 +36,7 @@ int set_user_policy() commnl_addattr_l(&req.n, sizeof(req), POLICYCONFA_SRCIP, debug, debug_len); /*发送组装好的netlink消息*/ - if (pdeliv_talk(1, &req.n, NULL) < 0) + if (pdeliv_talk(0, &req.n, NULL) < 0) { return -2; } @@ -63,7 +63,7 @@ int main( int argc, char **argv) printf("cfgchannel main begin:\r\n"); /*创建通道*/ - ret = pdelivnl_open(); + ret = pdelivnl_open(0); if(ret < 0) { printf("pdelivnl_open fail,exit.\r\n"); @@ -79,7 +79,7 @@ int main( int argc, char **argv) } /*关闭netlink通道*/ - pdelivnl_close(); + pdelivnl_close(0); printf("cfgchannel main exit!\r\n"); return 0; diff --git a/Platform/user/netlink_uapi/libnetlinku.c b/Platform/user/netlink_uapi/libnetlinku.c index 20a848072..ecd799896 100644 --- a/Platform/user/netlink_uapi/libnetlinku.c +++ b/Platform/user/netlink_uapi/libnetlinku.c @@ -293,14 +293,15 @@ void commcfgnl_close() return; } -int pdelivnl_open() +int pdelivnl_open(unsigned int group) { - return commnl_open_byproto(PDNLGRP_ALLRAW, NETLINK_PDELIVERY); + return commnl_open_byproto(group, NETLINK_PDELIVERY); } -void pdelivnl_close() + +void pdelivnl_close(unsigned int group) { - commnl_close(PDNLGRP_ALLRAW,NETLINK_PDELIVERY); + commnl_close(group,NETLINK_PDELIVERY); return; } @@ -769,7 +770,7 @@ int pdeliv_main(pdelivnl_listen_filter_t process_pkt) printf("pdeliv_main begin:\r\n"); /*创建通道*/ - ret = pdelivnl_open(); + ret = pdelivnl_open(PDNLGRP_ALLRAW); if(ret < 0) { printf("pdelivnl_open fail,exit.\r\n"); @@ -781,7 +782,7 @@ int pdeliv_main(pdelivnl_listen_filter_t process_pkt) /*关闭netlink通道*/ - pdelivnl_close(); + pdelivnl_close(PDNLGRP_ALLRAW); printf("pdeliv_main exit!\r\n"); return 0; diff --git a/Platform/user/netlink_uapi/libnetlinku.h b/Platform/user/netlink_uapi/libnetlinku.h index c76060b8c..d60784667 100644 --- a/Platform/user/netlink_uapi/libnetlinku.h +++ b/Platform/user/netlink_uapi/libnetlinku.h @@ -114,8 +114,8 @@ void commcfgnl_close(); /*输出参数: struct upmnl_handle * upmh ,存放创建的通道相关信息。*/ /*返回值:0通道创建成果;< 0,失败 */ /****************************************************************/ -int pdelivnl_open(); -void pdelivnl_close(); +int pdelivnl_open(unsigned int group); +void pdelivnl_close(unsigned int group); //int upnl_dump_type(struct upmnl_handle *upmh, unsigned int type); diff --git a/Platform/user/pdeliv_u/pdelivery_main.c b/Platform/user/pdeliv_u/pdelivery_main.c index a0ba35f85..e5d6dfa7f 100644 --- a/Platform/user/pdeliv_u/pdelivery_main.c +++ b/Platform/user/pdeliv_u/pdelivery_main.c @@ -51,7 +51,7 @@ int set_pdeliv_debug_waitack(unsigned char * msgtype) commnl_addattr_l(&req.n, sizeof(req), NLDEBUG_MSG_TYPE, msgtype, debug_len); /*发送组装好的netlink消息*/ - if (pdeliv_talk(1, &req.n, answer) < 0) + if (pdeliv_talk(0, &req.n, answer) < 0) { printf("set_user_policy_waitack rcv ack msg faild.\r\n"); return -2; @@ -110,7 +110,7 @@ int main( int argc, char **argv) } /*创建通道*/ - ret = pdelivnl_open(); + ret = pdelivnl_open(0); if(ret < 0) { printf("pdelivnl_open fail,exit.\r\n"); @@ -126,7 +126,7 @@ int main( int argc, char **argv) } /*关闭netlink通道*/ - pdelivnl_close(); + pdelivnl_close(0); printf("cfgchannel main exit!\r\n"); return 0;