├── .vscode ├── c_cpp_properties.json ├── launch.json ├── settings.json └── tasks.json ├── CMakeLists.txt ├── README.md ├── build ├── CMakeCache.txt ├── CMakeFiles │ ├── 3.8.2 │ │ ├── CMakeCCompiler.cmake │ │ ├── CMakeCXXCompiler.cmake │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ ├── CMakeSystem.cmake │ │ ├── CompilerIdC │ │ │ ├── CMakeCCompilerId.c │ │ │ └── a.out │ │ └── CompilerIdCXX │ │ │ ├── CMakeCXXCompilerId.cpp │ │ │ └── a.out │ ├── CMakeDirectoryInformation.cmake │ ├── CMakeOutput.log │ ├── Makefile.cmake │ ├── Makefile2 │ ├── TargetDirectories.txt │ ├── cmake.check_cache │ ├── feature_tests.bin │ ├── feature_tests.c │ ├── feature_tests.cxx │ ├── hero.dir │ │ ├── DependInfo.cmake │ │ ├── build.make │ │ ├── cmake_clean.cmake │ │ ├── depend.make │ │ ├── flags.make │ │ ├── link.txt │ │ └── progress.make │ └── progress.marks ├── Makefile ├── cmake_install.cmake ├── net │ ├── CMakeFiles │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── com.dir │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ └── progress.make │ │ ├── command_lib.dir │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ └── progress.make │ │ ├── net.dir │ │ │ ├── C.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── cmake_clean_target.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ ├── link.txt │ │ │ └── progress.make │ │ └── progress.marks │ ├── Makefile │ ├── cmake_install.cmake │ ├── com │ │ ├── CMakeFiles │ │ │ ├── CMakeDirectoryInformation.cmake │ │ │ ├── com.dir │ │ │ │ ├── C.includecache │ │ │ │ ├── DependInfo.cmake │ │ │ │ ├── build.make │ │ │ │ ├── cmake_clean.cmake │ │ │ │ ├── cmake_clean_target.cmake │ │ │ │ ├── depend.internal │ │ │ │ ├── depend.make │ │ │ │ ├── flags.make │ │ │ │ ├── handle_util.c.o │ │ │ │ ├── link.txt │ │ │ │ └── progress.make │ │ │ ├── command_lib.dir │ │ │ │ ├── DependInfo.cmake │ │ │ │ ├── build.make │ │ │ │ ├── cmake_clean.cmake │ │ │ │ ├── cmake_clean_target.cmake │ │ │ │ ├── depend.make │ │ │ │ ├── flags.make │ │ │ │ ├── link.txt │ │ │ │ └── progress.make │ │ │ └── progress.marks │ │ ├── Makefile │ │ └── cmake_install.cmake │ └── proto │ │ ├── CMakeFiles │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── progress.marks │ │ └── proto.dir │ │ │ ├── C.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── cmake_clean_target.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ ├── link.txt │ │ │ └── progress.make │ │ ├── Makefile │ │ └── cmake_install.cmake └── netdir │ ├── CMakeFiles │ ├── CMakeDirectoryInformation.cmake │ ├── net.dir │ │ ├── DependInfo.cmake │ │ ├── build.make │ │ ├── cmake_clean.cmake │ │ ├── cmake_clean_target.cmake │ │ ├── depend.make │ │ ├── flags.make │ │ ├── link.txt │ │ └── progress.make │ └── progress.marks │ ├── Makefile │ └── cmake_install.cmake ├── hero.code-workspace ├── main.c ├── net ├── CMakeLists.txt ├── basic.c ├── basic.h ├── buffer_util.c ├── buffer_util.h ├── com │ ├── CMakeLists.txt │ ├── handle_util.c │ ├── handle_util.h │ ├── select_handle.c │ ├── select_handle.h │ ├── show_handle.c │ └── show_handle.h ├── config.h ├── conn.c ├── conn.h ├── datasource.c ├── datasource.h ├── hero_poll.c ├── hero_poll.h ├── hero_worker.c ├── hero_worker.h ├── network.c ├── network.h ├── password.c ├── password.h ├── proto │ ├── CMakeLists.txt │ ├── capacity.h │ ├── list.h │ ├── list_test.c │ ├── packet.c │ ├── packet.h │ └── packet_const.h ├── query.c ├── query.h ├── server.c ├── server.h ├── server_parse.c ├── server_parse.h ├── session.c ├── session.h └── sql_error_code.h └── roadmap /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Mac", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "/usr/local/include/**", 8 | "/Users/alchemystar/cross-share/linux-include/include/**", 9 | "/usr/local/include/glib-2.0/glib/**" 10 | ], 11 | "defines": [], 12 | "macFrameworkPath": [ 13 | "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks" 14 | ], 15 | "compilerPath": "/usr/bin/clang", 16 | "cStandard": "c11", 17 | "cppStandard": "c++17", 18 | "intelliSenseMode": "clang-x64", 19 | "configurationProvider": "vector-of-bool.cmake-tools" 20 | } 21 | ], 22 | "version": 4 23 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "(lldb) launch", 9 | "type": "cppdbg", 10 | "request": "launch", 11 | "program": "${workspaceFolder}/build/hero", 12 | "args": [], 13 | "stopAtEntry": false, 14 | "cwd": "${workspaceFolder}", 15 | "environment": [], 16 | "externalConsole": true, 17 | "MIMode": "lldb", 18 | "setupCommands": [ 19 | { 20 | "description": "Enable pretty-printing for gdb", 21 | "text": "-enable-pretty-printing", 22 | "ignoreFailures": true 23 | } 24 | ] 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "server.h": "c", 4 | "socket.h": "c", 5 | "in.h": "c", 6 | "config.h": "c", 7 | "network.h": "c", 8 | "packet.h": "c", 9 | "list.h": "c", 10 | "stdio.h": "c", 11 | "capacity.h": "c", 12 | "buffer_util.h": "c", 13 | "packet_const.h": "c", 14 | "string.h": "c", 15 | "basic.h": "c", 16 | "stdatomic.h": "c", 17 | "stdlib.h": "c", 18 | "password.h": "c", 19 | "query.h": "c", 20 | "server_parse.h": "c", 21 | "show_handle.h": "c" 22 | }, 23 | "C_Cpp.configurationWarnings": "Disabled" 24 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "hero", 8 | "type": "shell", 9 | "command": "cd build && cmake -DCMAKE_BUILD_TYPE=Debug ../ && make clean && make", 10 | "group": { 11 | "kind": "build", 12 | "isDefault": true 13 | } 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #设置CMAKE最小版本 2 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 3 | #设置编译器 4 | SET(CMAKE_CXX_COMPILER "gcc") 5 | #项目名称 6 | project(hero) 7 | # for glibc 8 | include(FindPkgConfig) 9 | pkg_check_modules(GLIB glib-2.0 REQUIRED) 10 | include_directories(${GLIB_INCLUDE_DIRS}) 11 | link_directories(${GLIB_LIBRARY_DIRS}) 12 | # for tc malloc 13 | find_library(TCMALLOC_LIB NAMES libtcmalloc_minimal.a tcmalloc_minimal) 14 | # for libunwind 15 | find_library(UNWIND_LIB NAMES libunwind.a) 16 | #代码路径 main路径 17 | aux_source_directory(. source_list) 18 | # 子目录net路径 19 | ADD_SUBDIRECTORY(net) 20 | #debug 模式 21 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g ") 22 | #打印详细信息 23 | set(CMAKE_VERBOSE_MAKEFILE ON) 24 | #生成可执行的文件 25 | add_executable(hero ${source_list}) 26 | #link对应net lib 27 | target_link_libraries(hero net ${GLIB_LIBRARIES} ${TCMALLOC_LIB} pthread stdc++ m) -------------------------------------------------------------------------------- /build/CMakeFiles/3.8.2/CMakeCCompiler.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_C_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc") 2 | set(CMAKE_C_COMPILER_ARG1 "") 3 | set(CMAKE_C_COMPILER_ID "AppleClang") 4 | set(CMAKE_C_COMPILER_VERSION "10.0.0.10001145") 5 | set(CMAKE_C_COMPILER_WRAPPER "") 6 | set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11") 7 | set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") 8 | set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") 9 | set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") 10 | set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") 11 | 12 | set(CMAKE_C_PLATFORM_ID "Darwin") 13 | set(CMAKE_C_SIMULATE_ID "") 14 | set(CMAKE_C_SIMULATE_VERSION "") 15 | 16 | set(CMAKE_AR "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar") 17 | set(CMAKE_RANLIB "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib") 18 | set(CMAKE_LINKER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld") 19 | set(CMAKE_COMPILER_IS_GNUCC ) 20 | set(CMAKE_C_COMPILER_LOADED 1) 21 | set(CMAKE_C_COMPILER_WORKS TRUE) 22 | set(CMAKE_C_ABI_COMPILED TRUE) 23 | set(CMAKE_COMPILER_IS_MINGW ) 24 | set(CMAKE_COMPILER_IS_CYGWIN ) 25 | if(CMAKE_COMPILER_IS_CYGWIN) 26 | set(CYGWIN 1) 27 | set(UNIX 1) 28 | endif() 29 | 30 | set(CMAKE_C_COMPILER_ENV_VAR "CC") 31 | 32 | if(CMAKE_COMPILER_IS_MINGW) 33 | set(MINGW 1) 34 | endif() 35 | set(CMAKE_C_COMPILER_ID_RUN 1) 36 | set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) 37 | set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) 38 | set(CMAKE_C_LINKER_PREFERENCE 10) 39 | 40 | # Save compiler ABI information. 41 | set(CMAKE_C_SIZEOF_DATA_PTR "8") 42 | set(CMAKE_C_COMPILER_ABI "") 43 | set(CMAKE_C_LIBRARY_ARCHITECTURE "") 44 | 45 | if(CMAKE_C_SIZEOF_DATA_PTR) 46 | set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") 47 | endif() 48 | 49 | if(CMAKE_C_COMPILER_ABI) 50 | set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") 51 | endif() 52 | 53 | if(CMAKE_C_LIBRARY_ARCHITECTURE) 54 | set(CMAKE_LIBRARY_ARCHITECTURE "") 55 | endif() 56 | 57 | set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") 58 | if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) 59 | set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") 60 | endif() 61 | 62 | 63 | 64 | 65 | 66 | set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "") 67 | set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib") 68 | set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks") 69 | -------------------------------------------------------------------------------- /build/CMakeFiles/3.8.2/CMakeCXXCompiler.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_CXX_COMPILER "/usr/bin/gcc") 2 | set(CMAKE_CXX_COMPILER_ARG1 "") 3 | set(CMAKE_CXX_COMPILER_ID "AppleClang") 4 | set(CMAKE_CXX_COMPILER_VERSION "10.0.0.10001145") 5 | set(CMAKE_CXX_COMPILER_WRAPPER "") 6 | set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "98") 7 | set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17") 8 | set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") 9 | set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") 10 | set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") 11 | set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") 12 | 13 | set(CMAKE_CXX_PLATFORM_ID "Darwin") 14 | set(CMAKE_CXX_SIMULATE_ID "") 15 | set(CMAKE_CXX_SIMULATE_VERSION "") 16 | 17 | set(CMAKE_AR "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar") 18 | set(CMAKE_RANLIB "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib") 19 | set(CMAKE_LINKER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld") 20 | set(CMAKE_COMPILER_IS_GNUCXX ) 21 | set(CMAKE_CXX_COMPILER_LOADED 1) 22 | set(CMAKE_CXX_COMPILER_WORKS TRUE) 23 | set(CMAKE_CXX_ABI_COMPILED TRUE) 24 | set(CMAKE_COMPILER_IS_MINGW ) 25 | set(CMAKE_COMPILER_IS_CYGWIN ) 26 | if(CMAKE_COMPILER_IS_CYGWIN) 27 | set(CYGWIN 1) 28 | set(UNIX 1) 29 | endif() 30 | 31 | set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") 32 | 33 | if(CMAKE_COMPILER_IS_MINGW) 34 | set(MINGW 1) 35 | endif() 36 | set(CMAKE_CXX_COMPILER_ID_RUN 1) 37 | set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) 38 | set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP) 39 | set(CMAKE_CXX_LINKER_PREFERENCE 30) 40 | set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) 41 | 42 | # Save compiler ABI information. 43 | set(CMAKE_CXX_SIZEOF_DATA_PTR "8") 44 | set(CMAKE_CXX_COMPILER_ABI "") 45 | set(CMAKE_CXX_LIBRARY_ARCHITECTURE "") 46 | 47 | if(CMAKE_CXX_SIZEOF_DATA_PTR) 48 | set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") 49 | endif() 50 | 51 | if(CMAKE_CXX_COMPILER_ABI) 52 | set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") 53 | endif() 54 | 55 | if(CMAKE_CXX_LIBRARY_ARCHITECTURE) 56 | set(CMAKE_LIBRARY_ARCHITECTURE "") 57 | endif() 58 | 59 | set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") 60 | if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) 61 | set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") 62 | endif() 63 | 64 | 65 | 66 | 67 | 68 | set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") 69 | set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib") 70 | set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks") 71 | -------------------------------------------------------------------------------- /build/CMakeFiles/3.8.2/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alchemystar/hero/d719b66986e261b66433537d024348b8d26fe9db/build/CMakeFiles/3.8.2/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /build/CMakeFiles/3.8.2/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alchemystar/hero/d719b66986e261b66433537d024348b8d26fe9db/build/CMakeFiles/3.8.2/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /build/CMakeFiles/3.8.2/CMakeSystem.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_HOST_SYSTEM "Darwin-18.2.0") 2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin") 3 | set(CMAKE_HOST_SYSTEM_VERSION "18.2.0") 4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") 5 | 6 | 7 | 8 | set(CMAKE_SYSTEM "Darwin-18.2.0") 9 | set(CMAKE_SYSTEM_NAME "Darwin") 10 | set(CMAKE_SYSTEM_VERSION "18.2.0") 11 | set(CMAKE_SYSTEM_PROCESSOR "x86_64") 12 | 13 | set(CMAKE_CROSSCOMPILING "FALSE") 14 | 15 | set(CMAKE_SYSTEM_LOADED 1) 16 | -------------------------------------------------------------------------------- /build/CMakeFiles/3.8.2/CompilerIdC/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alchemystar/hero/d719b66986e261b66433537d024348b8d26fe9db/build/CMakeFiles/3.8.2/CompilerIdC/a.out -------------------------------------------------------------------------------- /build/CMakeFiles/3.8.2/CompilerIdCXX/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alchemystar/hero/d719b66986e261b66433537d024348b8d26fe9db/build/CMakeFiles/3.8.2/CompilerIdCXX/a.out -------------------------------------------------------------------------------- /build/CMakeFiles/CMakeDirectoryInformation.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Relative path conversion top directories. 5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/alchemystar/mycode/hero") 6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/alchemystar/mycode/hero/build") 7 | 8 | # Force unix paths in dependencies. 9 | set(CMAKE_FORCE_UNIX_PATHS 1) 10 | 11 | 12 | # The C and CXX include file regular expressions for this directory. 13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") 14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") 15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) 16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) 17 | -------------------------------------------------------------------------------- /build/CMakeFiles/TargetDirectories.txt: -------------------------------------------------------------------------------- 1 | /Users/alchemystar/mycode/hero/build/CMakeFiles/rebuild_cache.dir 2 | /Users/alchemystar/mycode/hero/build/CMakeFiles/edit_cache.dir 3 | /Users/alchemystar/mycode/hero/build/CMakeFiles/hero.dir 4 | /Users/alchemystar/mycode/hero/build/net/CMakeFiles/rebuild_cache.dir 5 | /Users/alchemystar/mycode/hero/build/net/CMakeFiles/edit_cache.dir 6 | /Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir 7 | /Users/alchemystar/mycode/hero/build/net/proto/CMakeFiles/rebuild_cache.dir 8 | /Users/alchemystar/mycode/hero/build/net/proto/CMakeFiles/edit_cache.dir 9 | /Users/alchemystar/mycode/hero/build/net/proto/CMakeFiles/proto.dir 10 | /Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/rebuild_cache.dir 11 | /Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/edit_cache.dir 12 | /Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/com.dir 13 | -------------------------------------------------------------------------------- /build/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /build/CMakeFiles/feature_tests.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alchemystar/hero/d719b66986e261b66433537d024348b8d26fe9db/build/CMakeFiles/feature_tests.bin -------------------------------------------------------------------------------- /build/CMakeFiles/feature_tests.c: -------------------------------------------------------------------------------- 1 | 2 | const char features[] = {"\n" 3 | "C_FEATURE:" 4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 400 5 | "1" 6 | #else 7 | "0" 8 | #endif 9 | "c_function_prototypes\n" 10 | "C_FEATURE:" 11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 400 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 12 | "1" 13 | #else 14 | "0" 15 | #endif 16 | "c_restrict\n" 17 | "C_FEATURE:" 18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 400 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L 19 | "1" 20 | #else 21 | "0" 22 | #endif 23 | "c_static_assert\n" 24 | "C_FEATURE:" 25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 400 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 26 | "1" 27 | #else 28 | "0" 29 | #endif 30 | "c_variadic_macros\n" 31 | 32 | }; 33 | 34 | int main(int argc, char** argv) { (void)argv; return features[argc]; } 35 | -------------------------------------------------------------------------------- /build/CMakeFiles/hero.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "C" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_C 7 | "/Users/alchemystar/mycode/hero/main.c" "/Users/alchemystar/mycode/hero/build/CMakeFiles/hero.dir/main.c.o" 8 | ) 9 | set(CMAKE_C_COMPILER_ID "Clang") 10 | 11 | # The include file search paths: 12 | set(CMAKE_C_TARGET_INCLUDE_PATH 13 | "/usr/local/Cellar/glib/2.58.1/include/glib-2.0" 14 | "/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include" 15 | "/usr/local/opt/gettext/include" 16 | "/usr/local/Cellar/pcre/8.42/include" 17 | ) 18 | 19 | # Targets to which this target links. 20 | set(CMAKE_TARGET_LINKED_INFO_FILES 21 | "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/DependInfo.cmake" 22 | "/Users/alchemystar/mycode/hero/build/net/proto/CMakeFiles/proto.dir/DependInfo.cmake" 23 | "/Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/com.dir/DependInfo.cmake" 24 | ) 25 | 26 | # Fortran module output directory. 27 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 28 | -------------------------------------------------------------------------------- /build/CMakeFiles/hero.dir/build.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Delete rule output on recipe failure. 5 | .DELETE_ON_ERROR: 6 | 7 | 8 | #============================================================================= 9 | # Special targets provided by cmake. 10 | 11 | # Disable implicit rules so canonical targets will work. 12 | .SUFFIXES: 13 | 14 | 15 | # Remove some rules from gmake that .SUFFIXES does not remove. 16 | SUFFIXES = 17 | 18 | .SUFFIXES: .hpux_make_needs_suffix_list 19 | 20 | 21 | # Produce verbose output by default. 22 | VERBOSE = 1 23 | 24 | # Suppress display of executed commands. 25 | $(VERBOSE).SILENT: 26 | 27 | 28 | # A target that is always out of date. 29 | cmake_force: 30 | 31 | .PHONY : cmake_force 32 | 33 | #============================================================================= 34 | # Set environment variables for the build. 35 | 36 | # The shell in which to execute make rules. 37 | SHELL = /bin/sh 38 | 39 | # The CMake executable. 40 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 41 | 42 | # The command to remove a file. 43 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 44 | 45 | # Escaping for special characters. 46 | EQUALS = = 47 | 48 | # The top-level source directory on which CMake was run. 49 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 50 | 51 | # The top-level build directory on which CMake was run. 52 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 53 | 54 | # Include any dependencies generated for this target. 55 | include CMakeFiles/hero.dir/depend.make 56 | 57 | # Include the progress variables for this target. 58 | include CMakeFiles/hero.dir/progress.make 59 | 60 | # Include the compile flags for this target's objects. 61 | include CMakeFiles/hero.dir/flags.make 62 | 63 | CMakeFiles/hero.dir/main.c.o: CMakeFiles/hero.dir/flags.make 64 | CMakeFiles/hero.dir/main.c.o: ../main.c 65 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/Users/alchemystar/mycode/hero/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/hero.dir/main.c.o" 66 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/hero.dir/main.c.o -c /Users/alchemystar/mycode/hero/main.c 67 | 68 | CMakeFiles/hero.dir/main.c.i: cmake_force 69 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/hero.dir/main.c.i" 70 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /Users/alchemystar/mycode/hero/main.c > CMakeFiles/hero.dir/main.c.i 71 | 72 | CMakeFiles/hero.dir/main.c.s: cmake_force 73 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/hero.dir/main.c.s" 74 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /Users/alchemystar/mycode/hero/main.c -o CMakeFiles/hero.dir/main.c.s 75 | 76 | CMakeFiles/hero.dir/main.c.o.requires: 77 | 78 | .PHONY : CMakeFiles/hero.dir/main.c.o.requires 79 | 80 | CMakeFiles/hero.dir/main.c.o.provides: CMakeFiles/hero.dir/main.c.o.requires 81 | $(MAKE) -f CMakeFiles/hero.dir/build.make CMakeFiles/hero.dir/main.c.o.provides.build 82 | .PHONY : CMakeFiles/hero.dir/main.c.o.provides 83 | 84 | CMakeFiles/hero.dir/main.c.o.provides.build: CMakeFiles/hero.dir/main.c.o 85 | 86 | 87 | # Object files for target hero 88 | hero_OBJECTS = \ 89 | "CMakeFiles/hero.dir/main.c.o" 90 | 91 | # External object files for target hero 92 | hero_EXTERNAL_OBJECTS = 93 | 94 | hero: CMakeFiles/hero.dir/main.c.o 95 | hero: CMakeFiles/hero.dir/build.make 96 | hero: net/libnet.a 97 | hero: /usr/local/lib/libtcmalloc_minimal.a 98 | hero: net/proto/libproto.a 99 | hero: net/com/libcom.a 100 | hero: CMakeFiles/hero.dir/link.txt 101 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/Users/alchemystar/mycode/hero/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C executable hero" 102 | $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/hero.dir/link.txt --verbose=$(VERBOSE) 103 | 104 | # Rule to build all files generated by this target. 105 | CMakeFiles/hero.dir/build: hero 106 | 107 | .PHONY : CMakeFiles/hero.dir/build 108 | 109 | CMakeFiles/hero.dir/requires: CMakeFiles/hero.dir/main.c.o.requires 110 | 111 | .PHONY : CMakeFiles/hero.dir/requires 112 | 113 | CMakeFiles/hero.dir/clean: 114 | $(CMAKE_COMMAND) -P CMakeFiles/hero.dir/cmake_clean.cmake 115 | .PHONY : CMakeFiles/hero.dir/clean 116 | 117 | CMakeFiles/hero.dir/depend: 118 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/alchemystar/mycode/hero /Users/alchemystar/mycode/hero /Users/alchemystar/mycode/hero/build /Users/alchemystar/mycode/hero/build /Users/alchemystar/mycode/hero/build/CMakeFiles/hero.dir/DependInfo.cmake --color=$(COLOR) 119 | .PHONY : CMakeFiles/hero.dir/depend 120 | 121 | -------------------------------------------------------------------------------- /build/CMakeFiles/hero.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/hero.dir/main.c.o" 3 | "hero.pdb" 4 | "hero" 5 | ) 6 | 7 | # Per-language clean rules from dependency scanning. 8 | foreach(lang C) 9 | include(CMakeFiles/hero.dir/cmake_clean_${lang}.cmake OPTIONAL) 10 | endforeach() 11 | -------------------------------------------------------------------------------- /build/CMakeFiles/hero.dir/depend.make: -------------------------------------------------------------------------------- 1 | # Empty dependencies file for hero. 2 | # This may be replaced when dependencies are built. 3 | -------------------------------------------------------------------------------- /build/CMakeFiles/hero.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # compile C with /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc 5 | C_FLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 6 | 7 | C_DEFINES = 8 | 9 | C_INCLUDES = -I/usr/local/Cellar/glib/2.58.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.42/include 10 | 11 | -------------------------------------------------------------------------------- /build/CMakeFiles/hero.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/hero.dir/main.c.o -o hero -L/usr/local/Cellar/glib/2.58.1/lib -L/usr/local/opt/gettext/lib -Wl,-rpath,/usr/local/Cellar/glib/2.58.1/lib -Wl,-rpath,/usr/local/opt/gettext/lib net/libnet.a -lglib-2.0 -lintl /usr/local/lib/libtcmalloc_minimal.a -lpthread -lstdc++ -lm net/proto/libproto.a net/com/libcom.a 2 | -------------------------------------------------------------------------------- /build/CMakeFiles/hero.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 5 2 | CMAKE_PROGRESS_2 = 6 3 | 4 | -------------------------------------------------------------------------------- /build/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 22 2 | -------------------------------------------------------------------------------- /build/Makefile: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Default target executed when no arguments are given to make. 5 | default_target: all 6 | 7 | .PHONY : default_target 8 | 9 | # Allow only one "make -f Makefile2" at a time, but pass parallelism. 10 | .NOTPARALLEL: 11 | 12 | 13 | #============================================================================= 14 | # Special targets provided by cmake. 15 | 16 | # Disable implicit rules so canonical targets will work. 17 | .SUFFIXES: 18 | 19 | 20 | # Remove some rules from gmake that .SUFFIXES does not remove. 21 | SUFFIXES = 22 | 23 | .SUFFIXES: .hpux_make_needs_suffix_list 24 | 25 | 26 | # Produce verbose output by default. 27 | VERBOSE = 1 28 | 29 | # Suppress display of executed commands. 30 | $(VERBOSE).SILENT: 31 | 32 | 33 | # A target that is always out of date. 34 | cmake_force: 35 | 36 | .PHONY : cmake_force 37 | 38 | #============================================================================= 39 | # Set environment variables for the build. 40 | 41 | # The shell in which to execute make rules. 42 | SHELL = /bin/sh 43 | 44 | # The CMake executable. 45 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 46 | 47 | # The command to remove a file. 48 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 49 | 50 | # Escaping for special characters. 51 | EQUALS = = 52 | 53 | # The top-level source directory on which CMake was run. 54 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 55 | 56 | # The top-level build directory on which CMake was run. 57 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 58 | 59 | #============================================================================= 60 | # Targets provided globally by CMake. 61 | 62 | # Special rule for the target rebuild_cache 63 | rebuild_cache: 64 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." 65 | /usr/local/Cellar/cmake/3.8.2/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 66 | .PHONY : rebuild_cache 67 | 68 | # Special rule for the target rebuild_cache 69 | rebuild_cache/fast: rebuild_cache 70 | 71 | .PHONY : rebuild_cache/fast 72 | 73 | # Special rule for the target edit_cache 74 | edit_cache: 75 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." 76 | /usr/local/Cellar/cmake/3.8.2/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 77 | .PHONY : edit_cache 78 | 79 | # Special rule for the target edit_cache 80 | edit_cache/fast: edit_cache 81 | 82 | .PHONY : edit_cache/fast 83 | 84 | # The main all target 85 | all: cmake_check_build_system 86 | $(CMAKE_COMMAND) -E cmake_progress_start /Users/alchemystar/mycode/hero/build/CMakeFiles /Users/alchemystar/mycode/hero/build/CMakeFiles/progress.marks 87 | $(MAKE) -f CMakeFiles/Makefile2 all 88 | $(CMAKE_COMMAND) -E cmake_progress_start /Users/alchemystar/mycode/hero/build/CMakeFiles 0 89 | .PHONY : all 90 | 91 | # The main clean target 92 | clean: 93 | $(MAKE) -f CMakeFiles/Makefile2 clean 94 | .PHONY : clean 95 | 96 | # The main clean target 97 | clean/fast: clean 98 | 99 | .PHONY : clean/fast 100 | 101 | # Prepare targets for installation. 102 | preinstall: all 103 | $(MAKE) -f CMakeFiles/Makefile2 preinstall 104 | .PHONY : preinstall 105 | 106 | # Prepare targets for installation. 107 | preinstall/fast: 108 | $(MAKE) -f CMakeFiles/Makefile2 preinstall 109 | .PHONY : preinstall/fast 110 | 111 | # clear depends 112 | depend: 113 | $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 114 | .PHONY : depend 115 | 116 | #============================================================================= 117 | # Target rules for targets named hero 118 | 119 | # Build rule for target. 120 | hero: cmake_check_build_system 121 | $(MAKE) -f CMakeFiles/Makefile2 hero 122 | .PHONY : hero 123 | 124 | # fast build rule for target. 125 | hero/fast: 126 | $(MAKE) -f CMakeFiles/hero.dir/build.make CMakeFiles/hero.dir/build 127 | .PHONY : hero/fast 128 | 129 | #============================================================================= 130 | # Target rules for targets named net 131 | 132 | # Build rule for target. 133 | net: cmake_check_build_system 134 | $(MAKE) -f CMakeFiles/Makefile2 net 135 | .PHONY : net 136 | 137 | # fast build rule for target. 138 | net/fast: 139 | $(MAKE) -f net/CMakeFiles/net.dir/build.make net/CMakeFiles/net.dir/build 140 | .PHONY : net/fast 141 | 142 | #============================================================================= 143 | # Target rules for targets named proto 144 | 145 | # Build rule for target. 146 | proto: cmake_check_build_system 147 | $(MAKE) -f CMakeFiles/Makefile2 proto 148 | .PHONY : proto 149 | 150 | # fast build rule for target. 151 | proto/fast: 152 | $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/build 153 | .PHONY : proto/fast 154 | 155 | #============================================================================= 156 | # Target rules for targets named com 157 | 158 | # Build rule for target. 159 | com: cmake_check_build_system 160 | $(MAKE) -f CMakeFiles/Makefile2 com 161 | .PHONY : com 162 | 163 | # fast build rule for target. 164 | com/fast: 165 | $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/build 166 | .PHONY : com/fast 167 | 168 | main.o: main.c.o 169 | 170 | .PHONY : main.o 171 | 172 | # target to build an object file 173 | main.c.o: 174 | $(MAKE) -f CMakeFiles/hero.dir/build.make CMakeFiles/hero.dir/main.c.o 175 | .PHONY : main.c.o 176 | 177 | main.i: main.c.i 178 | 179 | .PHONY : main.i 180 | 181 | # target to preprocess a source file 182 | main.c.i: 183 | $(MAKE) -f CMakeFiles/hero.dir/build.make CMakeFiles/hero.dir/main.c.i 184 | .PHONY : main.c.i 185 | 186 | main.s: main.c.s 187 | 188 | .PHONY : main.s 189 | 190 | # target to generate assembly for a file 191 | main.c.s: 192 | $(MAKE) -f CMakeFiles/hero.dir/build.make CMakeFiles/hero.dir/main.c.s 193 | .PHONY : main.c.s 194 | 195 | # Help Target 196 | help: 197 | @echo "The following are some of the valid targets for this Makefile:" 198 | @echo "... all (the default if no target is provided)" 199 | @echo "... clean" 200 | @echo "... depend" 201 | @echo "... rebuild_cache" 202 | @echo "... edit_cache" 203 | @echo "... hero" 204 | @echo "... net" 205 | @echo "... proto" 206 | @echo "... com" 207 | @echo "... main.o" 208 | @echo "... main.i" 209 | @echo "... main.s" 210 | .PHONY : help 211 | 212 | 213 | 214 | #============================================================================= 215 | # Special targets to cleanup operation of make. 216 | 217 | # Special rule to run CMake to check the build system integrity. 218 | # No rule that depends on this can have commands that come from listfiles 219 | # because they might be regenerated. 220 | cmake_check_build_system: 221 | $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 222 | .PHONY : cmake_check_build_system 223 | 224 | -------------------------------------------------------------------------------- /build/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /Users/alchemystar/mycode/hero 2 | 3 | # Set the install prefix 4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | set(CMAKE_INSTALL_PREFIX "/usr/local") 6 | endif() 7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | if(BUILD_TYPE) 12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | else() 15 | set(CMAKE_INSTALL_CONFIG_NAME "") 16 | endif() 17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | endif() 19 | 20 | # Set the component getting installed. 21 | if(NOT CMAKE_INSTALL_COMPONENT) 22 | if(COMPONENT) 23 | message(STATUS "Install component: \"${COMPONENT}\"") 24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | else() 26 | set(CMAKE_INSTALL_COMPONENT) 27 | endif() 28 | endif() 29 | 30 | if(NOT CMAKE_INSTALL_LOCAL_ONLY) 31 | # Include the install script for each subdirectory. 32 | include("/Users/alchemystar/mycode/hero/build/net/cmake_install.cmake") 33 | 34 | endif() 35 | 36 | if(CMAKE_INSTALL_COMPONENT) 37 | set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") 38 | else() 39 | set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") 40 | endif() 41 | 42 | string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT 43 | "${CMAKE_INSTALL_MANIFEST_FILES}") 44 | file(WRITE "/Users/alchemystar/mycode/hero/build/${CMAKE_INSTALL_MANIFEST}" 45 | "${CMAKE_INSTALL_MANIFEST_CONTENT}") 46 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/CMakeDirectoryInformation.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Relative path conversion top directories. 5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/alchemystar/mycode/hero") 6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/alchemystar/mycode/hero/build") 7 | 8 | # Force unix paths in dependencies. 9 | set(CMAKE_FORCE_UNIX_PATHS 1) 10 | 11 | 12 | # The C and CXX include file regular expressions for this directory. 13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") 14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") 15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) 16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) 17 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/com.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | ) 4 | # The set of files for implicit dependencies of each language: 5 | 6 | # Targets to which this target links. 7 | set(CMAKE_TARGET_LINKED_INFO_FILES 8 | ) 9 | 10 | # Fortran module output directory. 11 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 12 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/com.dir/build.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Delete rule output on recipe failure. 5 | .DELETE_ON_ERROR: 6 | 7 | 8 | #============================================================================= 9 | # Special targets provided by cmake. 10 | 11 | # Disable implicit rules so canonical targets will work. 12 | .SUFFIXES: 13 | 14 | 15 | # Remove some rules from gmake that .SUFFIXES does not remove. 16 | SUFFIXES = 17 | 18 | .SUFFIXES: .hpux_make_needs_suffix_list 19 | 20 | 21 | # Suppress display of executed commands. 22 | $(VERBOSE).SILENT: 23 | 24 | 25 | # A target that is always out of date. 26 | cmake_force: 27 | 28 | .PHONY : cmake_force 29 | 30 | #============================================================================= 31 | # Set environment variables for the build. 32 | 33 | # The shell in which to execute make rules. 34 | SHELL = /bin/sh 35 | 36 | # The CMake executable. 37 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 38 | 39 | # The command to remove a file. 40 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 41 | 42 | # Escaping for special characters. 43 | EQUALS = = 44 | 45 | # The top-level source directory on which CMake was run. 46 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 47 | 48 | # The top-level build directory on which CMake was run. 49 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 50 | 51 | # Include any dependencies generated for this target. 52 | include net/CMakeFiles/com.dir/depend.make 53 | 54 | # Include the progress variables for this target. 55 | include net/CMakeFiles/com.dir/progress.make 56 | 57 | # Include the compile flags for this target's objects. 58 | include net/CMakeFiles/com.dir/flags.make 59 | 60 | net/CMakeFiles/com.dir/requires: 61 | 62 | .PHONY : net/CMakeFiles/com.dir/requires 63 | 64 | net/CMakeFiles/com.dir/clean: 65 | cd /Users/alchemystar/mycode/hero/build/net && $(CMAKE_COMMAND) -P CMakeFiles/com.dir/cmake_clean.cmake 66 | .PHONY : net/CMakeFiles/com.dir/clean 67 | 68 | net/CMakeFiles/com.dir/depend: 69 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/alchemystar/mycode/hero /Users/alchemystar/mycode/hero/net /Users/alchemystar/mycode/hero/build /Users/alchemystar/mycode/hero/build/net /Users/alchemystar/mycode/hero/build/net/CMakeFiles/com.dir/DependInfo.cmake --color=$(COLOR) 70 | .PHONY : net/CMakeFiles/com.dir/depend 71 | 72 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/com.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Per-language clean rules from dependency scanning. 3 | foreach(lang ) 4 | include(CMakeFiles/com.dir/cmake_clean_${lang}.cmake OPTIONAL) 5 | endforeach() 6 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/com.dir/depend.make: -------------------------------------------------------------------------------- 1 | # Empty dependencies file for com. 2 | # This may be replaced when dependencies are built. 3 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/com.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/com.dir/progress.make: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/command_lib.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | ) 4 | # The set of files for implicit dependencies of each language: 5 | 6 | # Targets to which this target links. 7 | set(CMAKE_TARGET_LINKED_INFO_FILES 8 | ) 9 | 10 | # Fortran module output directory. 11 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 12 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/command_lib.dir/build.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Delete rule output on recipe failure. 5 | .DELETE_ON_ERROR: 6 | 7 | 8 | #============================================================================= 9 | # Special targets provided by cmake. 10 | 11 | # Disable implicit rules so canonical targets will work. 12 | .SUFFIXES: 13 | 14 | 15 | # Remove some rules from gmake that .SUFFIXES does not remove. 16 | SUFFIXES = 17 | 18 | .SUFFIXES: .hpux_make_needs_suffix_list 19 | 20 | 21 | # Suppress display of executed commands. 22 | $(VERBOSE).SILENT: 23 | 24 | 25 | # A target that is always out of date. 26 | cmake_force: 27 | 28 | .PHONY : cmake_force 29 | 30 | #============================================================================= 31 | # Set environment variables for the build. 32 | 33 | # The shell in which to execute make rules. 34 | SHELL = /bin/sh 35 | 36 | # The CMake executable. 37 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 38 | 39 | # The command to remove a file. 40 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 41 | 42 | # Escaping for special characters. 43 | EQUALS = = 44 | 45 | # The top-level source directory on which CMake was run. 46 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 47 | 48 | # The top-level build directory on which CMake was run. 49 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 50 | 51 | # Include any dependencies generated for this target. 52 | include net/CMakeFiles/command_lib.dir/depend.make 53 | 54 | # Include the progress variables for this target. 55 | include net/CMakeFiles/command_lib.dir/progress.make 56 | 57 | # Include the compile flags for this target's objects. 58 | include net/CMakeFiles/command_lib.dir/flags.make 59 | 60 | net/CMakeFiles/command_lib.dir/requires: 61 | 62 | .PHONY : net/CMakeFiles/command_lib.dir/requires 63 | 64 | net/CMakeFiles/command_lib.dir/clean: 65 | cd /Users/alchemystar/mycode/hero/build/net && $(CMAKE_COMMAND) -P CMakeFiles/command_lib.dir/cmake_clean.cmake 66 | .PHONY : net/CMakeFiles/command_lib.dir/clean 67 | 68 | net/CMakeFiles/command_lib.dir/depend: 69 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/alchemystar/mycode/hero /Users/alchemystar/mycode/hero/net /Users/alchemystar/mycode/hero/build /Users/alchemystar/mycode/hero/build/net /Users/alchemystar/mycode/hero/build/net/CMakeFiles/command_lib.dir/DependInfo.cmake --color=$(COLOR) 70 | .PHONY : net/CMakeFiles/command_lib.dir/depend 71 | 72 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/command_lib.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Per-language clean rules from dependency scanning. 3 | foreach(lang ) 4 | include(CMakeFiles/command_lib.dir/cmake_clean_${lang}.cmake OPTIONAL) 5 | endforeach() 6 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/command_lib.dir/depend.make: -------------------------------------------------------------------------------- 1 | # Empty dependencies file for command_lib. 2 | # This may be replaced when dependencies are built. 3 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/command_lib.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/command_lib.dir/progress.make: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/net.dir/C.includecache: -------------------------------------------------------------------------------- 1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) 2 | 3 | #IncludeRegexScan: ^.*$ 4 | 5 | #IncludeRegexComplain: ^$ 6 | 7 | #IncludeRegexTransform: 8 | 9 | /Users/alchemystar/mycode/hero/net/basic.c 10 | basic.h 11 | /Users/alchemystar/mycode/hero/net/basic.h 12 | stdio.h 13 | - 14 | stdlib.h 15 | - 16 | signal.h 17 | - 18 | 19 | /Users/alchemystar/mycode/hero/net/basic.h 20 | sys/time.h 21 | - 22 | stdio.h 23 | - 24 | sys/errno.h 25 | - 26 | unistd.h 27 | - 28 | 29 | /Users/alchemystar/mycode/hero/net/buffer_util.c 30 | buffer_util.h 31 | /Users/alchemystar/mycode/hero/net/buffer_util.h 32 | string.h 33 | - 34 | config.h 35 | /Users/alchemystar/mycode/hero/net/config.h 36 | stdio.h 37 | - 38 | basic.h 39 | /Users/alchemystar/mycode/hero/net/basic.h 40 | 41 | /Users/alchemystar/mycode/hero/net/buffer_util.h 42 | basic.h 43 | /Users/alchemystar/mycode/hero/net/basic.h 44 | 45 | /Users/alchemystar/mycode/hero/net/com/select_handle.h 46 | ../basic.h 47 | /Users/alchemystar/mycode/hero/net/basic.h 48 | ../network.h 49 | /Users/alchemystar/mycode/hero/net/network.h 50 | 51 | /Users/alchemystar/mycode/hero/net/com/show_handle.h 52 | ../basic.h 53 | /Users/alchemystar/mycode/hero/net/basic.h 54 | ../network.h 55 | /Users/alchemystar/mycode/hero/net/network.h 56 | 57 | /Users/alchemystar/mycode/hero/net/config.h 58 | 59 | /Users/alchemystar/mycode/hero/net/conn.c 60 | conn.h 61 | /Users/alchemystar/mycode/hero/net/conn.h 62 | sys/socket.h 63 | - 64 | arpa/inet.h 65 | - 66 | basic.h 67 | /Users/alchemystar/mycode/hero/net/basic.h 68 | fcntl.h 69 | - 70 | netinet/in.h 71 | - 72 | netinet/tcp.h 73 | - 74 | 75 | /Users/alchemystar/mycode/hero/net/conn.h 76 | basic.h 77 | /Users/alchemystar/mycode/hero/net/basic.h 78 | proto/packet.h 79 | /Users/alchemystar/mycode/hero/net/proto/packet.h 80 | stdatomic.h 81 | /Users/alchemystar/mycode/hero/net/stdatomic.h 82 | sys/socket.h 83 | - 84 | netinet/in.h 85 | - 86 | fcntl.h 87 | - 88 | netinet/tcp.h 89 | - 90 | memory.h 91 | - 92 | 93 | /Users/alchemystar/mycode/hero/net/hero_poll.c 94 | hero_poll.h 95 | /Users/alchemystar/mycode/hero/net/hero_poll.h 96 | sys/epoll.h 97 | - 98 | sys/errno.h 99 | - 100 | hero_worker.h 101 | /Users/alchemystar/mycode/hero/net/hero_worker.h 102 | 103 | /Users/alchemystar/mycode/hero/net/hero_poll.h 104 | conn.h 105 | /Users/alchemystar/mycode/hero/net/conn.h 106 | basic.h 107 | /Users/alchemystar/mycode/hero/net/basic.h 108 | 109 | /Users/alchemystar/mycode/hero/net/hero_worker.c 110 | hero_worker.h 111 | /Users/alchemystar/mycode/hero/net/hero_worker.h 112 | pthread.h 113 | - 114 | basic.h 115 | /Users/alchemystar/mycode/hero/net/basic.h 116 | hero_poll.h 117 | /Users/alchemystar/mycode/hero/net/hero_poll.h 118 | sys/epoll.h 119 | - 120 | network.h 121 | /Users/alchemystar/mycode/hero/net/network.h 122 | 123 | /Users/alchemystar/mycode/hero/net/hero_worker.h 124 | basic.h 125 | /Users/alchemystar/mycode/hero/net/basic.h 126 | conn.h 127 | /Users/alchemystar/mycode/hero/net/conn.h 128 | 129 | /Users/alchemystar/mycode/hero/net/network.c 130 | sys/socket.h 131 | - 132 | stdlib.h 133 | - 134 | proto/capacity.h 135 | /Users/alchemystar/mycode/hero/net/proto/capacity.h 136 | network.h 137 | /Users/alchemystar/mycode/hero/net/network.h 138 | config.h 139 | /Users/alchemystar/mycode/hero/net/config.h 140 | proto/packet_const.h 141 | /Users/alchemystar/mycode/hero/net/proto/packet_const.h 142 | buffer_util.h 143 | /Users/alchemystar/mycode/hero/net/buffer_util.h 144 | sys/errno.h 145 | - 146 | string.h 147 | - 148 | password.h 149 | /Users/alchemystar/mycode/hero/net/password.h 150 | query.h 151 | /Users/alchemystar/mycode/hero/net/query.h 152 | conn.h 153 | /Users/alchemystar/mycode/hero/net/conn.h 154 | 155 | /Users/alchemystar/mycode/hero/net/network.h 156 | proto/packet.h 157 | /Users/alchemystar/mycode/hero/net/proto/packet.h 158 | basic.h 159 | /Users/alchemystar/mycode/hero/net/basic.h 160 | netinet/in.h 161 | - 162 | conn.h 163 | /Users/alchemystar/mycode/hero/net/conn.h 164 | 165 | /Users/alchemystar/mycode/hero/net/password.c 166 | stdlib.h 167 | - 168 | stdio.h 169 | - 170 | string.h 171 | - 172 | password.h 173 | /Users/alchemystar/mycode/hero/net/password.h 174 | 175 | /Users/alchemystar/mycode/hero/net/password.h 176 | sys/types.h 177 | - 178 | 179 | /Users/alchemystar/mycode/hero/net/proto/capacity.h 180 | 181 | /Users/alchemystar/mycode/hero/net/proto/list.h 182 | 183 | /Users/alchemystar/mycode/hero/net/proto/packet.h 184 | stdio.h 185 | - 186 | list.h 187 | /Users/alchemystar/mycode/hero/net/proto/list.h 188 | ../buffer_util.h 189 | /Users/alchemystar/mycode/hero/net/buffer_util.h 190 | 191 | /Users/alchemystar/mycode/hero/net/proto/packet_const.h 192 | 193 | /Users/alchemystar/mycode/hero/net/query.c 194 | query.h 195 | /Users/alchemystar/mycode/hero/net/query.h 196 | config.h 197 | /Users/alchemystar/mycode/hero/net/config.h 198 | buffer_util.h 199 | /Users/alchemystar/mycode/hero/net/buffer_util.h 200 | server_parse.h 201 | /Users/alchemystar/mycode/hero/net/server_parse.h 202 | com/show_handle.h 203 | /Users/alchemystar/mycode/hero/net/com/show_handle.h 204 | com/select_handle.h 205 | /Users/alchemystar/mycode/hero/net/com/select_handle.h 206 | network.h 207 | /Users/alchemystar/mycode/hero/net/network.h 208 | sql_error_code.h 209 | /Users/alchemystar/mycode/hero/net/sql_error_code.h 210 | 211 | /Users/alchemystar/mycode/hero/net/query.h 212 | proto/packet.h 213 | /Users/alchemystar/mycode/hero/net/proto/packet.h 214 | conn.h 215 | /Users/alchemystar/mycode/hero/net/conn.h 216 | 217 | /Users/alchemystar/mycode/hero/net/server.c 218 | server.h 219 | /Users/alchemystar/mycode/hero/net/server.h 220 | basic.h 221 | /Users/alchemystar/mycode/hero/net/basic.h 222 | network.h 223 | /Users/alchemystar/mycode/hero/net/network.h 224 | sys/sysinfo.h 225 | - 226 | 227 | /Users/alchemystar/mycode/hero/net/server.h 228 | stdio.h 229 | - 230 | config.h 231 | /Users/alchemystar/mycode/hero/net/config.h 232 | proto/packet.h 233 | /Users/alchemystar/mycode/hero/net/proto/packet.h 234 | sys/socket.h 235 | - 236 | netinet/in.h 237 | - 238 | hero_poll.h 239 | /Users/alchemystar/mycode/hero/net/hero_poll.h 240 | 241 | /Users/alchemystar/mycode/hero/net/server_parse.c 242 | server_parse.h 243 | /Users/alchemystar/mycode/hero/net/server_parse.h 244 | string.h 245 | - 246 | 247 | /Users/alchemystar/mycode/hero/net/server_parse.h 248 | 249 | /Users/alchemystar/mycode/hero/net/session.c 250 | 251 | /Users/alchemystar/mycode/hero/net/sql_error_code.h 252 | 253 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/net.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "C" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_C 7 | "/Users/alchemystar/mycode/hero/net/basic.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/basic.c.o" 8 | "/Users/alchemystar/mycode/hero/net/buffer_util.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/buffer_util.c.o" 9 | "/Users/alchemystar/mycode/hero/net/conn.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/conn.c.o" 10 | "/Users/alchemystar/mycode/hero/net/datasource.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/datasource.c.o" 11 | "/Users/alchemystar/mycode/hero/net/hero_poll.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/hero_poll.c.o" 12 | "/Users/alchemystar/mycode/hero/net/hero_worker.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/hero_worker.c.o" 13 | "/Users/alchemystar/mycode/hero/net/network.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/network.c.o" 14 | "/Users/alchemystar/mycode/hero/net/password.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/password.c.o" 15 | "/Users/alchemystar/mycode/hero/net/query.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/query.c.o" 16 | "/Users/alchemystar/mycode/hero/net/server.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/server.c.o" 17 | "/Users/alchemystar/mycode/hero/net/server_parse.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/server_parse.c.o" 18 | "/Users/alchemystar/mycode/hero/net/session.c" "/Users/alchemystar/mycode/hero/build/net/CMakeFiles/net.dir/session.c.o" 19 | ) 20 | set(CMAKE_C_COMPILER_ID "Clang") 21 | 22 | # The include file search paths: 23 | set(CMAKE_C_TARGET_INCLUDE_PATH 24 | "/usr/local/Cellar/glib/2.58.1/include/glib-2.0" 25 | "/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include" 26 | "/usr/local/opt/gettext/include" 27 | "/usr/local/Cellar/pcre/8.42/include" 28 | ) 29 | 30 | # Targets to which this target links. 31 | set(CMAKE_TARGET_LINKED_INFO_FILES 32 | "/Users/alchemystar/mycode/hero/build/net/proto/CMakeFiles/proto.dir/DependInfo.cmake" 33 | "/Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/com.dir/DependInfo.cmake" 34 | ) 35 | 36 | # Fortran module output directory. 37 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 38 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/net.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/net.dir/basic.c.o" 3 | "CMakeFiles/net.dir/buffer_util.c.o" 4 | "CMakeFiles/net.dir/conn.c.o" 5 | "CMakeFiles/net.dir/datasource.c.o" 6 | "CMakeFiles/net.dir/hero_poll.c.o" 7 | "CMakeFiles/net.dir/hero_worker.c.o" 8 | "CMakeFiles/net.dir/network.c.o" 9 | "CMakeFiles/net.dir/password.c.o" 10 | "CMakeFiles/net.dir/query.c.o" 11 | "CMakeFiles/net.dir/server.c.o" 12 | "CMakeFiles/net.dir/server_parse.c.o" 13 | "CMakeFiles/net.dir/session.c.o" 14 | "libnet.pdb" 15 | "libnet.a" 16 | ) 17 | 18 | # Per-language clean rules from dependency scanning. 19 | foreach(lang C) 20 | include(CMakeFiles/net.dir/cmake_clean_${lang}.cmake OPTIONAL) 21 | endforeach() 22 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/net.dir/cmake_clean_target.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "libnet.a" 3 | ) 4 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/net.dir/depend.internal: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | net/CMakeFiles/net.dir/basic.c.o 5 | /Users/alchemystar/mycode/hero/net/basic.c 6 | /Users/alchemystar/mycode/hero/net/basic.h 7 | net/CMakeFiles/net.dir/buffer_util.c.o 8 | /Users/alchemystar/mycode/hero/net/basic.h 9 | /Users/alchemystar/mycode/hero/net/buffer_util.c 10 | /Users/alchemystar/mycode/hero/net/buffer_util.h 11 | /Users/alchemystar/mycode/hero/net/config.h 12 | net/CMakeFiles/net.dir/conn.c.o 13 | /Users/alchemystar/mycode/hero/net/basic.h 14 | /Users/alchemystar/mycode/hero/net/buffer_util.h 15 | /Users/alchemystar/mycode/hero/net/conn.c 16 | /Users/alchemystar/mycode/hero/net/conn.h 17 | /Users/alchemystar/mycode/hero/net/proto/list.h 18 | /Users/alchemystar/mycode/hero/net/proto/packet.h 19 | net/CMakeFiles/net.dir/hero_poll.c.o 20 | /Users/alchemystar/mycode/hero/net/basic.h 21 | /Users/alchemystar/mycode/hero/net/buffer_util.h 22 | /Users/alchemystar/mycode/hero/net/conn.h 23 | /Users/alchemystar/mycode/hero/net/hero_poll.c 24 | /Users/alchemystar/mycode/hero/net/hero_poll.h 25 | /Users/alchemystar/mycode/hero/net/hero_worker.h 26 | /Users/alchemystar/mycode/hero/net/proto/list.h 27 | /Users/alchemystar/mycode/hero/net/proto/packet.h 28 | net/CMakeFiles/net.dir/hero_worker.c.o 29 | /Users/alchemystar/mycode/hero/net/basic.h 30 | /Users/alchemystar/mycode/hero/net/buffer_util.h 31 | /Users/alchemystar/mycode/hero/net/conn.h 32 | /Users/alchemystar/mycode/hero/net/hero_poll.h 33 | /Users/alchemystar/mycode/hero/net/hero_worker.c 34 | /Users/alchemystar/mycode/hero/net/hero_worker.h 35 | /Users/alchemystar/mycode/hero/net/network.h 36 | /Users/alchemystar/mycode/hero/net/proto/list.h 37 | /Users/alchemystar/mycode/hero/net/proto/packet.h 38 | net/CMakeFiles/net.dir/network.c.o 39 | /Users/alchemystar/mycode/hero/net/basic.h 40 | /Users/alchemystar/mycode/hero/net/buffer_util.h 41 | /Users/alchemystar/mycode/hero/net/config.h 42 | /Users/alchemystar/mycode/hero/net/conn.h 43 | /Users/alchemystar/mycode/hero/net/network.c 44 | /Users/alchemystar/mycode/hero/net/network.h 45 | /Users/alchemystar/mycode/hero/net/password.h 46 | /Users/alchemystar/mycode/hero/net/proto/capacity.h 47 | /Users/alchemystar/mycode/hero/net/proto/list.h 48 | /Users/alchemystar/mycode/hero/net/proto/packet.h 49 | /Users/alchemystar/mycode/hero/net/proto/packet_const.h 50 | /Users/alchemystar/mycode/hero/net/query.h 51 | net/CMakeFiles/net.dir/password.c.o 52 | /Users/alchemystar/mycode/hero/net/password.c 53 | /Users/alchemystar/mycode/hero/net/password.h 54 | net/CMakeFiles/net.dir/query.c.o 55 | /Users/alchemystar/mycode/hero/net/basic.h 56 | /Users/alchemystar/mycode/hero/net/buffer_util.h 57 | /Users/alchemystar/mycode/hero/net/com/select_handle.h 58 | /Users/alchemystar/mycode/hero/net/com/show_handle.h 59 | /Users/alchemystar/mycode/hero/net/config.h 60 | /Users/alchemystar/mycode/hero/net/conn.h 61 | /Users/alchemystar/mycode/hero/net/network.h 62 | /Users/alchemystar/mycode/hero/net/proto/list.h 63 | /Users/alchemystar/mycode/hero/net/proto/packet.h 64 | /Users/alchemystar/mycode/hero/net/query.c 65 | /Users/alchemystar/mycode/hero/net/query.h 66 | /Users/alchemystar/mycode/hero/net/server_parse.h 67 | /Users/alchemystar/mycode/hero/net/sql_error_code.h 68 | net/CMakeFiles/net.dir/server.c.o 69 | /Users/alchemystar/mycode/hero/net/basic.h 70 | /Users/alchemystar/mycode/hero/net/buffer_util.h 71 | /Users/alchemystar/mycode/hero/net/config.h 72 | /Users/alchemystar/mycode/hero/net/conn.h 73 | /Users/alchemystar/mycode/hero/net/hero_poll.h 74 | /Users/alchemystar/mycode/hero/net/network.h 75 | /Users/alchemystar/mycode/hero/net/proto/list.h 76 | /Users/alchemystar/mycode/hero/net/proto/packet.h 77 | /Users/alchemystar/mycode/hero/net/server.c 78 | /Users/alchemystar/mycode/hero/net/server.h 79 | net/CMakeFiles/net.dir/server_parse.c.o 80 | /Users/alchemystar/mycode/hero/net/server_parse.c 81 | /Users/alchemystar/mycode/hero/net/server_parse.h 82 | net/CMakeFiles/net.dir/session.c.o 83 | /Users/alchemystar/mycode/hero/net/session.c 84 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/net.dir/depend.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | net/CMakeFiles/net.dir/basic.c.o: ../net/basic.c 5 | net/CMakeFiles/net.dir/basic.c.o: ../net/basic.h 6 | 7 | net/CMakeFiles/net.dir/buffer_util.c.o: ../net/basic.h 8 | net/CMakeFiles/net.dir/buffer_util.c.o: ../net/buffer_util.c 9 | net/CMakeFiles/net.dir/buffer_util.c.o: ../net/buffer_util.h 10 | net/CMakeFiles/net.dir/buffer_util.c.o: ../net/config.h 11 | 12 | net/CMakeFiles/net.dir/conn.c.o: ../net/basic.h 13 | net/CMakeFiles/net.dir/conn.c.o: ../net/buffer_util.h 14 | net/CMakeFiles/net.dir/conn.c.o: ../net/conn.c 15 | net/CMakeFiles/net.dir/conn.c.o: ../net/conn.h 16 | net/CMakeFiles/net.dir/conn.c.o: ../net/proto/list.h 17 | net/CMakeFiles/net.dir/conn.c.o: ../net/proto/packet.h 18 | 19 | net/CMakeFiles/net.dir/hero_poll.c.o: ../net/basic.h 20 | net/CMakeFiles/net.dir/hero_poll.c.o: ../net/buffer_util.h 21 | net/CMakeFiles/net.dir/hero_poll.c.o: ../net/conn.h 22 | net/CMakeFiles/net.dir/hero_poll.c.o: ../net/hero_poll.c 23 | net/CMakeFiles/net.dir/hero_poll.c.o: ../net/hero_poll.h 24 | net/CMakeFiles/net.dir/hero_poll.c.o: ../net/hero_worker.h 25 | net/CMakeFiles/net.dir/hero_poll.c.o: ../net/proto/list.h 26 | net/CMakeFiles/net.dir/hero_poll.c.o: ../net/proto/packet.h 27 | 28 | net/CMakeFiles/net.dir/hero_worker.c.o: ../net/basic.h 29 | net/CMakeFiles/net.dir/hero_worker.c.o: ../net/buffer_util.h 30 | net/CMakeFiles/net.dir/hero_worker.c.o: ../net/conn.h 31 | net/CMakeFiles/net.dir/hero_worker.c.o: ../net/hero_poll.h 32 | net/CMakeFiles/net.dir/hero_worker.c.o: ../net/hero_worker.c 33 | net/CMakeFiles/net.dir/hero_worker.c.o: ../net/hero_worker.h 34 | net/CMakeFiles/net.dir/hero_worker.c.o: ../net/network.h 35 | net/CMakeFiles/net.dir/hero_worker.c.o: ../net/proto/list.h 36 | net/CMakeFiles/net.dir/hero_worker.c.o: ../net/proto/packet.h 37 | 38 | net/CMakeFiles/net.dir/network.c.o: ../net/basic.h 39 | net/CMakeFiles/net.dir/network.c.o: ../net/buffer_util.h 40 | net/CMakeFiles/net.dir/network.c.o: ../net/config.h 41 | net/CMakeFiles/net.dir/network.c.o: ../net/conn.h 42 | net/CMakeFiles/net.dir/network.c.o: ../net/network.c 43 | net/CMakeFiles/net.dir/network.c.o: ../net/network.h 44 | net/CMakeFiles/net.dir/network.c.o: ../net/password.h 45 | net/CMakeFiles/net.dir/network.c.o: ../net/proto/capacity.h 46 | net/CMakeFiles/net.dir/network.c.o: ../net/proto/list.h 47 | net/CMakeFiles/net.dir/network.c.o: ../net/proto/packet.h 48 | net/CMakeFiles/net.dir/network.c.o: ../net/proto/packet_const.h 49 | net/CMakeFiles/net.dir/network.c.o: ../net/query.h 50 | 51 | net/CMakeFiles/net.dir/password.c.o: ../net/password.c 52 | net/CMakeFiles/net.dir/password.c.o: ../net/password.h 53 | 54 | net/CMakeFiles/net.dir/query.c.o: ../net/basic.h 55 | net/CMakeFiles/net.dir/query.c.o: ../net/buffer_util.h 56 | net/CMakeFiles/net.dir/query.c.o: ../net/com/select_handle.h 57 | net/CMakeFiles/net.dir/query.c.o: ../net/com/show_handle.h 58 | net/CMakeFiles/net.dir/query.c.o: ../net/config.h 59 | net/CMakeFiles/net.dir/query.c.o: ../net/conn.h 60 | net/CMakeFiles/net.dir/query.c.o: ../net/network.h 61 | net/CMakeFiles/net.dir/query.c.o: ../net/proto/list.h 62 | net/CMakeFiles/net.dir/query.c.o: ../net/proto/packet.h 63 | net/CMakeFiles/net.dir/query.c.o: ../net/query.c 64 | net/CMakeFiles/net.dir/query.c.o: ../net/query.h 65 | net/CMakeFiles/net.dir/query.c.o: ../net/server_parse.h 66 | net/CMakeFiles/net.dir/query.c.o: ../net/sql_error_code.h 67 | 68 | net/CMakeFiles/net.dir/server.c.o: ../net/basic.h 69 | net/CMakeFiles/net.dir/server.c.o: ../net/buffer_util.h 70 | net/CMakeFiles/net.dir/server.c.o: ../net/config.h 71 | net/CMakeFiles/net.dir/server.c.o: ../net/conn.h 72 | net/CMakeFiles/net.dir/server.c.o: ../net/hero_poll.h 73 | net/CMakeFiles/net.dir/server.c.o: ../net/network.h 74 | net/CMakeFiles/net.dir/server.c.o: ../net/proto/list.h 75 | net/CMakeFiles/net.dir/server.c.o: ../net/proto/packet.h 76 | net/CMakeFiles/net.dir/server.c.o: ../net/server.c 77 | net/CMakeFiles/net.dir/server.c.o: ../net/server.h 78 | 79 | net/CMakeFiles/net.dir/server_parse.c.o: ../net/server_parse.c 80 | net/CMakeFiles/net.dir/server_parse.c.o: ../net/server_parse.h 81 | 82 | net/CMakeFiles/net.dir/session.c.o: ../net/session.c 83 | 84 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/net.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # compile C with /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc 5 | C_FLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 6 | 7 | C_DEFINES = 8 | 9 | C_INCLUDES = -I/usr/local/Cellar/glib/2.58.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.42/include 10 | 11 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/net.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc libnet.a CMakeFiles/net.dir/basic.c.o CMakeFiles/net.dir/buffer_util.c.o CMakeFiles/net.dir/conn.c.o CMakeFiles/net.dir/datasource.c.o CMakeFiles/net.dir/hero_poll.c.o CMakeFiles/net.dir/hero_worker.c.o CMakeFiles/net.dir/network.c.o CMakeFiles/net.dir/password.c.o CMakeFiles/net.dir/query.c.o CMakeFiles/net.dir/server.c.o CMakeFiles/net.dir/server_parse.c.o CMakeFiles/net.dir/session.c.o 2 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib libnet.a 3 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/net.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 7 2 | CMAKE_PROGRESS_2 = 8 3 | CMAKE_PROGRESS_3 = 9 4 | CMAKE_PROGRESS_4 = 10 5 | CMAKE_PROGRESS_5 = 11 6 | CMAKE_PROGRESS_6 = 12 7 | CMAKE_PROGRESS_7 = 13 8 | CMAKE_PROGRESS_8 = 14 9 | CMAKE_PROGRESS_9 = 15 10 | CMAKE_PROGRESS_10 = 16 11 | CMAKE_PROGRESS_11 = 17 12 | CMAKE_PROGRESS_12 = 18 13 | CMAKE_PROGRESS_13 = 19 14 | 15 | -------------------------------------------------------------------------------- /build/net/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 20 2 | -------------------------------------------------------------------------------- /build/net/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /Users/alchemystar/mycode/hero/net 2 | 3 | # Set the install prefix 4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | set(CMAKE_INSTALL_PREFIX "/usr/local") 6 | endif() 7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | if(BUILD_TYPE) 12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | else() 15 | set(CMAKE_INSTALL_CONFIG_NAME "") 16 | endif() 17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | endif() 19 | 20 | # Set the component getting installed. 21 | if(NOT CMAKE_INSTALL_COMPONENT) 22 | if(COMPONENT) 23 | message(STATUS "Install component: \"${COMPONENT}\"") 24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | else() 26 | set(CMAKE_INSTALL_COMPONENT) 27 | endif() 28 | endif() 29 | 30 | if(NOT CMAKE_INSTALL_LOCAL_ONLY) 31 | # Include the install script for each subdirectory. 32 | include("/Users/alchemystar/mycode/hero/build/net/proto/cmake_install.cmake") 33 | include("/Users/alchemystar/mycode/hero/build/net/com/cmake_install.cmake") 34 | 35 | endif() 36 | 37 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/CMakeDirectoryInformation.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Relative path conversion top directories. 5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/alchemystar/mycode/hero") 6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/alchemystar/mycode/hero/build") 7 | 8 | # Force unix paths in dependencies. 9 | set(CMAKE_FORCE_UNIX_PATHS 1) 10 | 11 | 12 | # The C and CXX include file regular expressions for this directory. 13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") 14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") 15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) 16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) 17 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/C.includecache: -------------------------------------------------------------------------------- 1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) 2 | 3 | #IncludeRegexScan: ^.*$ 4 | 5 | #IncludeRegexComplain: ^$ 6 | 7 | #IncludeRegexTransform: 8 | 9 | /Users/alchemystar/mycode/hero/net/basic.h 10 | sys/time.h 11 | - 12 | stdio.h 13 | - 14 | sys/errno.h 15 | - 16 | unistd.h 17 | - 18 | 19 | /Users/alchemystar/mycode/hero/net/buffer_util.h 20 | basic.h 21 | /Users/alchemystar/mycode/hero/net/basic.h 22 | 23 | /Users/alchemystar/mycode/hero/net/com/handle_util.c 24 | handle_util.h 25 | /Users/alchemystar/mycode/hero/net/com/handle_util.h 26 | 27 | /Users/alchemystar/mycode/hero/net/com/handle_util.h 28 | ../config.h 29 | /Users/alchemystar/mycode/hero/net/config.h 30 | 31 | /Users/alchemystar/mycode/hero/net/com/select_handle.c 32 | select_handle.h 33 | /Users/alchemystar/mycode/hero/net/com/select_handle.h 34 | ../config.h 35 | /Users/alchemystar/mycode/hero/net/config.h 36 | ../server_parse.h 37 | /Users/alchemystar/mycode/hero/net/server_parse.h 38 | ../proto/packet.h 39 | /Users/alchemystar/mycode/hero/net/proto/packet.h 40 | ../proto/packet_const.h 41 | /Users/alchemystar/mycode/hero/net/proto/packet_const.h 42 | handle_util.h 43 | /Users/alchemystar/mycode/hero/net/com/handle_util.h 44 | 45 | /Users/alchemystar/mycode/hero/net/com/select_handle.h 46 | ../basic.h 47 | /Users/alchemystar/mycode/hero/net/basic.h 48 | ../network.h 49 | /Users/alchemystar/mycode/hero/net/network.h 50 | 51 | /Users/alchemystar/mycode/hero/net/com/show_handle.c 52 | show_handle.h 53 | /Users/alchemystar/mycode/hero/net/com/show_handle.h 54 | ../config.h 55 | /Users/alchemystar/mycode/hero/net/config.h 56 | ../server_parse.h 57 | /Users/alchemystar/mycode/hero/net/server_parse.h 58 | ../proto/packet.h 59 | /Users/alchemystar/mycode/hero/net/proto/packet.h 60 | handle_util.h 61 | /Users/alchemystar/mycode/hero/net/com/handle_util.h 62 | 63 | /Users/alchemystar/mycode/hero/net/com/show_handle.h 64 | ../basic.h 65 | /Users/alchemystar/mycode/hero/net/basic.h 66 | ../network.h 67 | /Users/alchemystar/mycode/hero/net/network.h 68 | 69 | /Users/alchemystar/mycode/hero/net/config.h 70 | 71 | /Users/alchemystar/mycode/hero/net/conn.h 72 | basic.h 73 | /Users/alchemystar/mycode/hero/net/basic.h 74 | proto/packet.h 75 | /Users/alchemystar/mycode/hero/net/proto/packet.h 76 | stdatomic.h 77 | /Users/alchemystar/mycode/hero/net/stdatomic.h 78 | sys/socket.h 79 | - 80 | netinet/in.h 81 | - 82 | fcntl.h 83 | - 84 | netinet/tcp.h 85 | - 86 | memory.h 87 | - 88 | sys/epoll.h 89 | - 90 | 91 | /Users/alchemystar/mycode/hero/net/network.h 92 | proto/packet.h 93 | /Users/alchemystar/mycode/hero/net/proto/packet.h 94 | basic.h 95 | /Users/alchemystar/mycode/hero/net/basic.h 96 | netinet/in.h 97 | - 98 | conn.h 99 | /Users/alchemystar/mycode/hero/net/conn.h 100 | 101 | /Users/alchemystar/mycode/hero/net/proto/list.h 102 | 103 | /Users/alchemystar/mycode/hero/net/proto/packet.h 104 | stdio.h 105 | - 106 | list.h 107 | /Users/alchemystar/mycode/hero/net/proto/list.h 108 | ../buffer_util.h 109 | /Users/alchemystar/mycode/hero/net/buffer_util.h 110 | 111 | /Users/alchemystar/mycode/hero/net/proto/packet_const.h 112 | 113 | /Users/alchemystar/mycode/hero/net/server_parse.h 114 | 115 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "C" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_C 7 | "/Users/alchemystar/mycode/hero/net/com/handle_util.c" "/Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/com.dir/handle_util.c.o" 8 | "/Users/alchemystar/mycode/hero/net/com/select_handle.c" "/Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/com.dir/select_handle.c.o" 9 | "/Users/alchemystar/mycode/hero/net/com/show_handle.c" "/Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/com.dir/show_handle.c.o" 10 | ) 11 | set(CMAKE_C_COMPILER_ID "Clang") 12 | 13 | # The include file search paths: 14 | set(CMAKE_C_TARGET_INCLUDE_PATH 15 | "/usr/local/Cellar/glib/2.58.1/include/glib-2.0" 16 | "/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include" 17 | "/usr/local/opt/gettext/include" 18 | "/usr/local/Cellar/pcre/8.42/include" 19 | ) 20 | 21 | # Targets to which this target links. 22 | set(CMAKE_TARGET_LINKED_INFO_FILES 23 | ) 24 | 25 | # Fortran module output directory. 26 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 27 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/com.dir/handle_util.c.o" 3 | "CMakeFiles/com.dir/select_handle.c.o" 4 | "CMakeFiles/com.dir/show_handle.c.o" 5 | "libcom.pdb" 6 | "libcom.a" 7 | ) 8 | 9 | # Per-language clean rules from dependency scanning. 10 | foreach(lang C) 11 | include(CMakeFiles/com.dir/cmake_clean_${lang}.cmake OPTIONAL) 12 | endforeach() 13 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/cmake_clean_target.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "libcom.a" 3 | ) 4 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/depend.internal: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | net/com/CMakeFiles/com.dir/handle_util.c.o 5 | /Users/alchemystar/mycode/hero/net/com/handle_util.c 6 | /Users/alchemystar/mycode/hero/net/com/handle_util.h 7 | /Users/alchemystar/mycode/hero/net/config.h 8 | net/com/CMakeFiles/com.dir/select_handle.c.o 9 | /Users/alchemystar/mycode/hero/net/basic.h 10 | /Users/alchemystar/mycode/hero/net/buffer_util.h 11 | /Users/alchemystar/mycode/hero/net/com/handle_util.h 12 | /Users/alchemystar/mycode/hero/net/com/select_handle.c 13 | /Users/alchemystar/mycode/hero/net/com/select_handle.h 14 | /Users/alchemystar/mycode/hero/net/config.h 15 | /Users/alchemystar/mycode/hero/net/conn.h 16 | /Users/alchemystar/mycode/hero/net/network.h 17 | /Users/alchemystar/mycode/hero/net/proto/list.h 18 | /Users/alchemystar/mycode/hero/net/proto/packet.h 19 | /Users/alchemystar/mycode/hero/net/proto/packet_const.h 20 | /Users/alchemystar/mycode/hero/net/server_parse.h 21 | net/com/CMakeFiles/com.dir/show_handle.c.o 22 | /Users/alchemystar/mycode/hero/net/basic.h 23 | /Users/alchemystar/mycode/hero/net/buffer_util.h 24 | /Users/alchemystar/mycode/hero/net/com/handle_util.h 25 | /Users/alchemystar/mycode/hero/net/com/show_handle.c 26 | /Users/alchemystar/mycode/hero/net/com/show_handle.h 27 | /Users/alchemystar/mycode/hero/net/config.h 28 | /Users/alchemystar/mycode/hero/net/conn.h 29 | /Users/alchemystar/mycode/hero/net/network.h 30 | /Users/alchemystar/mycode/hero/net/proto/list.h 31 | /Users/alchemystar/mycode/hero/net/proto/packet.h 32 | /Users/alchemystar/mycode/hero/net/server_parse.h 33 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/depend.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | net/com/CMakeFiles/com.dir/handle_util.c.o: ../net/com/handle_util.c 5 | net/com/CMakeFiles/com.dir/handle_util.c.o: ../net/com/handle_util.h 6 | net/com/CMakeFiles/com.dir/handle_util.c.o: ../net/config.h 7 | 8 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/basic.h 9 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/buffer_util.h 10 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/com/handle_util.h 11 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/com/select_handle.c 12 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/com/select_handle.h 13 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/config.h 14 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/conn.h 15 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/network.h 16 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/proto/list.h 17 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/proto/packet.h 18 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/proto/packet_const.h 19 | net/com/CMakeFiles/com.dir/select_handle.c.o: ../net/server_parse.h 20 | 21 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/basic.h 22 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/buffer_util.h 23 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/com/handle_util.h 24 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/com/show_handle.c 25 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/com/show_handle.h 26 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/config.h 27 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/conn.h 28 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/network.h 29 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/proto/list.h 30 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/proto/packet.h 31 | net/com/CMakeFiles/com.dir/show_handle.c.o: ../net/server_parse.h 32 | 33 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # compile C with /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc 5 | C_FLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 6 | 7 | C_DEFINES = 8 | 9 | C_INCLUDES = -I/usr/local/Cellar/glib/2.58.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.42/include 10 | 11 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/handle_util.c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alchemystar/hero/d719b66986e261b66433537d024348b8d26fe9db/build/net/com/CMakeFiles/com.dir/handle_util.c.o -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc libcom.a CMakeFiles/com.dir/handle_util.c.o CMakeFiles/com.dir/select_handle.c.o CMakeFiles/com.dir/show_handle.c.o 2 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib libcom.a 3 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/com.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | CMAKE_PROGRESS_3 = 3 4 | CMAKE_PROGRESS_4 = 4 5 | 6 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/command_lib.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "C" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_C 7 | "/Users/alchemystar/mycode/hero/net/com/show_handle.c" "/Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/command_lib.dir/show_handle.c.o" 8 | ) 9 | set(CMAKE_C_COMPILER_ID "Clang") 10 | 11 | # The include file search paths: 12 | set(CMAKE_C_TARGET_INCLUDE_PATH 13 | ) 14 | 15 | # Targets to which this target links. 16 | set(CMAKE_TARGET_LINKED_INFO_FILES 17 | ) 18 | 19 | # Fortran module output directory. 20 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 21 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/command_lib.dir/build.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Delete rule output on recipe failure. 5 | .DELETE_ON_ERROR: 6 | 7 | 8 | #============================================================================= 9 | # Special targets provided by cmake. 10 | 11 | # Disable implicit rules so canonical targets will work. 12 | .SUFFIXES: 13 | 14 | 15 | # Remove some rules from gmake that .SUFFIXES does not remove. 16 | SUFFIXES = 17 | 18 | .SUFFIXES: .hpux_make_needs_suffix_list 19 | 20 | 21 | # Suppress display of executed commands. 22 | $(VERBOSE).SILENT: 23 | 24 | 25 | # A target that is always out of date. 26 | cmake_force: 27 | 28 | .PHONY : cmake_force 29 | 30 | #============================================================================= 31 | # Set environment variables for the build. 32 | 33 | # The shell in which to execute make rules. 34 | SHELL = /bin/sh 35 | 36 | # The CMake executable. 37 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 38 | 39 | # The command to remove a file. 40 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 41 | 42 | # Escaping for special characters. 43 | EQUALS = = 44 | 45 | # The top-level source directory on which CMake was run. 46 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 47 | 48 | # The top-level build directory on which CMake was run. 49 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 50 | 51 | # Include any dependencies generated for this target. 52 | include net/com/CMakeFiles/command_lib.dir/depend.make 53 | 54 | # Include the progress variables for this target. 55 | include net/com/CMakeFiles/command_lib.dir/progress.make 56 | 57 | # Include the compile flags for this target's objects. 58 | include net/com/CMakeFiles/command_lib.dir/flags.make 59 | 60 | net/com/CMakeFiles/command_lib.dir/show_handle.c.o: net/com/CMakeFiles/command_lib.dir/flags.make 61 | net/com/CMakeFiles/command_lib.dir/show_handle.c.o: ../net/com/show_handle.c 62 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/Users/alchemystar/mycode/hero/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object net/com/CMakeFiles/command_lib.dir/show_handle.c.o" 63 | cd /Users/alchemystar/mycode/hero/build/net/com && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/command_lib.dir/show_handle.c.o -c /Users/alchemystar/mycode/hero/net/com/show_handle.c 64 | 65 | net/com/CMakeFiles/command_lib.dir/show_handle.c.i: cmake_force 66 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/command_lib.dir/show_handle.c.i" 67 | cd /Users/alchemystar/mycode/hero/build/net/com && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /Users/alchemystar/mycode/hero/net/com/show_handle.c > CMakeFiles/command_lib.dir/show_handle.c.i 68 | 69 | net/com/CMakeFiles/command_lib.dir/show_handle.c.s: cmake_force 70 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/command_lib.dir/show_handle.c.s" 71 | cd /Users/alchemystar/mycode/hero/build/net/com && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /Users/alchemystar/mycode/hero/net/com/show_handle.c -o CMakeFiles/command_lib.dir/show_handle.c.s 72 | 73 | net/com/CMakeFiles/command_lib.dir/show_handle.c.o.requires: 74 | 75 | .PHONY : net/com/CMakeFiles/command_lib.dir/show_handle.c.o.requires 76 | 77 | net/com/CMakeFiles/command_lib.dir/show_handle.c.o.provides: net/com/CMakeFiles/command_lib.dir/show_handle.c.o.requires 78 | $(MAKE) -f net/com/CMakeFiles/command_lib.dir/build.make net/com/CMakeFiles/command_lib.dir/show_handle.c.o.provides.build 79 | .PHONY : net/com/CMakeFiles/command_lib.dir/show_handle.c.o.provides 80 | 81 | net/com/CMakeFiles/command_lib.dir/show_handle.c.o.provides.build: net/com/CMakeFiles/command_lib.dir/show_handle.c.o 82 | 83 | 84 | # Object files for target command_lib 85 | command_lib_OBJECTS = \ 86 | "CMakeFiles/command_lib.dir/show_handle.c.o" 87 | 88 | # External object files for target command_lib 89 | command_lib_EXTERNAL_OBJECTS = 90 | 91 | net/com/libcommand_lib.a: net/com/CMakeFiles/command_lib.dir/show_handle.c.o 92 | net/com/libcommand_lib.a: net/com/CMakeFiles/command_lib.dir/build.make 93 | net/com/libcommand_lib.a: net/com/CMakeFiles/command_lib.dir/link.txt 94 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/Users/alchemystar/mycode/hero/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C static library libcommand_lib.a" 95 | cd /Users/alchemystar/mycode/hero/build/net/com && $(CMAKE_COMMAND) -P CMakeFiles/command_lib.dir/cmake_clean_target.cmake 96 | cd /Users/alchemystar/mycode/hero/build/net/com && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/command_lib.dir/link.txt --verbose=$(VERBOSE) 97 | 98 | # Rule to build all files generated by this target. 99 | net/com/CMakeFiles/command_lib.dir/build: net/com/libcommand_lib.a 100 | 101 | .PHONY : net/com/CMakeFiles/command_lib.dir/build 102 | 103 | net/com/CMakeFiles/command_lib.dir/requires: net/com/CMakeFiles/command_lib.dir/show_handle.c.o.requires 104 | 105 | .PHONY : net/com/CMakeFiles/command_lib.dir/requires 106 | 107 | net/com/CMakeFiles/command_lib.dir/clean: 108 | cd /Users/alchemystar/mycode/hero/build/net/com && $(CMAKE_COMMAND) -P CMakeFiles/command_lib.dir/cmake_clean.cmake 109 | .PHONY : net/com/CMakeFiles/command_lib.dir/clean 110 | 111 | net/com/CMakeFiles/command_lib.dir/depend: 112 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/alchemystar/mycode/hero /Users/alchemystar/mycode/hero/net/com /Users/alchemystar/mycode/hero/build /Users/alchemystar/mycode/hero/build/net/com /Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/command_lib.dir/DependInfo.cmake --color=$(COLOR) 113 | .PHONY : net/com/CMakeFiles/command_lib.dir/depend 114 | 115 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/command_lib.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/command_lib.dir/show_handle.c.o" 3 | "libcommand_lib.pdb" 4 | "libcommand_lib.a" 5 | ) 6 | 7 | # Per-language clean rules from dependency scanning. 8 | foreach(lang C) 9 | include(CMakeFiles/command_lib.dir/cmake_clean_${lang}.cmake OPTIONAL) 10 | endforeach() 11 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/command_lib.dir/cmake_clean_target.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "libcommand_lib.a" 3 | ) 4 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/command_lib.dir/depend.make: -------------------------------------------------------------------------------- 1 | # Empty dependencies file for command_lib. 2 | # This may be replaced when dependencies are built. 3 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/command_lib.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # compile C with /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc 5 | C_FLAGS = -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 6 | 7 | C_DEFINES = 8 | 9 | C_INCLUDES = 10 | 11 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/command_lib.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc libcommand_lib.a CMakeFiles/command_lib.dir/show_handle.c.o 2 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib libcommand_lib.a 3 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/command_lib.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | 4 | -------------------------------------------------------------------------------- /build/net/com/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /build/net/com/Makefile: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Default target executed when no arguments are given to make. 5 | default_target: all 6 | 7 | .PHONY : default_target 8 | 9 | # Allow only one "make -f Makefile2" at a time, but pass parallelism. 10 | .NOTPARALLEL: 11 | 12 | 13 | #============================================================================= 14 | # Special targets provided by cmake. 15 | 16 | # Disable implicit rules so canonical targets will work. 17 | .SUFFIXES: 18 | 19 | 20 | # Remove some rules from gmake that .SUFFIXES does not remove. 21 | SUFFIXES = 22 | 23 | .SUFFIXES: .hpux_make_needs_suffix_list 24 | 25 | 26 | # Suppress display of executed commands. 27 | $(VERBOSE).SILENT: 28 | 29 | 30 | # A target that is always out of date. 31 | cmake_force: 32 | 33 | .PHONY : cmake_force 34 | 35 | #============================================================================= 36 | # Set environment variables for the build. 37 | 38 | # The shell in which to execute make rules. 39 | SHELL = /bin/sh 40 | 41 | # The CMake executable. 42 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 43 | 44 | # The command to remove a file. 45 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 46 | 47 | # Escaping for special characters. 48 | EQUALS = = 49 | 50 | # The top-level source directory on which CMake was run. 51 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 52 | 53 | # The top-level build directory on which CMake was run. 54 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 55 | 56 | #============================================================================= 57 | # Targets provided globally by CMake. 58 | 59 | # Special rule for the target rebuild_cache 60 | rebuild_cache: 61 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." 62 | /usr/local/Cellar/cmake/3.8.2/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 63 | .PHONY : rebuild_cache 64 | 65 | # Special rule for the target rebuild_cache 66 | rebuild_cache/fast: rebuild_cache 67 | 68 | .PHONY : rebuild_cache/fast 69 | 70 | # Special rule for the target edit_cache 71 | edit_cache: 72 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." 73 | /usr/local/Cellar/cmake/3.8.2/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 74 | .PHONY : edit_cache 75 | 76 | # Special rule for the target edit_cache 77 | edit_cache/fast: edit_cache 78 | 79 | .PHONY : edit_cache/fast 80 | 81 | # The main all target 82 | all: cmake_check_build_system 83 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -E cmake_progress_start /Users/alchemystar/mycode/hero/build/CMakeFiles /Users/alchemystar/mycode/hero/build/net/com/CMakeFiles/progress.marks 84 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/com/all 85 | $(CMAKE_COMMAND) -E cmake_progress_start /Users/alchemystar/mycode/hero/build/CMakeFiles 0 86 | .PHONY : all 87 | 88 | # The main clean target 89 | clean: 90 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/com/clean 91 | .PHONY : clean 92 | 93 | # The main clean target 94 | clean/fast: clean 95 | 96 | .PHONY : clean/fast 97 | 98 | # Prepare targets for installation. 99 | preinstall: all 100 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/com/preinstall 101 | .PHONY : preinstall 102 | 103 | # Prepare targets for installation. 104 | preinstall/fast: 105 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/com/preinstall 106 | .PHONY : preinstall/fast 107 | 108 | # clear depends 109 | depend: 110 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 111 | .PHONY : depend 112 | 113 | # Convenience name for target. 114 | net/com/CMakeFiles/com.dir/rule: 115 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/com/CMakeFiles/com.dir/rule 116 | .PHONY : net/com/CMakeFiles/com.dir/rule 117 | 118 | # Convenience name for target. 119 | com: net/com/CMakeFiles/com.dir/rule 120 | 121 | .PHONY : com 122 | 123 | # fast build rule for target. 124 | com/fast: 125 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/build 126 | .PHONY : com/fast 127 | 128 | handle_util.o: handle_util.c.o 129 | 130 | .PHONY : handle_util.o 131 | 132 | # target to build an object file 133 | handle_util.c.o: 134 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/handle_util.c.o 135 | .PHONY : handle_util.c.o 136 | 137 | handle_util.i: handle_util.c.i 138 | 139 | .PHONY : handle_util.i 140 | 141 | # target to preprocess a source file 142 | handle_util.c.i: 143 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/handle_util.c.i 144 | .PHONY : handle_util.c.i 145 | 146 | handle_util.s: handle_util.c.s 147 | 148 | .PHONY : handle_util.s 149 | 150 | # target to generate assembly for a file 151 | handle_util.c.s: 152 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/handle_util.c.s 153 | .PHONY : handle_util.c.s 154 | 155 | select_handle.o: select_handle.c.o 156 | 157 | .PHONY : select_handle.o 158 | 159 | # target to build an object file 160 | select_handle.c.o: 161 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/select_handle.c.o 162 | .PHONY : select_handle.c.o 163 | 164 | select_handle.i: select_handle.c.i 165 | 166 | .PHONY : select_handle.i 167 | 168 | # target to preprocess a source file 169 | select_handle.c.i: 170 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/select_handle.c.i 171 | .PHONY : select_handle.c.i 172 | 173 | select_handle.s: select_handle.c.s 174 | 175 | .PHONY : select_handle.s 176 | 177 | # target to generate assembly for a file 178 | select_handle.c.s: 179 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/select_handle.c.s 180 | .PHONY : select_handle.c.s 181 | 182 | show_handle.o: show_handle.c.o 183 | 184 | .PHONY : show_handle.o 185 | 186 | # target to build an object file 187 | show_handle.c.o: 188 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/show_handle.c.o 189 | .PHONY : show_handle.c.o 190 | 191 | show_handle.i: show_handle.c.i 192 | 193 | .PHONY : show_handle.i 194 | 195 | # target to preprocess a source file 196 | show_handle.c.i: 197 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/show_handle.c.i 198 | .PHONY : show_handle.c.i 199 | 200 | show_handle.s: show_handle.c.s 201 | 202 | .PHONY : show_handle.s 203 | 204 | # target to generate assembly for a file 205 | show_handle.c.s: 206 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/com/CMakeFiles/com.dir/build.make net/com/CMakeFiles/com.dir/show_handle.c.s 207 | .PHONY : show_handle.c.s 208 | 209 | # Help Target 210 | help: 211 | @echo "The following are some of the valid targets for this Makefile:" 212 | @echo "... all (the default if no target is provided)" 213 | @echo "... clean" 214 | @echo "... depend" 215 | @echo "... rebuild_cache" 216 | @echo "... edit_cache" 217 | @echo "... com" 218 | @echo "... handle_util.o" 219 | @echo "... handle_util.i" 220 | @echo "... handle_util.s" 221 | @echo "... select_handle.o" 222 | @echo "... select_handle.i" 223 | @echo "... select_handle.s" 224 | @echo "... show_handle.o" 225 | @echo "... show_handle.i" 226 | @echo "... show_handle.s" 227 | .PHONY : help 228 | 229 | 230 | 231 | #============================================================================= 232 | # Special targets to cleanup operation of make. 233 | 234 | # Special rule to run CMake to check the build system integrity. 235 | # No rule that depends on this can have commands that come from listfiles 236 | # because they might be regenerated. 237 | cmake_check_build_system: 238 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 239 | .PHONY : cmake_check_build_system 240 | 241 | -------------------------------------------------------------------------------- /build/net/com/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /Users/alchemystar/mycode/hero/net/com 2 | 3 | # Set the install prefix 4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | set(CMAKE_INSTALL_PREFIX "/usr/local") 6 | endif() 7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | if(BUILD_TYPE) 12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | else() 15 | set(CMAKE_INSTALL_CONFIG_NAME "") 16 | endif() 17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | endif() 19 | 20 | # Set the component getting installed. 21 | if(NOT CMAKE_INSTALL_COMPONENT) 22 | if(COMPONENT) 23 | message(STATUS "Install component: \"${COMPONENT}\"") 24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | else() 26 | set(CMAKE_INSTALL_COMPONENT) 27 | endif() 28 | endif() 29 | 30 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/CMakeDirectoryInformation.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Relative path conversion top directories. 5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/alchemystar/mycode/hero") 6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/alchemystar/mycode/hero/build") 7 | 8 | # Force unix paths in dependencies. 9 | set(CMAKE_FORCE_UNIX_PATHS 1) 10 | 11 | 12 | # The C and CXX include file regular expressions for this directory. 13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") 14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") 15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) 16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) 17 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/C.includecache: -------------------------------------------------------------------------------- 1 | #IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) 2 | 3 | #IncludeRegexScan: ^.*$ 4 | 5 | #IncludeRegexComplain: ^$ 6 | 7 | #IncludeRegexTransform: 8 | 9 | /Users/alchemystar/mycode/hero/net/basic.h 10 | sys/time.h 11 | - 12 | stdio.h 13 | - 14 | sys/errno.h 15 | - 16 | unistd.h 17 | - 18 | 19 | /Users/alchemystar/mycode/hero/net/buffer_util.h 20 | basic.h 21 | /Users/alchemystar/mycode/hero/net/basic.h 22 | 23 | /Users/alchemystar/mycode/hero/net/config.h 24 | 25 | /Users/alchemystar/mycode/hero/net/conn.h 26 | basic.h 27 | /Users/alchemystar/mycode/hero/net/basic.h 28 | proto/packet.h 29 | /Users/alchemystar/mycode/hero/net/proto/packet.h 30 | stdatomic.h 31 | /Users/alchemystar/mycode/hero/net/stdatomic.h 32 | sys/socket.h 33 | - 34 | netinet/in.h 35 | - 36 | fcntl.h 37 | - 38 | netinet/tcp.h 39 | - 40 | memory.h 41 | - 42 | 43 | /Users/alchemystar/mycode/hero/net/network.h 44 | proto/packet.h 45 | /Users/alchemystar/mycode/hero/net/proto/packet.h 46 | basic.h 47 | /Users/alchemystar/mycode/hero/net/basic.h 48 | netinet/in.h 49 | - 50 | conn.h 51 | /Users/alchemystar/mycode/hero/net/conn.h 52 | 53 | /Users/alchemystar/mycode/hero/net/proto/list.h 54 | 55 | /Users/alchemystar/mycode/hero/net/proto/list_test.c 56 | list.h 57 | /Users/alchemystar/mycode/hero/net/proto/list.h 58 | 59 | /Users/alchemystar/mycode/hero/net/proto/packet.c 60 | packet.h 61 | /Users/alchemystar/mycode/hero/net/proto/packet.h 62 | packet_const.h 63 | /Users/alchemystar/mycode/hero/net/proto/packet_const.h 64 | string.h 65 | - 66 | ../network.h 67 | /Users/alchemystar/mycode/hero/net/network.h 68 | ../basic.h 69 | /Users/alchemystar/mycode/hero/net/basic.h 70 | ../buffer_util.h 71 | /Users/alchemystar/mycode/hero/net/buffer_util.h 72 | stdatomic.h 73 | - 74 | stdlib.h 75 | - 76 | ../config.h 77 | /Users/alchemystar/mycode/hero/net/config.h 78 | string.h 79 | /Users/alchemystar/mycode/hero/net/proto/string.h 80 | 81 | /Users/alchemystar/mycode/hero/net/proto/packet.h 82 | stdio.h 83 | - 84 | list.h 85 | /Users/alchemystar/mycode/hero/net/proto/list.h 86 | ../buffer_util.h 87 | /Users/alchemystar/mycode/hero/net/buffer_util.h 88 | 89 | /Users/alchemystar/mycode/hero/net/proto/packet_const.h 90 | 91 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "C" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_C 7 | "/Users/alchemystar/mycode/hero/net/proto/list_test.c" "/Users/alchemystar/mycode/hero/build/net/proto/CMakeFiles/proto.dir/list_test.c.o" 8 | "/Users/alchemystar/mycode/hero/net/proto/packet.c" "/Users/alchemystar/mycode/hero/build/net/proto/CMakeFiles/proto.dir/packet.c.o" 9 | ) 10 | set(CMAKE_C_COMPILER_ID "Clang") 11 | 12 | # The include file search paths: 13 | set(CMAKE_C_TARGET_INCLUDE_PATH 14 | "/usr/local/Cellar/glib/2.58.1/include/glib-2.0" 15 | "/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include" 16 | "/usr/local/opt/gettext/include" 17 | "/usr/local/Cellar/pcre/8.42/include" 18 | ) 19 | 20 | # Targets to which this target links. 21 | set(CMAKE_TARGET_LINKED_INFO_FILES 22 | ) 23 | 24 | # Fortran module output directory. 25 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 26 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/build.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Delete rule output on recipe failure. 5 | .DELETE_ON_ERROR: 6 | 7 | 8 | #============================================================================= 9 | # Special targets provided by cmake. 10 | 11 | # Disable implicit rules so canonical targets will work. 12 | .SUFFIXES: 13 | 14 | 15 | # Remove some rules from gmake that .SUFFIXES does not remove. 16 | SUFFIXES = 17 | 18 | .SUFFIXES: .hpux_make_needs_suffix_list 19 | 20 | 21 | # Suppress display of executed commands. 22 | $(VERBOSE).SILENT: 23 | 24 | 25 | # A target that is always out of date. 26 | cmake_force: 27 | 28 | .PHONY : cmake_force 29 | 30 | #============================================================================= 31 | # Set environment variables for the build. 32 | 33 | # The shell in which to execute make rules. 34 | SHELL = /bin/sh 35 | 36 | # The CMake executable. 37 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 38 | 39 | # The command to remove a file. 40 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 41 | 42 | # Escaping for special characters. 43 | EQUALS = = 44 | 45 | # The top-level source directory on which CMake was run. 46 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 47 | 48 | # The top-level build directory on which CMake was run. 49 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 50 | 51 | # Include any dependencies generated for this target. 52 | include net/proto/CMakeFiles/proto.dir/depend.make 53 | 54 | # Include the progress variables for this target. 55 | include net/proto/CMakeFiles/proto.dir/progress.make 56 | 57 | # Include the compile flags for this target's objects. 58 | include net/proto/CMakeFiles/proto.dir/flags.make 59 | 60 | net/proto/CMakeFiles/proto.dir/list_test.c.o: net/proto/CMakeFiles/proto.dir/flags.make 61 | net/proto/CMakeFiles/proto.dir/list_test.c.o: ../net/proto/list_test.c 62 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/Users/alchemystar/mycode/hero/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object net/proto/CMakeFiles/proto.dir/list_test.c.o" 63 | cd /Users/alchemystar/mycode/hero/build/net/proto && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/proto.dir/list_test.c.o -c /Users/alchemystar/mycode/hero/net/proto/list_test.c 64 | 65 | net/proto/CMakeFiles/proto.dir/list_test.c.i: cmake_force 66 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/proto.dir/list_test.c.i" 67 | cd /Users/alchemystar/mycode/hero/build/net/proto && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /Users/alchemystar/mycode/hero/net/proto/list_test.c > CMakeFiles/proto.dir/list_test.c.i 68 | 69 | net/proto/CMakeFiles/proto.dir/list_test.c.s: cmake_force 70 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/proto.dir/list_test.c.s" 71 | cd /Users/alchemystar/mycode/hero/build/net/proto && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /Users/alchemystar/mycode/hero/net/proto/list_test.c -o CMakeFiles/proto.dir/list_test.c.s 72 | 73 | net/proto/CMakeFiles/proto.dir/list_test.c.o.requires: 74 | 75 | .PHONY : net/proto/CMakeFiles/proto.dir/list_test.c.o.requires 76 | 77 | net/proto/CMakeFiles/proto.dir/list_test.c.o.provides: net/proto/CMakeFiles/proto.dir/list_test.c.o.requires 78 | $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/list_test.c.o.provides.build 79 | .PHONY : net/proto/CMakeFiles/proto.dir/list_test.c.o.provides 80 | 81 | net/proto/CMakeFiles/proto.dir/list_test.c.o.provides.build: net/proto/CMakeFiles/proto.dir/list_test.c.o 82 | 83 | 84 | net/proto/CMakeFiles/proto.dir/packet.c.o: net/proto/CMakeFiles/proto.dir/flags.make 85 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/proto/packet.c 86 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/Users/alchemystar/mycode/hero/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building C object net/proto/CMakeFiles/proto.dir/packet.c.o" 87 | cd /Users/alchemystar/mycode/hero/build/net/proto && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/proto.dir/packet.c.o -c /Users/alchemystar/mycode/hero/net/proto/packet.c 88 | 89 | net/proto/CMakeFiles/proto.dir/packet.c.i: cmake_force 90 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/proto.dir/packet.c.i" 91 | cd /Users/alchemystar/mycode/hero/build/net/proto && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /Users/alchemystar/mycode/hero/net/proto/packet.c > CMakeFiles/proto.dir/packet.c.i 92 | 93 | net/proto/CMakeFiles/proto.dir/packet.c.s: cmake_force 94 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/proto.dir/packet.c.s" 95 | cd /Users/alchemystar/mycode/hero/build/net/proto && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /Users/alchemystar/mycode/hero/net/proto/packet.c -o CMakeFiles/proto.dir/packet.c.s 96 | 97 | net/proto/CMakeFiles/proto.dir/packet.c.o.requires: 98 | 99 | .PHONY : net/proto/CMakeFiles/proto.dir/packet.c.o.requires 100 | 101 | net/proto/CMakeFiles/proto.dir/packet.c.o.provides: net/proto/CMakeFiles/proto.dir/packet.c.o.requires 102 | $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/packet.c.o.provides.build 103 | .PHONY : net/proto/CMakeFiles/proto.dir/packet.c.o.provides 104 | 105 | net/proto/CMakeFiles/proto.dir/packet.c.o.provides.build: net/proto/CMakeFiles/proto.dir/packet.c.o 106 | 107 | 108 | # Object files for target proto 109 | proto_OBJECTS = \ 110 | "CMakeFiles/proto.dir/list_test.c.o" \ 111 | "CMakeFiles/proto.dir/packet.c.o" 112 | 113 | # External object files for target proto 114 | proto_EXTERNAL_OBJECTS = 115 | 116 | net/proto/libproto.a: net/proto/CMakeFiles/proto.dir/list_test.c.o 117 | net/proto/libproto.a: net/proto/CMakeFiles/proto.dir/packet.c.o 118 | net/proto/libproto.a: net/proto/CMakeFiles/proto.dir/build.make 119 | net/proto/libproto.a: net/proto/CMakeFiles/proto.dir/link.txt 120 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/Users/alchemystar/mycode/hero/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking C static library libproto.a" 121 | cd /Users/alchemystar/mycode/hero/build/net/proto && $(CMAKE_COMMAND) -P CMakeFiles/proto.dir/cmake_clean_target.cmake 122 | cd /Users/alchemystar/mycode/hero/build/net/proto && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/proto.dir/link.txt --verbose=$(VERBOSE) 123 | 124 | # Rule to build all files generated by this target. 125 | net/proto/CMakeFiles/proto.dir/build: net/proto/libproto.a 126 | 127 | .PHONY : net/proto/CMakeFiles/proto.dir/build 128 | 129 | net/proto/CMakeFiles/proto.dir/requires: net/proto/CMakeFiles/proto.dir/list_test.c.o.requires 130 | net/proto/CMakeFiles/proto.dir/requires: net/proto/CMakeFiles/proto.dir/packet.c.o.requires 131 | 132 | .PHONY : net/proto/CMakeFiles/proto.dir/requires 133 | 134 | net/proto/CMakeFiles/proto.dir/clean: 135 | cd /Users/alchemystar/mycode/hero/build/net/proto && $(CMAKE_COMMAND) -P CMakeFiles/proto.dir/cmake_clean.cmake 136 | .PHONY : net/proto/CMakeFiles/proto.dir/clean 137 | 138 | net/proto/CMakeFiles/proto.dir/depend: 139 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/alchemystar/mycode/hero /Users/alchemystar/mycode/hero/net/proto /Users/alchemystar/mycode/hero/build /Users/alchemystar/mycode/hero/build/net/proto /Users/alchemystar/mycode/hero/build/net/proto/CMakeFiles/proto.dir/DependInfo.cmake --color=$(COLOR) 140 | .PHONY : net/proto/CMakeFiles/proto.dir/depend 141 | 142 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/proto.dir/list_test.c.o" 3 | "CMakeFiles/proto.dir/packet.c.o" 4 | "libproto.pdb" 5 | "libproto.a" 6 | ) 7 | 8 | # Per-language clean rules from dependency scanning. 9 | foreach(lang C) 10 | include(CMakeFiles/proto.dir/cmake_clean_${lang}.cmake OPTIONAL) 11 | endforeach() 12 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/cmake_clean_target.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "libproto.a" 3 | ) 4 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/depend.internal: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | net/proto/CMakeFiles/proto.dir/list_test.c.o 5 | /Users/alchemystar/mycode/hero/net/proto/list.h 6 | /Users/alchemystar/mycode/hero/net/proto/list_test.c 7 | net/proto/CMakeFiles/proto.dir/packet.c.o 8 | /Users/alchemystar/mycode/hero/net/basic.h 9 | /Users/alchemystar/mycode/hero/net/buffer_util.h 10 | /Users/alchemystar/mycode/hero/net/config.h 11 | /Users/alchemystar/mycode/hero/net/conn.h 12 | /Users/alchemystar/mycode/hero/net/network.h 13 | /Users/alchemystar/mycode/hero/net/proto/list.h 14 | /Users/alchemystar/mycode/hero/net/proto/packet.c 15 | /Users/alchemystar/mycode/hero/net/proto/packet.h 16 | /Users/alchemystar/mycode/hero/net/proto/packet_const.h 17 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/depend.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | net/proto/CMakeFiles/proto.dir/list_test.c.o: ../net/proto/list.h 5 | net/proto/CMakeFiles/proto.dir/list_test.c.o: ../net/proto/list_test.c 6 | 7 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/basic.h 8 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/buffer_util.h 9 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/config.h 10 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/conn.h 11 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/network.h 12 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/proto/list.h 13 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/proto/packet.c 14 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/proto/packet.h 15 | net/proto/CMakeFiles/proto.dir/packet.c.o: ../net/proto/packet_const.h 16 | 17 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # compile C with /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc 5 | C_FLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 6 | 7 | C_DEFINES = 8 | 9 | C_INCLUDES = -I/usr/local/Cellar/glib/2.58.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.42/include 10 | 11 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc libproto.a CMakeFiles/proto.dir/list_test.c.o CMakeFiles/proto.dir/packet.c.o 2 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib libproto.a 3 | -------------------------------------------------------------------------------- /build/net/proto/CMakeFiles/proto.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 20 2 | CMAKE_PROGRESS_2 = 21 3 | CMAKE_PROGRESS_3 = 22 4 | 5 | -------------------------------------------------------------------------------- /build/net/proto/Makefile: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Default target executed when no arguments are given to make. 5 | default_target: all 6 | 7 | .PHONY : default_target 8 | 9 | # Allow only one "make -f Makefile2" at a time, but pass parallelism. 10 | .NOTPARALLEL: 11 | 12 | 13 | #============================================================================= 14 | # Special targets provided by cmake. 15 | 16 | # Disable implicit rules so canonical targets will work. 17 | .SUFFIXES: 18 | 19 | 20 | # Remove some rules from gmake that .SUFFIXES does not remove. 21 | SUFFIXES = 22 | 23 | .SUFFIXES: .hpux_make_needs_suffix_list 24 | 25 | 26 | # Suppress display of executed commands. 27 | $(VERBOSE).SILENT: 28 | 29 | 30 | # A target that is always out of date. 31 | cmake_force: 32 | 33 | .PHONY : cmake_force 34 | 35 | #============================================================================= 36 | # Set environment variables for the build. 37 | 38 | # The shell in which to execute make rules. 39 | SHELL = /bin/sh 40 | 41 | # The CMake executable. 42 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 43 | 44 | # The command to remove a file. 45 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 46 | 47 | # Escaping for special characters. 48 | EQUALS = = 49 | 50 | # The top-level source directory on which CMake was run. 51 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 52 | 53 | # The top-level build directory on which CMake was run. 54 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 55 | 56 | #============================================================================= 57 | # Targets provided globally by CMake. 58 | 59 | # Special rule for the target rebuild_cache 60 | rebuild_cache: 61 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." 62 | /usr/local/Cellar/cmake/3.8.2/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 63 | .PHONY : rebuild_cache 64 | 65 | # Special rule for the target rebuild_cache 66 | rebuild_cache/fast: rebuild_cache 67 | 68 | .PHONY : rebuild_cache/fast 69 | 70 | # Special rule for the target edit_cache 71 | edit_cache: 72 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." 73 | /usr/local/Cellar/cmake/3.8.2/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 74 | .PHONY : edit_cache 75 | 76 | # Special rule for the target edit_cache 77 | edit_cache/fast: edit_cache 78 | 79 | .PHONY : edit_cache/fast 80 | 81 | # The main all target 82 | all: cmake_check_build_system 83 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -E cmake_progress_start /Users/alchemystar/mycode/hero/build/CMakeFiles /Users/alchemystar/mycode/hero/build/net/proto/CMakeFiles/progress.marks 84 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/proto/all 85 | $(CMAKE_COMMAND) -E cmake_progress_start /Users/alchemystar/mycode/hero/build/CMakeFiles 0 86 | .PHONY : all 87 | 88 | # The main clean target 89 | clean: 90 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/proto/clean 91 | .PHONY : clean 92 | 93 | # The main clean target 94 | clean/fast: clean 95 | 96 | .PHONY : clean/fast 97 | 98 | # Prepare targets for installation. 99 | preinstall: all 100 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/proto/preinstall 101 | .PHONY : preinstall 102 | 103 | # Prepare targets for installation. 104 | preinstall/fast: 105 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/proto/preinstall 106 | .PHONY : preinstall/fast 107 | 108 | # clear depends 109 | depend: 110 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 111 | .PHONY : depend 112 | 113 | # Convenience name for target. 114 | net/proto/CMakeFiles/proto.dir/rule: 115 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 net/proto/CMakeFiles/proto.dir/rule 116 | .PHONY : net/proto/CMakeFiles/proto.dir/rule 117 | 118 | # Convenience name for target. 119 | proto: net/proto/CMakeFiles/proto.dir/rule 120 | 121 | .PHONY : proto 122 | 123 | # fast build rule for target. 124 | proto/fast: 125 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/build 126 | .PHONY : proto/fast 127 | 128 | list_test.o: list_test.c.o 129 | 130 | .PHONY : list_test.o 131 | 132 | # target to build an object file 133 | list_test.c.o: 134 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/list_test.c.o 135 | .PHONY : list_test.c.o 136 | 137 | list_test.i: list_test.c.i 138 | 139 | .PHONY : list_test.i 140 | 141 | # target to preprocess a source file 142 | list_test.c.i: 143 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/list_test.c.i 144 | .PHONY : list_test.c.i 145 | 146 | list_test.s: list_test.c.s 147 | 148 | .PHONY : list_test.s 149 | 150 | # target to generate assembly for a file 151 | list_test.c.s: 152 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/list_test.c.s 153 | .PHONY : list_test.c.s 154 | 155 | packet.o: packet.c.o 156 | 157 | .PHONY : packet.o 158 | 159 | # target to build an object file 160 | packet.c.o: 161 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/packet.c.o 162 | .PHONY : packet.c.o 163 | 164 | packet.i: packet.c.i 165 | 166 | .PHONY : packet.i 167 | 168 | # target to preprocess a source file 169 | packet.c.i: 170 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/packet.c.i 171 | .PHONY : packet.c.i 172 | 173 | packet.s: packet.c.s 174 | 175 | .PHONY : packet.s 176 | 177 | # target to generate assembly for a file 178 | packet.c.s: 179 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f net/proto/CMakeFiles/proto.dir/build.make net/proto/CMakeFiles/proto.dir/packet.c.s 180 | .PHONY : packet.c.s 181 | 182 | # Help Target 183 | help: 184 | @echo "The following are some of the valid targets for this Makefile:" 185 | @echo "... all (the default if no target is provided)" 186 | @echo "... clean" 187 | @echo "... depend" 188 | @echo "... rebuild_cache" 189 | @echo "... edit_cache" 190 | @echo "... proto" 191 | @echo "... list_test.o" 192 | @echo "... list_test.i" 193 | @echo "... list_test.s" 194 | @echo "... packet.o" 195 | @echo "... packet.i" 196 | @echo "... packet.s" 197 | .PHONY : help 198 | 199 | 200 | 201 | #============================================================================= 202 | # Special targets to cleanup operation of make. 203 | 204 | # Special rule to run CMake to check the build system integrity. 205 | # No rule that depends on this can have commands that come from listfiles 206 | # because they might be regenerated. 207 | cmake_check_build_system: 208 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 209 | .PHONY : cmake_check_build_system 210 | 211 | -------------------------------------------------------------------------------- /build/net/proto/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /Users/alchemystar/mycode/hero/net/proto 2 | 3 | # Set the install prefix 4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | set(CMAKE_INSTALL_PREFIX "/usr/local") 6 | endif() 7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | if(BUILD_TYPE) 12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | else() 15 | set(CMAKE_INSTALL_CONFIG_NAME "") 16 | endif() 17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | endif() 19 | 20 | # Set the component getting installed. 21 | if(NOT CMAKE_INSTALL_COMPONENT) 22 | if(COMPONENT) 23 | message(STATUS "Install component: \"${COMPONENT}\"") 24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | else() 26 | set(CMAKE_INSTALL_COMPONENT) 27 | endif() 28 | endif() 29 | 30 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/CMakeDirectoryInformation.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Relative path conversion top directories. 5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/alchemystar/mycode/hero") 6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/alchemystar/mycode/hero/build") 7 | 8 | # Force unix paths in dependencies. 9 | set(CMAKE_FORCE_UNIX_PATHS 1) 10 | 11 | 12 | # The C and CXX include file regular expressions for this directory. 13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") 14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") 15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) 16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) 17 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/net.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "C" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_C 7 | "/Users/alchemystar/mycode/hero/net/server.c" "/Users/alchemystar/mycode/hero/build/netdir/CMakeFiles/net.dir/server.c.o" 8 | ) 9 | set(CMAKE_C_COMPILER_ID "Clang") 10 | 11 | # The include file search paths: 12 | set(CMAKE_C_TARGET_INCLUDE_PATH 13 | ) 14 | 15 | # Targets to which this target links. 16 | set(CMAKE_TARGET_LINKED_INFO_FILES 17 | ) 18 | 19 | # Fortran module output directory. 20 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 21 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/net.dir/build.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Delete rule output on recipe failure. 5 | .DELETE_ON_ERROR: 6 | 7 | 8 | #============================================================================= 9 | # Special targets provided by cmake. 10 | 11 | # Disable implicit rules so canonical targets will work. 12 | .SUFFIXES: 13 | 14 | 15 | # Remove some rules from gmake that .SUFFIXES does not remove. 16 | SUFFIXES = 17 | 18 | .SUFFIXES: .hpux_make_needs_suffix_list 19 | 20 | 21 | # Suppress display of executed commands. 22 | $(VERBOSE).SILENT: 23 | 24 | 25 | # A target that is always out of date. 26 | cmake_force: 27 | 28 | .PHONY : cmake_force 29 | 30 | #============================================================================= 31 | # Set environment variables for the build. 32 | 33 | # The shell in which to execute make rules. 34 | SHELL = /bin/sh 35 | 36 | # The CMake executable. 37 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 38 | 39 | # The command to remove a file. 40 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 41 | 42 | # Escaping for special characters. 43 | EQUALS = = 44 | 45 | # The top-level source directory on which CMake was run. 46 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 47 | 48 | # The top-level build directory on which CMake was run. 49 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 50 | 51 | # Include any dependencies generated for this target. 52 | include netdir/CMakeFiles/net.dir/depend.make 53 | 54 | # Include the progress variables for this target. 55 | include netdir/CMakeFiles/net.dir/progress.make 56 | 57 | # Include the compile flags for this target's objects. 58 | include netdir/CMakeFiles/net.dir/flags.make 59 | 60 | netdir/CMakeFiles/net.dir/server.c.o: netdir/CMakeFiles/net.dir/flags.make 61 | netdir/CMakeFiles/net.dir/server.c.o: ../net/server.c 62 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/Users/alchemystar/mycode/hero/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object netdir/CMakeFiles/net.dir/server.c.o" 63 | cd /Users/alchemystar/mycode/hero/build/netdir && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/net.dir/server.c.o -c /Users/alchemystar/mycode/hero/net/server.c 64 | 65 | netdir/CMakeFiles/net.dir/server.c.i: cmake_force 66 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/net.dir/server.c.i" 67 | cd /Users/alchemystar/mycode/hero/build/netdir && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /Users/alchemystar/mycode/hero/net/server.c > CMakeFiles/net.dir/server.c.i 68 | 69 | netdir/CMakeFiles/net.dir/server.c.s: cmake_force 70 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/net.dir/server.c.s" 71 | cd /Users/alchemystar/mycode/hero/build/netdir && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /Users/alchemystar/mycode/hero/net/server.c -o CMakeFiles/net.dir/server.c.s 72 | 73 | netdir/CMakeFiles/net.dir/server.c.o.requires: 74 | 75 | .PHONY : netdir/CMakeFiles/net.dir/server.c.o.requires 76 | 77 | netdir/CMakeFiles/net.dir/server.c.o.provides: netdir/CMakeFiles/net.dir/server.c.o.requires 78 | $(MAKE) -f netdir/CMakeFiles/net.dir/build.make netdir/CMakeFiles/net.dir/server.c.o.provides.build 79 | .PHONY : netdir/CMakeFiles/net.dir/server.c.o.provides 80 | 81 | netdir/CMakeFiles/net.dir/server.c.o.provides.build: netdir/CMakeFiles/net.dir/server.c.o 82 | 83 | 84 | # Object files for target net 85 | net_OBJECTS = \ 86 | "CMakeFiles/net.dir/server.c.o" 87 | 88 | # External object files for target net 89 | net_EXTERNAL_OBJECTS = 90 | 91 | netdir/libnet.a: netdir/CMakeFiles/net.dir/server.c.o 92 | netdir/libnet.a: netdir/CMakeFiles/net.dir/build.make 93 | netdir/libnet.a: netdir/CMakeFiles/net.dir/link.txt 94 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/Users/alchemystar/mycode/hero/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C static library libnet.a" 95 | cd /Users/alchemystar/mycode/hero/build/netdir && $(CMAKE_COMMAND) -P CMakeFiles/net.dir/cmake_clean_target.cmake 96 | cd /Users/alchemystar/mycode/hero/build/netdir && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/net.dir/link.txt --verbose=$(VERBOSE) 97 | 98 | # Rule to build all files generated by this target. 99 | netdir/CMakeFiles/net.dir/build: netdir/libnet.a 100 | 101 | .PHONY : netdir/CMakeFiles/net.dir/build 102 | 103 | netdir/CMakeFiles/net.dir/requires: netdir/CMakeFiles/net.dir/server.c.o.requires 104 | 105 | .PHONY : netdir/CMakeFiles/net.dir/requires 106 | 107 | netdir/CMakeFiles/net.dir/clean: 108 | cd /Users/alchemystar/mycode/hero/build/netdir && $(CMAKE_COMMAND) -P CMakeFiles/net.dir/cmake_clean.cmake 109 | .PHONY : netdir/CMakeFiles/net.dir/clean 110 | 111 | netdir/CMakeFiles/net.dir/depend: 112 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /Users/alchemystar/mycode/hero /Users/alchemystar/mycode/hero/net /Users/alchemystar/mycode/hero/build /Users/alchemystar/mycode/hero/build/netdir /Users/alchemystar/mycode/hero/build/netdir/CMakeFiles/net.dir/DependInfo.cmake --color=$(COLOR) 113 | .PHONY : netdir/CMakeFiles/net.dir/depend 114 | 115 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/net.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/net.dir/server.c.o" 3 | "libnet.pdb" 4 | "libnet.a" 5 | ) 6 | 7 | # Per-language clean rules from dependency scanning. 8 | foreach(lang C) 9 | include(CMakeFiles/net.dir/cmake_clean_${lang}.cmake OPTIONAL) 10 | endforeach() 11 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/net.dir/cmake_clean_target.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "libnet.a" 3 | ) 4 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/net.dir/depend.make: -------------------------------------------------------------------------------- 1 | # Empty dependencies file for net. 2 | # This may be replaced when dependencies are built. 3 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/net.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # compile C with /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc 5 | C_FLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 6 | 7 | C_DEFINES = 8 | 9 | C_INCLUDES = 10 | 11 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/net.dir/link.txt: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc libnet.a CMakeFiles/net.dir/server.c.o 2 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib libnet.a 3 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/net.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 3 2 | CMAKE_PROGRESS_2 = 4 3 | 4 | -------------------------------------------------------------------------------- /build/netdir/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /build/netdir/Makefile: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.8 3 | 4 | # Default target executed when no arguments are given to make. 5 | default_target: all 6 | 7 | .PHONY : default_target 8 | 9 | # Allow only one "make -f Makefile2" at a time, but pass parallelism. 10 | .NOTPARALLEL: 11 | 12 | 13 | #============================================================================= 14 | # Special targets provided by cmake. 15 | 16 | # Disable implicit rules so canonical targets will work. 17 | .SUFFIXES: 18 | 19 | 20 | # Remove some rules from gmake that .SUFFIXES does not remove. 21 | SUFFIXES = 22 | 23 | .SUFFIXES: .hpux_make_needs_suffix_list 24 | 25 | 26 | # Suppress display of executed commands. 27 | $(VERBOSE).SILENT: 28 | 29 | 30 | # A target that is always out of date. 31 | cmake_force: 32 | 33 | .PHONY : cmake_force 34 | 35 | #============================================================================= 36 | # Set environment variables for the build. 37 | 38 | # The shell in which to execute make rules. 39 | SHELL = /bin/sh 40 | 41 | # The CMake executable. 42 | CMAKE_COMMAND = /usr/local/Cellar/cmake/3.8.2/bin/cmake 43 | 44 | # The command to remove a file. 45 | RM = /usr/local/Cellar/cmake/3.8.2/bin/cmake -E remove -f 46 | 47 | # Escaping for special characters. 48 | EQUALS = = 49 | 50 | # The top-level source directory on which CMake was run. 51 | CMAKE_SOURCE_DIR = /Users/alchemystar/mycode/hero 52 | 53 | # The top-level build directory on which CMake was run. 54 | CMAKE_BINARY_DIR = /Users/alchemystar/mycode/hero/build 55 | 56 | #============================================================================= 57 | # Targets provided globally by CMake. 58 | 59 | # Special rule for the target rebuild_cache 60 | rebuild_cache: 61 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." 62 | /usr/local/Cellar/cmake/3.8.2/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 63 | .PHONY : rebuild_cache 64 | 65 | # Special rule for the target rebuild_cache 66 | rebuild_cache/fast: rebuild_cache 67 | 68 | .PHONY : rebuild_cache/fast 69 | 70 | # Special rule for the target edit_cache 71 | edit_cache: 72 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." 73 | /usr/local/Cellar/cmake/3.8.2/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 74 | .PHONY : edit_cache 75 | 76 | # Special rule for the target edit_cache 77 | edit_cache/fast: edit_cache 78 | 79 | .PHONY : edit_cache/fast 80 | 81 | # The main all target 82 | all: cmake_check_build_system 83 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -E cmake_progress_start /Users/alchemystar/mycode/hero/build/CMakeFiles /Users/alchemystar/mycode/hero/build/netdir/CMakeFiles/progress.marks 84 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 netdir/all 85 | $(CMAKE_COMMAND) -E cmake_progress_start /Users/alchemystar/mycode/hero/build/CMakeFiles 0 86 | .PHONY : all 87 | 88 | # The main clean target 89 | clean: 90 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 netdir/clean 91 | .PHONY : clean 92 | 93 | # The main clean target 94 | clean/fast: clean 95 | 96 | .PHONY : clean/fast 97 | 98 | # Prepare targets for installation. 99 | preinstall: all 100 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 netdir/preinstall 101 | .PHONY : preinstall 102 | 103 | # Prepare targets for installation. 104 | preinstall/fast: 105 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 netdir/preinstall 106 | .PHONY : preinstall/fast 107 | 108 | # clear depends 109 | depend: 110 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 111 | .PHONY : depend 112 | 113 | # Convenience name for target. 114 | netdir/CMakeFiles/net.dir/rule: 115 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f CMakeFiles/Makefile2 netdir/CMakeFiles/net.dir/rule 116 | .PHONY : netdir/CMakeFiles/net.dir/rule 117 | 118 | # Convenience name for target. 119 | net: netdir/CMakeFiles/net.dir/rule 120 | 121 | .PHONY : net 122 | 123 | # fast build rule for target. 124 | net/fast: 125 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f netdir/CMakeFiles/net.dir/build.make netdir/CMakeFiles/net.dir/build 126 | .PHONY : net/fast 127 | 128 | server.o: server.c.o 129 | 130 | .PHONY : server.o 131 | 132 | # target to build an object file 133 | server.c.o: 134 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f netdir/CMakeFiles/net.dir/build.make netdir/CMakeFiles/net.dir/server.c.o 135 | .PHONY : server.c.o 136 | 137 | server.i: server.c.i 138 | 139 | .PHONY : server.i 140 | 141 | # target to preprocess a source file 142 | server.c.i: 143 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f netdir/CMakeFiles/net.dir/build.make netdir/CMakeFiles/net.dir/server.c.i 144 | .PHONY : server.c.i 145 | 146 | server.s: server.c.s 147 | 148 | .PHONY : server.s 149 | 150 | # target to generate assembly for a file 151 | server.c.s: 152 | cd /Users/alchemystar/mycode/hero/build && $(MAKE) -f netdir/CMakeFiles/net.dir/build.make netdir/CMakeFiles/net.dir/server.c.s 153 | .PHONY : server.c.s 154 | 155 | # Help Target 156 | help: 157 | @echo "The following are some of the valid targets for this Makefile:" 158 | @echo "... all (the default if no target is provided)" 159 | @echo "... clean" 160 | @echo "... depend" 161 | @echo "... rebuild_cache" 162 | @echo "... edit_cache" 163 | @echo "... net" 164 | @echo "... server.o" 165 | @echo "... server.i" 166 | @echo "... server.s" 167 | .PHONY : help 168 | 169 | 170 | 171 | #============================================================================= 172 | # Special targets to cleanup operation of make. 173 | 174 | # Special rule to run CMake to check the build system integrity. 175 | # No rule that depends on this can have commands that come from listfiles 176 | # because they might be regenerated. 177 | cmake_check_build_system: 178 | cd /Users/alchemystar/mycode/hero/build && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 179 | .PHONY : cmake_check_build_system 180 | 181 | -------------------------------------------------------------------------------- /build/netdir/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /Users/alchemystar/mycode/hero/net 2 | 3 | # Set the install prefix 4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | set(CMAKE_INSTALL_PREFIX "/usr/local") 6 | endif() 7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | if(BUILD_TYPE) 12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | else() 15 | set(CMAKE_INSTALL_CONFIG_NAME "") 16 | endif() 17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | endif() 19 | 20 | # Set the component getting installed. 21 | if(NOT CMAKE_INSTALL_COMPONENT) 22 | if(COMPONENT) 23 | message(STATUS "Install component: \"${COMPONENT}\"") 24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | else() 26 | set(CMAKE_INSTALL_COMPONENT) 27 | endif() 28 | endif() 29 | 30 | -------------------------------------------------------------------------------- /hero.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": { 8 | "files.associations": { 9 | "server.h": "c", 10 | "network.h": "c", 11 | "basic.h": "c", 12 | "packet.h": "c", 13 | "packet_const.h": "c", 14 | "buffer_util.h": "c", 15 | "limits": "c", 16 | "type_traits": "c", 17 | "query.h": "c", 18 | "show_handle.h": "c", 19 | "sql_error_code.h": "c", 20 | "select_handle.h": "c", 21 | "config.h": "c", 22 | "string.h": "c", 23 | "stdio.h": "c", 24 | "glib.h": "c", 25 | "galloca.h": "c", 26 | "gconvert.h": "c", 27 | "gbitlock.h": "c", 28 | "garray.h": "c", 29 | "gtypes.h": "c", 30 | "gversionmacros.h": "c", 31 | "gmacros.h": "c", 32 | "tcmalloc.h": "c", 33 | "conn.h": "c", 34 | "socket.h": "c", 35 | "time.h": "c", 36 | "inet.h": "c", 37 | "in.h": "c", 38 | "epoll.h": "c", 39 | "limits.h": "c", 40 | "hero_poll.h": "c", 41 | "sysinfo.h": "c", 42 | "errno.h": "c", 43 | "hero_worker.h": "c", 44 | "stdlib.h": "c", 45 | "pthread.h": "c", 46 | "fcntl.h": "c", 47 | "unistd.h": "c", 48 | "memory.h": "c", 49 | "server_parse.h": "c", 50 | "stdatomic.h": "c", 51 | "datasource.h": "c", 52 | "capacity.h": "c", 53 | "handle_util.h": "c" 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | #include "net/server.h" 2 | 3 | int main(int argc,char* argv[]){ 4 | // 注册忽略信号hanlder 5 | init_signal_handlers(); 6 | start_server(); 7 | } 8 | -------------------------------------------------------------------------------- /net/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 设置当前代码路径=>DIR_NET_SRC 2 | AUX_SOURCE_DIRECTORY(. DIR_NET_SRCS) 3 | ADD_SUBDIRECTORY(proto) 4 | ADD_SUBDIRECTORY(com) 5 | # 将当前路径的编译结果加入net lib 6 | ADD_LIBRARY (net ${DIR_NET_SRCS}) 7 | target_link_libraries(net proto com) -------------------------------------------------------------------------------- /net/basic.c: -------------------------------------------------------------------------------- 1 | #include "basic.h" 2 | #include 3 | // 这边stdlib.h是为了malloc,or use void* cast 4 | // 现在cmake里面link了tcmalloc=>底层非ptmalloc而是tcmalloc 5 | #include 6 | #include 7 | #include 8 | // if use ctime,use ctime_r! 9 | 10 | // todo 需要参照<> 将mem_pool自身内存也纳入其buffer中 11 | mem_pool* mem_pool_create(int size){ 12 | // 至少分配512字节的空间,防止碎片太多 13 | if(size < DEFAULT_MEM_POOL_SIZE){ 14 | size = DEFAULT_MEM_POOL_SIZE; 15 | } 16 | int mem_size = 1; 17 | // 向上2的幂次取整 18 | while (mem_size < size){ 19 | mem_size <<= 1; 20 | } 21 | size = (size + sizeof(union hero_align) - 1) & (~(sizeof(union hero_align) - 1)); 22 | mem_pool* pool = (void*)malloc(sizeof(mem_pool)); 23 | if(pool == NULL){ 24 | printf("mem exhausted"); 25 | return NULL; 26 | } 27 | // 用malloc的原因是少走向上取整这一步 28 | unsigned char* buffer = (void*)malloc(mem_size); 29 | if(buffer == NULL){ 30 | printf("mem exhausted"); 31 | free(pool); 32 | return NULL; 33 | } 34 | pool->buffer = buffer; 35 | pool->length = mem_size; 36 | pool->pos = 0; 37 | pool->next = NULL; 38 | return pool; 39 | } 40 | 41 | void* mem_pool_alloc(int size,mem_pool* pool){ 42 | #ifdef HERO_DEBUG 43 | if(size == sizeof(void*)){ 44 | printf("are you sure?,size=%d may cause error\n",size); 45 | } 46 | #endif 47 | return mem_pool_alloc_ignore_check(size,pool); 48 | } 49 | 50 | void* mem_pool_alloc_ignore_check(int size,mem_pool* pool){ 51 | // 内存向上对齐 52 | // 数学推导过程大致如下 53 | // if size = k*n: 54 | // (k *n + n -1)/n = k+(n-1)/n = > k 55 | // else if size = k*n+a && 1=k+1 => okay 59 | // size = ((size+sizeof(union hero_align)-1)/(sizeof(union hero_align))) * (sizeof(union hero_align)); 60 | // 更进一步 (size/align) == size & ~(align - 1)=>下面的表达式 61 | size = (size + sizeof(union hero_align) - 1) & (~(sizeof(union hero_align) - 1)); 62 | mem_pool* entry; 63 | // 记录最后一个last_entry,即->next=NULL的那个 64 | mem_pool* last_entry; 65 | for(entry=pool,last_entry=pool ;entry != NULL;entry = entry->next){ 66 | // 遍历搜索内存块中有足够buffer的块 67 | if(entry->pos + size > entry->length){ 68 | last_entry = entry; 69 | continue; 70 | }else{ 71 | // 有,直接返回 72 | void* ptr = entry->buffer + entry->pos; 73 | entry->pos +=size; 74 | // 以0填充 75 | memset(ptr, 0, size); 76 | return ptr; 77 | } 78 | } 79 | // 到此处说明需要分配新的内存 80 | mem_pool* mem_pool = mem_pool_create(size); 81 | if(mem_pool == NULL) { 82 | // 内存耗尽 83 | printf("Memory Exhausted"); 84 | return NULL; 85 | }else{ 86 | // 当前last_entry已经指向了最后一个mem_pool 87 | // 将新创建的链接上去 88 | last_entry->next = mem_pool; 89 | void* ptr = mem_pool->buffer + mem_pool->pos; 90 | mem_pool->pos += size; 91 | // 以0填充 92 | memset(ptr, 0, size); 93 | return ptr; 94 | } 95 | } 96 | 97 | void mem_pool_free(mem_pool* pool){ 98 | if(pool == NULL){ 99 | return; 100 | } 101 | mem_pool* entry = pool; 102 | mem_pool* to_free = pool; 103 | while(entry != NULL){ 104 | to_free = entry; 105 | entry = entry->next; 106 | free(to_free->buffer); 107 | free(to_free); 108 | } 109 | } 110 | 111 | // 重置内存池回初始状态 112 | void mem_pool_reset(mem_pool* pool){ 113 | // 取出pool的next 114 | mem_pool* to_free = pool->next; 115 | // 删除之后的内存池 116 | if(to_free != NULL){ 117 | mem_pool_free(to_free); 118 | } 119 | pool->next = NULL; 120 | pool->pos = 0; 121 | } 122 | 123 | // for 预留内存池实现,返回是指针类型 124 | void* mem_alloc(int size){ 125 | #ifdef HERO_DEBUG 126 | if(size == sizeof(void*)){ 127 | printf("are you sure?,size=%d may cause error\n",size); 128 | } 129 | #endif 130 | // 这边用calloc,因为很多结构体的初始化都没有显示置NULL 131 | // calloc在某些偏门的架构上对指针来其NULL!=0,当前不考虑这种情况 132 | return (void*)calloc(1,size); 133 | } 134 | // for 预留内存池实现 135 | void mem_free(void* addr){ 136 | if(addr != NULL){ 137 | free(addr); 138 | } 139 | } 140 | 141 | void* mem_realloc(void* ptr ,int size){ 142 | #ifdef HERO_DEBUG 143 | if(size == sizeof(void*)){ 144 | printf("are you sure?,size=%d may cause error\n",size); 145 | } 146 | #endif 147 | return (void*)realloc(ptr,size); 148 | } 149 | 150 | void init_signal_handlers() { 151 | signal(SIGPIPE, SIG_IGN); 152 | signal(SIGINT, SIG_IGN); 153 | signal(SIGHUP, SIG_IGN); 154 | signal(SIGUSR1, SIG_IGN); 155 | signal(SIGUSR2, SIG_IGN); 156 | } -------------------------------------------------------------------------------- /net/basic.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_BASIC_H 2 | #define HERO_BASIC_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "config.h" 8 | 9 | #define DEFAULT_MEM_POOL_SIZE 4096 10 | #define HERO_DEBUG 11 | // 是否使用epoll进行编译 12 | #define HERO_USE_EPOLL 13 | #define TRUE 1 14 | #define FALSE 0 15 | 16 | // 简易内存池实现 17 | typedef struct _mem_pool{ 18 | int pos; 19 | int length; 20 | // 这边必须是unsigned char的buffer,原因是这样才以字节进行移动 21 | unsigned char* buffer; 22 | // 指向下一个mem_pool,假设内存不够的话 23 | void* next; 24 | }mem_pool; 25 | 26 | // for 对齐 27 | // 采用<>的实现 28 | union hero_align{ 29 | int i; 30 | long l; 31 | long *lp; 32 | void *p; 33 | void (*fp)(void); 34 | float f; 35 | double d; 36 | long double ld; 37 | }; 38 | 39 | // 必须以2的整数倍分配 40 | mem_pool* mem_pool_create(int size); 41 | void* mem_pool_alloc(int size,mem_pool* pool); 42 | void* mem_pool_alloc_ignore_check(int size,mem_pool* pool); 43 | void mem_pool_free(mem_pool* pool); 44 | 45 | 46 | void* mem_alloc(int size); 47 | void mem_free(void* address); 48 | void* mem_realloc(void* ptr ,int size); 49 | void init_signal_handlers(); 50 | void mem_pool_reset(mem_pool* pool); 51 | 52 | #endif -------------------------------------------------------------------------------- /net/buffer_util.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_BUFFER_UTIL_H 2 | #define HERO_BUFFER_UTIL_H 3 | #include "basic.h" 4 | 5 | typedef struct _packet_buffer{ 6 | int pos; 7 | int read_limit; // for read,write则无此限制 8 | int write_index; // for write 9 | int length; 10 | unsigned char* buffer; 11 | }packet_buffer; 12 | 13 | // 当前所有函数都是以buffer开头进行读取 14 | int read_byte(packet_buffer* pb); 15 | int read_ub2(packet_buffer* pb); 16 | int read_ub3(packet_buffer* pb); 17 | int read_packet_length(unsigned char* buffer); 18 | long read_ub4(packet_buffer* pb); 19 | long read_long(packet_buffer* pb); 20 | long read_length(packet_buffer* pb); 21 | char* read_string(packet_buffer* pb,mem_pool* pool); 22 | char* read_string_with_null(packet_buffer* pb,mem_pool* pool); 23 | char* read_bytes_with_length(packet_buffer* pb,mem_pool* pool,int* bytes_length); 24 | unsigned char* read_bytes_with_null(packet_buffer* pb,mem_pool* pool); 25 | 26 | int write_byte(packet_buffer* pb ,unsigned char c); 27 | int write_UB2(packet_buffer* pb,int i); 28 | int write_UB3(packet_buffer* pb, int i); 29 | int write_UB4(packet_buffer* pb,int i); 30 | int write_long(packet_buffer* pb,long l); 31 | int write_length(packet_buffer* pb,long l); 32 | int write_bytes(packet_buffer* pb ,unsigned char* src ,int length); 33 | int write_with_null(packet_buffer* pb , unsigned char* src , int length); 34 | int write_with_length(packet_buffer* pb,unsigned char* src,int length); 35 | int write_string_with_length_or_null(packet_buffer* pb ,char* src ); 36 | 37 | packet_buffer* get_packet_buffer(int size); 38 | 39 | void set_packet_buffer_read_limit(packet_buffer* pb , int read_limit); 40 | 41 | int get_length(long length); 42 | 43 | int get_length_with_bytes(long length); 44 | 45 | void free_packet_buffer(packet_buffer* pb); 46 | 47 | int packet_has_read_remaining(packet_buffer* pb); 48 | 49 | int expand(packet_buffer* pb,int size); 50 | 51 | void reset_packet_buffer(packet_buffer* pb); 52 | 53 | #endif -------------------------------------------------------------------------------- /net/com/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 设置当前代码路径=>DIR_NET_SRC 2 | AUX_SOURCE_DIRECTORY(. DIR_COMMAND_SRCS) 3 | # 将当前路径的编译结果加入proto 4 | ADD_LIBRARY (com ${DIR_COMMAND_SRCS}) -------------------------------------------------------------------------------- /net/com/handle_util.c: -------------------------------------------------------------------------------- 1 | #include "handle_util.h" 2 | 3 | int is_char_eof(unsigned char c){ 4 | if(c == '\0' || c == ' ' || c == '\n' || c == '\r' || c == '\n' || c==';'){ 5 | return TRUE; 6 | } 7 | return FALSE; 8 | } -------------------------------------------------------------------------------- /net/com/handle_util.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_HANDLE_UTIL_H 2 | #define HERO_HANDLE_UTIL_H 3 | #include "../config.h" 4 | 5 | int is_char_eof(unsigned char c); 6 | 7 | #endif -------------------------------------------------------------------------------- /net/com/select_handle.c: -------------------------------------------------------------------------------- 1 | #include "select_handle.h" 2 | #include "../config.h" 3 | #include "../server_parse.h" 4 | #include "../proto/packet.h" 5 | #include "../proto/packet_const.h" 6 | #include "handle_util.h" 7 | #include "../datasource.h" 8 | 9 | #define OTHER -1 10 | #define VERSION_COMMENT 1 11 | #define DATABASE 2 12 | #define USER 3 13 | #define LAST_INSERT_ID 4 14 | #define IDENTITY 5 15 | #define VERSION 6 16 | #define TX_ISOLATION 7 17 | 18 | int select_parse_sql(char* sql,int offset,int length); 19 | 20 | int verion_comment_check(char* sql,int offset,int length); 21 | 22 | int select_2_check(char* sql,int offset,int length); 23 | 24 | int write_version_comment(front_conn* front); 25 | 26 | int write_auto_increment(front_conn* front); 27 | 28 | int handle_select(front_conn* front,char* sql,int offset){ 29 | int sockfd = front->conn->sockfd; 30 | mem_pool* pool = front->conn->request_pool; 31 | int type = select_parse_sql(sql,offset,strlen(sql)); 32 | switch(type){ 33 | case VERSION_COMMENT: 34 | printf("it's version_comment\n"); 35 | return write_version_comment(front); 36 | case AUTO_INCREMENT: 37 | printf("it's auto increment\n"); 38 | return write_auto_increment(front); 39 | default: 40 | return default_execute(front,sql,TRUE); 41 | } 42 | return TRUE; 43 | } 44 | 45 | 46 | int select_parse_sql(char* sql,int offset,int length){ 47 | int i = offset; 48 | for(;i ++offset && sql[offset] == '@'){ 69 | if(length > ++offset){ 70 | printf("%c\n",sql[offset]); 71 | switch(sql[offset]){ 72 | case 'V': 73 | case 'v': 74 | return verion_comment_check(sql,offset,length); 75 | case 'I': 76 | case 'i': 77 | // identify check 78 | return OTHER; 79 | case 'S': 80 | case 's': 81 | // todo session comment 82 | return AUTO_INCREMENT; 83 | default: 84 | return OTHER; 85 | } 86 | } 87 | } 88 | return OTHER; 89 | } 90 | 91 | int verion_comment_check(char* sql,int offset,int length){ 92 | if(length > offset + strlen("ersion_comment")){ 93 | char c1 = sql[++offset]; 94 | char c2 = sql[++offset]; 95 | char c3 = sql[++offset]; 96 | char c4 = sql[++offset]; 97 | char c5 = sql[++offset]; 98 | char c6 = sql[++offset]; 99 | char c7 = sql[++offset]; 100 | char c8 = sql[++offset]; 101 | char c9 = sql[++offset]; 102 | char c10 = sql[++offset]; 103 | char c11 = sql[++offset]; 104 | char c12 = sql[++offset]; 105 | char c13 = sql[++offset]; 106 | char c14 = sql[++offset]; 107 | // for eof 108 | char c15 = sql[++offset]; 109 | 110 | if((c1 == 'e' || c2 =='E') && 111 | (c2 == 'r' || c3 =='R') && 112 | (c3 == 's' || c4 =='S') && 113 | (c4 == 'i' || c5 =='I') && 114 | (c5 == 'o' || c6 =='O') && 115 | (c6 == 'n' || c7 =='N') && 116 | (c7 == '_' || c8 =='_') && 117 | (c8 == 'c' || c9 =='C') && 118 | (c9 == 'o' || c10 =='O') && 119 | (c10 == 'm' || c11 =='M') && 120 | (c11 == 'm' || c12 =='M') && 121 | (c12 == 'e' || c13 =='E') && 122 | (c13 == 'n' || c14 =='N') && 123 | (c14 == 't' || c15 =='T') && 124 | (is_char_eof(c15)) 125 | ) { 126 | return VERSION_COMMENT; 127 | } 128 | } 129 | return OTHER; 130 | } 131 | 132 | 133 | int write_version_comment(front_conn* front){ 134 | int sockfd = front->conn->sockfd; 135 | mem_pool* pool = front->conn->request_pool; 136 | packet_buffer* pb = get_conn_write_buffer(front->conn); 137 | if(pb == NULL){ 138 | return NULL; 139 | } 140 | int packet_id = 1; 141 | // 发送result set header 142 | result_set_header* header = get_result_set_header(pool); 143 | header->field_count = 1; 144 | header->extra = 0; 145 | int size = caculate_result_set_header_size(header); 146 | if(header == NULL){ 147 | return NULL; 148 | } 149 | header->header.packet_length = size; 150 | header->header.packet_id = packet_id++; 151 | // 参照kernel的错误处理方法 152 | if(!write_result_set_header(pb,header)){ 153 | goto error_process; 154 | } 155 | // 发送fields 156 | field_packet* field = get_field_packet(pool); 157 | if(field == NULL){ 158 | goto error_process; 159 | } 160 | field->name = "@@version_comment"; 161 | field->header.packet_length = caculate_field_size(field); 162 | field->header.packet_id = packet_id++; 163 | if(!write_field(pb,field)){ 164 | goto error_process; 165 | } 166 | // 发送 eof 167 | eof_packet* eof = get_eof_packet(pool); 168 | if(eof == NULL){ 169 | goto error_process; 170 | } 171 | eof->header.packet_length = caculate_eof_size(); 172 | eof->header.packet_id = packet_id++; 173 | if(!write_eof(pb,eof)){ 174 | goto error_process; 175 | } 176 | // 发送 row 177 | row_packet* row = get_row_packet(pool); 178 | row->field_count=1; 179 | add_field_value_to_row(pool,row,SERVER_VERSION,strlen(SERVER_VERSION)); 180 | row->header.packet_length = caculate_row_size(row); 181 | row->header.packet_id = packet_id++; 182 | if(!write_row(pb,row)){ 183 | goto error_process; 184 | } 185 | // 发送last eof,只需要修改下packet_id 186 | eof->header.packet_id = packet_id++; 187 | if(!write_eof(pb,eof)){ 188 | goto error_process; 189 | } 190 | write_nonblock(front->conn); 191 | return TRUE; 192 | error_process: 193 | // 错误后提前清空buffer 194 | reset_packet_buffer(pb); 195 | return FALSE; 196 | } 197 | 198 | // todo 这个auto increment应该交由后面的mysql去路由 199 | int write_auto_increment(front_conn* front){ 200 | int sockfd = front->conn->sockfd; 201 | mem_pool* pool = front->conn->request_pool; 202 | packet_buffer* pb = get_conn_write_buffer(front->conn); 203 | if(pb == NULL){ 204 | return NULL; 205 | } 206 | int packet_id = 1; 207 | // 发送result set header 208 | result_set_header* header = get_result_set_header(pool); 209 | header->field_count = 1; 210 | header->extra = 0; 211 | int size = caculate_result_set_header_size(header); 212 | if(header == NULL){ 213 | return NULL; 214 | } 215 | header->header.packet_length = size; 216 | header->header.packet_id = packet_id++; 217 | // 参照kernel的错误处理方法 218 | if(!write_result_set_header(pb,header)){ 219 | goto error_process; 220 | } 221 | // 发送fields 222 | field_packet* field = get_field_packet(pool); 223 | if(field == NULL){ 224 | goto error_process; 225 | } 226 | field->name = "@@session.auto_increment_increment"; 227 | field->header.packet_length = caculate_field_size(field); 228 | field->header.packet_id = packet_id++; 229 | if(!write_field(pb,field)){ 230 | goto error_process; 231 | } 232 | // 发送 eof 233 | eof_packet* eof = get_eof_packet(pool); 234 | if(eof == NULL){ 235 | goto error_process; 236 | } 237 | eof->header.packet_length = caculate_eof_size(); 238 | eof->header.packet_id = packet_id++; 239 | if(!write_eof(pb,eof)){ 240 | goto error_process; 241 | } 242 | // 发送 row 243 | row_packet* row = get_row_packet(pool); 244 | row->field_count=1; 245 | add_field_value_to_row(pool,row,"1",strlen("1")); 246 | row->header.packet_length = caculate_row_size(row); 247 | row->header.packet_id = packet_id++; 248 | if(!write_row(pb,row)){ 249 | goto error_process; 250 | } 251 | // 发送last eof,只需要修改下packet_id 252 | eof->header.packet_id = packet_id++; 253 | if(!write_eof(pb,eof)){ 254 | goto error_process; 255 | } 256 | write_nonblock(front->conn); 257 | return TRUE; 258 | error_process: 259 | // 错误后提前清空buffer 260 | reset_packet_buffer(pb); 261 | return FALSE; 262 | } 263 | -------------------------------------------------------------------------------- /net/com/select_handle.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_SELECT_HANDLE_H 2 | #define HERO_SELECT_HANDLE_H 3 | #include "../basic.h" 4 | #include "../network.h" 5 | 6 | int handle_select(front_conn* front,char* sql,int offset); 7 | 8 | #endif -------------------------------------------------------------------------------- /net/com/show_handle.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_SHOW_HANDLE 2 | #define HERO_SHOW_HANDLE 3 | #include "../basic.h" 4 | #include "../network.h" 5 | 6 | int handle_show(front_conn* front,char* sql,int offset); 7 | 8 | #endif -------------------------------------------------------------------------------- /net/config.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_CONFIG_H 2 | #define SERVER_PORT 8090 3 | #define SERVER_INET_ADDR "127.0.0.1" 4 | #define RECV_MAX_BUFFER_SIZE 4096 * 1024 5 | #define SEND_MAX_BUFFER_SIZE 4096 * 1024 6 | #define MAX_BACK_LOG 128 7 | #define TRUE 1 8 | #define FALSE 0 9 | #define USER_NAME "pay" 10 | #define PASS_WORD "MiraCle" 11 | #define MAX_FRAME_SIZE (RECV_MAX_BUFFER_SIZE-MYSQL_HEADER_LEN) 12 | 13 | #define BACKEND_SERVER_PORT 3306 14 | // 这边得时常修改!!!todo 15 | #define BACKEND_INET_ADDR "172.20.52.185" 16 | #define BACKEND_USER_NAME "lzy" 17 | #define BACKEND_PASS_WORD "123123123" 18 | #define BACKEND_DATA_BASE "temp_db" 19 | #define MAX_PACKET_SIZE 1024 * 1024 * 16 20 | #define DATASOUCE_LENGTH 1 21 | #endif -------------------------------------------------------------------------------- /net/conn.c: -------------------------------------------------------------------------------- 1 | #include "conn.h" 2 | #include 3 | #include 4 | #include "basic.h" 5 | #include 6 | #include 7 | #include 8 | 9 | atomic_int front_conn_id = 0 ; 10 | atomic_int back_conn_id = 0; 11 | 12 | connection* init_conn_and_mempool(int sockfd,struct sockaddr_in* addr,int front_or_back){ 13 | if(FALSE == set_fd_flags(sockfd)){ 14 | return NULL; 15 | } 16 | mem_pool* pool = mem_pool_create(DEFAULT_MEM_POOL_SIZE); 17 | if(pool == NULL){ 18 | return NULL; 19 | } 20 | connection *conn_addr = (connection*)mem_pool_alloc(sizeof(connection),pool); 21 | if(conn_addr == NULL){ 22 | goto error_process; 23 | } 24 | // 对backend做处理,因为其addr是公用的server addr 25 | if(FALSE == init_conn(conn_addr,sockfd,addr,pool)){ 26 | goto error_process; 27 | } 28 | conn_addr->is_front_or_back = front_or_back; 29 | return conn_addr; 30 | error_process: 31 | mem_pool_free(pool); 32 | return NULL; 33 | } 34 | 35 | // release conn 直接就release其对应的内存池以及不从mem_poll分配的buffer 36 | void release_conn_and_mempool(connection* conn){ 37 | printf("connection close,sockfd=%d\n",conn->sockfd); 38 | close(conn->sockfd); 39 | free_packet_buffer(conn->read_buffer); 40 | free_packet_buffer(conn->write_buffer); 41 | if(conn->request_pool != NULL){ 42 | mem_pool_free(conn->request_pool); 43 | } 44 | // meta_pool必须在最后释放 45 | if(conn->meta_pool != NULL){ 46 | mem_pool_free(conn->meta_pool); 47 | } 48 | } 49 | 50 | int init_conn(connection* conn,int sockfd,struct sockaddr_in* addr,mem_pool* pool) { 51 | conn->sockfd = sockfd; 52 | conn->addr = addr; 53 | conn->meta_pool = pool; 54 | // 请求内存池,在每次请求过后,重置 55 | conn->request_pool = mem_pool_create(DEFAULT_MEM_POOL_SIZE); 56 | pthread_mutex_init(&(conn->mutex),NULL); 57 | if(conn->request_pool == NULL){ 58 | return FALSE; 59 | } 60 | // addr must be initialized 61 | // Each call to inet_ntoa() in your application will override this area 62 | // so copy it 63 | char* ip = (char*)inet_ntoa((*addr).sin_addr); 64 | if(ip != NULL){ 65 | snprintf((char*)conn->ip,48,"%s",ip); 66 | }else{ 67 | conn->ip[0] = "\0"; 68 | } 69 | // here must use htons 70 | conn->port = htons((*addr).sin_port); 71 | // 初始化读buffer 72 | conn->read_buffer = get_packet_buffer(DEFAULT_PB_SIZE); 73 | if(conn->read_buffer == NULL){ 74 | goto error_process; 75 | } 76 | // 初始化写buffer 77 | conn->write_buffer = get_packet_buffer(DEFAULT_PB_SIZE); 78 | if(conn->write_buffer == NULL){ 79 | goto error_process; 80 | } 81 | conn->is_closed = FALSE; 82 | // 统计信息 83 | if(gettimeofday(&conn->start_time,0) != 0){ 84 | printf("get time of day error"); 85 | goto error_process; 86 | } 87 | if(gettimeofday(&conn->last_read_time,0) != 0){ 88 | printf("get time of day error"); 89 | goto error_process; 90 | } 91 | if(gettimeofday(&conn->last_write_time,0) != 0){ 92 | printf("get time of day error"); 93 | goto error_process; 94 | } 95 | conn->packet_id = 0; 96 | conn->packet_length = 0; 97 | conn->query_count = 0; 98 | conn->front = NULL; 99 | conn->back = NULL; 100 | conn->datasource = NULL; 101 | conn->header_read_len = 0; 102 | conn->body_read_len = 0; 103 | conn->epfd = 0; 104 | conn->reading_or_writing = CONN_WRITING; 105 | return TRUE; 106 | error_process: 107 | if(close(sockfd) != 0){ 108 | printf("close sockfd error,sockfd=%d",sockfd); 109 | } 110 | mem_pool_free(conn->request_pool); 111 | free_packet_buffer(conn->read_buffer); 112 | free_packet_buffer(conn->write_buffer); 113 | return FALSE; 114 | 115 | } 116 | 117 | // todo 在适当时机调整一下read_buffer,不至于过大 118 | packet_buffer* get_conn_read_buffer_with_size(connection* conn,int size){ 119 | packet_buffer* pb = conn->read_buffer; 120 | if(size > pb->length) { 121 | if(!expand(pb,size)){ 122 | return NULL; 123 | } 124 | } 125 | return pb; 126 | } 127 | 128 | // todo 在适当时机调整一下write_buffer,不至于过大 129 | packet_buffer* get_conn_write_buffer_with_size(connection* conn,int size){ 130 | packet_buffer* pb = conn->write_buffer; 131 | if(size > pb->length) { 132 | if(!expand(pb,size)){ 133 | return NULL; 134 | } 135 | } 136 | return pb; 137 | } 138 | 139 | 140 | void free_front_conn(front_conn* front){ 141 | free_packet_buffer(front->conn->read_buffer); 142 | free_packet_buffer(front->conn->write_buffer); 143 | // front_conn本身由mem_pool free 144 | } 145 | 146 | 147 | void reset_conn_from_one_request(connection* conn){ 148 | // 重置connection的request_pool 149 | mem_pool_reset(conn->request_pool); 150 | // 重置connection的read_buffer 151 | reset_packet_buffer(conn->read_buffer); 152 | // 重置connection的write_buffer 153 | reset_packet_buffer(conn->write_buffer); 154 | // 重置connection的读取属性 155 | conn->packet_id = 0; 156 | conn->packet_length = 0; 157 | conn->header_read_len = 0; 158 | conn->body_read_len = 0; 159 | } 160 | 161 | // todo epoll add event function 162 | int poll_add_event(int epfd,int epifd,int mask,void* ptr){ 163 | // 栈上变量,传递给kernel,会复制 164 | struct epoll_event event = {0}; 165 | // 不需要加EPOLLHUP或EPOLLERR,因为kernel会自动加上 166 | event.events = mask; 167 | if(ptr == NULL){ 168 | // 此种情况在listen fd时候出现 169 | event.data.fd = epifd; 170 | }else{ 171 | // ptr 其实是connection 172 | ((connection*)ptr)->epfd = epfd; 173 | event.data.ptr = ptr; 174 | } 175 | return epoll_ctl(epfd,EPOLL_CTL_ADD,epifd,&event); 176 | } 177 | 178 | int poll_mod_event(int epfd,int epifd,int mask,void* ptr){ 179 | // 栈上变量,传递给kernel,会复制 180 | struct epoll_event event = {0}; 181 | // 不需要加EPOLLHUP或EPOLLERR,因为kernel会自动加上 182 | event.events = mask; 183 | if(ptr == NULL){ 184 | // 此种情况在listen fd时候出现 185 | event.data.fd = epifd; 186 | }else{ 187 | event.data.ptr = ptr; 188 | } 189 | return epoll_ctl(epfd,EPOLL_CTL_MOD,epifd,&event); 190 | } 191 | 192 | int enable_conn_write_and_disable_read(connection* conn){ 193 | if(CONN_WRITING == conn->reading_or_writing){ 194 | return TRUE; 195 | } 196 | printf("enable_conn_write_and_disable_read\n"); 197 | if(-1 == poll_mod_event(conn->epfd,conn->sockfd,EPOLLOUT,conn)){ 198 | return FALSE; 199 | } 200 | conn->reading_or_writing = CONN_WRITING; 201 | return TRUE; 202 | } 203 | 204 | int enable_conn_read_and_disable_write(connection* conn){ 205 | if(CONN_READING == conn->reading_or_writing){ 206 | return TRUE; 207 | } 208 | printf("enable_conn_read_and_disable_write\n"); 209 | if(-1 == poll_mod_event(conn->epfd,conn->sockfd,EPOLLIN,conn)){ 210 | return FALSE; 211 | } 212 | conn->reading_or_writing = CONN_READING; 213 | return TRUE; 214 | } 215 | 216 | int is_need_lock(connection* conn){ 217 | if(IS_BACK_CONN == conn->is_front_or_back){ 218 | if(TRUE == conn->back->selecting){ 219 | return TRUE; 220 | }else{ 221 | return FALSE; 222 | } 223 | }else{ 224 | front_conn* front = conn->front; 225 | if(NULL == front->back){ 226 | printf("front->back NULL\n"); 227 | return FALSE; 228 | } 229 | if(FALSE == front->back->selecting){ 230 | printf("front->back selecting FALSE\n"); 231 | return FALSE; 232 | } 233 | // 只有在处理结果集的时候才会有并发现象 234 | // backend才可能并发往front里面写 235 | return TRUE; 236 | } 237 | } -------------------------------------------------------------------------------- /net/conn.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_CON_H 2 | #define HERO_CON_H 3 | #include "basic.h" 4 | #include "proto/packet.h" 5 | #include "stdatomic.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define IS_FRONT_CONN 1 14 | #define IS_BACK_CONN 0 15 | // front status 16 | #define NOT_SEND_HANDSHAKE 0 17 | #define NOT_GET_HANDSHAKE 0 18 | #define NOT_AUTHED 1 19 | #define AUTHED 2 20 | 21 | #define RESULT_SET_FIELD_COUNT 1 22 | #define RESULT_SET_FIELDS 2 23 | #define RESULT_SET_EOF 3 24 | #define RESULT_SET_ROW 4 25 | #define RESULT_SET_LAST_EOF 5 26 | 27 | #define CONN_WRITING 0 28 | #define CONN_READING 1 29 | 30 | 31 | // for function pointer 32 | struct _front_conn; 33 | struct _back_conn; 34 | struct _Datasource; 35 | 36 | typedef int (*handle_fun)(struct _front_conn* conn,char* sql); 37 | 38 | typedef int (*resp_fun)(struct _front_conn* conn,unsigned char* buffer); 39 | 40 | // connection [front,end] 41 | typedef struct _connection{ 42 | pthread_mutex_t mutex; 43 | // 对应的sock_fd 44 | int sockfd; 45 | // sockaddr 46 | struct sockaddr_in* addr; 47 | // connection元信息内存池 48 | mem_pool* meta_pool; 49 | // 单次请求的内存池 50 | mem_pool* request_pool; 51 | // ip v6最高46位,取整48 52 | char ip[48]; 53 | // 端口号 54 | int port; 55 | // 字符集 56 | int charset_index; 57 | // 读写buffer 58 | packet_buffer* read_buffer; 59 | // todo 设置 rw buffer最大限制 60 | packet_buffer* write_buffer; 61 | // header char,用作decode todo 删除 62 | unsigned char header[4]; 63 | // 记录当前packet_id,由于是calloc=>0 64 | int packet_id; 65 | // 记录当前packet_length的长度 66 | int packet_length; 67 | // 标识当前packet_id 68 | // 状态信息=>atomic 69 | atomic_int is_closed; 70 | // 如果是backend,则指向其datasource 71 | struct _Datasource* datasource; 72 | // 统计信息 73 | struct timeval start_time; 74 | struct timeval last_read_time; 75 | struct timeval last_write_time; 76 | int query_count; 77 | // 其关联的是前端还是后端连接 78 | int is_front_or_back; 79 | struct _front_conn* front; 80 | struct _back_conn* back; 81 | // 当前读到的报文头长度 82 | int header_read_len; 83 | // 当前读到的body长度 84 | int body_read_len; 85 | // connection对应的epoll fd 86 | int epfd; 87 | int reading_or_writing; 88 | }connection; 89 | 90 | // 前端连接 91 | typedef struct _front_conn{ 92 | connection* conn; 93 | // 请求函数 94 | handle_fun handle; 95 | // 是否已经auth处理 96 | int auth_state; 97 | // 用户名 98 | char* user; 99 | // schema 100 | char* schema; 101 | // 当前正在处理的sql 102 | char* sql; 103 | // 当前的database 104 | char* database; 105 | // 对应的后端连接 106 | struct _back_conn* back; 107 | // 对应的握手包 108 | hand_shake_packet* hand_shake; 109 | }front_conn; 110 | 111 | typedef struct _back_conn{ 112 | connection* conn; 113 | long client_flags; 114 | // 对应的后端user 115 | char* user; 116 | // 对应的后端schema 117 | char* schema; 118 | // 密码 119 | char* password; 120 | // 后端认证状态 121 | int auth_state; 122 | // 当前sql是否使用select 123 | int selecting; 124 | // select状态 125 | int select_status; 126 | // 是否正在使用 127 | volatile int borrowed; 128 | // 对应的前端连接 129 | struct _front_conn* front; 130 | // 对应的处理器 131 | resp_fun handle; 132 | // 对端发过来的hand_shake_packet 133 | hand_shake_packet* hand_shake; 134 | 135 | }back_conn; 136 | 137 | int init_conn(connection* conn,int sockfd,struct sockaddr_in* addr,mem_pool* pool); 138 | 139 | packet_buffer* get_conn_read_buffer_with_size(connection* conn,int size); 140 | 141 | packet_buffer* get_conn_write_buffer_with_size(connection* conn,int size); 142 | 143 | //简单函数 直接内联 144 | inline static packet_buffer * get_conn_write_buffer(connection* conn){ 145 | return conn->write_buffer; 146 | } 147 | 148 | inline static void reset_conn_read_buffer(connection* conn){ 149 | reset_packet_buffer(conn->read_buffer); 150 | } 151 | 152 | inline static void reset_conn_write_buffer(connection* conn){ 153 | reset_packet_buffer(conn->write_buffer); 154 | } 155 | 156 | void free_front_conn(front_conn* front); 157 | 158 | void reset_conn_from_one_request(connection* conn); 159 | 160 | connection* init_conn_and_mempool(int sockfd,struct sockaddr_in* addr,int front_or_back); 161 | 162 | void release_conn_and_mempool(connection* conn); 163 | 164 | inline static int set_fd_flags(int fd) { 165 | 166 | if (fd < 0) { 167 | return FALSE; 168 | } 169 | int opts; 170 | if (0 > (opts = fcntl(fd, F_GETFL))) { 171 | return FALSE; 172 | } 173 | // 这边置为非阻塞 174 | opts = opts | O_NONBLOCK; 175 | if (0 > fcntl(fd, F_SETFL, opts)) { 176 | return FALSE; 177 | } 178 | struct linger li; 179 | memset(&li, 0, sizeof(li)); 180 | // close时候丢弃buffer,同时发送rst,避免time_wait状态 181 | li.l_onoff = 1; 182 | li.l_linger = 0; 183 | int snd_size = 1024 * 16 * 2; 184 | int recv_size = 1024 * 16 * 2; 185 | // 设置读写buffer 186 | if (0 != setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &snd_size, sizeof(snd_size))){ 187 | return FALSE; 188 | } 189 | if(0 != setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &recv_size, sizeof(recv_size))){ 190 | return FALSE; 191 | } 192 | if (0 != setsockopt(fd, SOL_SOCKET, SO_LINGER, (const char*) &li, sizeof(li))) { 193 | return FALSE; 194 | } 195 | int var = 1; 196 | if (0 != setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &var, sizeof(var))) { 197 | return FALSE; 198 | } 199 | return TRUE; 200 | } 201 | 202 | int poll_add_event(int epfd,int epifd,int mask,void* ptr); 203 | int poll_mod_event(int epfd,int epifd,int mask,void* ptr); 204 | int enable_conn_write_and_disable_read(connection* conn); 205 | int enable_conn_read_and_disable_write(connection* conn); 206 | 207 | int is_need_lock(connection* conn); 208 | 209 | #endif -------------------------------------------------------------------------------- /net/datasource.c: -------------------------------------------------------------------------------- 1 | #include "datasource.h" 2 | 3 | // must use reference , or it's just a copy 4 | Datasource* golbalDatasource; 5 | 6 | // index for choose the reactor work poll 7 | int create_backend_connection(Datasource* datasource,int index){ 8 | int sockfd = socket(AF_INET, SOCK_STREAM, 0); 9 | if(sockfd < 0){ 10 | printf("create socket failed,sockfd=%d, errno=%d, error:%s\n",sockfd, errno, strerror(errno)); 11 | return FALSE; 12 | } 13 | // connect 14 | if(connect(sockfd,&(datasource->db_addr),sizeof(struct sockaddr)) < 0){ 15 | printf("connect failed,sockfd=%d, errno=%d, error:%s\n",sockfd, errno, strerror(errno)); 16 | goto error_process; 17 | } 18 | // init 19 | connection* conn = init_conn_and_mempool(sockfd,&datasource->db_addr,IS_BACK_CONN); 20 | conn->datasource = datasource; 21 | if(conn == NULL){ 22 | close(sockfd); 23 | return FALSE; 24 | } 25 | Reactor* reactor = datasource->reactor; 26 | printf("connect okay\n"); 27 | // 添加可读事件到reactor反应堆 28 | if(-1 == poll_add_event(reactor->worker_fd_arrays[index%reactor->worker_count],conn->sockfd,EPOLLIN,conn)){ 29 | // 添加失败,则close掉连接 30 | release_conn_and_mempool(conn); 31 | return FALSE; 32 | } 33 | return TRUE; 34 | error_process: 35 | release_conn_and_mempool(conn); 36 | return FALSE; 37 | } 38 | 39 | int init_datasource(Reactor* reactor) { 40 | mem_pool* mem_pool = mem_pool_create(DEFAULT_MEM_POOL_SIZE); 41 | Datasource* datasource = (Datasource*)mem_pool_alloc(sizeof(Datasource),mem_pool); 42 | // init datasource server addr 43 | datasource->db_addr.sin_family=AF_INET; 44 | datasource->db_addr.sin_addr.s_addr=inet_addr(BACKEND_INET_ADDR);; 45 | datasource->db_addr.sin_port=htons(BACKEND_SERVER_PORT); 46 | bzero(&(datasource->db_addr.sin_zero), 8); 47 | datasource->reactor = reactor; 48 | datasource->current_conn_pos = 0; 49 | datasource->conn_pool_size = DATASOUCE_LENGTH; 50 | datasource->conn_array = (connection**)mem_pool_alloc_ignore_check(sizeof(connection**) * DATASOUCE_LENGTH,mem_pool); 51 | golbalDatasource = datasource; 52 | printf("init pthread mutex\n"); 53 | pthread_mutex_init(&(datasource->mutex),NULL); 54 | // create backend connection 55 | printf("init datasource\n"); 56 | for(int i=0 ; i < DATASOUCE_LENGTH ; i++){ 57 | printf("creating one backend connection,index=%d\n",i); 58 | if(FALSE == create_backend_connection(datasource,i)){ 59 | printf("create backend connection error\n"); 60 | goto error_process; 61 | } 62 | } 63 | return TRUE; 64 | error_process: 65 | printf("create dataSource error\n"); 66 | return FALSE; 67 | } 68 | 69 | int put_conn_to_datasource(connection* conn,Datasource* datasource){ 70 | pthread_mutex_lock(&(datasource->mutex)); 71 | int current_conn_pos = datasource->current_conn_pos; 72 | printf("current pos = %d\n",current_conn_pos); 73 | if(current_conn_pos >= datasource->conn_pool_size){ 74 | pthread_mutex_unlock(&datasource->mutex); 75 | release_conn_and_mempool(conn); 76 | return TRUE; 77 | }else{ 78 | datasource->conn_array[current_conn_pos] = conn; 79 | datasource->current_conn_pos++; 80 | pthread_mutex_unlock(&(datasource->mutex)); 81 | printf("put one conn to datasource,conn_pos=%d\n",current_conn_pos); 82 | printf("next_conn_pos=%d\n",datasource->current_conn_pos); 83 | } 84 | return TRUE; 85 | } 86 | 87 | connection* get_conn_from_datasource(Datasource* datasource){ 88 | connection* conn = NULL; 89 | pthread_mutex_lock(&datasource->mutex); 90 | printf("conn_pos=%d\n",datasource->current_conn_pos); 91 | printf("conn_pool_size=%d\n",datasource->conn_pool_size); 92 | printf("reactor count=%d\n",datasource->reactor->worker_count); 93 | if(datasource->current_conn_pos <= 0){ 94 | pthread_mutex_unlock(&(datasource->mutex)); 95 | }else{ 96 | // 由于current_conn_pos表示的是待放入的 97 | datasource->current_conn_pos--; 98 | conn = datasource->conn_array[datasource->current_conn_pos]; 99 | pthread_mutex_unlock(&(datasource->mutex)); 100 | printf("got one conn from datasource,conn_pos=%d\n",datasource->current_conn_pos); 101 | } 102 | return conn; 103 | } 104 | 105 | int write_query_command_to_back(connection* conn,char* sql){ 106 | // 如果写入失败,要将后端conn删除,返回false后,再由前面删除 107 | if(!write_query_command(conn->write_buffer,sql,COM_QUERY)){ 108 | release_conn_and_mempool(conn); 109 | return FALSE; 110 | } 111 | if(!write_nonblock(conn)){ 112 | release_conn_and_mempool(conn); 113 | return FALSE; 114 | } 115 | return TRUE; 116 | } 117 | 118 | int write_query_command(packet_buffer*pb,char* sql,unsigned char* sql_type){ 119 | int packet_size = 1 + strlen(sql); 120 | printf("write query command,packet_size=%d\n",packet_size); 121 | int packet_id = 0; 122 | if(!write_UB3(pb,packet_size)){ 123 | return FALSE; 124 | } 125 | if(!write_byte(pb,packet_id)){ 126 | return FALSE; 127 | } 128 | if(!write_byte(pb,sql_type)){ 129 | return FALSE; 130 | } 131 | if(!write_bytes(pb,sql,strlen(sql))){ 132 | return FALSE; 133 | } 134 | return TRUE; 135 | } 136 | 137 | int default_execute(front_conn* front,char* sql,int is_selecting){ 138 | connection* back_actual_conn = NULL; 139 | // pass to backend 140 | printf("get conn from datasource\n"); 141 | if(NULL == front->back){ 142 | back_actual_conn = get_conn_from_datasource(golbalDatasource); 143 | }else{ 144 | printf("front->back is not null\n"); 145 | back_actual_conn = front->back->conn; 146 | } 147 | // 设置为正在进行select 148 | back_actual_conn->back->selecting = is_selecting; 149 | back_actual_conn->front = front; 150 | front->back = back_actual_conn->back; 151 | back_actual_conn->back->front = front; 152 | if(back_actual_conn == NULL){ 153 | printf("get conn NULL\n"); 154 | return FALSE; 155 | }else{ 156 | printf("got one database conn\n"); 157 | } 158 | return write_query_command_to_back(back_actual_conn,sql); 159 | } -------------------------------------------------------------------------------- /net/datasource.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_DATASOURCE 2 | #define HERO_DATASOURCE 3 | #include "config.h" 4 | #include "conn.h" 5 | #include "hero_poll.h" 6 | 7 | typedef struct _Datasource{ 8 | // 互斥锁 9 | pthread_mutex_t mutex; 10 | // db address 11 | struct sockaddr_in db_addr; 12 | // datasource对应的内存池 13 | mem_pool* pool; 14 | // 当前conn的position 15 | int current_conn_pos; 16 | // 连接池size 17 | int conn_pool_size; 18 | // 连接池数组 19 | connection** conn_array; 20 | // 对应的反应堆模型 21 | Reactor* reactor; 22 | }Datasource; 23 | 24 | int init_datasource(Reactor* reactor); 25 | 26 | int put_conn_to_datasource(connection* conn,Datasource* datasource); 27 | connection* get_conn_from_datasource(Datasource* datasource); 28 | 29 | int default_execute(front_conn* front,char* sql,int is_selecting); 30 | int write_query_command_to_back(connection* conn,char* sql); 31 | int write_query_command(packet_buffer*pb,char* sql,unsigned char* sql_type); 32 | 33 | #endif -------------------------------------------------------------------------------- /net/hero_poll.c: -------------------------------------------------------------------------------- 1 | #include "hero_poll.h" 2 | #include 3 | #include "hero_worker.h" 4 | #include "datasource.h" 5 | 6 | // reactor模式创建 7 | // reactor的内存一直存在,暂时没必要删除,只有在出错时刻删除 8 | int init_reactor(int listen_fd,int worker_count){ 9 | mem_pool* pool = (mem_pool*)mem_pool_create(DEFAULT_MEM_POOL_SIZE); 10 | Reactor *reactor = mem_alloc(sizeof(Reactor)); 11 | reactor->events = mem_alloc(sizeof(struct epoll_event) * EPOLL_MAX_EVENTS); 12 | reactor->master_fd = epoll_create(EPOLL_MAX_EVENTS); 13 | if(reactor->master_fd == -1){ 14 | goto error_process; 15 | } 16 | reactor->worker_fd_arrays = mem_alloc(sizeof(int) * worker_count); 17 | reactor->worker_count = worker_count; 18 | for(int i=0;iworker_fd_arrays[i] = epoll_create(EPOLL_MAX_EVENTS); 20 | if(reactor->worker_fd_arrays[i] == -1){ 21 | goto error_process; 22 | } 23 | if(FALSE == create_and_start_rw_thread(reactor->worker_fd_arrays[i],pool)){ 24 | goto error_process; 25 | } 26 | } 27 | // 创建后端连接池 28 | if(FALSE == init_datasource(reactor)){ 29 | goto error_process; 30 | } 31 | if(-1 == poll_add_event(reactor->master_fd,listen_fd,EPOLLIN,NULL)){ 32 | goto error_process; 33 | } 34 | // 注意,这边需要是unsigned 防止出现负数 35 | unsigned int current_worker = 0; 36 | for(;;){ 37 | int numevents = 0; 38 | int retval = epoll_wait(reactor->master_fd,reactor->events,EPOLL_MAX_EVENTS,500); 39 | if(retval > 0){ 40 | int j; 41 | numevents = retval; 42 | // 块内作用域会被回收 43 | struct epoll_event *e; 44 | for(j=0; j < numevents; j++){ 45 | e = reactor->events+j; 46 | // accept主循环中只有一个fd 47 | if(e->data.fd == listen_fd){ 48 | int client_fd; 49 | struct sockaddr_in client_addr; 50 | socklen_t client_len = sizeof(client_addr); 51 | if (0 > (client_fd = accept(listen_fd, (struct sockaddr *) &client_addr, &client_len))) { 52 | continue; 53 | } 54 | printf("created one new connection\n"); 55 | connection *conn = init_conn_and_mempool(client_fd,&client_addr,IS_FRONT_CONN); 56 | if(conn == NULL){ 57 | // 关闭对应的client_fd 58 | close(client_fd); 59 | continue; 60 | } 61 | // 首先是触发可写事件,因为是三次握手之后,主动发起请求 62 | if(-1 == poll_add_event(reactor->worker_fd_arrays[current_worker++%reactor->worker_count],conn->sockfd,EPOLLOUT,conn)){ 63 | // 添加失败,则close掉连接 64 | release_conn_and_mempool(conn); 65 | } 66 | } 67 | } 68 | }else{ 69 | if(retval == -1){ 70 | // 对应信号打断需要做特殊处理 71 | if(errno == EINTR){ 72 | continue; 73 | } 74 | }else if(retval == 0){ 75 | // 无可用数据 76 | continue; 77 | } 78 | printf("main accept epoll has some exception,error=%d\n",errno); 79 | } 80 | } 81 | return FALSE; 82 | error_process: 83 | mem_free(reactor->worker_fd_arrays); 84 | mem_free(reactor->events); 85 | mem_free(reactor); 86 | mem_pool_free(pool); 87 | return FALSE; 88 | } -------------------------------------------------------------------------------- /net/hero_poll.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_POLL 2 | #define HERO_POLL 3 | #include "conn.h" 4 | #include "basic.h" 5 | 6 | #define EPOLL_MAX_EVENTS 1024 7 | #define DEFAULT_EPOLL_WAIT_TIMEOUT 500 8 | 9 | #ifdef HERO_USE_EPOLL 10 | typedef struct Reactor{ 11 | // accept fd 12 | int master_fd; 13 | // worker数组 14 | int *worker_fd_arrays; 15 | // worker数量 16 | int worker_count; 17 | // 主循环epoll数组 18 | struct epoll_event *events; 19 | }Reactor; 20 | 21 | int init_reactor(int listen_fd,int worker_count); 22 | 23 | #endif 24 | #endif -------------------------------------------------------------------------------- /net/hero_worker.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_WORKER_H 2 | #define HERO_WORKER_H 3 | #include "basic.h" 4 | #include "conn.h" 5 | 6 | int create_and_start_rw_thread(int worker_fd,mem_pool* pool); 7 | 8 | void handle_ready_read_connection(connection* conn); 9 | 10 | void hanlde_ready_write_connection(connection* conn); 11 | 12 | int write_nonblock(connection* conn); 13 | 14 | int write_auth_okay(connection* conn); 15 | 16 | int write_okay(connection* conn); 17 | 18 | #endif -------------------------------------------------------------------------------- /net/network.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_NET_WORK_H 2 | #define HERO_NET_WORK_H 3 | #include "proto/packet.h" 4 | #include "basic.h" 5 | #include 6 | #include "conn.h" 7 | 8 | // 返回码 9 | #define READ_PACKET_SUCCESS 1 10 | #define READ_PACKET_ERROR 2 11 | #define READ_WAIT_FOR_EVENT 3 12 | #define READ_PACKET_LENGTH_MORE_THAN_MAX 4 13 | #define MEMORY_EXHAUSTED 5 14 | 15 | #define AUTH_OKAY_SIZE 11 16 | #define OKAY_SIZE 11 17 | #define FILLER_SIZE 23 18 | 19 | // 全局变量extern 20 | extern unsigned char FILLER_HAND_SHAKE[]; 21 | extern unsigned char AUTH_OKAY[]; 22 | extern unsigned char FILLER[]; 23 | extern unsigned char OKAY[]; 24 | 25 | // 这边由于需要修改指针类型的result,所以需要双重指针 26 | int send_handshake(front_conn* front,hand_shake_packet** result); 27 | 28 | int read_auth(front_conn* front,auth_packet** result); 29 | 30 | int read_error_packet(connection* conn); 31 | 32 | void send_auth_okay(int sockfd); 33 | 34 | int check_auth(auth_packet* auth,hand_shake_packet* handshake); 35 | 36 | int get_server_capacities(); 37 | 38 | int handle_one_connection(int sockfd,struct sockaddr_in* sockaddr_ptr, mem_pool* pool); 39 | 40 | int readn(int sockfd,int size,unsigned char* recv_buff); 41 | 42 | int writen(int sockfd,int size ,unsigned char* write_buff); 43 | 44 | void read_query(int sockfd, mem_pool* pool); 45 | 46 | int read_packet(connection* conn); 47 | 48 | int read_and_check_auth(connection* conn); 49 | 50 | #endif -------------------------------------------------------------------------------- /net/password.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "password.h" 5 | 6 | #define SHA1CircularShift(bits,word) \ 7 | (((word) << (bits)) | ((word) >> (32-(bits)))) 8 | 9 | const uint32 sha_const_key[5]= 10 | { 11 | 0x67452301, 12 | 0xEFCDAB89, 13 | 0x98BADCFE, 14 | 0x10325476, 15 | 0xC3D2E1F0 16 | }; 17 | 18 | static const uint32 K[]= 19 | { 20 | 0x5A827999, 21 | 0x6ED9EBA1, 22 | 0x8F1BBCDC, 23 | 0xCA62C1D6 24 | }; 25 | 26 | static void SHA1ProcessMessageBlock(SHA1_CONTEXT *context) 27 | { 28 | int t; /* Loop counter */ 29 | uint32 temp; /* Temporary word value */ 30 | uint32 W[80]; /* Word sequence */ 31 | uint32 A, B, C, D, E; /* Word buffers */ 32 | int idx; 33 | 34 | /* 35 | Initialize the first 16 words in the array W 36 | */ 37 | 38 | for (t = 0; t < 16; t++) 39 | { 40 | idx=t*4; 41 | W[t] = context->Message_Block[idx] << 24; 42 | W[t] |= context->Message_Block[idx + 1] << 16; 43 | W[t] |= context->Message_Block[idx + 2] << 8; 44 | W[t] |= context->Message_Block[idx + 3]; 45 | } 46 | 47 | 48 | for (t = 16; t < 80; t++) 49 | { 50 | W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); 51 | } 52 | 53 | A = context->Intermediate_Hash[0]; 54 | B = context->Intermediate_Hash[1]; 55 | C = context->Intermediate_Hash[2]; 56 | D = context->Intermediate_Hash[3]; 57 | E = context->Intermediate_Hash[4]; 58 | 59 | for (t = 0; t < 20; t++) 60 | { 61 | temp= SHA1CircularShift(5,A) + ((B & C) | ((~B) & D)) + E + W[t] + K[0]; 62 | E = D; 63 | D = C; 64 | C = SHA1CircularShift(30,B); 65 | B = A; 66 | A = temp; 67 | } 68 | 69 | for (t = 20; t < 40; t++) 70 | { 71 | temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; 72 | E = D; 73 | D = C; 74 | C = SHA1CircularShift(30,B); 75 | B = A; 76 | A = temp; 77 | } 78 | 79 | for (t = 40; t < 60; t++) 80 | { 81 | temp= (SHA1CircularShift(5,A) + ((B & C) | (B & D) | (C & D)) + E + W[t] + 82 | K[2]); 83 | E = D; 84 | D = C; 85 | C = SHA1CircularShift(30,B); 86 | B = A; 87 | A = temp; 88 | } 89 | 90 | for (t = 60; t < 80; t++) 91 | { 92 | temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; 93 | E = D; 94 | D = C; 95 | C = SHA1CircularShift(30,B); 96 | B = A; 97 | A = temp; 98 | } 99 | 100 | context->Intermediate_Hash[0] += A; 101 | context->Intermediate_Hash[1] += B; 102 | context->Intermediate_Hash[2] += C; 103 | context->Intermediate_Hash[3] += D; 104 | context->Intermediate_Hash[4] += E; 105 | 106 | context->Message_Block_Index = 0; 107 | } 108 | 109 | static void SHA1PadMessage(SHA1_CONTEXT *context) 110 | { 111 | /* 112 | Check to see if the current message block is too small to hold 113 | the initial padding bits and length. If so, we will pad the 114 | block, process it, and then continue padding into a second 115 | block. 116 | */ 117 | 118 | int i=context->Message_Block_Index; 119 | 120 | if (i > 55) 121 | { 122 | context->Message_Block[i++] = 0x80; 123 | bzero((char*) &context->Message_Block[i], 124 | sizeof(context->Message_Block[0])*(64-i)); 125 | context->Message_Block_Index=64; 126 | 127 | /* This function sets context->Message_Block_Index to zero */ 128 | SHA1ProcessMessageBlock(context); 129 | 130 | bzero((char*) &context->Message_Block[0], 131 | sizeof(context->Message_Block[0])*56); 132 | context->Message_Block_Index=56; 133 | } 134 | else 135 | { 136 | context->Message_Block[i++] = 0x80; 137 | bzero((char*) &context->Message_Block[i], 138 | sizeof(context->Message_Block[0])*(56-i)); 139 | context->Message_Block_Index=56; 140 | } 141 | 142 | /* 143 | Store the message length as the last 8 octets 144 | */ 145 | 146 | context->Message_Block[56] = (int8) (context->Length >> 56); 147 | context->Message_Block[57] = (int8) (context->Length >> 48); 148 | context->Message_Block[58] = (int8) (context->Length >> 40); 149 | context->Message_Block[59] = (int8) (context->Length >> 32); 150 | context->Message_Block[60] = (int8) (context->Length >> 24); 151 | context->Message_Block[61] = (int8) (context->Length >> 16); 152 | context->Message_Block[62] = (int8) (context->Length >> 8); 153 | context->Message_Block[63] = (int8) (context->Length); 154 | 155 | SHA1ProcessMessageBlock(context); 156 | } 157 | static void my_crypt( char *to, const uchar *s1, const uchar *s2, uint len){ 158 | 159 | const uint8 *s1_end= s1 + len; 160 | while (s1 < s1_end) 161 | *to++= *s1++ ^ *s2++; 162 | } 163 | 164 | int mysql_sha1_reset(SHA1_CONTEXT *context){ 165 | 166 | #ifndef DBUG_OFF 167 | if (!context){ 168 | return SHA_NULL; 169 | } 170 | #endif 171 | 172 | context->Length = 0; 173 | context->Message_Block_Index = 0; 174 | 175 | context->Intermediate_Hash[0] = sha_const_key[0]; 176 | context->Intermediate_Hash[1] = sha_const_key[1]; 177 | context->Intermediate_Hash[2] = sha_const_key[2]; 178 | context->Intermediate_Hash[3] = sha_const_key[3]; 179 | context->Intermediate_Hash[4] = sha_const_key[4]; 180 | 181 | context->Computed = 0; 182 | context->Corrupted = 0; 183 | 184 | return SHA_SUCCESS; 185 | } 186 | 187 | int mysql_sha1_input(SHA1_CONTEXT *context, const uint8 *message_array, unsigned length) 188 | { 189 | if (!length){ 190 | return SHA_SUCCESS; 191 | } 192 | 193 | #ifndef DBUG_OFF 194 | /* We assume client konows what it is doing in non-debug mode */ 195 | if (!context || !message_array){ 196 | return SHA_NULL; 197 | } 198 | if (context->Computed){ 199 | return (context->Corrupted= SHA_STATE_ERROR); 200 | } 201 | if (context->Corrupted){ 202 | return context->Corrupted; 203 | } 204 | #endif 205 | 206 | while (length--) 207 | { 208 | context->Message_Block[context->Message_Block_Index++]= 209 | (*message_array & 0xFF); 210 | context->Length += 8; /* Length is in bits */ 211 | 212 | #ifndef DBUG_OFF 213 | /* 214 | Then we're not debugging we assume we never will get message longer 215 | 2^64 bits. 216 | */ 217 | if (context->Length == 0){ 218 | return (context->Corrupted= 1); /* Message is too long */ 219 | } 220 | #endif 221 | 222 | if (context->Message_Block_Index == 64) 223 | { 224 | SHA1ProcessMessageBlock(context); 225 | } 226 | message_array++; 227 | } 228 | return SHA_SUCCESS; 229 | } 230 | 231 | int mysql_sha1_result(SHA1_CONTEXT *context, 232 | uint8 Message_Digest[SHA1_HASH_SIZE]) 233 | { 234 | int i; 235 | 236 | #ifndef DBUG_OFF 237 | if (!context || !Message_Digest){ 238 | return SHA_NULL; 239 | } 240 | 241 | if (context->Corrupted){ 242 | return context->Corrupted; 243 | } 244 | #endif 245 | 246 | if (!context->Computed) 247 | { 248 | SHA1PadMessage(context); 249 | /* message may be sensitive, clear it out */ 250 | bzero((char*) context->Message_Block,64); 251 | context->Length = 0; /* and clear length */ 252 | context->Computed = 1; 253 | } 254 | 255 | for (i = 0; i < SHA1_HASH_SIZE; i++) 256 | Message_Digest[i] = (int8)((context->Intermediate_Hash[i>>2] >> 8 257 | * ( 3 - ( i & 0x03 ) ))); 258 | return SHA_SUCCESS; 259 | } 260 | 261 | void scramble(char *to, const char *message, const char *password) { 262 | 263 | SHA1_CONTEXT sha1_context; 264 | uint8 hash_stage1[SHA1_HASH_SIZE]; 265 | uint8 hash_stage2[SHA1_HASH_SIZE]; 266 | 267 | mysql_sha1_reset(&sha1_context); 268 | /* stage 1: hash password */ 269 | mysql_sha1_input(&sha1_context, (uint8 *) password, (uint) strlen(password)); 270 | mysql_sha1_result(&sha1_context, hash_stage1); 271 | /* stage 2: hash stage 1; note that hash_stage2 is stored in the database */ 272 | mysql_sha1_reset(&sha1_context); 273 | mysql_sha1_input(&sha1_context, hash_stage1, SHA1_HASH_SIZE); 274 | mysql_sha1_result(&sha1_context, hash_stage2); 275 | /* create crypt string as sha1(message, hash_stage2) */; 276 | mysql_sha1_reset(&sha1_context); 277 | mysql_sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH); 278 | mysql_sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE); 279 | /* xor allows 'from' and 'to' overlap: lets take advantage of it */ 280 | mysql_sha1_result(&sha1_context, (uint8 *) to); 281 | my_crypt(to, (const uchar *) to, hash_stage1, SCRAMBLE_LENGTH); 282 | } 283 | -------------------------------------------------------------------------------- /net/password.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_PASSWORD_H_ 2 | #define HERO_PASSWORD_H_ 3 | 4 | 5 | #define SHA1_HASH_SIZE 20 /* Hash size in bytes */ 6 | #define SCRAMBLE_LENGTH 20 7 | 8 | #include 9 | 10 | typedef unsigned char uint8; 11 | typedef signed char int8; 12 | typedef short int16; 13 | typedef unsigned char uchar; 14 | typedef unsigned long long int ulonglong; 15 | typedef unsigned int uint32; 16 | 17 | enum sha_result_codes 18 | { 19 | SHA_SUCCESS = 0, 20 | SHA_NULL, /* Null pointer parameter */ 21 | SHA_INPUT_TOO_LONG, /* input data too long */ 22 | SHA_STATE_ERROR /* called Input after Result */ 23 | }; 24 | 25 | typedef struct SHA1_CONTEXT{ 26 | 27 | ulonglong Length; /* Message length in bits */ 28 | uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest */ 29 | int Computed; /* Is the digest computed? */ 30 | int Corrupted; /* Is the message digest corrupted? */ 31 | int16 Message_Block_Index; /* Index into message block array */ 32 | uint8 Message_Block[64]; /* 512-bit message blocks */ 33 | 34 | } SHA1_CONTEXT; 35 | 36 | void scramble(char *to, const char *message, const char *password); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /net/proto/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 设置当前代码路径=>DIR_NET_SRC 2 | AUX_SOURCE_DIRECTORY(. DIR_PROTO_SRCS) 3 | # 将当前路径的编译结果加入proto 4 | ADD_LIBRARY (proto ${DIR_PROTO_SRCS}) -------------------------------------------------------------------------------- /net/proto/capacity.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_CAPACITY_H 2 | #define HERO_CAPACITY_H 3 | // new more secure passwords 4 | int CLIENT_LONG_PASSWORD = 1; 5 | 6 | // Found instead of affected rows 7 | // 返回找到(匹配)的行数,而不是改变了的行数。 8 | int CLIENT_FOUND_ROWS = 2; 9 | 10 | // Get all column flags 11 | int CLIENT_LONG_FLAG = 4; 12 | 13 | // One can specify db on connect 14 | int CLIENT_CONNECT_WITH_DB = 8; 15 | 16 | // Don't allow database.table.column 17 | // 不允许“数据库名.表名.列名”这样的语法。这是对于ODBC的设置。 18 | // 当使用这样的语法时解析器会产生一个错误,这对于一些ODBC的程序限制bug来说是有用的。 19 | int CLIENT_NO_SCHEMA = 16; 20 | 21 | // Can use compression protocol 22 | // 使用压缩协议 23 | int CLIENT_COMPRESS = 32; 24 | 25 | // Odbc client 26 | int CLIENT_ODBC = 64; 27 | 28 | // Can use LOAD DATA LOCAL 29 | int CLIENT_LOCAL_FILES = 128; 30 | 31 | // Ignore spaces before '(' 32 | // 允许在函数名后使用空格。所有函数名可以预留字。 33 | int CLIENT_IGNORE_SPACE = 256; 34 | 35 | // New 4.1 protocol This is an interactive client 36 | int CLIENT_PROTOCOL_41 = 512; 37 | 38 | // This is an interactive client 39 | // 允许使用关闭连接之前的不活动交互超时的描述,而不是等待超时秒数。 40 | // 客户端的会话等待超时变量变为交互超时变量。 41 | int CLIENT_INTERACTIVE = 1024; 42 | 43 | // Switch to SSL after handshake 44 | // 使用SSL。这个设置不应该被应用程序设置,他应该是在客户端库内部是设置的。 45 | // 可以在调用mysql_real_connect()之前调用mysql_ssl_set()来代替设置。 46 | int CLIENT_SSL = 2048; 47 | 48 | // IGNORE sigpipes 49 | // 阻止客户端库安装一个SIGPIPE信号处理器。 50 | // 这个可以用于当应用程序已经安装该处理器的时候避免与其发生冲突。 51 | int CLIENT_IGNORE_SIGPIPE = 4096; 52 | 53 | // Client knows about transactions 54 | int CLIENT_TRANSACTIONS = 8192; 55 | 56 | // Old flag for 4.1 protocol 57 | int CLIENT_RESERVED = 16384; 58 | 59 | // New 4.1 authentication 60 | int CLIENT_SECURE_CONNECTION = 32768; 61 | 62 | // Enable/disable multi-stmt support 63 | // 通知服务器客户端可以发送多条语句(由分号分隔)。如果该标志为没有被设置,多条语句执行。 64 | int CLIENT_MULTI_STATEMENTS = 65536; 65 | 66 | // Enable/disable multi-results 67 | // 通知服务器客户端可以处理由多语句或者存储过程执行生成的多结果集。 68 | // 当打开CLIENT_MULTI_STATEMENTS时,这个标志自动的被打开。 69 | int CLIENT_MULTI_RESULTS = 131072; 70 | #endif -------------------------------------------------------------------------------- /net/proto/list.h: -------------------------------------------------------------------------------- 1 | #ifndef hero_list_h 2 | 3 | // 参照linux中的list方案 4 | 5 | struct list_head{ 6 | struct list_head *prev,*next; 7 | }; 8 | 9 | #ifndef container_of 10 | // 指向对应偏移 11 | #define container_of(ptr, type, member) \ 12 | (type *)((char *)(ptr) - (char *) &((type *)0)->member) 13 | #endif 14 | 15 | #define LIST_HEAD_INIT(name) { &(name), &(name) } 16 | 17 | // 这样list_head的prev和next就指向了&name,&name两个地址本身 18 | #define LIST_HEAD(name) \ 19 | struct list_head name = LIST_HEAD_INIT(name) 20 | 21 | static inline void INIT_LIST_HEAD(struct list_head *list) 22 | { 23 | list->prev = list; 24 | list->next = list; 25 | list->next = list; 26 | } 27 | 28 | static inline void __list_add(struct list_head *newObj, 29 | struct list_head *prev, 30 | struct list_head *next) 31 | { 32 | next->prev = newObj; 33 | newObj->next = next; 34 | newObj->prev = prev; 35 | prev->next = newObj; 36 | } 37 | 38 | // 链表的添加 inline的必须为static,不然内联函数会有冲突问题 39 | // 内联函数仅仅包含文件的内部可见 40 | static inline void list_add(struct list_head *newObj,struct list_head *head) 41 | { 42 | __list_add(newObj, head, head->next); 43 | } 44 | 45 | static inline void __list_del(struct list_head * prev, struct list_head * next) 46 | { 47 | next->prev = prev; 48 | prev->next = next; 49 | } 50 | 51 | // 链表的删除 52 | static inline void list_del_entry(struct list_head *entry) 53 | { 54 | __list_del(entry->prev, entry->next); 55 | } 56 | 57 | // list正向遍历 58 | #define list_for_each(pos, head) \ 59 | for (pos = (head)->next; pos != (head); pos = pos->next) 60 | 61 | // list反向遍历 62 | #define list_for_each_prev(pos, head) \ 63 | for (pos = (head)->prev; pos != (head); pos = pos->prev) 64 | 65 | #define list_entry(ptr, type, member) \ 66 | container_of(ptr, type, member) 67 | 68 | #endif -------------------------------------------------------------------------------- /net/proto/list_test.c: -------------------------------------------------------------------------------- 1 | #include "list.h" 2 | 3 | 4 | typedef struct _item{ 5 | int n; 6 | struct list_head list; 7 | }item,*item_ptr; 8 | 9 | void testListHead(){ 10 | item_ptr itemHeader = (item_ptr)malloc(sizeof(item)); 11 | itemHeader->n=1; 12 | // 所有对list的操作都是按list_head为 13 | INIT_LIST_HEAD(&(itemHeader->list)); 14 | for(int i=0 ; i < 10 ;i++) { 15 | item_ptr item2ptr = malloc(sizeof(item)); 16 | item2ptr->n=i; 17 | list_add(&(item2ptr->list),&(itemHeader->list)); 18 | } 19 | struct list_head* pos; 20 | item_ptr tmp; 21 | struct list_head* head = &itemHeader->list; 22 | list_for_each_prev(pos,head) { 23 | tmp = list_entry(pos,struct _item,list); 24 | printf("%d\n",tmp->n); 25 | } 26 | } 27 | 28 | 29 | int main(int argc,char* argv[]){ 30 | testListHead(); 31 | } -------------------------------------------------------------------------------- /net/proto/packet.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_PACKET_H 2 | #define HERO_PACKET_H 3 | 4 | #include 5 | #include "list.h" 6 | #include "../buffer_util.h" 7 | #define FIELD_COUNT 0xfe 8 | #define SQL_STATE_MARKER '#' 9 | 10 | #define MYSQL_HEADER_LEN 4 11 | // 最大长度1M 12 | #define MYSQL_PACKET_MAX_LENGTH 1024 * 1024 13 | #define MYSQL_HEADER_END_POS 3 14 | #define PACKET_ID_POS 3 15 | #define UTF8_CHAR_INDEX 83 16 | #define SCRAMBLE_PASSWORD_LEN 20 17 | 18 | #define COM_QUIT 1 19 | #define COM_INIT_DB 2 20 | #define COM_QUERY 3 21 | 22 | // field type 23 | #define FIELD_TYPE_DECIMAL 0 24 | #define FIELD_TYPE_TINY 1 25 | #define FIELD_TYPE_SHORT 2 26 | #define FIELD_TYPE_LONG 3 27 | #define FIELD_TYPE_FLOAT 4 28 | #define FIELD_TYPE_DOUBLE 5 29 | #define FIELD_TYPE_NULL 6 30 | #define FIELD_TYPE_TIMESTAMP 7 31 | #define FIELD_TYPE_LONGLONG 8 32 | #define FIELD_TYPE_INT24 9 33 | #define FIELD_TYPE_DATE 10 34 | #define FIELD_TYPE_TIME 11 35 | #define FIELD_TYPE_DATETIME 12 36 | #define FIELD_TYPE_YEAR 13 37 | #define FIELD_TYPE_NEWDATE 14 38 | #define FIELD_TYPE_VARCHAR 15 39 | #define FIELD_TYPE_BIT 16 40 | #define FIELD_TYPE_NEW_DECIMAL 246 41 | #define FIELD_TYPE_ENUM 247 42 | #define FIELD_TYPE_SET 248 43 | #define FIELD_TYPE_TINY_BLOB 249 44 | #define FIELD_TYPE_MEDIUM_BLOB 250 45 | #define FIELD_TYPE_LONG_BLOB 251 46 | #define FIELD_TYPE_BLOB 252 47 | #define FIELD_TYPE_VAR_STRING 253 48 | #define FIELD_TYPE_STRING 254 49 | #define FIELD_TYPE_GEOMETRY 255 50 | 51 | // todo 改小点 52 | #define DEFAULT_PB_SIZE 4096 53 | 54 | #define OKAY_PACKET_FIELD_COUNT 0 55 | #define ERROR_PACKET_FIELD_COUNT 255 56 | #define EOF_FIELD_COUNT 0xfe 57 | // todo以后考虑对齐(align)问题 58 | // 这边typedef就可以不用写成struct mysql_packet的形式 59 | typedef struct { 60 | // 3 字节 61 | int packet_length; 62 | // 1 字节 63 | char packet_id; 64 | }mysql_packet; 65 | 66 | typedef struct _auth_packet{ 67 | // mysql通用头部 68 | mysql_packet header; 69 | // client标识 70 | long client_flags; 71 | // 最大packet大小 72 | long max_packet_size; 73 | // 对应字符集 74 | int charset_index; 75 | unsigned char* extra; 76 | char* user; 77 | unsigned char* password; 78 | // 表示password对应byte长度,不参与buffer的写入 79 | int password_length; 80 | char* database; 81 | }auth_packet; 82 | 83 | typedef struct _command_packet{ 84 | // mysql通用头部 85 | mysql_packet header; 86 | char* command; 87 | unsigned char* args; 88 | }command_packet; 89 | 90 | typedef struct _eof_packet{ 91 | mysql_packet header; 92 | unsigned char field_count; 93 | unsigned char warning_count; 94 | unsigned char status; 95 | }eof_packet; 96 | 97 | typedef struct _error_packet{ 98 | mysql_packet header; 99 | unsigned char field_count; 100 | int error; 101 | unsigned char mark; 102 | char* sql_state; 103 | char* message; 104 | }error_packet; 105 | 106 | typedef struct _field_packet{ 107 | mysql_packet header; 108 | unsigned char* catalog; 109 | unsigned char* db; 110 | unsigned char* table; 111 | unsigned char* org_table; 112 | unsigned char* name; 113 | unsigned char* org_name; 114 | int charset_index; 115 | long length; 116 | int type; 117 | int flags; 118 | unsigned char decimals; 119 | unsigned char* definition; 120 | }field_packet; 121 | 122 | typedef struct _hand_shake_packet{ 123 | mysql_packet header; 124 | unsigned char* protocol_version; 125 | unsigned char* server_version; 126 | long thread_id; 127 | unsigned char* seed; 128 | int server_capabilities; 129 | unsigned char server_charset_index; 130 | int server_status; 131 | unsigned char* rest_of_scramble_buff; 132 | // 用作auth解密用,不参与网络传输 133 | unsigned char* scramble; 134 | }hand_shake_packet; 135 | 136 | typedef struct _ok_packet{ 137 | mysql_packet header; 138 | unsigned char field_count; 139 | long affected_rows; 140 | long insert_id; 141 | int server_status; 142 | int warning_count; 143 | unsigned char* message; 144 | }ok_packet; 145 | 146 | typedef struct _result_set_header{ 147 | mysql_packet header; 148 | int field_count; 149 | long extra; 150 | }result_set_header; 151 | 152 | typedef struct _field_value{ 153 | unsigned char* value; 154 | int length; 155 | void *next; 156 | }field_value; 157 | 158 | typedef struct _row_packet{ 159 | mysql_packet header; 160 | int field_count; 161 | // 通用链表设计,对应的value链表 162 | field_value* value_list; 163 | }row_packet; 164 | 165 | // 代表了整个result结构体 166 | typedef struct _result_set{ 167 | result_set_header* header; 168 | struct list_head fields; 169 | eof_packet* eof_packet; 170 | row_packet* data; 171 | eof_packet* last_eof; 172 | }result_set; 173 | 174 | 175 | hand_shake_packet* get_handshake_packet(mem_pool* pool); 176 | ok_packet* get_ok_packet(mem_pool* pool); 177 | result_set_header* get_result_set_header(mem_pool* pool); 178 | field_packet* get_field_packet(mem_pool* pool); 179 | field_packet* get_field_packet_with_type(mem_pool* pool,int type); 180 | eof_packet* get_eof_packet(mem_pool* pool); 181 | row_packet* get_row_packet(mem_pool* pool); 182 | error_packet* get_error_packet(mem_pool* pool); 183 | 184 | 185 | int add_field_value_to_row(mem_pool* pool,row_packet* row,unsigned char* buffer,int length); 186 | 187 | int caculate_handshake_size(); 188 | int caculate_auth_packet_size(); 189 | int caculate_result_set_header_size(result_set_header* ptr); 190 | int caculate_field_size(field_packet* ptr); 191 | int caculate_eof_size(); 192 | int caculate_row_size(row_packet* row); 193 | int caculate_error_packet_size(error_packet* error); 194 | 195 | void free_packet_buffer(packet_buffer* pb); 196 | 197 | int write_result_set_header(packet_buffer*pb,result_set_header* header); 198 | int write_field(packet_buffer* pb,field_packet* field); 199 | int write_eof(packet_buffer* pb,eof_packet* eof); 200 | int write_row(packet_buffer* pb,row_packet* row); 201 | int write_error(packet_buffer* pb,error_packet* error); 202 | 203 | #endif -------------------------------------------------------------------------------- /net/proto/packet_const.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_PACKET_CONST_H 2 | #define HERO_PACKET_CONST_H 3 | #define SERVER_VERSION "5.1.1-Hero" 4 | #endif -------------------------------------------------------------------------------- /net/query.c: -------------------------------------------------------------------------------- 1 | #include "query.h" 2 | #include "config.h" 3 | #include "buffer_util.h" 4 | #include "server_parse.h" 5 | #include "com/show_handle.h" 6 | #include "com/select_handle.h" 7 | #include "network.h" 8 | #include "sql_error_code.h" 9 | 10 | int handle_mysql_command(front_conn* front){ 11 | unsigned char* header_buffer = front->conn->header; 12 | int sockfd = front->conn->sockfd; 13 | mem_pool* pool = front->conn->request_pool; 14 | // 读取4个字节(MySQL Header Len) 15 | if(!readn(sockfd,MYSQL_HEADER_LEN,header_buffer)){ 16 | printf("read handshake error"); 17 | return FALSE; 18 | } 19 | // 读取长度 20 | int length = read_packet_length(header_buffer); 21 | printf("length = %d\n",length); 22 | if(length > MAX_FRAME_SIZE){ 23 | printf("handshake size more than max size,length=%d",length); 24 | return FALSE; 25 | } 26 | // 读取packet_id 27 | front->conn->packet_id = header_buffer[PACKET_ID_POS]; 28 | // 使用front conn的buffer 29 | packet_buffer* pb = get_conn_read_buffer_with_size(front->conn,length); 30 | if( pb == NULL) { 31 | return FALSE; 32 | } 33 | // 读取整个body 34 | if(!readn(sockfd,length,pb->buffer)){ 35 | reset_packet_buffer(pb); 36 | return FALSE; 37 | } 38 | // 设置read_limit 39 | set_packet_buffer_read_limit(pb,length); 40 | // 首字节为type 41 | int type = read_byte(pb); 42 | int result = FALSE; 43 | switch(type){ 44 | case COM_QUERY: 45 | result = handle_com_query(front); 46 | break; 47 | default: 48 | result = write_unkown_error_message(front); 49 | break; 50 | } 51 | // 重置packet_buffer 52 | reset_packet_buffer(pb); 53 | return result; 54 | } 55 | 56 | int handle_com_query(front_conn* front){ 57 | char* sql = read_string(front->conn->read_buffer,front->conn->request_pool); 58 | int rs = server_parse_sql(sql); 59 | switch(rs & 0xff){ 60 | case SHOW: 61 | return handle_show(front,sql,rs >> 8); 62 | case SELECT: 63 | printf("it's select\n"); 64 | return handle_select(front,sql,rs >> 8); 65 | case KILL_QUERY: 66 | printf("it's kill\n"); 67 | // todo kill backend的连接 68 | // return false,上层关闭连接 69 | return FALSE; 70 | default: 71 | return default_execute(front,sql,FALSE); 72 | } 73 | return TRUE; 74 | } 75 | 76 | // todo default error packet 不再n申请内存 77 | int write_unkown_error_message(front_conn* front){ 78 | int sockfd = front->conn->sockfd; 79 | mem_pool* pool = front->conn->request_pool; 80 | printf("unknown command\n"); 81 | error_packet* error = get_error_packet(pool); 82 | error->message = "Unknown command"; 83 | error->header.packet_length=caculate_error_packet_size(error); 84 | error->header.packet_id = front->conn->packet_id+1; 85 | error->error = ER_UNKNOWN_COM_ERROR; 86 | packet_buffer* pb = get_conn_write_buffer(front->conn); 87 | if(pb == NULL){ 88 | return NULL; 89 | } 90 | if(!write_error(pb,error)){ 91 | goto error_process; 92 | } 93 | if(!writen(sockfd,pb->pos,pb->buffer)){ 94 | goto error_process; 95 | } 96 | reset_packet_buffer(pb); 97 | return TRUE; 98 | error_process: 99 | reset_packet_buffer(pb); 100 | return FALSE; 101 | } 102 | -------------------------------------------------------------------------------- /net/query.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_QUERY_H 2 | #define HERO_QUERY_H 3 | #include "proto/packet.h" 4 | #include "conn.h" 5 | 6 | int handle_mysql_command(front_conn* front); 7 | 8 | int handle_com_query(front_conn* front); 9 | 10 | int write_unkown_error_message(front_conn* front); 11 | 12 | #endif -------------------------------------------------------------------------------- /net/server.c: -------------------------------------------------------------------------------- 1 | #include "server.h" 2 | #include "basic.h" 3 | #include "network.h" 4 | #ifdef HERO_USE_EPOLL 5 | #include 6 | #endif 7 | 8 | void process_connection(int sockfd,struct sockaddr_in* sockaddr_ptr); 9 | 10 | // 先用bio搞一搞 11 | // 后端调试成功之后再采用epoll 12 | void start_server(){ 13 | // server fd 14 | int sockfd_server; 15 | // accept fd 16 | int sockfd; 17 | int fd_temp; 18 | struct sockaddr_in sock_addr; 19 | 20 | sockfd_server = socket(AF_INET,SOCK_STREAM,0); 21 | // 设置重新利用PORT(ADDR),方便调试 22 | setsockopt(sockfd_server, SOL_SOCKET, SO_REUSEPORT, &(int){ 1 }, sizeof(int)); 23 | memset(&sock_addr,0,sizeof(sock_addr)); 24 | sock_addr.sin_family = AF_INET; 25 | sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); 26 | sock_addr.sin_port = htons(SERVER_PORT); 27 | // bind 28 | fd_temp=bind(sockfd_server,(struct sockaddr*)(&sock_addr),sizeof(sock_addr)); 29 | if(fd_temp == - 1){ 30 | fprintf(stdout,"bind error!\n"); 31 | exit(1); 32 | } 33 | // listen 34 | fd_temp=listen(sockfd_server,MAX_BACK_LOG); 35 | if(fd_temp == -1){ 36 | fprintf(stdout,"listen error!\n"); 37 | exit(1); 38 | } 39 | #ifdef HERO_USE_EPOLL 40 | // for docker 41 | init_reactor(sockfd_server,get_nprocs()); 42 | #endif 43 | #ifndef HERO_USE_EPOLL 44 | while(1){ 45 | printf("waiting for new connection..."); 46 | struct sockaddr_in* s_addr_client = mem_alloc(sizeof(struct sockaddr_in)); 47 | int client_length = sizeof(*s_addr_client); 48 | sockfd = accept(sockfd_server,(struct sockaddr_ *)(s_addr_client),(socklen_t *)&(client_length)); 49 | if(sockfd == -1){ 50 | printf("Accept error!\n"); 51 | continue; 52 | } 53 | printf("A new connection occurs\n"); 54 | process_connection(sockfd,(struct sockaddr_in*)(&s_addr_client)); 55 | } 56 | #endif 57 | } 58 | 59 | 60 | void process_connection(int sockfd,struct sockaddr_in* sockaddr_ptr){ 61 | mem_pool* pool = mem_pool_create(DEFAULT_MEM_POOL_SIZE); 62 | handle_one_connection(sockfd,sockaddr_ptr,pool); 63 | mem_pool_free(pool); 64 | // close(sockfd); 65 | } -------------------------------------------------------------------------------- /net/server.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_SERVER_H 2 | #define HERO_SERVER_H 3 | 4 | #include 5 | #include "config.h" 6 | #include "proto/packet.h" 7 | #include 8 | #include 9 | #include "hero_poll.h" 10 | 11 | void start_server(); 12 | 13 | #endif -------------------------------------------------------------------------------- /net/server_parse.c: -------------------------------------------------------------------------------- 1 | #include "server_parse.h" 2 | #include 3 | #include 4 | 5 | int s_check(char* sql,int offset,int length); 6 | int se_check(char* sql,int offset,int length); 7 | int select_check(char* sql,int offset,int length); 8 | int show_check(char* sql,int offset,int length); 9 | int kill_check(char* sql,int offset,int length); 10 | 11 | int server_parse_sql(char* sql){ 12 | // printf("sql = %s\n",sql); 13 | int length = strlen(sql); 14 | for(int i=0 ; i < length ; i++){ 15 | switch(sql[i]){ 16 | case ' ': 17 | case '\t': 18 | case '\r': 19 | case '\n': 20 | continue; 21 | case '/': 22 | case '#': 23 | // parse comment 24 | i = skip_comment(sql,i); 25 | continue; 26 | case 'B': 27 | case 'b': 28 | // parse begin 29 | return -1; 30 | case 'C': 31 | case 'c': 32 | // parse schema and commit 33 | return -1; 34 | case 'D': 35 | case 'd': 36 | // parse delete 37 | return -1; 38 | case 'E': 39 | case 'e': 40 | // parse explain 41 | return -1; 42 | case 'I': 43 | case 'i': 44 | // parse insert 45 | return -1; 46 | case 'R': 47 | case 'r': 48 | // r check 49 | return -1; 50 | case 'S': 51 | case 's': 52 | // s check 53 | return s_check(sql,i,length); 54 | case 'U': 55 | case 'u': 56 | // u check 57 | return -1; 58 | case 'K': 59 | case 'k': 60 | return k_check(sql,i,length); 61 | default: 62 | return -1; 63 | } 64 | } 65 | } 66 | 67 | int skip_comment(char* sql,int offset){ 68 | int len = strlen(sql); 69 | int n = offset; 70 | switch(sql[n]){ 71 | case '/': 72 | if(len > ++n && sql[n++] == '*' && (len > n + 1) && sql[n] != '!') { 73 | for(int i=n;i m && sql[m] == '/'){ 77 | return m; 78 | } 79 | } 80 | } 81 | } 82 | break; 83 | case '#': 84 | for(int i=n+1;i offset + 4){ 101 | char c1 = sql[++offset]; 102 | char c2 = sql[++offset]; 103 | char c3 = sql[++offset]; 104 | char c4 = sql[++offset]; 105 | if ((c1 == 'i' || c1 == 'I') && (c2 == 'l' || c2 == 'L') && (c3=='l' || c3 == 'L') && (c4 == ' ' || c4 == '\t' || c4 == '\r' || c4 == '\n')) { 106 | return (offset << 8) | KILL_QUERY; 107 | } 108 | } 109 | return OTHER; 110 | } 111 | 112 | int s_check(char* sql,int offset,int length){ 113 | if(length > ++offset){ 114 | switch(sql[offset]){ 115 | case 'A': 116 | case 'a': 117 | // save point check 118 | return -1; 119 | case 'E': 120 | case 'e': 121 | // se check 122 | return se_check(sql,offset,length); 123 | case 'H': 124 | case 'h': 125 | // show check; 126 | return show_check(sql,offset,length); 127 | case 'T': 128 | case 't': 129 | // start check 130 | return -1; 131 | default: 132 | return OTHER; 133 | } 134 | } 135 | return OTHER; 136 | } 137 | 138 | int show_check(char* sql,int offset,int length){ 139 | if(length > offset + 3){ 140 | char c1 = sql[++offset]; 141 | char c2 = sql[++offset]; 142 | char c3 = sql[++offset]; 143 | if ((c1 == 'O' || c1 == 'o') && (c2 == 'W' || c2 == 'w') && (c3 == ' ' || c3 == '\t' || c3 == '\r' || c3 == '\n')) { 144 | return (offset << 8) | SHOW; 145 | } 146 | } 147 | return OTHER; 148 | } 149 | 150 | int se_check(char* sql,int offset,int length){ 151 | if(length > ++offset){ 152 | switch(sql[offset]){ 153 | case 'L': 154 | case 'l': 155 | return select_check(sql,offset,length); 156 | case 'T': 157 | case 't': 158 | // set check 159 | return OTHER; 160 | default: 161 | return OTHER; 162 | } 163 | } 164 | return OTHER; 165 | } 166 | 167 | int select_check(char* sql,int offset,int length){ 168 | if(length > offset + 4){ 169 | char c1 = sql[++offset]; 170 | char c2 = sql[++offset]; 171 | char c3 = sql[++offset]; 172 | char c4 = sql[++offset]; 173 | if ((c1 == 'E' || c1 == 'e') && (c2 == 'C' || c2 == 'c') && (c3 == 'T' || c3 == 't') 174 | && (c4 == ' ' || c4 == '\t' || c4 == '\r' || c4 == '\n' || c4 == '/' || c4 == '#')) { 175 | return (offset << 8) | SELECT; 176 | } 177 | } 178 | } -------------------------------------------------------------------------------- /net/server_parse.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_SERVER_PARSE_H 2 | #define HERO_SERVER_PARSE_H 3 | 4 | #define OTHER -1 5 | #define BEGIN 1 6 | #define COMMIT 2 7 | #define DELETE 3 8 | #define INSERT 4 9 | #define REPLACE 5 10 | #define ROLLBACK 6 11 | #define SELECT 7 12 | #define SET 8 13 | #define SHOW 9 14 | #define START 10 15 | #define UPDATE 11 16 | #define KILL 12 17 | #define SAVEPOINT 13 18 | #define USE 14 19 | #define EXPLAIN 15 20 | #define KILL_QUERY 16 21 | #define CREATE_DATABASE 17 22 | #define RELOAD 18 23 | #define AUTO_INCREMENT 19 24 | 25 | int server_parse_sql(char* sql); 26 | int skip_comment(char* sql,int offset); 27 | 28 | #endif -------------------------------------------------------------------------------- /net/session.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alchemystar/hero/d719b66986e261b66433537d024348b8d26fe9db/net/session.c -------------------------------------------------------------------------------- /net/session.h: -------------------------------------------------------------------------------- 1 | #ifndef HERO_SESSION_H 2 | #define HERO_SESSION_H 3 | 4 | typedef struct _session { 5 | 6 | }session; 7 | 8 | #endif -------------------------------------------------------------------------------- /roadmap: -------------------------------------------------------------------------------- 1 | 重启发布,连接不断功能 --------------------------------------------------------------------------------