diff options
| author | zhangyang <[email protected]> | 2024-04-25 05:42:45 -0400 |
|---|---|---|
| committer | zhangyang <[email protected]> | 2024-04-25 05:42:45 -0400 |
| commit | a9cf7f20462f2977df9ab0bb48118546e94bdbcb (patch) | |
| tree | 5b8ceb4c51a1debfcb466e40a866d99e8c77b6c3 | |
| parent | ca1516c28b2f8440d1eab0e11df9b2b302ab95d8 (diff) | |
demo4
25 files changed, 325 insertions, 399 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fabd04..3597114 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,4 +11,5 @@ link_libraries(maatframe fieldstat4) add_subdirectory(demo1) add_subdirectory(demo2) add_subdirectory(demo3) +add_subdirectory(demo4) add_subdirectory(matt)
\ No newline at end of file diff --git a/build/.cmake/api/v1/reply/codemodel-v2-9d3a2fccc1a385b84bbc.json b/build/.cmake/api/v1/reply/codemodel-v2-9d3a2fccc1a385b84bbc.json deleted file mode 100644 index 60c05d8..0000000 --- a/build/.cmake/api/v1/reply/codemodel-v2-9d3a2fccc1a385b84bbc.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "configurations" : - [ - { - "directories" : - [ - { - "build" : ".", - "childIndexes" : - [ - 1, - 2, - 3, - 4 - ], - "jsonFile" : "directory-.-Debug-f5ebdc15457944623624.json", - "minimumCMakeVersion" : - { - "string" : "3.10" - }, - "projectIndex" : 0, - "source" : "." - }, - { - "build" : "demo1", - "jsonFile" : "directory-demo1-Debug-afc0378f5fc55573f7ad.json", - "minimumCMakeVersion" : - { - "string" : "3.10" - }, - "parentIndex" : 0, - "projectIndex" : 1, - "source" : "demo1", - "targetIndexes" : - [ - 0 - ] - }, - { - "build" : "demo2", - "jsonFile" : "directory-demo2-Debug-02366f60116917dfeb97.json", - "minimumCMakeVersion" : - { - "string" : "3.10" - }, - "parentIndex" : 0, - "projectIndex" : 2, - "source" : "demo2", - "targetIndexes" : - [ - 1 - ] - }, - { - "build" : "demo3", - "jsonFile" : "directory-demo3-Debug-540b1811c94ea9bbdced.json", - "minimumCMakeVersion" : - { - "string" : "3.10" - }, - "parentIndex" : 0, - "projectIndex" : 3, - "source" : "demo3", - "targetIndexes" : - [ - 2 - ] - }, - { - "build" : "matt", - "jsonFile" : "directory-matt-Debug-deb8920de8562baf6e09.json", - "minimumCMakeVersion" : - { - "string" : "3.10" - }, - "parentIndex" : 0, - "projectIndex" : 4, - "source" : "matt", - "targetIndexes" : - [ - 3 - ] - } - ], - "name" : "Debug", - "projects" : - [ - { - "childIndexes" : - [ - 1, - 2, - 3, - 4 - ], - "directoryIndexes" : - [ - 0 - ], - "name" : "MyProject" - }, - { - "directoryIndexes" : - [ - 1 - ], - "name" : "Demo1", - "parentIndex" : 0, - "targetIndexes" : - [ - 0 - ] - }, - { - "directoryIndexes" : - [ - 2 - ], - "name" : "Demo2", - "parentIndex" : 0, - "targetIndexes" : - [ - 1 - ] - }, - { - "directoryIndexes" : - [ - 3 - ], - "name" : "demo3", - "parentIndex" : 0, - "targetIndexes" : - [ - 2 - ] - }, - { - "directoryIndexes" : - [ - 4 - ], - "name" : "maat", - "parentIndex" : 0, - "targetIndexes" : - [ - 3 - ] - } - ], - "targets" : - [ - { - "directoryIndex" : 1, - "id" : "Demo1::@2e4d1c325edd2030c738", - "jsonFile" : "target-Demo1-Debug-7cc44388b56620017ca8.json", - "name" : "Demo1", - "projectIndex" : 1 - }, - { - "directoryIndex" : 2, - "id" : "Demo2::@b55165302732da4498f2", - "jsonFile" : "target-Demo2-Debug-e217036f4a8d6fd35795.json", - "name" : "Demo2", - "projectIndex" : 2 - }, - { - "directoryIndex" : 3, - "id" : "demo3::@2b2278b4a1923d310ae0", - "jsonFile" : "target-demo3-Debug-198b208f2d3e702111a1.json", - "name" : "demo3", - "projectIndex" : 3 - }, - { - "directoryIndex" : 4, - "id" : "maat::@df8a535218c4af5b545b", - "jsonFile" : "target-maat-Debug-2174f4a39137783d9bdc.json", - "name" : "maat", - "projectIndex" : 4 - } - ] - } - ], - "kind" : "codemodel", - "paths" : - { - "build" : "/root/Git/demo/build", - "source" : "/root/Git/demo" - }, - "version" : - { - "major" : 2, - "minor" : 5 - } -} diff --git a/build/CMakeCache.txt b/build/CMakeCache.txt index c3ec1fe..521dd81 100644 --- a/build/CMakeCache.txt +++ b/build/CMakeCache.txt @@ -230,6 +230,15 @@ Demo2_IS_TOP_LEVEL:STATIC=OFF Demo2_SOURCE_DIR:STATIC=/root/Git/demo/demo2 //Value Computed by CMake +Demo4_BINARY_DIR:STATIC=/root/Git/demo/build/demo4 + +//Value Computed by CMake +Demo4_IS_TOP_LEVEL:STATIC=OFF + +//Value Computed by CMake +Demo4_SOURCE_DIR:STATIC=/root/Git/demo/demo4 + +//Value Computed by CMake MyProject_BINARY_DIR:STATIC=/root/Git/demo/build //Value Computed by CMake @@ -361,7 +370,7 @@ CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 //ADVANCED property for variable: CMAKE_NM CMAKE_NM-ADVANCED:INTERNAL=1 //number of local generators -CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=5 +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=6 //ADVANCED property for variable: CMAKE_OBJCOPY CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 //ADVANCED property for variable: CMAKE_OBJDUMP diff --git a/build/CMakeFiles/Makefile.cmake b/build/CMakeFiles/Makefile.cmake index f34cbff..3db10eb 100644 --- a/build/CMakeFiles/Makefile.cmake +++ b/build/CMakeFiles/Makefile.cmake @@ -14,6 +14,7 @@ set(CMAKE_MAKEFILE_DEPENDS "/root/Git/demo/demo1/CMakeLists.txt" "/root/Git/demo/demo2/CMakeLists.txt" "/root/Git/demo/demo3/CMakeLists.txt" + "/root/Git/demo/demo4/CMakeLists.txt" "/root/Git/demo/matt/CMakeLists.txt" "/usr/share/cmake/Modules/CMakeCInformation.cmake" "/usr/share/cmake/Modules/CMakeCXXInformation.cmake" @@ -46,6 +47,7 @@ set(CMAKE_MAKEFILE_PRODUCTS "demo1/CMakeFiles/CMakeDirectoryInformation.cmake" "demo2/CMakeFiles/CMakeDirectoryInformation.cmake" "demo3/CMakeFiles/CMakeDirectoryInformation.cmake" + "demo4/CMakeFiles/CMakeDirectoryInformation.cmake" "matt/CMakeFiles/CMakeDirectoryInformation.cmake" ) @@ -54,5 +56,6 @@ set(CMAKE_DEPEND_INFO_FILES "demo1/CMakeFiles/Demo1.dir/DependInfo.cmake" "demo2/CMakeFiles/Demo2.dir/DependInfo.cmake" "demo3/CMakeFiles/demo3.dir/DependInfo.cmake" + "demo4/CMakeFiles/Demo4.dir/DependInfo.cmake" "matt/CMakeFiles/maat.dir/DependInfo.cmake" ) diff --git a/build/CMakeFiles/Makefile2 b/build/CMakeFiles/Makefile2 index 5f4ea3f..3cdf09e 100644 --- a/build/CMakeFiles/Makefile2 +++ b/build/CMakeFiles/Makefile2 @@ -66,6 +66,7 @@ CMAKE_BINARY_DIR = /root/Git/demo/build all: demo1/all all: demo2/all all: demo3/all +all: demo4/all all: matt/all .PHONY : all @@ -73,6 +74,7 @@ all: matt/all preinstall: demo1/preinstall preinstall: demo2/preinstall preinstall: demo3/preinstall +preinstall: demo4/preinstall preinstall: matt/preinstall .PHONY : preinstall @@ -80,6 +82,7 @@ preinstall: matt/preinstall clean: demo1/clean clean: demo2/clean clean: demo3/clean +clean: demo4/clean clean: matt/clean .PHONY : clean @@ -129,6 +132,21 @@ demo3/clean: demo3/CMakeFiles/demo3.dir/clean .PHONY : demo3/clean #============================================================================= +# Directory level rules for directory demo4 + +# Recursive "all" directory target. +demo4/all: demo4/CMakeFiles/Demo4.dir/all +.PHONY : demo4/all + +# Recursive "preinstall" directory target. +demo4/preinstall: +.PHONY : demo4/preinstall + +# Recursive "clean" directory target. +demo4/clean: demo4/CMakeFiles/Demo4.dir/clean +.PHONY : demo4/clean + +#============================================================================= # Directory level rules for directory matt # Recursive "all" directory target. @@ -202,7 +220,7 @@ demo2/CMakeFiles/Demo2.dir/clean: demo3/CMakeFiles/demo3.dir/all: $(MAKE) $(MAKESILENT) -f demo3/CMakeFiles/demo3.dir/build.make demo3/CMakeFiles/demo3.dir/depend $(MAKE) $(MAKESILENT) -f demo3/CMakeFiles/demo3.dir/build.make demo3/CMakeFiles/demo3.dir/build - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/root/Git/demo/build/CMakeFiles --progress-num=5,6 "Built target demo3" + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/root/Git/demo/build/CMakeFiles --progress-num=7,8 "Built target demo3" .PHONY : demo3/CMakeFiles/demo3.dir/all # Build rule for subdir invocation for target. @@ -222,13 +240,39 @@ demo3/CMakeFiles/demo3.dir/clean: .PHONY : demo3/CMakeFiles/demo3.dir/clean #============================================================================= +# Target rules for target demo4/CMakeFiles/Demo4.dir + +# All Build rule for target. +demo4/CMakeFiles/Demo4.dir/all: + $(MAKE) $(MAKESILENT) -f demo4/CMakeFiles/Demo4.dir/build.make demo4/CMakeFiles/Demo4.dir/depend + $(MAKE) $(MAKESILENT) -f demo4/CMakeFiles/Demo4.dir/build.make demo4/CMakeFiles/Demo4.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/root/Git/demo/build/CMakeFiles --progress-num=5,6 "Built target Demo4" +.PHONY : demo4/CMakeFiles/Demo4.dir/all + +# Build rule for subdir invocation for target. +demo4/CMakeFiles/Demo4.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /root/Git/demo/build/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 demo4/CMakeFiles/Demo4.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /root/Git/demo/build/CMakeFiles 0 +.PHONY : demo4/CMakeFiles/Demo4.dir/rule + +# Convenience name for target. +Demo4: demo4/CMakeFiles/Demo4.dir/rule +.PHONY : Demo4 + +# clean rule for target. +demo4/CMakeFiles/Demo4.dir/clean: + $(MAKE) $(MAKESILENT) -f demo4/CMakeFiles/Demo4.dir/build.make demo4/CMakeFiles/Demo4.dir/clean +.PHONY : demo4/CMakeFiles/Demo4.dir/clean + +#============================================================================= # Target rules for target matt/CMakeFiles/maat.dir # All Build rule for target. matt/CMakeFiles/maat.dir/all: $(MAKE) $(MAKESILENT) -f matt/CMakeFiles/maat.dir/build.make matt/CMakeFiles/maat.dir/depend $(MAKE) $(MAKESILENT) -f matt/CMakeFiles/maat.dir/build.make matt/CMakeFiles/maat.dir/build - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/root/Git/demo/build/CMakeFiles --progress-num=7,8 "Built target maat" + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/root/Git/demo/build/CMakeFiles --progress-num=9,10 "Built target maat" .PHONY : matt/CMakeFiles/maat.dir/all # Build rule for subdir invocation for target. diff --git a/build/CMakeFiles/TargetDirectories.txt b/build/CMakeFiles/TargetDirectories.txt index c747e08..32a6af9 100644 --- a/build/CMakeFiles/TargetDirectories.txt +++ b/build/CMakeFiles/TargetDirectories.txt @@ -9,6 +9,9 @@ /root/Git/demo/build/demo3/CMakeFiles/demo3.dir /root/Git/demo/build/demo3/CMakeFiles/edit_cache.dir /root/Git/demo/build/demo3/CMakeFiles/rebuild_cache.dir +/root/Git/demo/build/demo4/CMakeFiles/Demo4.dir +/root/Git/demo/build/demo4/CMakeFiles/edit_cache.dir +/root/Git/demo/build/demo4/CMakeFiles/rebuild_cache.dir /root/Git/demo/build/matt/CMakeFiles/maat.dir /root/Git/demo/build/matt/CMakeFiles/edit_cache.dir /root/Git/demo/build/matt/CMakeFiles/rebuild_cache.dir diff --git a/build/CMakeFiles/progress.marks b/build/CMakeFiles/progress.marks index 45a4fb7..f599e28 100644 --- a/build/CMakeFiles/progress.marks +++ b/build/CMakeFiles/progress.marks @@ -1 +1 @@ -8 +10 diff --git a/build/Makefile b/build/Makefile index f261a85..71bbee7 100644 --- a/build/Makefile +++ b/build/Makefile @@ -156,6 +156,19 @@ demo3/fast: .PHONY : demo3/fast #============================================================================= +# Target rules for targets named Demo4 + +# Build rule for target. +Demo4: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 Demo4 +.PHONY : Demo4 + +# fast build rule for target. +Demo4/fast: + $(MAKE) $(MAKESILENT) -f demo4/CMakeFiles/Demo4.dir/build.make demo4/CMakeFiles/Demo4.dir/build +.PHONY : Demo4/fast + +#============================================================================= # Target rules for targets named maat # Build rule for target. @@ -178,6 +191,7 @@ help: @echo "... rebuild_cache" @echo "... Demo1" @echo "... Demo2" + @echo "... Demo4" @echo "... demo3" @echo "... maat" .PHONY : help diff --git a/build/cmake_install.cmake b/build/cmake_install.cmake index d6209fd..e07ccdf 100644 --- a/build/cmake_install.cmake +++ b/build/cmake_install.cmake @@ -47,6 +47,7 @@ if(NOT CMAKE_INSTALL_LOCAL_ONLY) include("/root/Git/demo/build/demo1/cmake_install.cmake") include("/root/Git/demo/build/demo2/cmake_install.cmake") include("/root/Git/demo/build/demo3/cmake_install.cmake") + include("/root/Git/demo/build/demo4/cmake_install.cmake") include("/root/Git/demo/build/matt/cmake_install.cmake") endif() diff --git a/build/compile_commands.json b/build/compile_commands.json index ece9076..52df143 100644 --- a/build/compile_commands.json +++ b/build/compile_commands.json @@ -18,6 +18,12 @@ "output": "demo3/CMakeFiles/demo3.dir/main.c.o" }, { + "directory": "/root/Git/demo/build/demo4", + "command": "/usr/bin/gcc -I/opt/MESA/include/MESA -g -o CMakeFiles/Demo4.dir/main.c.o -c /root/Git/demo/demo4/main.c", + "file": "/root/Git/demo/demo4/main.c", + "output": "demo4/CMakeFiles/Demo4.dir/main.c.o" +}, +{ "directory": "/root/Git/demo/build/matt", "command": "/usr/bin/gcc -I/opt/MESA/include/MESA -g -o CMakeFiles/maat.dir/main.c.o -c /root/Git/demo/matt/main.c", "file": "/root/Git/demo/matt/main.c", diff --git a/build/demo2/CMakeFiles/Demo2.dir/compiler_depend.make b/build/demo2/CMakeFiles/Demo2.dir/compiler_depend.make index ad811bc..118c25b 100644 --- a/build/demo2/CMakeFiles/Demo2.dir/compiler_depend.make +++ b/build/demo2/CMakeFiles/Demo2.dir/compiler_depend.make @@ -1,196 +1,2 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.26 - -demo2/CMakeFiles/Demo2.dir/main.c.o: /root/Git/demo/demo2/main.c \ - /usr/include/stdc-predef.h \ - /opt/MESA/include/MESA/maat.h \ - /usr/lib/gcc/x86_64-redhat-linux/8/include/stdint.h \ - /usr/include/stdint.h \ - /usr/include/bits/libc-header-start.h \ - /usr/include/features.h \ - /usr/include/sys/cdefs.h \ - /usr/include/bits/wordsize.h \ - /usr/include/bits/long-double.h \ - /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h \ - /usr/include/bits/types.h \ - /usr/include/bits/typesizes.h \ - /usr/include/bits/wchar.h \ - /usr/include/bits/stdint-intn.h \ - /usr/include/bits/stdint-uintn.h \ - /usr/include/netinet/in.h \ - /usr/include/sys/socket.h \ - /usr/include/bits/types/struct_iovec.h \ - /usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h \ - /usr/include/bits/socket.h \ - /usr/include/sys/types.h \ - /usr/include/bits/types/clock_t.h \ - /usr/include/bits/types/clockid_t.h \ - /usr/include/bits/types/time_t.h \ - /usr/include/bits/types/timer_t.h \ - /usr/include/endian.h \ - /usr/include/bits/endian.h \ - /usr/include/bits/byteswap.h \ - /usr/include/bits/uintn-identity.h \ - /usr/include/sys/select.h \ - /usr/include/bits/select.h \ - /usr/include/bits/types/sigset_t.h \ - /usr/include/bits/types/__sigset_t.h \ - /usr/include/bits/types/struct_timeval.h \ - /usr/include/bits/types/struct_timespec.h \ - /usr/include/bits/pthreadtypes.h \ - /usr/include/bits/thread-shared-types.h \ - /usr/include/bits/pthreadtypes-arch.h \ - /usr/include/bits/socket_type.h \ - /usr/include/bits/sockaddr.h \ - /usr/include/asm/socket.h \ - /usr/include/asm-generic/socket.h \ - /usr/include/asm/sockios.h \ - /usr/include/asm-generic/sockios.h \ - /usr/include/bits/types/struct_osockaddr.h \ - /usr/include/bits/in.h \ - /usr/include/stdio.h \ - /usr/lib/gcc/x86_64-redhat-linux/8/include/stdarg.h \ - /usr/include/bits/types/__fpos_t.h \ - /usr/include/bits/types/__mbstate_t.h \ - /usr/include/bits/types/__fpos64_t.h \ - /usr/include/bits/types/__FILE.h \ - /usr/include/bits/types/FILE.h \ - /usr/include/bits/types/struct_FILE.h \ - /usr/include/bits/stdio_lim.h \ - /usr/include/bits/sys_errlist.h \ - /usr/include/arpa/inet.h \ - /usr/include/assert.h \ - /usr/include/string.h \ - /usr/include/bits/types/locale_t.h \ - /usr/include/bits/types/__locale_t.h \ - /usr/include/strings.h - - -/usr/include/string.h: - -/usr/include/assert.h: - -/usr/include/arpa/inet.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/bits/types/FILE.h: - -/usr/include/bits/types/__FILE.h: - -/usr/include/bits/types/__mbstate_t.h: - -/usr/include/bits/types/__fpos_t.h: - -/usr/lib/gcc/x86_64-redhat-linux/8/include/stdarg.h: - -/usr/include/stdio.h: - -/usr/include/bits/in.h: - -/usr/include/bits/types/struct_FILE.h: - -/usr/include/bits/types/struct_osockaddr.h: - -/usr/include/asm-generic/sockios.h: - -/usr/include/asm/socket.h: - -/usr/include/asm-generic/socket.h: - -/usr/include/bits/sockaddr.h: - -/usr/include/bits/pthreadtypes-arch.h: - -/usr/include/bits/types/__fpos64_t.h: - -/usr/include/bits/thread-shared-types.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/bits/types/struct_timespec.h: - -/usr/include/bits/typesizes.h: - -/usr/include/bits/wordsize.h: - -/usr/include/bits/stdint-intn.h: - -/opt/MESA/include/MESA/maat.h: - -/usr/include/bits/socket.h: - -/usr/include/bits/byteswap.h: - -/usr/include/bits/types/__sigset_t.h: - -/usr/lib/gcc/x86_64-redhat-linux/8/include/stdint.h: - -/usr/include/gnu/stubs.h: - -/usr/include/stdc-predef.h: - -/root/Git/demo/demo2/main.c: - -/usr/include/stdint.h: - -/usr/include/gnu/stubs-64.h: - -/usr/include/bits/select.h: - -/usr/include/bits/wchar.h: - -/usr/include/asm/sockios.h: - -/usr/include/sys/cdefs.h: - -/usr/include/bits/types/sigset_t.h: - -/usr/include/features.h: - -/usr/include/bits/long-double.h: - -/usr/include/bits/types/locale_t.h: - -/usr/include/netinet/in.h: - -/usr/include/sys/socket.h: - -/usr/include/bits/types/timer_t.h: - -/usr/include/bits/types/__locale_t.h: - -/usr/include/bits/socket_type.h: - -/usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h: - -/usr/include/strings.h: - -/usr/include/sys/types.h: - -/usr/include/bits/types/clockid_t.h: - -/usr/include/bits/types/struct_iovec.h: - -/usr/include/bits/stdint-uintn.h: - -/usr/include/bits/types/clock_t.h: - -/usr/include/bits/types.h: - -/usr/include/endian.h: - -/usr/include/bits/types/struct_timeval.h: - -/usr/include/bits/endian.h: - -/usr/include/bits/libc-header-start.h: - -/usr/include/bits/types/time_t.h: - -/usr/include/bits/uintn-identity.h: - -/usr/include/sys/select.h: +# Empty compiler generated dependencies file for Demo2. +# This may be replaced when dependencies are built. diff --git a/build/demo3/CMakeFiles/demo3.dir/progress.make b/build/demo3/CMakeFiles/demo3.dir/progress.make index 3a86673..72bb7dd 100644 --- a/build/demo3/CMakeFiles/demo3.dir/progress.make +++ b/build/demo3/CMakeFiles/demo3.dir/progress.make @@ -1,3 +1,3 @@ -CMAKE_PROGRESS_1 = 5 -CMAKE_PROGRESS_2 = 6 +CMAKE_PROGRESS_1 = 7 +CMAKE_PROGRESS_2 = 8 diff --git a/build/matt/CMakeFiles/maat.dir/progress.make b/build/matt/CMakeFiles/maat.dir/progress.make index 72bb7dd..b700c2c 100644 --- a/build/matt/CMakeFiles/maat.dir/progress.make +++ b/build/matt/CMakeFiles/maat.dir/progress.make @@ -1,3 +1,3 @@ -CMAKE_PROGRESS_1 = 7 -CMAKE_PROGRESS_2 = 8 +CMAKE_PROGRESS_1 = 9 +CMAKE_PROGRESS_2 = 10 diff --git a/demo4/CMakeLists.txt b/demo4/CMakeLists.txt new file mode 100644 index 0000000..ca15499 --- /dev/null +++ b/demo4/CMakeLists.txt @@ -0,0 +1,8 @@ +# Set the minimum version of CMake that can be used +cmake_minimum_required(VERSION 3.10) + +# Define a new project +project(Demo4) + +# Add an executable +add_executable(Demo4 main.c)
\ No newline at end of file diff --git a/demo4/maat_json_cb.json b/demo4/maat_json_cb.json new file mode 100644 index 0000000..b35a2c5 --- /dev/null +++ b/demo4/maat_json_cb.json @@ -0,0 +1,37 @@ +{ + "compile_table": "COMPILE", + "group2compile_table": "GROUP2COMPILE", + "group2group_table": "GROUP2GROUP", + "plugin_table": [ + { + "table_name": "WANNAT_DYN_UE_ID_IP", + "table_content": [ + "1\t4\t10.0.0.1\tabcdefghij\t1\t0", + "2\t4\t10.0.0.2\tbbcdefghij\t1\t0" + ] + }, + { + "table_name": "WANNAT_OBJ_UE_ID", + "table_content": [ + "101\t1\tabcdefghij\t0\t3\t0\t1\t0", + "102\t2\tbbcdefghij\t0\t3\t0\t1\t0" + ] + }, + { + "table_name": "WANNAT_OBJ_IP_ADDR", + "table_content": [ + "201\t2\t4\tCIDR\t20.20.20.20\t32\t[0,65535]\t1\t0", + "202\t2\t4\tCIDR\t8.8.8.8\t32\t[0,65535]\t1\t0", + "203\t3\t4\tCIDR\t100.0.0.0\t24\t[0,65535]\t1\t0", + "204\t3\t4\tCIDR\t100.0.1.0\t24\t[0,65535]\t1\t0" + ] + }, + { + "table_name": "WANNAT_COMPILE", + "table_content": [ + "301\t0\t1\t0\t2\t{}\t{\"ip_object_ids\":[203,204], \"translate_type\":\"never\", \"time_interval\":123, \"connection_count\":1243}\t1\t1\t0", + "302\t0\t2\t0\t2\t{}\t{\"ue_object_ids\":[102], \"failover\":\"drop\"}\t1\t1\t0" + ] + } + ] +}
\ No newline at end of file diff --git a/demo4/maat_json_cb.json_iris_tmp/COMPILE.local b/demo4/maat_json_cb.json_iris_tmp/COMPILE.local new file mode 100644 index 0000000..62580c9 --- /dev/null +++ b/demo4/maat_json_cb.json_iris_tmp/COMPILE.local @@ -0,0 +1 @@ +0000000000 diff --git a/demo4/maat_json_cb.json_iris_tmp/GROUP2COMPILE.local b/demo4/maat_json_cb.json_iris_tmp/GROUP2COMPILE.local new file mode 100644 index 0000000..62580c9 --- /dev/null +++ b/demo4/maat_json_cb.json_iris_tmp/GROUP2COMPILE.local @@ -0,0 +1 @@ +0000000000 diff --git a/demo4/maat_json_cb.json_iris_tmp/GROUP2GROUP.local b/demo4/maat_json_cb.json_iris_tmp/GROUP2GROUP.local new file mode 100644 index 0000000..62580c9 --- /dev/null +++ b/demo4/maat_json_cb.json_iris_tmp/GROUP2GROUP.local @@ -0,0 +1 @@ +0000000000 diff --git a/demo4/maat_json_cb.json_iris_tmp/WANNAT_COMPILE.local b/demo4/maat_json_cb.json_iris_tmp/WANNAT_COMPILE.local new file mode 100644 index 0000000..7dd67ae --- /dev/null +++ b/demo4/maat_json_cb.json_iris_tmp/WANNAT_COMPILE.local @@ -0,0 +1,3 @@ +0000000002 +301 0 1 0 2 {} {"ip_object_ids":[203,204], "translate_type":"never", "time_interval":123, "connection_count":1243} 8 1 0 +302 0 2 0 2 {} {"ue_object_ids":[102], "failover":"drop"} 8 1 0 diff --git a/demo4/maat_json_cb.json_iris_tmp/WANNAT_DYN_UE_ID_IP.local b/demo4/maat_json_cb.json_iris_tmp/WANNAT_DYN_UE_ID_IP.local new file mode 100644 index 0000000..50a21a1 --- /dev/null +++ b/demo4/maat_json_cb.json_iris_tmp/WANNAT_DYN_UE_ID_IP.local @@ -0,0 +1,3 @@ +0000000002 +1 4 10.0.0.1 abcdefghij 1 0 +2 4 10.0.0.2 bbcdefghij 1 0 diff --git a/demo4/maat_json_cb.json_iris_tmp/WANNAT_OBJ_IP_ADDR.local b/demo4/maat_json_cb.json_iris_tmp/WANNAT_OBJ_IP_ADDR.local new file mode 100644 index 0000000..28d411a --- /dev/null +++ b/demo4/maat_json_cb.json_iris_tmp/WANNAT_OBJ_IP_ADDR.local @@ -0,0 +1,5 @@ +0000000004 +201 2 4 CIDR 20.20.20.20 32 [0,65535] 1 0 +202 2 4 CIDR 8.8.8.8 32 [0,65535] 1 0 +203 3 4 CIDR 100.0.0.0 24 [0,65535] 1 0 +204 3 4 CIDR 100.0.1.0 24 [0,65535] 1 0 diff --git a/demo4/maat_json_cb.json_iris_tmp/WANNAT_OBJ_UE_ID.local b/demo4/maat_json_cb.json_iris_tmp/WANNAT_OBJ_UE_ID.local new file mode 100644 index 0000000..cab6e0f --- /dev/null +++ b/demo4/maat_json_cb.json_iris_tmp/WANNAT_OBJ_UE_ID.local @@ -0,0 +1,3 @@ +0000000002 +101 1 abcdefghij 0 3 0 1 0 +102 2 bbcdefghij 0 3 0 1 0 diff --git a/demo4/maat_json_cb.json_iris_tmp/index/full_config_index.0000000001 b/demo4/maat_json_cb.json_iris_tmp/index/full_config_index.0000000001 new file mode 100644 index 0000000..b6abc4e --- /dev/null +++ b/demo4/maat_json_cb.json_iris_tmp/index/full_config_index.0000000001 @@ -0,0 +1,7 @@ +COMPILE 0 /root/Git/demo/demo4/maat_json_cb.json_iris_tmp/COMPILE.local +GROUP2COMPILE 0 /root/Git/demo/demo4/maat_json_cb.json_iris_tmp/GROUP2COMPILE.local +GROUP2GROUP 0 /root/Git/demo/demo4/maat_json_cb.json_iris_tmp/GROUP2GROUP.local +WANNAT_DYN_UE_ID_IP 2 /root/Git/demo/demo4/maat_json_cb.json_iris_tmp/WANNAT_DYN_UE_ID_IP.local +WANNAT_OBJ_UE_ID 2 /root/Git/demo/demo4/maat_json_cb.json_iris_tmp/WANNAT_OBJ_UE_ID.local +WANNAT_OBJ_IP_ADDR 4 /root/Git/demo/demo4/maat_json_cb.json_iris_tmp/WANNAT_OBJ_IP_ADDR.local +WANNAT_COMPILE 2 /root/Git/demo/demo4/maat_json_cb.json_iris_tmp/WANNAT_COMPILE.local diff --git a/demo4/main.c b/demo4/main.c new file mode 100644 index 0000000..d6fd1d4 --- /dev/null +++ b/demo4/main.c @@ -0,0 +1,113 @@ +#include "maat.h" +#include "stdio.h" +#include <arpa/inet.h> +#include <assert.h> +#include <stddef.h> +#include <string.h> + +#define ARRAY_SIZE 16 + +const char *json_filename = "/root/Git/demo/demo4/maat_json_cb.json"; +const char *table_info_path = "/root/Git/demo/demo4/table_info_cb.conf"; + +// struct ip_plugin_ud { +// long long rule_id; +// char *buffer; +// size_t buf_len; +// }; +// void ip_plugin_ex_new_cb(const char *table_name, int table_id, const char *key, +// const char *table_line, void **ad, long argl, void *argp) +// { +// int *counter = (int *)argp; +// size_t column_offset=0, column_len=0; +// struct ip_plugin_ud *ud = ALLOC(struct ip_plugin_ud, 1); + +// int ret = get_column_pos(table_line, 1, &column_offset, &column_len); +// EXPECT_EQ(ret, 0); + +// ud->rule_id = atoll(table_line + column_offset); + +// ret = get_column_pos(table_line, 5, &column_offset, &column_len); +// EXPECT_EQ(ret, 0); + +// ud->buffer = ALLOC(char, column_len + 1); +// strncpy(ud->buffer, table_line + column_offset, column_len); + +// ud->buf_len = column_len + 1; +// *ad = ud; +// (*counter)++; +// } + +// void ip_plugin_ex_free_cb(int table_id, void **ad, long argl, void *argp) +// { +// struct ip_plugin_ud *ud = (struct ip_plugin_ud *)(*ad); + +// ud->rule_id = 0; +// memset(ud->buffer, 0, ud->buf_len); +// ud->buf_len = 0; + +// free(ud->buffer); +// free(ud); +// *ad = NULL; +// } + +// void ip_plugin_ex_dup_cb(int table_id, void **to, void **from, long argl, void *argp) +// { +// struct ip_plugin_ud *ud = (struct ip_plugin_ud *)(*from); + +// *to = ud; +// } + +int main() +{ + /* initialize maat options which will be used by maat_new() */ + struct maat_options *opts = maat_options_new(); + maat_options_set_json_file(opts, json_filename); + maat_options_set_logger(opts, "./sample_test.log", LOG_LEVEL_INFO); + + /* create maat instance, rules in table_info.conf will be loaded. */ + struct maat *maat_instance = maat_new(opts, table_info_path); + assert(maat_instance != NULL); + maat_options_free(opts); + + const char *table_name = "WANNAT_DYN_UE_ID_IP"; /* maat_json.json has TEST_IP_PLUGIN_WITH_EXDATA rule */ + int table_id = maat_get_table_id(maat_instance, table_name); + assert(table_id == 0); /* defined in table_info.conf */ + + // int ret = maat_plugin_table_ex_schema_register(maat_inst, table_name, + // ip_plugin_ex_new_cb, + // ip_plugin_ex_free_cb, + // ip_plugin_ex_dup_cb, + // 0, &ip_plugin_ex_data_counter); + // EXPECT_EQ(ret, 0); + // EXPECT_EQ(ip_plugin_ex_data_counter, 4); + + // struct ip_addr ipv4; + // ipv4.ip_type = IPv4; + // ret = inet_pton(AF_INET, "192.168.30.100", &ipv4.ipv4); + // EXPECT_EQ(ret, 1); + + // /* get ex_data */ + // struct ip_plugin_ud *results[ARRAY_SIZE]; + // ret = maat_ip_plugin_table_get_ex_data(maat_inst, table_id, &ipv4, + // (void **)results, ARRAY_SIZE); + // EXPECT_EQ(ret, 2); + // EXPECT_EQ(results[0]->rule_id, 101); + // EXPECT_EQ(results[1]->rule_id, 102); + + // struct ip_addr ipv6; + // ipv6.ip_type = IPv6; + // inet_pton(AF_INET6, "2001:db8:1234::5210", &(ipv6.ipv6)); + // memset(results, 0, sizeof(results)); + + // ret = maat_ip_plugin_table_get_ex_data(maat_inst, table_id, &ipv6, + // (void**)results, ARRAY_SIZE); + // EXPECT_EQ(ret, 2); + // EXPECT_EQ(results[0]->rule_id, 104); + // EXPECT_EQ(results[1]->rule_id, 103); + + // maat_state_free(state); + + return 0; +} + diff --git a/demo4/table_info_cb.conf b/demo4/table_info_cb.conf new file mode 100644 index 0000000..81ba965 --- /dev/null +++ b/demo4/table_info_cb.conf @@ -0,0 +1,52 @@ +[ + { + "table_id":0, + "table_name":"WANNAT_DYN_UE_ID_IP", + "table_type":"plugin", + "valid_column":5, + "custom": { + "key_type":"ip_addr", + "addr_type":1, + "key":3 + } + }, + { + "table_id":1, + "table_name":"WANNAT_OBJ_UE_ID", + "table_type":"plugin", + "valid_column":7, + "custom": { + "key_type":"integer", + "key_len":4, + "key": 1 + } + }, + { + "table_id":2, + "table_name":"WANNAT_OBJ_IP_ADDR", + "table_type":"plugin", + "valid_column":8, + "custom": { + "key_type":"integer", + "key_len":4, + "key": 1, + "addr_type":3, + "addr_format":4, + "ip1":5, + "ip2":6, + "port":7 + } + }, + { + "table_id":3, + "table_name":"WANNAT_COMPILE", + "table_type":"plugin", + "valid_column":9, + "custom": { + "key_type":"integer", + "key_len":4, + "key": 1, + "user_region":7 + } + } +]
\ No newline at end of file |
