├── src ├── test │ └── zealot │ │ ├── predefine.cpp │ │ ├── test_hash.cpp │ │ ├── Makefile │ │ ├── conf │ │ ├── test_0001.ini │ │ └── test_0002.xml │ │ ├── CMakeLists.txt │ │ ├── test_server.cpp │ │ └── test_config.cpp ├── commlib │ ├── soarlib │ │ ├── soar │ │ │ ├── predefine.cpp │ │ │ ├── fsm │ │ │ │ ├── fsmtask_fsmbase.cpp │ │ │ │ └── fsmtask_fsmbase.h │ │ │ ├── zerg │ │ │ │ ├── frame_malloc.cpp │ │ │ │ └── sndrcv_lolo.cpp │ │ │ ├── svrd │ │ │ │ ├── app_fsm.h │ │ │ │ ├── cfg_fsm.cpp │ │ │ │ ├── app_plain.h │ │ │ │ ├── svc_console.h │ │ │ │ ├── app_fsmtask.h │ │ │ │ └── cfg_fsm.h │ │ │ └── ogre │ │ │ │ ├── peer_id.h │ │ │ │ └── peer_id.cpp │ │ ├── Makefile │ │ └── CMakeLists.txt │ └── zcelib │ │ ├── zce │ │ ├── event │ │ │ ├── proactor.cpp │ │ │ ├── proactor.h │ │ │ └── handle_base.cpp │ │ ├── script │ │ │ ├── javascript.h │ │ │ └── javascript.cpp │ │ ├── time │ │ │ ├── time_value.h │ │ │ └── time_value.cpp │ │ ├── net │ │ │ ├── http_client.cpp │ │ │ ├── http_client.h │ │ │ └── ping.h │ │ ├── config.h │ │ ├── os_adapt │ │ │ ├── backtrace.h │ │ │ ├── math.cpp │ │ │ ├── dlfcn.h │ │ │ ├── stdlib.cpp │ │ │ ├── stdlib.h │ │ │ ├── spin.cpp │ │ │ ├── dlfcn.cpp │ │ │ └── getopt.h │ │ ├── timer │ │ │ ├── timer_handler.cpp │ │ │ └── timer_handler.h │ │ ├── lock │ │ │ ├── spin_lock.h │ │ │ ├── thread_semaphore.h │ │ │ ├── thread_spin.h │ │ │ ├── process_mutex.h │ │ │ ├── process_semaphore.h │ │ │ └── file_lock.h │ │ ├── util │ │ │ └── non_copyable.h │ │ ├── sqlite │ │ │ └── sqlite_result.cpp │ │ ├── string │ │ │ ├── from_string.h │ │ │ └── extend.cpp │ │ ├── socket │ │ │ ├── acceptor.h │ │ │ ├── addr_base.cpp │ │ │ └── addr_any.h │ │ ├── comm │ │ │ └── common.h │ │ ├── config │ │ │ └── file_implement.h │ │ ├── predefine.cpp │ │ ├── shared_mem │ │ │ ├── systemv.h │ │ │ └── posix.h │ │ ├── logger │ │ │ ├── log_comm.h │ │ │ └── log_print.h │ │ └── thread │ │ │ └── thread_wait_mgr.h │ │ ├── Makefile │ │ ├── cpp.hint │ │ └── CMakeLists.txt ├── commsvr │ ├── ogre4asvrd │ │ ├── ogre │ │ │ ├── predefine.cpp │ │ │ ├── main.cpp │ │ │ ├── app_timer.h │ │ │ ├── application.h │ │ │ ├── ip_restrict.h │ │ │ ├── app_timer.cpp │ │ │ ├── svc_accept.h │ │ │ ├── comm_manager.h │ │ │ ├── tcppeer_set.h │ │ │ ├── svc_udp.h │ │ │ ├── buf_storage.h │ │ │ └── auto_connect.h │ │ ├── Makefile │ │ └── CMakeLists.txt │ ├── zergsvrd │ │ ├── zerg │ │ │ ├── predefine.cpp │ │ │ ├── main.cpp │ │ │ ├── app_timer.h │ │ │ ├── application.h │ │ │ ├── ip_restrict.h │ │ │ ├── svc_accept.h │ │ │ └── app_timer.cpp │ │ ├── Makefile │ │ └── CMakeLists.txt │ └── wormholesvrd │ │ ├── wormhole │ │ ├── predefine.cpp │ │ ├── main.cpp │ │ ├── configture.h │ │ ├── stat_define.h │ │ ├── application.h │ │ └── configture.cpp │ │ ├── Makefile │ │ └── CMakeLists.txt ├── tools │ └── illusion │ │ ├── targetver.h │ │ ├── template │ │ ├── db3 │ │ │ └── game_config.db3 │ │ ├── excelcfg │ │ │ └── 配置范例表格.xlsx │ │ └── protofile │ │ │ └── game_config_01.proto │ │ ├── illusion.vcxproj.user │ │ ├── stdafx.cpp │ │ ├── illusion_main.h │ │ └── illusion.sln ├── Makefile ├── make │ ├── Makefile.rule │ └── Makefile.define └── msvcpch.cmake ├── third_party ├── include │ ├── protobuf-2.6.1 │ │ ├── python │ │ │ └── google │ │ │ │ ├── protobuf │ │ │ │ ├── __init__.py │ │ │ │ ├── internal │ │ │ │ │ └── __init__.py │ │ │ │ └── pyext │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── README │ │ │ │ └── __init__.py │ │ ├── src │ │ │ └── google │ │ │ │ └── protobuf │ │ │ │ ├── testdata │ │ │ │ ├── golden_message │ │ │ │ ├── bad_utf8_string │ │ │ │ ├── golden_packed_fields_message │ │ │ │ └── golden_message_oneof_implemented │ │ │ │ └── stubs │ │ │ │ └── structurally_valid_unittest.cc │ │ ├── editors │ │ │ └── README.txt │ │ ├── gtest │ │ │ ├── xcode │ │ │ │ ├── Config │ │ │ │ │ ├── TestTarget.xcconfig │ │ │ │ │ ├── FrameworkTarget.xcconfig │ │ │ │ │ ├── StaticLibraryTarget.xcconfig │ │ │ │ │ ├── DebugProject.xcconfig │ │ │ │ │ ├── ReleaseProject.xcconfig │ │ │ │ │ └── General.xcconfig │ │ │ │ ├── Samples │ │ │ │ │ └── FrameworkSample │ │ │ │ │ │ └── Info.plist │ │ │ │ └── Resources │ │ │ │ │ └── Info.plist │ │ │ ├── msvc │ │ │ │ ├── gtest.vcxproj.filters │ │ │ │ └── gtest_main.vcxproj.filters │ │ │ ├── m4 │ │ │ │ └── ltversion.m4 │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ └── test │ │ │ │ └── production.cc │ │ ├── protobuf-lite.pc.in │ │ ├── protobuf.pc.in │ │ ├── examples │ │ │ ├── addressbook.proto │ │ │ ├── list_people.py │ │ │ ├── README.txt │ │ │ └── ListPeople.java │ │ ├── m4 │ │ │ ├── ltversion.m4 │ │ │ └── ac_system_extensions.m4 │ │ ├── vsprojects │ │ │ ├── convert2008to2005.sh │ │ │ ├── protoc.vcxproj.filters │ │ │ ├── config.h │ │ │ └── test_plugin.vcxproj.filters │ │ ├── generate_descriptor_proto.sh │ │ ├── autogen.sh │ │ └── LICENSE │ ├── sqlite-3.8.8.1 │ │ ├── Makefile │ │ └── sqlite.vcxproj.filters │ ├── lualib-5.4.3 │ │ ├── README │ │ ├── lualib.vcxproj.user │ │ ├── lua.hpp │ │ ├── lundump.h │ │ ├── lprefix.h │ │ ├── lualib.h │ │ ├── lapi.h │ │ ├── lzio.c │ │ ├── lopnames.h │ │ ├── lzio.h │ │ ├── lstring.h │ │ └── linit.c │ ├── lualib-5.1.5 │ │ ├── lapi.h │ │ ├── linit.c │ │ ├── lstring.h │ │ ├── lundump.h │ │ ├── ldebug.h │ │ ├── ltm.h │ │ ├── lualib.h │ │ ├── lfunc.h │ │ ├── lvm.h │ │ ├── ltable.h │ │ ├── lmem.h │ │ └── lzio.h │ ├── mysql-linux-5.6.22 │ │ ├── mysql │ │ │ ├── client_authentication.h │ │ │ ├── services.h │ │ │ ├── get_password.h │ │ │ ├── innodb_priv.h │ │ │ └── plugin_validate_password.h │ │ ├── mysql_version.h │ │ ├── mysql_embed.h │ │ ├── mysql_com_server.h │ │ ├── sslopt-case.h │ │ ├── sslopt-vars.h │ │ ├── my_list.h │ │ └── plugin_validate_password.h │ └── mysql-win-5.6.22 │ │ ├── mysql │ │ ├── client_authentication.h │ │ ├── services.h │ │ ├── get_password.h │ │ ├── innodb_priv.h │ │ └── plugin_validate_password.h │ │ ├── mysql_version.h │ │ ├── mysql_embed.h │ │ ├── mysql_com_server.h │ │ ├── sslopt-case.h │ │ ├── sslopt-vars.h │ │ ├── my_list.h │ │ └── plugin_validate_password.h ├── Makefile ├── lib │ ├── linux │ │ └── libmysqlclient.a │ └── win │ │ ├── debug │ │ └── libmysql.lib │ │ └── release │ │ └── libmysql.lib └── install │ └── readme.md ├── run └── cfg │ ├── common.cfg │ ├── svctable.cfg │ ├── zergsvrd.cfg │ ├── ogre4asvrd.cfg │ └── wormholesvrd.cfg ├── bin ├── debug │ ├── libmysql.dll │ └── libmysql.pdb ├── release │ ├── libmysql.dll │ └── libmysql.pdb └── test.lua │ ├── lua_test_01.lua │ ├── lua_test_02.lua │ ├── lua_test_03.lua │ ├── lua_test_04.lua │ ├── lua_test_06.lua │ ├── lua_test_07.lua │ ├── lua_test_08.lua │ ├── lua_test_09.lua │ └── lua_test_05.lua └── .gitignore /src/test/zealot/predefine.cpp: -------------------------------------------------------------------------------- 1 | #include "predefine.h" -------------------------------------------------------------------------------- /src/test/zealot/test_hash.cpp: -------------------------------------------------------------------------------- 1 | #include "predefine.h" -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/predefine.cpp: -------------------------------------------------------------------------------- 1 | #include "soar/predefine.h" -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/predefine.cpp: -------------------------------------------------------------------------------- 1 | #include "ogre/predefine.h" -------------------------------------------------------------------------------- /src/commsvr/zergsvrd/zerg/predefine.cpp: -------------------------------------------------------------------------------- 1 | #include "zerg/predefine.h" -------------------------------------------------------------------------------- /src/tools/illusion/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/commsvr/wormholesvrd/wormhole/predefine.cpp: -------------------------------------------------------------------------------- 1 | #include "predefine.h" -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/python/google/protobuf/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/Makefile -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/python/google/protobuf/internal/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/python/google/protobuf/pyext/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /run/cfg/common.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/run/cfg/common.cfg -------------------------------------------------------------------------------- /run/cfg/svctable.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/run/cfg/svctable.cfg -------------------------------------------------------------------------------- /run/cfg/zergsvrd.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/run/cfg/zergsvrd.cfg -------------------------------------------------------------------------------- /third_party/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/third_party/Makefile -------------------------------------------------------------------------------- /bin/debug/libmysql.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/debug/libmysql.dll -------------------------------------------------------------------------------- /bin/debug/libmysql.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/debug/libmysql.pdb -------------------------------------------------------------------------------- /run/cfg/ogre4asvrd.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/run/cfg/ogre4asvrd.cfg -------------------------------------------------------------------------------- /src/make/Makefile.rule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/make/Makefile.rule -------------------------------------------------------------------------------- /bin/release/libmysql.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/release/libmysql.dll -------------------------------------------------------------------------------- /bin/release/libmysql.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/release/libmysql.pdb -------------------------------------------------------------------------------- /run/cfg/wormholesvrd.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/run/cfg/wormholesvrd.cfg -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/event/proactor.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/event/proactor.h" -------------------------------------------------------------------------------- /src/make/Makefile.define: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/make/Makefile.define -------------------------------------------------------------------------------- /src/test/zealot/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/test/zealot/Makefile -------------------------------------------------------------------------------- /bin/test.lua/lua_test_01.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/test.lua/lua_test_01.lua -------------------------------------------------------------------------------- /bin/test.lua/lua_test_02.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/test.lua/lua_test_02.lua -------------------------------------------------------------------------------- /bin/test.lua/lua_test_03.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/test.lua/lua_test_03.lua -------------------------------------------------------------------------------- /bin/test.lua/lua_test_04.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/test.lua/lua_test_04.lua -------------------------------------------------------------------------------- /bin/test.lua/lua_test_06.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/test.lua/lua_test_06.lua -------------------------------------------------------------------------------- /bin/test.lua/lua_test_07.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/test.lua/lua_test_07.lua -------------------------------------------------------------------------------- /bin/test.lua/lua_test_08.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/test.lua/lua_test_08.lua -------------------------------------------------------------------------------- /bin/test.lua/lua_test_09.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/bin/test.lua/lua_test_09.lua -------------------------------------------------------------------------------- /src/commlib/soarlib/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/commlib/soarlib/Makefile -------------------------------------------------------------------------------- /src/commlib/zcelib/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/commlib/zcelib/Makefile -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/commsvr/ogre4asvrd/Makefile -------------------------------------------------------------------------------- /src/commsvr/zergsvrd/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/commsvr/zergsvrd/Makefile -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/fsm/fsmtask_fsmbase.cpp: -------------------------------------------------------------------------------- 1 | #include "soar/predefine.h" 2 | #include "soar/fsm/fsmtask_fsmbase.h" -------------------------------------------------------------------------------- /src/commsvr/wormholesvrd/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/commsvr/wormholesvrd/Makefile -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/python/google/__init__.py: -------------------------------------------------------------------------------- 1 | __import__('pkg_resources').declare_namespace(__name__) 2 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/script/javascript.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined ZCE_USE_V8 && ZCE_USE_V8 == 1 4 | 5 | #endif 6 | -------------------------------------------------------------------------------- /third_party/lib/linux/libmysqlclient.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/third_party/lib/linux/libmysqlclient.a -------------------------------------------------------------------------------- /third_party/lib/win/debug/libmysql.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/third_party/lib/win/debug/libmysql.lib -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/time/time_value.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/commlib/zcelib/zce/time/time_value.h -------------------------------------------------------------------------------- /third_party/lib/win/release/libmysql.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/third_party/lib/win/release/libmysql.lib -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/time/time_value.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/commlib/zcelib/zce/time/time_value.cpp -------------------------------------------------------------------------------- /third_party/include/sqlite-3.8.8.1/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/third_party/include/sqlite-3.8.8.1/Makefile -------------------------------------------------------------------------------- /src/test/zealot/conf/test_0001.ini: -------------------------------------------------------------------------------- 1 | [SECTION_A] 2 | KEY1=12345 3 | KEY2=-67890 4 | 5 | 6 | [SECTION_B] 7 | KEY1=10.1.1.1 8 | KEY2=10.123 9 | -------------------------------------------------------------------------------- /src/tools/illusion/template/db3/game_config.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/tools/illusion/template/db3/game_config.db3 -------------------------------------------------------------------------------- /src/tools/illusion/template/excelcfg/配置范例表格.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/src/tools/illusion/template/excelcfg/配置范例表格.xlsx -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/net/http_client.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/logger/logging.h" 3 | #include "zce/net/http_client.h" 4 | 5 | #if 0 6 | 7 | #endif -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/script/javascript.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/script/javascript.h" 3 | 4 | #if defined ZCE_USE_V8 && ZCE_USE_V8 == 1 5 | 6 | #endif -------------------------------------------------------------------------------- /src/test/zealot/conf/test_0002.xml: -------------------------------------------------------------------------------- 1 | 2 | value 3 | 4 | 500 5 | 500 6 | 7 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/src/google/protobuf/testdata/golden_message: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/third_party/include/protobuf-2.6.1/src/google/protobuf/testdata/golden_message -------------------------------------------------------------------------------- /src/tools/illusion/illusion.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/src/google/protobuf/testdata/bad_utf8_string: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/third_party/include/protobuf-2.6.1/src/google/protobuf/testdata/bad_utf8_string -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/README: -------------------------------------------------------------------------------- 1 | 2 | This is Lua 5.4.3, released on 15 Mar 2021. 3 | 4 | For installation instructions, license details, and 5 | further information about Lua, see doc/readme.html. 6 | 7 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lualib.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/src/google/protobuf/testdata/golden_packed_fields_message: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/third_party/include/protobuf-2.6.1/src/google/protobuf/testdata/golden_packed_fields_message -------------------------------------------------------------------------------- /third_party/install/readme.md: -------------------------------------------------------------------------------- 1 | ZCELIB外部库说明 2 | ============================================= 3 | 我们使用了如下的外部库: 4 | 5 | 1. MySQL 6 | 2. RapidXML 7 | 3. SQLite 8 | 4. Protobuf 9 | 5. Lualib 10 | 11 | 我打算后面提供一个baidu盘进行分享下载这些代码的安装包。 -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/src/google/protobuf/testdata/golden_message_oneof_implemented: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailzeng/zcelib/HEAD/third_party/include/protobuf-2.6.1/src/google/protobuf/testdata/golden_message_oneof_implemented -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define ZCE_USE_LOGMSG 1 4 | #define ZCE_USE_RAPIDXML 1 5 | #define ZCE_USE_LUA 1 6 | #define ZCE_USE_PROTOBUF 1 7 | #define ZCE_USE_SQLITE 1 8 | #define ZCE_USE_MYSQL 1 9 | #define ZCE_USE_V8 1 10 | -------------------------------------------------------------------------------- /src/tools/illusion/stdafx.cpp: -------------------------------------------------------------------------------- 1 | 2 | // stdafx.cpp : source file that includes just the standard includes 3 | // illusion.pch will be the pre-compiled header 4 | // stdafx.obj will contain the pre-compiled type information 5 | 6 | #include "stdafx.h" 7 | 8 | 9 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/python/google/protobuf/pyext/README: -------------------------------------------------------------------------------- 1 | This is the 'v2' C++ implementation for python proto2. 2 | 3 | It is active when: 4 | 5 | PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp 6 | PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2 7 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/editors/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains syntax highlighting and configuration files for editors 2 | to properly display Protocol Buffer files. 3 | 4 | See each file's header comment for directions on how to use it with the 5 | appropriate editor. 6 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /src/commsvr/wormholesvrd/wormhole/main.cpp: -------------------------------------------------------------------------------- 1 | #include "predefine.h" 2 | #include "application.h" 3 | #include "configture.h" 4 | 5 | int main(int argc, const char* argv[]) 6 | { 7 | //利用模板开始启动 8 | return soar::svrd_main < wormhole::application, 9 | wormhole::configure, 10 | soar::server_timer >(argc, argv); 11 | } -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/zerg/frame_malloc.cpp: -------------------------------------------------------------------------------- 1 | #include "soar/predefine.h" 2 | #include "soar/zerg/frame_malloc.h" 3 | 4 | //放入CPP?还是? 5 | template <> zergframe_mallocor* 6 | zergframe_mallocor::instance_ = nullptr; 7 | 8 | template <> zergframe_mallocor* 9 | zergframe_mallocor::instance_ = nullptr; -------------------------------------------------------------------------------- /src/commsvr/zergsvrd/zerg/main.cpp: -------------------------------------------------------------------------------- 1 | #include "zerg/predefine.h" 2 | #include "zerg/application.h" 3 | #include "zerg/configure.h" 4 | #include "zerg/app_timer.h" 5 | 6 | int main(int argc, const char* argv[]) 7 | { 8 | //利用模板开始启动 9 | return soar::svrd_main < zerg::zerg_app, 10 | zerg::zerg_config, 11 | zerg::app_timer >(argc, argv); 12 | } -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ogre/predefine.h" 2 | #include "ogre/application.h" 3 | #include "ogre/app_timer.h" 4 | #include "ogre/configure.h" 5 | 6 | int main(int argc, const char* argv[]) 7 | { 8 | //利用模板开始启动 9 | return soar::svrd_main < ogre::application, 10 | ogre::configure, 11 | ogre::app_timer >(argc, argv); 12 | } -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/app_timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ogre 4 | { 5 | class app_timer : public soar::server_timer 6 | { 7 | public: 8 | // 9 | app_timer(); 10 | protected: 11 | ~app_timer(); 12 | 13 | // 14 | virtual int timer_timeout(const zce::time_value& time, 15 | int timer_id); 16 | }; 17 | } //namespace ogre 18 | -------------------------------------------------------------------------------- /src/commlib/zcelib/cpp.hint: -------------------------------------------------------------------------------- 1 | // Hint files help the Visual Studio IDE interpret Visual C++ identifiers 2 | // such as names of functions and macros. 3 | // For more information see https://go.microsoft.com/fwlink/?linkid=865984 4 | #define assert(expression) ((void)0) 5 | #define assert(expression) (void)( (!!(expression)) || (_wassert(_CRT_WIDE(#expression), _CRT_WIDE(__FILE__), (unsigned)(__LINE__)), 0) ) 6 | -------------------------------------------------------------------------------- /src/commlib/zcelib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # zcelib 2 | 3 | add_library(zcelib STATIC "") 4 | 5 | file(GLOB_RECURSE SOURCE_FILES ${CMAKE_SOURCE_DIR}/commlib/zcelib/*.cpp) 6 | file(GLOB_RECURSE HEADER_FILES ${CMAKE_SOURCE_DIR}/commlib/zcelib/*.h) 7 | 8 | set(All_FILES ${HEADER_FILES} ${SOURCE_FILES} ) 9 | target_sources(zcelib PRIVATE ${All_FILES} ) 10 | target_include_directories(zcelib PUBLIC ${CMAKE_SOURCE_DIR}/commlib/zcelib/) 11 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/mysql/client_authentication.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_AUTHENTICATION_H 2 | #define CLIENT_AUTHENTICATION_H 3 | #include 4 | #include "mysql.h" 5 | #include "mysql/client_plugin.h" 6 | 7 | C_MODE_START 8 | int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql); 9 | int sha256_password_init(char *, size_t, int, va_list); 10 | int sha256_password_deinit(void); 11 | C_MODE_END 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/mysql/client_authentication.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_AUTHENTICATION_H 2 | #define CLIENT_AUTHENTICATION_H 3 | #include 4 | #include "mysql.h" 5 | #include "mysql/client_plugin.h" 6 | 7 | C_MODE_START 8 | int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql); 9 | int sha256_password_init(char *, size_t, int, va_list); 10 | int sha256_password_deinit(void); 11 | C_MODE_END 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /src/commsvr/zergsvrd/zerg/app_timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace zerg 4 | { 5 | /*! 6 | * @brief ZERG服务的定时器,定时器用于各种处理 7 | * 8 | * @note 9 | */ 10 | class app_timer : public soar::server_timer 11 | { 12 | public: 13 | // 14 | app_timer(); 15 | protected: 16 | //自己管理自己的清理 17 | ~app_timer(); 18 | 19 | ///定时器触发 20 | virtual int timer_timeout(const zce::time_value& time, 21 | int timer_id); 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/application.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ogre 4 | { 5 | class application : public soar::app_buspipe 6 | { 7 | public: 8 | 9 | //我又要偷偷藏着 10 | application(); 11 | virtual ~application(); 12 | 13 | public: 14 | 15 | ///初始化,根据启动参数启动 16 | virtual int app_start(int argc, const char* argv[]); 17 | 18 | ///处理退出的清理工作 19 | virtual int app_exit(); 20 | 21 | ///运行,运行函数,不到万不得已,不会退出,为了加快发送的速度,对多种请求做了不同的微调。 22 | virtual int app_run(); 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/protobuf-lite.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Protocol Buffers 7 | Description: Google's Data Interchange Format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lprotobuf-lite @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ 10 | Cflags: -I${includedir} @PTHREAD_CFLAGS@ 11 | # Commented out because it crashes pkg-config *sigh*: 12 | # http://bugs.freedesktop.org/show_bug.cgi?id=13265 13 | # Conflicts: protobuf 14 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/protobuf.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Protocol Buffers 7 | Description: Google's Data Interchange Format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lprotobuf @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ 10 | Libs.private: @LIBS@ 11 | Cflags: -I${includedir} @PTHREAD_CFLAGS@ 12 | # Commented out because it crashes pkg-config *sigh*: 13 | # http://bugs.freedesktop.org/show_bug.cgi?id=13265 14 | # Conflicts: protobuf-lite 15 | -------------------------------------------------------------------------------- /src/commlib/soarlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # soarlib 2 | 3 | add_library(soarlib STATIC "") 4 | 5 | file(GLOB_RECURSE SOURCE_FILES ${CMAKE_SOURCE_DIR}/commlib/soarlib/*.cpp) 6 | file(GLOB_RECURSE HEADER_FILES ${CMAKE_SOURCE_DIR}/commlib/soarlib/*.h) 7 | 8 | set(All_FILES ${HEADER_FILES} ${SOURCE_FILES} ) 9 | target_sources(soarlib PRIVATE ${All_FILES}) 10 | target_include_directories(soarlib PUBLIC ${CMAKE_SOURCE_DIR}/commlib/zcelib/) 11 | target_include_directories(soarlib PUBLIC ${CMAKE_SOURCE_DIR}/commlib/soarlib/) 12 | 13 | add_dependencies(soarlib zcelib) 14 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/os_adapt/backtrace.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace zce 4 | { 5 | /*! 6 | * @brief 7 | * @return int ==0 表示执行成功 8 | * @param level_num 层数 9 | * @param str_ary 地址信息 10 | * @note 11 | */ 12 | int backtrace_stack(size_t level_num, 13 | std::vector& str_ary); 14 | 15 | int backtrace_stack(size_t level_num, 16 | FILE* stream); 17 | 18 | int backtrace_stack(zce::LOG_PRIORITY dbg_lvl, 19 | size_t level_num, 20 | const char* dbg_info); 21 | }; 22 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/net/http_client.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2014 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/net/http_client.h 4 | * @author Sailzeng 5 | * @version 6 | * @date Monday, August 25, 2014 7 | * @brief 代码的第一版本来自libghttp,还没有任何改写,只是尝试移植。 8 | * 有点违反他的版权(GNU),但我肯定要改写移植的。 9 | * 目前这段代码还处于不可以用状态,见谅。 10 | * @details 11 | * 12 | * 13 | * 14 | * @note 15 | * 16 | */ 17 | #ifndef ZCE_LIB_NET_HTTP_CLIENT_H_ 18 | #define ZCE_LIB_NET_HTTP_CLIENT_H_ 19 | 20 | #endif //_ZCE_LIB_NET_HTTP_CLIENT_H_ 21 | -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/svrd/app_fsm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "soar/svrd/app_bus.h" 4 | 5 | /*! 6 | * @brief 状态机的APP 7 | * 8 | * @note 9 | */ 10 | class svrd_fsm : public soar::app_buspipe 11 | { 12 | protected: 13 | 14 | //使用事务处理的Application 15 | svrd_fsm(); 16 | virtual ~svrd_fsm(); 17 | 18 | public: 19 | 20 | //增加调用register_func_cmd 21 | int app_start(int argc, const char* argv[]) override; 22 | 23 | //运行处理, 24 | int app_run() override; 25 | 26 | //退出处理 27 | int app_exit() override; 28 | 29 | protected: 30 | 31 | virtual int register_trans_cmd() = 0; 32 | }; 33 | -------------------------------------------------------------------------------- /src/test/zealot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # test zealot 2 | 3 | # add the executable 4 | add_executable(zealot "") 5 | 6 | file(GLOB_RECURSE SOURCE_FILES ${CMAKE_SOURCE_DIR}/test/zealot/*.cpp) 7 | file(GLOB_RECURSE HEADER_FILES ${CMAKE_SOURCE_DIR}/test/zealot/*.h) 8 | set(All_FILES ${HEADER_FILES} ${SOURCE_FILES} ) 9 | target_sources(zealot PRIVATE ${All_FILES}) 10 | target_include_directories(zealot PUBLIC ${CMAKE_SOURCE_DIR}/commlib/zcelib/) 11 | target_include_directories(zealot PUBLIC ${CMAKE_SOURCE_DIR}/test/zealot/) 12 | add_dependencies(zealot zcelib) 13 | target_link_libraries(zealot zcelib) 14 | #target_precompile_headers(zealot PRIVATE zealot_predefine.h) 15 | -------------------------------------------------------------------------------- /src/commsvr/wormholesvrd/wormhole/configture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "proxy_process.h" 4 | 5 | namespace wormhole 6 | { 7 | class configure : public soar::svrd_cfg_base 8 | { 9 | public: 10 | // 11 | configure(); 12 | virtual ~configure(); 13 | 14 | public: 15 | 16 | ///读取配置文件,得到文件配置参数 17 | virtual int read_cfgfile(); 18 | 19 | ///从配置中读取Wormhole svrd的配置 20 | int get_wormhole_cfg(const zce::propertytree* conf_tree); 21 | 22 | public: 23 | 24 | ///代理类型 25 | proxy_interface::PROXY_TYPE proxy_type_ = proxy_interface::INVALID_PROXY_TYPE; 26 | 27 | ///代理的配置数据要 28 | zce::propertytree proxy_conf_tree_; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/os_adapt/math.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/os_adapt/define.h" 3 | #include "zce/os_adapt/math.h" 4 | 5 | // Euclid's greatest common divisor algorithm. 6 | uint32_t zce::gcd(uint32_t x, uint32_t y) 7 | { 8 | while (y != 0) 9 | { 10 | u_long r = x % y; 11 | x = y; 12 | y = r; 13 | } 14 | 15 | return x; 16 | } 17 | 18 | //找到输入参数n最近(大于)的一个质数, 19 | size_t zce::nearest_prime(const size_t n) 20 | { 21 | size_t test_num = n; 22 | for (;; ++test_num) 23 | { 24 | if (zce::is_prime(test_num)) 25 | { 26 | break; 27 | } 28 | } 29 | return test_num; 30 | } -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/svrd/cfg_fsm.cpp: -------------------------------------------------------------------------------- 1 | #include "soar/predefine.h" 2 | #include "soar/enum/error_code.h" 3 | #include "soar/zerg/services_info.h" 4 | #include "soar_server_ver_define.h" 5 | #include "soar/svrd/app_bus.h" 6 | #include "soar/svrd/cfg_fsm.h" 7 | 8 | svrd_cfg_fsm::svrd_cfg_fsm() 9 | { 10 | } 11 | 12 | svrd_cfg_fsm::~svrd_cfg_fsm() 13 | { 14 | } 15 | 16 | int svrd_cfg_fsm::read_cfgfile() 17 | { 18 | // 加载zerg 配置 19 | int ret = 0; 20 | 21 | ret = svrd_cfg_base::read_cfgfile(); 22 | if (ret != 0) 23 | { 24 | return ret; 25 | } 26 | 27 | // 配置加载成功 28 | ZCE_LOG(RS_INFO, "Comm_Svrd_Config load framework config succ."); 29 | return 0; 30 | } -------------------------------------------------------------------------------- /src/tools/illusion/template/protofile/game_config_01.proto: -------------------------------------------------------------------------------- 1 | //option optimize_for = LITE_RUNTIME; 2 | 3 | enum ENUM_WEEK 4 | { 5 | MON = 1; 6 | TUE = 2; 7 | WED = 3; 8 | THU = 4; 9 | FRI = 5; 10 | SAT = 6; 11 | SUN = 7; 12 | } 13 | 14 | message GAME_CFG_STRUCT_1 15 | { 16 | optional int32 s1_a = 1; 17 | optional uint32 s1_b = 2 ; 18 | optional int64 s1_c = 3; 19 | optional uint64 s1_d = 4 ; 20 | optional double s1_e = 5; 21 | optional float s1_f = 6 ; 22 | optional bool s1_g = 7; 23 | optional string s1_h = 8 ; 24 | optional bytes s1_i = 9; 25 | repeated int32 s1_j = 10 ; 26 | repeated string s1_k = 11; 27 | optional ENUM_WEEK s1_l = 12; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /src/commsvr/zergsvrd/zerg/application.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "zerg/comm_manager.h" 4 | 5 | namespace zerg 6 | { 7 | class zerg_app : public soar::app_buspipe 8 | { 9 | public: 10 | //我又要偷偷藏着 11 | zerg_app(); 12 | virtual ~zerg_app(); 13 | 14 | public: 15 | 16 | ///初始化,根据启动参数启动 17 | virtual int app_start(int argc, const char* argv[]); 18 | 19 | ///处理退出的清理工作 20 | virtual int app_exit(); 21 | 22 | ///运行,运行函数,不到万不得已,不会退出,为了加快发送的速度,对多种请求做了不同的微调。 23 | virtual int app_run(); 24 | 25 | public: 26 | 27 | ///通信管理器 28 | zerg::comm_manager* zerg_comm_mgr_; 29 | 30 | ///OP KEY文件的时间戳 31 | time_t conf_timestamp_; 32 | }; 33 | } // namespace zerg -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/timer/timer_handler.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/os_adapt/time.h" 3 | #include "zce/timer/timer_handler.h" 4 | 5 | namespace zce 6 | { 7 | //构造函数和析构函数 8 | timer_handler::timer_handler(zce::timer_queue* timer_queue) : 9 | timer_queue_(timer_queue) 10 | { 11 | } 12 | 13 | timer_handler::timer_handler() 14 | { 15 | } 16 | 17 | timer_handler::~timer_handler() 18 | { 19 | } 20 | 21 | //得到Timer Queue 22 | timer_queue* timer_handler::timer_queue() 23 | { 24 | return timer_queue_; 25 | } 26 | 27 | //得到Timer Queue 28 | void timer_handler::timer_queue(zce::timer_queue* set_timer_queue) 29 | { 30 | timer_queue_ = set_timer_queue; 31 | } 32 | 33 | //定时器关闭 34 | int timer_handler::timer_close() 35 | { 36 | return 0; 37 | } 38 | } -------------------------------------------------------------------------------- /src/commsvr/zergsvrd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # server zergsvrd 2 | 3 | # add the executable 4 | add_executable(zergsvrd "") 5 | 6 | file(GLOB_RECURSE SOURCE_FILES ${CMAKE_SOURCE_DIR}/commsvr/zergsvrd/*.cpp) 7 | file(GLOB_RECURSE HEADER_FILES ${CMAKE_SOURCE_DIR}/commsvr/zergsvrd/*.h) 8 | set(All_FILES ${HEADER_FILES} ${SOURCE_FILES} ) 9 | target_sources(zergsvrd PRIVATE ${All_FILES}) 10 | target_include_directories(zergsvrd PUBLIC ${CMAKE_SOURCE_DIR}/commlib/zcelib/) 11 | target_include_directories(zergsvrd PUBLIC ${CMAKE_SOURCE_DIR}/commlib/soarlib/) 12 | target_include_directories(zergsvrd PUBLIC ${CMAKE_SOURCE_DIR}/commsvr/zergsvrd/) 13 | add_dependencies(zergsvrd zcelib soarlib) 14 | target_link_libraries(zergsvrd zcelib soarlib) 15 | #target_precompile_headers(zealot PRIVATE zealot_predefine.h) 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | obj 3 | *.obj 4 | *.slo 5 | *.lo 6 | *.o 7 | 8 | *.tlog 9 | *.pch 10 | *.ipch 11 | *.gch 12 | *~ 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | 18 | # Compiled Static libraries 19 | *.lai 20 | *.la 21 | *.a 22 | 23 | *.lib 24 | *.exe 25 | *.dll 26 | *.idb 27 | *.pdb 28 | *.ilk 29 | *.lastbuildstate 30 | 31 | #VS的一些文件,目录 32 | .vs 33 | *.sdf 34 | *.opensdf 35 | 36 | *.suo 37 | *.obj 38 | *.ncb 39 | *.user 40 | 41 | 42 | #执行后的一些文件。 43 | *.pid 44 | *.MMAP 45 | *.aps 46 | log 47 | *.log 48 | 49 | 50 | #微软的一些临时文件 51 | ~$*.* 52 | *.tmp 53 | 54 | #这些目录都忽视,需要时手动添加 55 | bin 56 | lib 57 | log 58 | Debug 59 | Release 60 | Win32-Debug 61 | Win32-Release 62 | x64-Debug 63 | x64-Release 64 | #CMake目录 65 | build 66 | #第三方的库代码目录 67 | third_party 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/svrd/app_plain.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "soar/svrd/app_bus.h" 4 | 5 | namespace soar 6 | { 7 | class zerg_frame; 8 | 9 | //单个函数处理APP FRAME 10 | class svrdapp_plain : public soar::app_buspipe 11 | { 12 | protected: 13 | // 14 | svrdapp_plain(); 15 | virtual ~svrdapp_plain(); 16 | 17 | public: 18 | 19 | //运行处理, 20 | virtual int app_run(); 21 | 22 | protected: 23 | 24 | //处理接收到的Frame, 25 | virtual int popfront_recvpipe(size_t max_prc, 26 | size_t& proc_frame); 27 | 28 | //处理收到的APPFRAME,不使用const的原因是因为为了加快速度,很多地方是直接将recv_frame修改 29 | virtual int process_recv_frame(soar::zerg_frame* recv_frame) = 0; 30 | 31 | protected: 32 | 33 | //接受的数据区 34 | soar::zerg_frame* nonctrl_recv_buffer_; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/msvc/gtest.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # server ogre4asvrd 2 | 3 | # add the executable 4 | add_executable(ogre4asvrd "") 5 | 6 | file(GLOB_RECURSE SOURCE_FILES ${CMAKE_SOURCE_DIR}/commsvr/ogre4asvrd/*.cpp) 7 | file(GLOB_RECURSE HEADER_FILES ${CMAKE_SOURCE_DIR}/commsvr/ogre4asvrd/*.h) 8 | set(All_FILES ${HEADER_FILES} ${SOURCE_FILES} ) 9 | target_sources(ogre4asvrd PRIVATE ${All_FILES}) 10 | target_include_directories(ogre4asvrd PUBLIC ${CMAKE_SOURCE_DIR}/commlib/zcelib/) 11 | target_include_directories(ogre4asvrd PUBLIC ${CMAKE_SOURCE_DIR}/commlib/soarlib/) 12 | target_include_directories(ogre4asvrd PUBLIC ${CMAKE_SOURCE_DIR}/commsvr/ogre4asvrd/) 13 | add_dependencies(ogre4asvrd zcelib soarlib) 14 | target_link_libraries(ogre4asvrd zcelib soarlib) 15 | #target_precompile_headers(zealot PRIVATE zealot_predefine.h) 16 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/msvc/gtest_main.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/examples/addressbook.proto: -------------------------------------------------------------------------------- 1 | // See README.txt for information and build instructions. 2 | 3 | package tutorial; 4 | 5 | option java_package = "com.example.tutorial"; 6 | option java_outer_classname = "AddressBookProtos"; 7 | 8 | message Person { 9 | required string name = 1; 10 | required int32 id = 2; // Unique ID number for this person. 11 | optional string email = 3; 12 | 13 | enum PhoneType { 14 | MOBILE = 0; 15 | HOME = 1; 16 | WORK = 2; 17 | } 18 | 19 | message PhoneNumber { 20 | required string number = 1; 21 | optional PhoneType type = 2 [default = HOME]; 22 | } 23 | 24 | repeated PhoneNumber phone = 4; 25 | } 26 | 27 | // Our address book file is just one of these. 28 | message AddressBook { 29 | repeated Person person = 1; 30 | } 31 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/event/proactor.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2014 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/event/proactor.h 4 | * @author Sailzeng 5 | * @version 6 | * @date Thursday, August 21, 2014 7 | * @brief 前摄器,这个名字是不是有点怪怪的, 8 | * 其实应该来自这来自 前摄行为,遭遇困境時,反過來控制局面,而不被局面所牽制。 9 | * 用于为异步事件多路分离和分派处理器的对象行为模式 10 | * 前摄器的作用是前面进行操作。操作交给操作系统,操作系统完成事件后,通知相应的 11 | * 处理模式 12 | * 前摄器对应的操作系统功能是 13 | * Windows IOCP,完成端口 14 | * Linux :glibc 的AIO(Posix),封装内核的libaio.以及libev,三个库。目前 15 | * Linux AIO还不是特别成熟。 16 | * @details 17 | * 18 | * 19 | * 20 | * @note 21 | * 22 | */ 23 | 24 | #ifndef ZCE_LIB_EVENT_PROACTOR_H_ 25 | #define ZCE_LIB_EVENT_PROACTOR_H_ 26 | 27 | #endif //ZCE_LIB_EVENT_PROACTOR_H_ 28 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/lock/spin_lock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace zce 4 | { 5 | /*! 6 | * @brief SPIN自旋锁,线程互斥锁, 7 | */ 8 | class spin_lock 9 | { 10 | public: 11 | 12 | spin_lock() = default; 13 | ~spin_lock() = default; 14 | 15 | spin_lock(const spin_lock&) = delete; 16 | spin_lock& operator=(const spin_lock &) = delete; 17 | 18 | bool lock() 19 | { 20 | // acquire spin lock 21 | while (flag_.test_and_set()) 22 | { 23 | } 24 | return true; 25 | } 26 | bool try_lock() 27 | { 28 | // acquire spin lock 29 | return (flag_.test_and_set()); 30 | } 31 | void unlock() 32 | { 33 | // release spin lock 34 | flag_.clear(); 35 | } 36 | private: 37 | //!atomic 的标志,有atomic的功能 38 | std::atomic_flag flag_; 39 | }; 40 | } -------------------------------------------------------------------------------- /src/commsvr/wormholesvrd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # server wormholesvrd 2 | 3 | # add the executable 4 | add_executable(wormholesvrd "") 5 | 6 | file(GLOB_RECURSE SOURCE_FILES ${CMAKE_SOURCE_DIR}/commsvr/wormholesvrd/*.cpp) 7 | file(GLOB_RECURSE HEADER_FILES ${CMAKE_SOURCE_DIR}/commsvr/wormholesvrd/*.h) 8 | set(All_FILES ${HEADER_FILES} ${SOURCE_FILES} ) 9 | target_sources(wormholesvrd PRIVATE ${All_FILES}) 10 | target_include_directories(wormholesvrd PUBLIC ${CMAKE_SOURCE_DIR}/commlib/zcelib/) 11 | target_include_directories(wormholesvrd PUBLIC ${CMAKE_SOURCE_DIR}/commlib/soarlib/) 12 | target_include_directories(wormholesvrd PUBLIC ${CMAKE_SOURCE_DIR}/commsvr/wormholesvrd/) 13 | add_dependencies(wormholesvrd zcelib soarlib) 14 | target_link_libraries(wormholesvrd zcelib soarlib) 15 | #target_precompile_headers(zealot PRIVATE zealot_predefine.h) 16 | -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/ip_restrict.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ogre 4 | { 5 | class ip_restrict 6 | { 7 | typedef std::unordered_set SET_OF_IPADDRESS; 8 | 9 | protected: 10 | 11 | ip_restrict(); 12 | ~ip_restrict(); 13 | 14 | public: 15 | 16 | ///从配置文件中得到相关的配置 17 | int get_config(const configure* config); 18 | //检查IP限制 19 | int check_ip_restrict(const zce::skt::addr_in& remoteaddress); 20 | 21 | public: 22 | 23 | //单子实例函数 24 | static ip_restrict* instance(); 25 | //清理单子实例 26 | static void clear_inst(); 27 | 28 | protected: 29 | 30 | //允许进行连接的IP地址 31 | SET_OF_IPADDRESS allow_ip_set_; 32 | //拒绝进行连接的IP地址 33 | SET_OF_IPADDRESS reject_ip_set_; 34 | 35 | protected: 36 | //单子实例 37 | static ip_restrict* instance_; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/app_timer.cpp: -------------------------------------------------------------------------------- 1 | #include "ogre/predefine.h" 2 | #include "ogre/app_timer.h" 3 | #include "ogre/svc_tcp.h" 4 | #include "ogre/application.h" 5 | 6 | namespace ogre 7 | { 8 | // 9 | app_timer::app_timer() 10 | { 11 | //主动重现链接的间隔时间 12 | const time_t AUTOCONNECT_RETRY_SEC = 5; 13 | zce::time_value connect_all_internal(AUTOCONNECT_RETRY_SEC, 0); 14 | 15 | add_app_timer(connect_all_internal); 16 | } 17 | 18 | app_timer::~app_timer() 19 | { 20 | } 21 | 22 | // 23 | int app_timer::timer_timeout(const zce::time_value& time_now, int time_id) 24 | { 25 | //等到当前的时间 26 | server_timer::timer_timeout(time_now, time_id); 27 | 28 | //处理一个错误发送数据 29 | if (zan_timer_act_[0] == time_id) 30 | { 31 | svc_tcp::connect_all_server(); 32 | } 33 | else 34 | { 35 | } 36 | 37 | return 0; 38 | } 39 | } -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/vsprojects/convert2008to2005.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh -e 2 | 3 | # This script downgrades MSVC 2008 projects to MSVC 2005 projects, allowing 4 | # people with MSVC 2005 to open them. Otherwise, MSVC 2005 simply refuses to 5 | # open projects created with 2008. We run this as part of our release process. 6 | # If you obtained the code direct from version control and you want to use 7 | # MSVC 2005, you may have to run this manually. (Hint: Use Cygwin or MSYS.) 8 | 9 | for file in *.sln; do 10 | echo "downgrading $file..." 11 | sed -i -re 's/Format Version 10.00/Format Version 9.00/g; 12 | s/Visual Studio 2008/Visual Studio 2005/g;' $file 13 | done 14 | 15 | for file in *.vcproj; do 16 | echo "downgrading $file..." 17 | sed -i -re 's/Version="9.00"/Version="8.00"/g;' $file 18 | done 19 | 20 | # Yes, really, that's it. 21 | -------------------------------------------------------------------------------- /src/tools/illusion/illusion_main.h: -------------------------------------------------------------------------------- 1 | 2 | // illusion_main.h : main header file for the illusion application 3 | // 4 | #pragma once 5 | 6 | 7 | class Illusion_Application 8 | { 9 | 10 | public: 11 | 12 | Illusion_Application(); 13 | 14 | virtual ~Illusion_Application(); 15 | 16 | 17 | /// app的开始运行 18 | virtual int app_start(int argc, const char *argv[]); 19 | 20 | /// app 运行 21 | virtual int on_run(); 22 | 23 | /// app的退出 24 | virtual int on_exit(); 25 | 26 | protected: 27 | /// 28 | std::string config_path_; 29 | 30 | /// 31 | std::string excel_path_; 32 | /// 33 | std::string proto_path_; 34 | /// 35 | std::string logdir_path_; 36 | 37 | /// 38 | std::vector execl_cfg_fileary_; 39 | /// 40 | std::vector proto_cfg_fileary_; 41 | 42 | }; 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/svrd/svc_console.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | 5 | namespace zce 6 | { 7 | class event_handler; 8 | class reactor; 9 | } 10 | 11 | namespace soar 12 | { 13 | class svc_console : public zce::event_handler 14 | { 15 | public: 16 | explicit svc_console(zce::reactor *reactor_inst); 17 | 18 | protected: 19 | virtual ~svc_console(); 20 | 21 | protected: 22 | // 23 | virtual int process_mml_command(); 24 | 25 | //处理的命令组 26 | 27 | //查询ZERG服务器的状态 28 | int cmd_get_zergstats(); 29 | //查询联接的Peer状态,不一定能全部返回,而且比较耗时 30 | int cmd_get_peer_stats(); 31 | //关闭服务器 32 | int cmd_close_services(); 33 | //关闭相应的端口 34 | int cmd_close_socketpeer(); 35 | //修改日志的输出级别 36 | int cmd_modify_logpriority(); 37 | 38 | protected: 39 | /// 40 | std::string req_string_; 41 | /// 42 | std::string rsp_string_; 43 | /// 44 | zce::mml_cmd mml_process_; 45 | }; 46 | } -------------------------------------------------------------------------------- /src/commsvr/zergsvrd/zerg/ip_restrict.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class zerg_config; 4 | 5 | namespace zerg 6 | { 7 | /*! 8 | * @brief 9 | * 10 | * @note 11 | */ 12 | class IPRestrict_Mgr 13 | { 14 | typedef std::unordered_set Set_Of_IPAddress; 15 | 16 | protected: 17 | // 18 | IPRestrict_Mgr(); 19 | ~IPRestrict_Mgr(); 20 | 21 | public: 22 | 23 | ///从配置文件中得到相关的配置 24 | int get_config(const zerg_config* config); 25 | ///检查IP限制 26 | int check_iprestrict(const zce::skt::addr_in& remoteaddress); 27 | 28 | public: 29 | 30 | ///单子实例函数 31 | static IPRestrict_Mgr* instance(); 32 | ///清理单子实例 33 | static void clear_inst(); 34 | 35 | protected: 36 | ///单子实例 37 | static IPRestrict_Mgr* instance_; 38 | 39 | protected: 40 | 41 | //允许进行连接的IP地址 42 | Set_Of_IPAddress allow_ip_set_; 43 | //拒绝进行连接的IP地址 44 | Set_Of_IPAddress reject_ip_set_; 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/util/non_copyable.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2019 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/util/non_copyable.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2011年7月1日 7 | * @brief 参考boost写的一个类,用于不可复制的类型,只要从这个类继承就OK了 8 | * 如果希望一个类不能拷贝,继承zce::NON_Copyable就可以了。 9 | * 10 | * @details 11 | * 12 | * @note 13 | * 14 | */ 15 | 16 | #pragma once 17 | 18 | namespace zce 19 | { 20 | /*! 21 | * @brief 不能复制的通过声明但不实现,拷贝构造函数和赋值函数,达到无法复制的目的 22 | */ 23 | class non_copyable 24 | { 25 | protected: 26 | ///构造函数和析构函数,保护,保证可以继承 27 | non_copyable() = default; 28 | 29 | ~non_copyable() = default; 30 | 31 | // emphasize the following members are private 32 | private: 33 | 34 | ///拷贝构造函数,声明但不实现 35 | non_copyable(const zce::non_copyable&) = delete; 36 | ///赋值函数,声明但不实现 37 | const non_copyable& operator=(const zce::non_copyable&) = delete; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Initialization of libraries for lua.c 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | #include "lua.h" 12 | 13 | #include "lualib.h" 14 | #include "lauxlib.h" 15 | 16 | 17 | static const luaL_Reg lualibs[] = { 18 | {"", luaopen_base}, 19 | {LUA_LOADLIBNAME, luaopen_package}, 20 | {LUA_TABLIBNAME, luaopen_table}, 21 | {LUA_IOLIBNAME, luaopen_io}, 22 | {LUA_OSLIBNAME, luaopen_os}, 23 | {LUA_STRLIBNAME, luaopen_string}, 24 | {LUA_MATHLIBNAME, luaopen_math}, 25 | {LUA_DBLIBNAME, luaopen_debug}, 26 | {NULL, NULL} 27 | }; 28 | 29 | 30 | LUALIB_API void luaL_openlibs (lua_State *L) { 31 | const luaL_Reg *lib = lualibs; 32 | for (; lib->func; lib++) { 33 | lua_pushcfunction(L, lib->func); 34 | lua_pushstring(L, lib->name); 35 | lua_call(L, 1, 0); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/commsvr/wormholesvrd/wormhole/stat_define.h: -------------------------------------------------------------------------------- 1 | /// @file arbiter_type_define.h 2 | /// @date 2012/07/19 3 | 4 | /// @brief 数据和类型定义 5 | /// @details 6 | 7 | #pragma once 8 | 9 | /****************************************************************************************** 10 | 监控信息 11 | ******************************************************************************************/ 12 | enum ArbiterMonitorFeatureID 13 | { 14 | WORMHOLE_SERVICE_STAT_BEGIN = SVC_PROXY_SERVER * 10000, // proxysvr start 15 | WORMHOLE_TRANS_PKG_ERROR, // 转发的数据包错误 16 | WORMHOLE_TRANS_SEND_UNBALANCE_RATE, // 发送端负载不均衡比例 17 | WORMHOLE_SERVICE_STAT_END, 18 | }; 19 | 20 | // 统计信息字符串 21 | static const zce::STATUS_ITEM_WITHNAME STR_WORMHOLE_STAT[] = 22 | { 23 | DEF_STATUS_ITEM(WORMHOLE_TRANS_PKG_ERROR, zce::STATUS_STATICS::PER_FIVE_MINTUES), 24 | DEF_STATUS_ITEM(WORMHOLE_TRANS_SEND_UNBALANCE_RATE,zce::STATUS_STATICS::PER_FIVE_MINTUES), 25 | }; 26 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | 11 | #include "lgc.h" 12 | #include "lobject.h" 13 | #include "lstate.h" 14 | 15 | 16 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) 17 | 18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) 19 | 20 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 22 | (sizeof(s)/sizeof(char))-1)) 23 | 24 | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) 25 | 26 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 27 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); 28 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/commsvr/wormholesvrd/wormhole/application.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "proxy_process.h" 4 | 5 | /*! 6 | * @brief 7 | * 8 | * @note 9 | */ 10 | namespace wormhole 11 | { 12 | class application : public soar::svrdapp_plain 13 | { 14 | public: 15 | // 自己的单子偷偷藏着, 16 | application(); 17 | ~application(); 18 | 19 | public: 20 | 21 | /*! 22 | * @brief 处理收到的APPFRAME, 23 | * @return int 24 | * @param recv_frame 处理的Frame,不使用const的原因是因为为了加快速度,很多地方是直接将recv_frame修改 25 | * @note app_run函数在Comm_SvrdApp_BUS里面已经实现了, 26 | */ 27 | virtual int process_recv_frame(soar::zerg_frame* recv_frame); 28 | 29 | ///初始化,根据启动参数启动 30 | virtual int app_start(int argc, const char* argv[]); 31 | 32 | ///处理退出的清理工作 33 | virtual int app_exit(); 34 | 35 | protected: 36 | ///重新加载配置 37 | virtual int reload_config(); 38 | 39 | protected: 40 | 41 | /// 处理的PROXY的接口 42 | proxy_interface* interface_proxy_ = nullptr; 43 | }; 44 | } -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/sqlite/sqlite_result.cpp: -------------------------------------------------------------------------------- 1 | //========================================================================================= 2 | #include "zce/predefine.h" 3 | #include "zce/sqlite/sqlite_result.h" 4 | 5 | #if SQLITE_VERSION_NUMBER >= 3005000 6 | 7 | namespace zce 8 | { 9 | sqlite_result::~sqlite_result() 10 | { 11 | free_result(); 12 | } 13 | 14 | bool sqlite_result::is_null() 15 | { 16 | return (result_ == nullptr); 17 | } 18 | 19 | const char* sqlite_result::field_name(size_t column) 20 | { 21 | return result_[column - 1]; 22 | } 23 | 24 | const char* sqlite_result::field_cstr(size_t row, size_t column) 25 | { 26 | return result_[row * column_ + column - 1]; 27 | } 28 | 29 | //释放结果集合 30 | void sqlite_result::free_result() 31 | { 32 | if (result_) 33 | { 34 | ::sqlite3_free_table(result_); 35 | result_ = nullptr; 36 | } 37 | 38 | column_ = 0; 39 | row_ = 0; 40 | } 41 | } 42 | 43 | #endif //#if SQLITE_VERSION_NUMBER >= 3005000 -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/svc_accept.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ogre/configure.h" 4 | 5 | namespace ogre 6 | { 7 | class ip_restrict; 8 | 9 | /*! 10 | * @brief TCP Accept 处理的EventHandler 11 | * 12 | * @note 13 | */ 14 | class svc_accept : public zce::event_handler 15 | { 16 | public: 17 | 18 | //构造函数 19 | svc_accept(const TCP_PEER_CONFIG_INFO& config_info, 20 | zce::reactor* reactor = zce::reactor::instance()); 21 | protected: 22 | ~svc_accept(); 23 | public: 24 | 25 | //创建监听的端口 26 | int create_listenpeer(); 27 | 28 | //处理有端口 29 | void accept_event() override; 30 | 31 | //关闭处理 32 | void close_handle() override; 33 | 34 | //得到Acceptor的句柄 35 | ZCE_HANDLE get_handle(void) const override; 36 | 37 | protected: 38 | 39 | //ACCPET PEER 40 | zce::skt::acceptor peer_acceptor_; 41 | 42 | TCP_PEER_MODULE_INFO peer_module_info_; 43 | 44 | //IP限制管理器 45 | ip_restrict* ip_restrict_; 46 | }; 47 | }//namespace ogre 48 | -------------------------------------------------------------------------------- /bin/test.lua/lua_test_05.lua: -------------------------------------------------------------------------------- 1 | -- array_a 2 | print("array_a[0] = "..array_a[1]) 3 | print("array_a[50] = "..array_a[50]) 4 | print("array_a[51] = "..array_a[51]) 5 | print("array_a[100] = "..array_a[100]) 6 | 7 | print("==============================================") 8 | -- map_a 9 | print("map_a[10.2] = "..map_a[10.2]) 10 | print("map_a[10.3] = "..map_a[20.3]) 11 | 12 | print("==============================================") 13 | print("map_b.B_KEY_1 = "..map_b.B_KEY_1) 14 | print("map_b.B_KEY_2 = "..map_b.B_KEY_2) 15 | print("map_b.B_KEY_3 = "..map_b.B_KEY_3) 16 | 17 | -- table_array 18 | print("==============================================") 19 | table_array={} 20 | table_array[1]=88880 21 | table_array[2]=88881 22 | table_array[3]=88885 23 | table_array[4]=88886 24 | table_array[5]=88888 25 | table_array[6]=88889 26 | table_array[7]=88899 27 | table_array[8]=88999 28 | table_array[9]=89999 29 | table_array[10]=99999 30 | 31 | 32 | table_map={} 33 | table_map[121]=111.1111 34 | table_map[222]=222.2222 35 | 36 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/string/from_string.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2013 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/string/from_string.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2012年5月2日 7 | * @brief 8 | * 9 | * @details 10 | * 11 | * 12 | */ 13 | #pragma once 14 | 15 | namespace zce 16 | { 17 | //---------------------------------------------------------------------------------------------------------- 18 | 19 | /*! 20 | * @brief 将c str 转换为很多数值类型,作为返回值返回 21 | * @tparam ret_type 返回值类型 22 | * @return ret_type 23 | * @param[in] str c string 字符串参数 24 | */ 25 | template 26 | ret_type from_str(const char* str); 27 | 28 | /*! 29 | * @brief 从std string字符串转换得到数据类型 30 | * @tparam ret_type 返回的类型 31 | * @return ret_type 返回的数据类型 32 | * @param[in] str 字符串 33 | */ 34 | template 35 | ret_type from_string(const std::string& stdstr) 36 | { 37 | return from_str(stdstr.c_str()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/socket/acceptor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "zce/util/non_copyable.h" 4 | #include "zce/os_adapt/socket.h" 5 | #include "zce/os_adapt/time.h" 6 | #include "zce/socket/stream.h" 7 | 8 | ///skt socket的缩写 9 | namespace zce::skt 10 | { 11 | /// acceptor的工厂,用于产生zce::skt::stream 12 | class acceptor : public zce::skt::socket_base 13 | { 14 | public: 15 | acceptor(); 16 | ~acceptor(); 17 | 18 | public: 19 | 20 | //打开一个监听地址,目前只支持AF_INET,和AFINET6 21 | int open(const zce::skt::addr_base* local_addr, 22 | bool reuse_addr = true, 23 | int protocol_family = AF_UNSPEC, 24 | int backlog = ZCE_DEFAULT_BACKLOG, 25 | int protocol = 0); 26 | 27 | //接受一个SOCKET 28 | int accept(zce::skt::stream& new_stream, 29 | zce::skt::addr_base* remote_addr) const; 30 | 31 | //带有超时的处理的accept 32 | int accept(zce::skt::stream& new_stream, 33 | time_value& timeout, 34 | zce::skt::addr_base* remote_addr) const; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/tools/illusion/illusion.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "illusion", "illusion.vcxproj", "{DAA5178E-6C26-4B4B-B89C-52C6B188758B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {DAA5178E-6C26-4B4B-B89C-52C6B188758B}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {DAA5178E-6C26-4B4B-B89C-52C6B188758B}.Debug|Win32.Build.0 = Debug|Win32 16 | {DAA5178E-6C26-4B4B-B89C-52C6B188758B}.Release|Win32.ActiveCfg = Release|Win32 17 | {DAA5178E-6C26-4B4B-B89C-52C6B188758B}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* data to catch conversion errors */ 16 | #define LUAC_DATA "\x19\x93\r\n\x1a\n" 17 | 18 | #define LUAC_INT 0x5678 19 | #define LUAC_NUM cast_num(370.5) 20 | 21 | /* 22 | ** Encode major-minor version in one byte, one nibble for each 23 | */ 24 | #define MYINT(s) (s[0]-'0') /* assume one-digit numerals */ 25 | #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) 26 | 27 | #define LUAC_FORMAT 0 /* this is the official format */ 28 | 29 | /* load one chunk; from lundump.c */ 30 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); 31 | 32 | /* dump one chunk; from ldump.c */ 33 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, 34 | void* data, int strip); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lprefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lprefix.h $ 3 | ** Definitions for Lua code that must come before any other header file 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lprefix_h 8 | #define lprefix_h 9 | 10 | 11 | /* 12 | ** Allows POSIX/XSI stuff 13 | */ 14 | #if !defined(LUA_USE_C89) /* { */ 15 | 16 | #if !defined(_XOPEN_SOURCE) 17 | #define _XOPEN_SOURCE 600 18 | #elif _XOPEN_SOURCE == 0 19 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ 20 | #endif 21 | 22 | /* 23 | ** Allows manipulation of large files in gcc and some other compilers 24 | */ 25 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) 26 | #define _LARGEFILE_SOURCE 1 27 | #define _FILE_OFFSET_BITS 64 28 | #endif 29 | 30 | #endif /* } */ 31 | 32 | 33 | /* 34 | ** Windows stuff 35 | */ 36 | #if defined(_WIN32) /* { */ 37 | 38 | #if !defined(_CRT_SECURE_NO_WARNINGS) 39 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ 40 | #endif 41 | 42 | #endif /* } */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/mysql_version.h: -------------------------------------------------------------------------------- 1 | /* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB 2 | & Detron HB, 1996, 1999-2004, 2007 MySQL AB. 3 | This file is public domain and comes with NO WARRANTY of any kind 4 | */ 5 | 6 | /* Version numbers for protocol & mysqld */ 7 | 8 | #ifndef _mysql_version_h 9 | #define _mysql_version_h 10 | #ifdef _CUSTOMCONFIG_ 11 | #include 12 | #else 13 | #define PROTOCOL_VERSION 10 14 | #define MYSQL_SERVER_VERSION "5.6.22" 15 | #define MYSQL_BASE_VERSION "mysqld-5.6" 16 | #define MYSQL_SERVER_SUFFIX_DEF "" 17 | #define FRM_VER 6 18 | #define MYSQL_VERSION_ID 50622 19 | #define MYSQL_PORT 3306 20 | #define MYSQL_PORT_DEFAULT 0 21 | #define MYSQL_UNIX_ADDR "/tmp/mysql.sock" 22 | #define MYSQL_CONFIG_NAME "my" 23 | #define MYSQL_COMPILATION_COMMENT "MySQL Community Server (GPL)" 24 | 25 | /* mysqld compile time options */ 26 | #endif /* _CUSTOMCONFIG_ */ 27 | 28 | #ifndef LICENSE 29 | #define LICENSE GPL 30 | #endif /* LICENSE */ 31 | 32 | #endif /* _mysql_version_h */ 33 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/vsprojects/protoc.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 6 | h;hpp;hxx;hm;inl;inc;xsd 7 | 8 | 9 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 10 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx 11 | 12 | 13 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 14 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | /* load one chunk; from lundump.c */ 14 | LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); 15 | 16 | /* make header; from lundump.c */ 17 | LUAI_FUNC void luaU_header (char* h); 18 | 19 | /* dump one chunk; from ldump.c */ 20 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); 21 | 22 | #ifdef luac_c 23 | /* print one chunk; from print.c */ 24 | LUAI_FUNC void luaU_print (const Proto* f, int full); 25 | #endif 26 | 27 | /* for header of binary files -- this is Lua 5.1 */ 28 | #define LUAC_VERSION 0x51 29 | 30 | /* for header of binary files -- this is the official format */ 31 | #define LUAC_FORMAT 0 32 | 33 | /* size of header of binary files */ 34 | #define LUAC_HEADERSIZE 12 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/mysql_version.h: -------------------------------------------------------------------------------- 1 | /* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB 2 | & Detron HB, 1996, 1999-2004, 2007 MySQL AB. 3 | This file is public domain and comes with NO WARRANTY of any kind 4 | */ 5 | 6 | /* Version numbers for protocol & mysqld */ 7 | 8 | #ifndef _mysql_version_h 9 | #define _mysql_version_h 10 | #ifdef _CUSTOMCONFIG_ 11 | #include 12 | #else 13 | #define PROTOCOL_VERSION 10 14 | #define MYSQL_SERVER_VERSION "5.6.22" 15 | #define MYSQL_BASE_VERSION "mysqld-5.6" 16 | #define MYSQL_SERVER_SUFFIX_DEF "" 17 | #define FRM_VER 6 18 | #define MYSQL_VERSION_ID 50622 19 | #define MYSQL_PORT 3306 20 | #define MYSQL_PORT_DEFAULT 0 21 | #define MYSQL_UNIX_ADDR "/var/run/mysqld/mysqld.sock" 22 | #define MYSQL_CONFIG_NAME "my" 23 | #define MYSQL_COMPILATION_COMMENT "MySQL Community Server (GPL)" 24 | 25 | /* mysqld compile time options */ 26 | #endif /* _CUSTOMCONFIG_ */ 27 | 28 | #ifndef LICENSE 29 | #define LICENSE GPL 30 | #endif /* LICENSE */ 31 | 32 | #endif /* _mysql_version_h */ 33 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/comm/common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /////////////////////////////////////////////////////////////////////////////////////////////////////////// 4 | namespace zce 5 | { 6 | ///IO触发事件, 这儿不要改造成enum class 7 | enum RECTOR_EVENT 8 | { 9 | NULL_MASK = 0, 10 | 11 | ///SOCKET读取事件,但句柄变为可读是,调用read_event 12 | READ_MASK = (1 << 1), 13 | ///SOCKET写事件,当句柄变为可写是,write_event 14 | WRITE_MASK = (1 << 2), 15 | ///SOCKET异常事件,触发后调用exception_event 16 | EXCEPTION_MASK = (1 << 3), 17 | ///SOCKET异步CONNECT成功后,调用connect_event,异步CONNECT失败后, 18 | CONNECT_MASK = (1 << 4), 19 | ///SOCKET ACCEPT事件,当一个ACCEPT端口可以链接后,调用accept_event 20 | ACCEPT_MASK = (1 << 5), 21 | 22 | ///iNotify通知事件,文件系统的改变通知,调用read_event, 23 | INOTIFY_MASK = (1 << 9), 24 | }; 25 | 26 | //SLECT函数处理的3个事件 27 | enum class SELECT_EVENT 28 | { 29 | SE_READ, 30 | SE_WRITE, 31 | SE_EXCEPTION, 32 | }; 33 | 34 | enum MQW_WAIT_MODEL 35 | { 36 | //不用等待,尝试一下 37 | MQW_NO_WAIT, 38 | //一直等待 39 | MQW_WAIT_FOREVER, 40 | //在超时时间内等待 41 | MQW_WAIT_TIMEOUT, 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/comm_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace soar 4 | { 5 | class ogre4a_frame; 6 | } 7 | 8 | namespace ogre 9 | { 10 | class svc_accept; 11 | class svc_udp; 12 | class auto_connect; 13 | class configure; 14 | //通讯集中管理器 15 | class comm_manager 16 | { 17 | public: 18 | 19 | comm_manager(); 20 | ~comm_manager(); 21 | 22 | ///读取配置文件 23 | int get_config(const configure* config); 24 | 25 | //从SEND管道找到所有的数据去发送, 26 | int get_all_senddata_to_write(size_t& procframe); 27 | 28 | //检查安全端口 29 | int check_safe_port(zce::skt::addr_in& inetadd); 30 | 31 | //初始化通讯管理器 32 | int init_comm_manger(); 33 | //注销通讯管理器 34 | int uninit_comm_manger(); 35 | 36 | public: 37 | //得到单子的实例 38 | static comm_manager* instance(); 39 | //清理单子的实例 40 | static void clear_inst(); 41 | 42 | protected: 43 | 44 | //一次最多发送1024帧 45 | static const unsigned int MAX_ONCE_SEND_FRAME = 1024; 46 | 47 | protected: 48 | // 49 | static comm_manager* instance_; 50 | 51 | protected: 52 | 53 | //配置实例指针 54 | const configure* ogre_config_; 55 | }; 56 | }//namespace ogre 57 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/socket/addr_base.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/socket/addr_base.h" 3 | #include "zce/socket/addr_in.h" 4 | #include "zce/socket/addr_in6.h" 5 | 6 | namespace zce::skt 7 | { 8 | addr_base::addr_base(sockaddr* sockaddr_ptr, int sa_size) : 9 | sockaddr_ptr_(sockaddr_ptr), 10 | sockaddr_size_(sa_size) 11 | { 12 | } 13 | 14 | //,和析构函数 15 | addr_base::~addr_base() 16 | { 17 | } 18 | 19 | // 检查地址是否相等 20 | bool addr_base::operator == (const addr_base& others_sockaddr) const 21 | { 22 | if (sockaddr_ptr_ == others_sockaddr.sockaddr_ptr_ && 23 | sockaddr_size_ == others_sockaddr.sockaddr_size_) 24 | { 25 | return true; 26 | } 27 | return false; 28 | } 29 | 30 | // 检查地址是否不相等 31 | bool addr_base::operator != (const addr_base& others_sockaddr) const 32 | { 33 | return !(*this == others_sockaddr); 34 | } 35 | 36 | //检查地址是否是一个内网地址 37 | bool addr_base::is_internal() 38 | { 39 | return zce::is_internal(sockaddr_ptr_); 40 | } 41 | 42 | //检查地址是否是一个外网地址,其实我就简单认为不是外网地址就是内网地址 43 | bool addr_base::is_internet() 44 | { 45 | return !(zce::is_internal(sockaddr_ptr_)); 46 | } 47 | } -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/tcppeer_set.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ogre 4 | { 5 | class svc_tcp; 6 | /**************************************************************************************************** 7 | class tcppeer_set 8 | ****************************************************************************************************/ 9 | class tcppeer_set 10 | { 11 | public: 12 | ///构造函数, 13 | tcppeer_set(); 14 | ~tcppeer_set(); 15 | 16 | //初始化 17 | void init_services_peerinfo(size_t szpeer); 18 | 19 | ///查询配置信息 20 | int find_services_peerinfo(const soar::OGRE_PEER_ID& svrinfo, 21 | svc_tcp*&); 22 | ///设置配置信息 23 | int add_services_peerinfo(const soar::OGRE_PEER_ID& svrinfo, 24 | svc_tcp*); 25 | ///删除配置信息 26 | size_t del_services_peerinfo(const soar::OGRE_PEER_ID& svrinfo); 27 | // 28 | void clear_and_close(); 29 | 30 | protected: 31 | // 32 | typedef std::unordered_map < soar::OGRE_PEER_ID, 33 | svc_tcp*, 34 | soar::HASH_OF_OGREPEERID > MAP_OF_SOCKETPEER_ID; 35 | // 36 | MAP_OF_SOCKETPEER_ID peer_info_set_; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /third_party/include/sqlite-3.8.8.1/sqlite.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/vsprojects/config.h: -------------------------------------------------------------------------------- 1 | /* protobuf config.h for MSVC. On other platforms, this is generated 2 | * automatically by autoheader / autoconf / configure. */ 3 | #ifndef _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 4 | #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 5 | #endif 6 | 7 | /* the location of */ 8 | #define HASH_MAP_H 9 | 10 | /* the namespace of hash_map/hash_set */ 11 | // Apparently Microsoft decided to move hash_map *back* to the std namespace 12 | // in MSVC 2010: 13 | // http://blogs.msdn.com/vcblog/archive/2009/05/25/stl-breaking-changes-in-visual-studio-2010-beta-1.aspx 14 | // TODO(kenton): Use unordered_map instead, which is available in MSVC 2010. 15 | #if _MSC_VER < 1310 || _MSC_VER >= 1600 16 | #define HASH_NAMESPACE std 17 | #else 18 | #define HASH_NAMESPACE stdext 19 | #endif 20 | 21 | /* the location of */ 22 | #define HASH_SET_H 23 | 24 | /* define if the compiler has hash_map */ 25 | #define HAVE_HASH_MAP 1 26 | 27 | /* define if the compiler has hash_set */ 28 | #define HAVE_HASH_SET 1 29 | 30 | /* define if you want to use zlib. See readme.txt for additional 31 | * requirements. */ 32 | // #define HAVE_ZLIB 1 33 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/config/file_implement.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "zce/util/non_copyable.h" 4 | #include "zce/config/property_tree.h" 5 | 6 | namespace zce::cfg 7 | { 8 | //! @brief 读取,将结果保存在propertytree数据结构里面 9 | //! @param file_name 10 | //! @param propertytree 11 | //! @return 12 | int read_ini(const char* file_name, 13 | zce::propertytree* propertytree); 14 | 15 | //! 写入,暂时没有实现,实在是漏的太多,10.1期间有点贪多, 16 | int write_ini(const char* file_name, 17 | const zce::propertytree* propertytree); 18 | 19 | /*! 20 | * @brief XML文件的配置读取,写入实现器 21 | * @note 22 | */ 23 | 24 | //! 读取,将结果保存在ZCE_INI_propertytree数据结构里面 25 | int read_xml(const char* file_name, 26 | zce::propertytree* propertytree); 27 | 28 | //! 写入,暂时没有实现,实在是漏的太多,10.1期间有点贪多, 29 | int write_xml(const char* file_name, 30 | const zce::propertytree* propertytree); 31 | 32 | //! @brief 33 | //! @param file_name 34 | //! @param data 35 | //! @param read_line_len 36 | //! @param word_delim 37 | //! @return 38 | int read_cvs(const char* file_name, 39 | std::vector > *data, 40 | size_t read_line_len = 64 * 1024, 41 | unsigned char word_delim = ','); 42 | } 43 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) 15 | 16 | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) 17 | 18 | #define resethookcount(L) (L->hookcount = L->basehookcount) 19 | 20 | 21 | LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, 22 | const char *opname); 23 | LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); 24 | LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, 25 | const TValue *p2); 26 | LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, 27 | const TValue *p2); 28 | LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); 29 | LUAI_FUNC void luaG_errormsg (lua_State *L); 30 | LUAI_FUNC int luaG_checkcode (const Proto *pt); 31 | LUAI_FUNC int luaG_checkopenop (Instruction i); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/commsvr/zergsvrd/zerg/svc_accept.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "zerg/ip_restrict.h" 4 | 5 | namespace zerg 6 | { 7 | /*! 8 | * @brief TCP Accept 处理的EventHandler, 9 | * 10 | * @note 11 | */ 12 | class svc_accept : public zce::event_handler 13 | { 14 | public: 15 | 16 | /*! 17 | * @brief 构造函数 18 | * @param svcid 相应的svc id 19 | * @param addr 相应的IP地址 20 | */ 21 | svc_accept(const soar::SERVICES_ID& svcid, 22 | const zce::skt::addr_in& addr); 23 | 24 | protected: 25 | ///监听端口 26 | ~svc_accept(); 27 | 28 | public: 29 | 30 | ///创建监听的端口 31 | int create_listen(); 32 | 33 | /*! 34 | * @brief 事件触发的毁掉处理,表示有一个accept 的数据 35 | * @return int 36 | */ 37 | void accept_event() override; 38 | 39 | ///关闭处理 40 | void close_handle() override; 41 | 42 | ///得到Acceptor的句柄 43 | ZCE_HANDLE get_handle(void) const override; 44 | 45 | protected: 46 | 47 | ///ACCPET PEER 48 | zce::skt::acceptor peer_acceptor_; 49 | 50 | ///自己的 SVC INFO 51 | soar::SERVICES_ID my_svc_info_; 52 | 53 | ///邦定的地址 54 | zce::skt::addr_in accept_bind_addr_; 55 | 56 | ///IP限制管理器 57 | zerg::IPRestrict_Mgr* ip_restrict_; 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /src/msvcpch.cmake: -------------------------------------------------------------------------------- 1 | #msvcpch.cmake 2 | #声明一个宏,参数如下 3 | #USE_MSVC_PCH :宏名字 4 | #PCH_TARGET :项目名称 5 | #PCH_HEADER_FILE :预编译头文件名称(stdafx.h) 6 | #PCH_SOURCE_FILE :预编译源文件名称(stdafx.cpp) 7 | macro(USE_MSVC_PCH PCH_TARGET PCH_HEADER_FILE PCH_SOURCE_FILE) 8 | if(MSVC) 9 | # 获取预编译头文件的文件名,通常是stdafx 10 | GET_FILENAME_COMPONENT(PCH_NAME ${PCH_HEADER_FILE} NAME_WE) 11 | 12 | # 生成预编译文件的路径 13 | if(CMAKE_CONFIGURATION_TYPES) 14 | # 如果有配置选项(Debug/Release),路径添加以及配置选项 15 | SET(PCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/PCH/${CMAKE_CFG_INTDIR}") 16 | ELSE(CMAKE_CONFIGURATION_TYPES) 17 | SET(PCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/PCH") 18 | ENDIF(CMAKE_CONFIGURATION_TYPES) 19 | 20 | # 创建预编译文件的路径 21 | FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PCH) 22 | 23 | # 设置项目属性,使用预编译头文件 24 | SET_TARGET_PROPERTIES(${PCH_TARGET} PROPERTIES COMPILE_FLAGS 25 | "/Yu${PCH_HEADER_FILE} /FI${PCH_HEADER_FILE} /Fp${PCH_DIR}/${PCH_NAME}.pch") 26 | 27 | # 预编译源文件(stdafx.cpp)设置属性,创建预编译文件 28 | SET_SOURCE_FILES_PROPERTIES(${PCH_SOURCE_FILE} PROPERTIES COMPILE_FLAGS 29 | "/Yc${PCH_HEADER_FILE}") 30 | 31 | # 把预编译文件寄到清除列表 32 | SET_DIRECTORY_PROPERTIES(PROPERTIES 33 | ADDITIONAL_MAKE_CLEAN_FILES ${PCH_DIR}/${PCH_NAME}.pch) 34 | endif(MSVC) 35 | endmacro(USE_MSVC_PCH) 36 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_EQ, /* last tag method with `fast' access */ 24 | TM_ADD, 25 | TM_SUB, 26 | TM_MUL, 27 | TM_DIV, 28 | TM_MOD, 29 | TM_POW, 30 | TM_UNM, 31 | TM_LEN, 32 | TM_LT, 33 | TM_LE, 34 | TM_CONCAT, 35 | TM_CALL, 36 | TM_N /* number of elements in the enum */ 37 | } TMS; 38 | 39 | 40 | 41 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 42 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 43 | 44 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 45 | 46 | LUAI_DATA const char *const luaT_typenames[]; 47 | 48 | 49 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 50 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 51 | TMS event); 52 | LUAI_FUNC void luaT_init (lua_State *L); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/string/extend.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/string/extend.h" 3 | 4 | namespace zce 5 | { 6 | void _string_format_outlist(std::string& foo_string, 7 | const char*& foo_fmt_spec) 8 | { 9 | foo_string.append(foo_fmt_spec); 10 | } 11 | 12 | //如果没有参数的特殊处理 13 | void _sformat_outlist(char*& foo_buffer, 14 | size_t& foo_max_len, 15 | size_t& foo_use_len, 16 | const char*& foo_fmt_spec) 17 | { 18 | size_t len_of_str = ::strlen(foo_fmt_spec); 19 | if (len_of_str > foo_max_len) 20 | { 21 | foo_max_len = 0; 22 | foo_use_len += foo_max_len; 23 | ::memcpy(foo_buffer, foo_fmt_spec, foo_max_len); 24 | } 25 | else 26 | { 27 | foo_max_len -= len_of_str; 28 | foo_use_len += len_of_str; 29 | ::memcpy(foo_buffer, foo_fmt_spec, len_of_str); 30 | } 31 | } 32 | 33 | void _splice_outlist(char*& /*foo_buffer*/, 34 | size_t /*foo_max_len*/, 35 | size_t& /*foo_use_len*/, 36 | char /*separator_char*/) 37 | { 38 | } 39 | 40 | void _string_splice_list(std::string& /*foo_string*/, 41 | char /*separator_char*/) 42 | { 43 | } 44 | } -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* Key to file-handle type */ 15 | #define LUA_FILEHANDLE "FILE*" 16 | 17 | 18 | #define LUA_COLIBNAME "coroutine" 19 | LUALIB_API int (luaopen_base) (lua_State *L); 20 | 21 | #define LUA_TABLIBNAME "table" 22 | LUALIB_API int (luaopen_table) (lua_State *L); 23 | 24 | #define LUA_IOLIBNAME "io" 25 | LUALIB_API int (luaopen_io) (lua_State *L); 26 | 27 | #define LUA_OSLIBNAME "os" 28 | LUALIB_API int (luaopen_os) (lua_State *L); 29 | 30 | #define LUA_STRLIBNAME "string" 31 | LUALIB_API int (luaopen_string) (lua_State *L); 32 | 33 | #define LUA_MATHLIBNAME "math" 34 | LUALIB_API int (luaopen_math) (lua_State *L); 35 | 36 | #define LUA_DBLIBNAME "debug" 37 | LUALIB_API int (luaopen_debug) (lua_State *L); 38 | 39 | #define LUA_LOADLIBNAME "package" 40 | LUALIB_API int (luaopen_package) (lua_State *L); 41 | 42 | 43 | /* open all previous libraries */ 44 | LUALIB_API void (luaL_openlibs) (lua_State *L); 45 | 46 | 47 | 48 | #ifndef lua_assert 49 | #define lua_assert(x) ((void)0) 50 | #endif 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 15 | cast(int, sizeof(TValue)*((n)-1))) 16 | 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 18 | cast(int, sizeof(TValue *)*((n)-1))) 19 | 20 | 21 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 22 | LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); 23 | LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); 24 | LUAI_FUNC UpVal *luaF_newupval (lua_State *L); 25 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 26 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); 27 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 28 | LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); 29 | LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); 30 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 31 | int pc); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/generate_descriptor_proto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run this script to regenerate descriptor.pb.{h,cc} after the protocol 4 | # compiler changes. Since these files are compiled into the protocol compiler 5 | # itself, they cannot be generated automatically by a make rule. "make check" 6 | # will fail if these files do not match what the protocol compiler would 7 | # generate. 8 | # 9 | # HINT: Flags passed to generate_descriptor_proto.sh will be passed directly 10 | # to make when building protoc. This is particularly useful for passing 11 | # -j4 to run 4 jobs simultaneously. 12 | 13 | if test ! -e src/google/protobuf/stubs/common.h; then 14 | cat >&2 << __EOF__ 15 | Could not find source code. Make sure you are running this script from the 16 | root of the distribution tree. 17 | __EOF__ 18 | exit 1 19 | fi 20 | 21 | if test ! -e src/Makefile; then 22 | cat >&2 << __EOF__ 23 | Could not find src/Makefile. You must run ./configure (and perhaps 24 | ./autogen.sh) first. 25 | __EOF__ 26 | exit 1 27 | fi 28 | 29 | cd src 30 | make $@ protoc && 31 | ./protoc --cpp_out=dllexport_decl=LIBPROTOBUF_EXPORT:. google/protobuf/descriptor.proto && \ 32 | ./protoc --cpp_out=dllexport_decl=LIBPROTOC_EXPORT:. google/protobuf/compiler/plugin.proto 33 | cd .. 34 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/mysql/services.h: -------------------------------------------------------------------------------- 1 | #ifndef MYSQL_SERVICES_INCLUDED 2 | /* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; version 2 of the License. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #define MYSQL_SERVICES_INCLUDED 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/mysql/services.h: -------------------------------------------------------------------------------- 1 | #ifndef MYSQL_SERVICES_INCLUDED 2 | /* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; version 2 of the License. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #define MYSQL_SERVICES_INCLUDED 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/m4/ac_system_extensions.m4: -------------------------------------------------------------------------------- 1 | dnl Provide AC_USE_SYSTEM_EXTENSIONS for old autoconf machines. 2 | AC_DEFUN([ACX_USE_SYSTEM_EXTENSIONS],[ 3 | ifdef([AC_USE_SYSTEM_EXTENSIONS],[ 4 | AC_USE_SYSTEM_EXTENSIONS 5 | ],[ 6 | AC_BEFORE([$0], [AC_COMPILE_IFELSE]) 7 | AC_BEFORE([$0], [AC_RUN_IFELSE]) 8 | 9 | AC_REQUIRE([AC_GNU_SOURCE]) 10 | AC_REQUIRE([AC_AIX]) 11 | AC_REQUIRE([AC_MINIX]) 12 | 13 | AH_VERBATIM([__EXTENSIONS__], 14 | [/* Enable extensions on Solaris. */ 15 | #ifndef __EXTENSIONS__ 16 | # undef __EXTENSIONS__ 17 | #endif 18 | #ifndef _POSIX_PTHREAD_SEMANTICS 19 | # undef _POSIX_PTHREAD_SEMANTICS 20 | #endif 21 | #ifndef _TANDEM_SOURCE 22 | # undef _TANDEM_SOURCE 23 | #endif]) 24 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], 25 | [ac_cv_safe_to_define___extensions__], 26 | [AC_COMPILE_IFELSE( 27 | [AC_LANG_PROGRAM([ 28 | # define __EXTENSIONS__ 1 29 | AC_INCLUDES_DEFAULT])], 30 | [ac_cv_safe_to_define___extensions__=yes], 31 | [ac_cv_safe_to_define___extensions__=no])]) 32 | test $ac_cv_safe_to_define___extensions__ = yes && 33 | AC_DEFINE([__EXTENSIONS__]) 34 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) 35 | AC_DEFINE([_TANDEM_SOURCE]) 36 | ]) 37 | ]) 38 | -------------------------------------------------------------------------------- /src/test/zealot/test_server.cpp: -------------------------------------------------------------------------------- 1 | #include "predefine.h" 2 | 3 | enum ENUM_SVR_STATUS_1 4 | { 5 | SVR_STATUS_1_1 = 1000, 6 | SVR_STATUS_1_2 = 1001, 7 | SVR_STATUS_1_3 = 1002, 8 | }; 9 | 10 | enum ENUM_SVR_STATUS_2 11 | { 12 | SVR_STATUS_2_1 = 2000, 13 | SVR_STATUS_2_2 = 2001, 14 | SVR_STATUS_2_3 = 2002, 15 | }; 16 | 17 | zce::STATUS_ITEM_WITHNAME SERVER_STATUS_1[] = 18 | { 19 | DEF_STATUS_ITEM(SVR_STATUS_1_1,zce::STATUS_STATICS::PER_FIVE_MINTUES), 20 | DEF_STATUS_ITEM(SVR_STATUS_1_2,zce::STATUS_STATICS::PER_FIVE_MINTUES), 21 | DEF_STATUS_ITEM(SVR_STATUS_1_3,zce::STATUS_STATICS::PER_FIVE_MINTUES), 22 | }; 23 | 24 | zce::STATUS_ITEM_WITHNAME SERVER_STATUS_2[] = 25 | { 26 | DEF_STATUS_ITEM(SVR_STATUS_2_1,zce::STATUS_STATICS::PER_FIVE_MINTUES), 27 | DEF_STATUS_ITEM(SVR_STATUS_2_2,zce::STATUS_STATICS::PER_FIVE_MINTUES), 28 | DEF_STATUS_ITEM(SVR_STATUS_2_3,zce::STATUS_STATICS::ABSOLUTE_VALUE), 29 | }; 30 | 31 | #define ZEALOT_FILE_NAME "ZEALOT.STATUS" 32 | 33 | int test_server_status(int, char*[]) 34 | { 35 | zce::server_status::instance()->initialize(ZEALOT_FILE_NAME, 3, SERVER_STATUS_1, true); 36 | zce::server_status::instance()->add_status_item(3, SERVER_STATUS_1); 37 | zce::server_status::instance()->add_status_item(3, SERVER_STATUS_2); 38 | return 0; 39 | } -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/zerg/sndrcv_lolo.cpp: -------------------------------------------------------------------------------- 1 | #include "soar/predefine.h" 2 | #include "soar/enum/error_code.h" 3 | #include "soar/zerg/services_info.h" 4 | #include "soar/zerg/frame_zerg.h" 5 | #include "soar/zerg/sndrcv_lolo.h" 6 | 7 | namespace soar 8 | { 9 | lolo_sendrecv::lolo_sendrecv() 10 | { 11 | lolo_datagram_.open(); 12 | } 13 | 14 | lolo_sendrecv::~lolo_sendrecv() 15 | { 16 | lolo_datagram_.close(); 17 | } 18 | 19 | //设置相应的SVC INFO, 20 | int lolo_sendrecv::set_lolo_svcinfo(const char* svc_ip, 21 | unsigned short svc_port, 22 | const SERVICES_ID& recv_service, 23 | const SERVICES_ID& send_service, 24 | const SERVICES_ID& proxy_service, 25 | size_t frame_len, 26 | bool is_check_conn_info) 27 | { 28 | int ret = 0; 29 | 30 | set_services_id(recv_service, send_service, proxy_service, frame_len); 31 | 32 | ret = lolo_svc_ip_.set(svc_ip, svc_port); 33 | if (ret != 0) 34 | { 35 | return SOAR_RET::ERROR_ZULU_INPUT_IPADDRESS_ERROR; 36 | } 37 | 38 | if (is_check_conn_info) 39 | { 40 | lolo_datagram_.connect(&lolo_svc_ip_); 41 | } 42 | 43 | return 0; 44 | } 45 | } -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/lvm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua virtual machine 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lvm_h 8 | #define lvm_h 9 | 10 | 11 | #include "ldo.h" 12 | #include "lobject.h" 13 | #include "ltm.h" 14 | 15 | 16 | #define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) 17 | 18 | #define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ 19 | (((o) = luaV_tonumber(o,n)) != NULL)) 20 | 21 | #define equalobj(L,o1,o2) \ 22 | (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) 23 | 24 | 25 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); 26 | LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); 27 | LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); 28 | LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); 29 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, 30 | StkId val); 31 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, 32 | StkId val); 33 | LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); 34 | LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/mysql_embed.h: -------------------------------------------------------------------------------- 1 | #ifndef MYSQL_EMBED_INCLUDED 2 | #define MYSQL_EMBED_INCLUDED 3 | 4 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; version 2 of the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 18 | 19 | /* Defines that are unique to the embedded version of MySQL */ 20 | 21 | #ifdef EMBEDDED_LIBRARY 22 | 23 | /* Things we don't need in the embedded version of MySQL */ 24 | /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ 25 | 26 | #undef HAVE_DLOPEN /* No udf functions */ 27 | #undef HAVE_SMEM /* No shared memory */ 28 | 29 | #endif /* EMBEDDED_LIBRARY */ 30 | #endif /* MYSQL_EMBED_INCLUDED */ 31 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/mysql_embed.h: -------------------------------------------------------------------------------- 1 | #ifndef MYSQL_EMBED_INCLUDED 2 | #define MYSQL_EMBED_INCLUDED 3 | 4 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; version 2 of the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 18 | 19 | /* Defines that are unique to the embedded version of MySQL */ 20 | 21 | #ifdef EMBEDDED_LIBRARY 22 | 23 | /* Things we don't need in the embedded version of MySQL */ 24 | /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ 25 | 26 | #undef HAVE_DLOPEN /* No udf functions */ 27 | #undef HAVE_SMEM /* No shared memory */ 28 | 29 | #endif /* EMBEDDED_LIBRARY */ 30 | #endif /* MYSQL_EMBED_INCLUDED */ 31 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/examples/list_people.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | # See README.txt for information and build instructions. 4 | 5 | import addressbook_pb2 6 | import sys 7 | 8 | # Iterates though all people in the AddressBook and prints info about them. 9 | def ListPeople(address_book): 10 | for person in address_book.person: 11 | print "Person ID:", person.id 12 | print " Name:", person.name 13 | if person.HasField('email'): 14 | print " E-mail address:", person.email 15 | 16 | for phone_number in person.phone: 17 | if phone_number.type == addressbook_pb2.Person.MOBILE: 18 | print " Mobile phone #:", 19 | elif phone_number.type == addressbook_pb2.Person.HOME: 20 | print " Home phone #:", 21 | elif phone_number.type == addressbook_pb2.Person.WORK: 22 | print " Work phone #:", 23 | print phone_number.number 24 | 25 | # Main procedure: Reads the entire address book from a file and prints all 26 | # the information inside. 27 | if len(sys.argv) != 2: 28 | print "Usage:", sys.argv[0], "ADDRESS_BOOK_FILE" 29 | sys.exit(-1) 30 | 31 | address_book = addressbook_pb2.AddressBook() 32 | 33 | # Read the existing address book. 34 | f = open(sys.argv[1], "rb") 35 | address_book.ParseFromString(f.read()) 36 | f.close() 37 | 38 | ListPeople(address_book) 39 | -------------------------------------------------------------------------------- /src/test/zealot/test_config.cpp: -------------------------------------------------------------------------------- 1 | #include "predefine.h" 2 | 3 | // 4 | int test_conf_xml(int /*argc*/, char* /*argv*/[]) 5 | { 6 | zce::propertytree pt_tree; 7 | 8 | int ret = zce::cfg::read_xml("conf/test_0002.xml", &pt_tree); 9 | if (ret != 0) 10 | { 11 | return ret; 12 | } 13 | int32_t abc = 0; 14 | ret = pt_tree.path_get_leaf("root.size.width", "", abc); 15 | if (ret != 0) 16 | { 17 | std::cout << "read fail." << std::endl; 18 | return ret; 19 | } 20 | std::cout << "read:" << abc << std::endl; 21 | return 0; 22 | } 23 | 24 | int test_conf_ini(int /*argc*/, char* /*argv*/[]) 25 | { 26 | zce::propertytree pt_tree; 27 | 28 | int ret = zce::cfg::read_ini("conf/test_0001.ini", &pt_tree); 29 | if (ret != 0) 30 | { 31 | return ret; 32 | } 33 | int32_t abc, def = 0; 34 | ret = pt_tree.path_get_leaf("SECTION_A", "KEY1", abc); 35 | if (ret != 0) 36 | { 37 | std::cout << "read fail." << std::endl; 38 | return ret; 39 | } 40 | std::cout << "read:" << abc << std::endl; 41 | 42 | ret = pt_tree.path_get_leaf("SECTION_A", "KEY2", def); 43 | if (ret != 0) 44 | { 45 | std::cout << "read fail." << std::endl; 46 | return ret; 47 | } 48 | std::cout << "read:" << def << std::endl; 49 | 50 | return 0; 51 | } -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/lock/thread_semaphore.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2013 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/lock/thread_semaphore.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2013年1月14日 7 | * @brief 线程的信号灯封装 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "zce/lock/lock_base.h" 13 | #include "zce/lock/lock_guard.h" 14 | #include "zce/time/time_value.h" 15 | 16 | namespace zce 17 | { 18 | /*! 19 | @brief 线程的信号灯封装,使用的是无名的信号灯, 20 | */ 21 | class thread_semaphore : public zce::semaphore_base 22 | { 23 | public: 24 | //线程锁的GUARD 25 | typedef zce::lock_guard LOCK_GUARD; 26 | 27 | public: 28 | 29 | //构造函数,默认创建匿名信号灯,线程下一般用匿名信号灯就足够了,sem_name一般用nullptr就足够了 30 | //匿名信号灯==无名信号灯 31 | thread_semaphore(unsigned int init_value); 32 | virtual ~thread_semaphore(void); 33 | 34 | //锁定 35 | void acquire() noexcept override; 36 | 37 | //尝试锁定 38 | bool try_acquire() noexcept override; 39 | 40 | //解锁, 41 | void release() noexcept override; 42 | 43 | //绝对时间超时的的锁定,超时后解锁 44 | bool try_acquire_until(const zce::time_value& abs_time) noexcept override; 45 | 46 | //相对时间的超时锁定,超时后,解锁 47 | bool try_acquire_for(const zce::time_value& relative_time) noexcept override; 48 | 49 | protected: 50 | //线程锁 51 | sem_t* lock_; 52 | }; 53 | } 54 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* version suffix for environment variable names */ 15 | #define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR 16 | 17 | 18 | LUAMOD_API int (luaopen_base) (lua_State *L); 19 | 20 | #define LUA_COLIBNAME "coroutine" 21 | LUAMOD_API int (luaopen_coroutine) (lua_State *L); 22 | 23 | #define LUA_TABLIBNAME "table" 24 | LUAMOD_API int (luaopen_table) (lua_State *L); 25 | 26 | #define LUA_IOLIBNAME "io" 27 | LUAMOD_API int (luaopen_io) (lua_State *L); 28 | 29 | #define LUA_OSLIBNAME "os" 30 | LUAMOD_API int (luaopen_os) (lua_State *L); 31 | 32 | #define LUA_STRLIBNAME "string" 33 | LUAMOD_API int (luaopen_string) (lua_State *L); 34 | 35 | #define LUA_UTF8LIBNAME "utf8" 36 | LUAMOD_API int (luaopen_utf8) (lua_State *L); 37 | 38 | #define LUA_MATHLIBNAME "math" 39 | LUAMOD_API int (luaopen_math) (lua_State *L); 40 | 41 | #define LUA_DBLIBNAME "debug" 42 | LUAMOD_API int (luaopen_debug) (lua_State *L); 43 | 44 | #define LUA_LOADLIBNAME "package" 45 | LUAMOD_API int (luaopen_package) (lua_State *L); 46 | 47 | 48 | /* open all previous libraries */ 49 | LUALIB_API void (luaL_openlibs) (lua_State *L); 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gkey(n) (&(n)->i_key.nk) 15 | #define gval(n) (&(n)->i_val) 16 | #define gnext(n) ((n)->i_key.nk.next) 17 | 18 | #define key2tval(n) (&(n)->i_key.tvk) 19 | 20 | 21 | LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); 22 | LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); 23 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 24 | LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); 25 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 26 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); 27 | LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); 28 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); 29 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 30 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 31 | LUAI_FUNC int luaH_getn (Table *t); 32 | 33 | 34 | #if defined(LUA_DEBUG) 35 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 36 | LUAI_FUNC int luaH_isdummy (Node *n); 37 | #endif 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/os_adapt/dlfcn.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2013 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/os_adapt/dlfcn.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2011年7月9日 7 | * @brief DLL库操作的几个跨平台函数 8 | * 9 | * @details 10 | * 11 | */ 12 | 13 | #ifndef ZCE_LIB_OS_ADAPT_DLFCN_H_ 14 | #define ZCE_LIB_OS_ADAPT_DLFCN_H_ 15 | 16 | #include "zce/os_adapt/define.h" 17 | 18 | namespace zce 19 | { 20 | //动态库使用的四个函数 21 | 22 | /*! 23 | * @brief 打开动态库 24 | * @return ZCE_SHLIB_HANDLE 动态库的句柄,在不同的平台有不同的typdef,==nullptr标识失败 25 | * @param fname DLL的文件名称 26 | * @param mode 打开的模式 27 | */ 28 | ZCE_SHLIB_HANDLE dlopen(const char* fname, 29 | int mode = ZCE_DEFAULT_SHLIB_MODE); 30 | 31 | /*! 32 | * @brief 关闭动态库 33 | * @return int = 0 标识成功,(WINDOWS其实这个函数没有返回值,其实释放资源永远不应失败) 34 | * @param handle 打开动态库时得到的句柄 35 | */ 36 | int dlclose(ZCE_SHLIB_HANDLE handle); 37 | 38 | /*! 39 | * @brief 此动态库引出函数 40 | * @return void* 函数指针 41 | * @param handle 打开动态库时得到的句柄 42 | * @param symbolname 函数符号的名称 43 | * @note 44 | */ 45 | void* dlsym(ZCE_SHLIB_HANDLE handle, 46 | const char* symbolname); 47 | 48 | /*! 49 | * @brief 返回动态库函数的错误描述 50 | * @return const char* 错误描述 51 | */ 52 | const char* dlerror(void); 53 | }; 54 | 55 | #endif //ZCE_LIB_OS_ADAPT_DLFCN_H_ 56 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/mysql/get_password.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /* 17 | ** Ask for a password from tty 18 | ** This is an own file to avoid conflicts with curses 19 | */ 20 | 21 | #ifndef MYSQL_GET_PASSWORD_H_INCLUDED 22 | #define MYSQL_GET_PASSWORD_H_INCLUDED 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | typedef char *(* strdup_handler_t)(const char *, int); 29 | char *get_tty_password_ext(const char *opt_message, 30 | strdup_handler_t strdup_function); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* ! MYSQL_GET_PASSWORD_H_INCLUDED */ 37 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/mysql/get_password.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /* 17 | ** Ask for a password from tty 18 | ** This is an own file to avoid conflicts with curses 19 | */ 20 | 21 | #ifndef MYSQL_GET_PASSWORD_H_INCLUDED 22 | #define MYSQL_GET_PASSWORD_H_INCLUDED 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | typedef char *(* strdup_handler_t)(const char *, int); 29 | char *get_tty_password_ext(const char *opt_message, 30 | strdup_handler_t strdup_function); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* ! MYSQL_GET_PASSWORD_H_INCLUDED */ 37 | -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/svc_udp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ogre 4 | { 5 | //forward declaration 6 | class ip_restrict; 7 | 8 | class svc_udp : public zce::event_handler 9 | { 10 | protected: 11 | // 12 | public: 13 | svc_udp(const zce::skt::addr_in& upd_addr, 14 | zce::reactor* reactor = zce::reactor::instance()); 15 | protected: 16 | ~svc_udp(); 17 | 18 | public: 19 | //取得句柄 20 | virtual ZCE_HANDLE get_handle(void) const; 21 | // 22 | void read_event() override; 23 | // 24 | void close_handle() override; 25 | 26 | public: 27 | //初始化UPD端口 28 | int init_udp_peer(); 29 | 30 | public: 31 | 32 | //发送UDP数据给 33 | static int send_alldata_to_udp(soar::ogre4a_frame* send_frame); 34 | 35 | protected: 36 | 37 | //从PEER读取数据 38 | int read_data_fromudp(size_t& szrevc, zce::skt::addr_in& remote_addr); 39 | //将收到的数据放入管道 40 | int pushdata_to_recvpipe(); 41 | 42 | protected: 43 | 44 | // 45 | zce::skt::datagram dgram_peer_; 46 | 47 | //邦定的地址 48 | zce::skt::addr_in udp_bind_addr_; 49 | //Socket_Peer_Info 50 | soar::OGRE_PEER_ID peer_svc_info_; 51 | 52 | // 53 | soar::ogre4a_frame* dgram_databuf_; 54 | 55 | //IP限制管理器 56 | ip_restrict* ip_restrict_; 57 | 58 | protected: 59 | // 60 | static std::vector ary_upd_peer_; 61 | }; 62 | } //namespace ogre 63 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/vsprojects/test_plugin.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {3f77b501-40d9-45d5-a27e-b8bb2891ec42} 6 | h;hpp;hxx;hm;inl;inc;xsd 7 | 8 | 9 | {55085f0c-3dc7-4fe1-b556-6e88358e9203} 10 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 11 | 12 | 13 | 14 | 15 | Header Files 16 | 17 | 18 | Header Files 19 | 20 | 21 | 22 | 23 | Source Files 24 | 25 | 26 | Source Files 27 | 28 | 29 | Source Files 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/predefine.cpp: -------------------------------------------------------------------------------- 1 | //预定义头文件对应的CPP文件,所有预定义信息描述 2 | #include "zce/predefine.h" 3 | 4 | /* 5 | //摘抄: 6 | // _ooOoo_ 7 | // o8888888o 8 | // 88" . "88 9 | // (| -_- |) 10 | // O\ = /O 11 | // ____/`---'\____ 12 | // . ' \\| |// `. 13 | // / \\||| : |||// \ 14 | // / _||||| -:- |||||- \ 15 | // | | \\\ - /// | | 16 | // | \_| ''\---/'' | | 17 | // \ .-\__ `-` ___/-. / 18 | // ___`. .' /--.--\ `. . __ 19 | // ."" '< `.___\_<|>_/___.' >'"". 20 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 21 | // \ \ `-. \_ __\ /__ _/ .-` / / 22 | // ======`-.____`-.___\_____/___.-`____.-'====== 23 | // `=---=' 24 | // 25 | // ............................................. 26 | // 佛祖镇楼 BUG辟易 27 | // 佛曰: 28 | // 写字楼里写字间,写字间里程序员; 29 | // 程序人员写程序,又拿程序换酒钱。 30 | // 酒醒只在网上坐,酒醉还来网下眠; 31 | // 酒醉酒醒日复日,网上网下年复年。 32 | // 但愿老死电脑间,不愿鞠躬老板前; 33 | // 奔驰宝马贵者趣,公交自行程序员。 34 | // 别人笑我忒疯癫,我笑自己命太贱; 35 | // 不见满街漂亮妹,哪个归得程序员? 36 | */ -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/shared_mem/systemv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "zce/os_adapt/define.h" 4 | 5 | namespace zce 6 | { 7 | /*! 8 | * @brief 封装SystemV共享内存映射代码,和POSIX和MMAP的最大区别是, 9 | * 没有映射文件 10 | * note 11 | */ 12 | class shm_systemv : public zce::non_copyable 13 | { 14 | public: 15 | //构造函数 16 | shm_systemv(); 17 | ~shm_systemv(); 18 | 19 | shm_systemv(const shm_systemv &) = delete; 20 | shm_systemv& operator=(const shm_systemv&) = delete; 21 | public: 22 | //打开文件,进行映射 23 | int open(key_t sysv_key, 24 | std::size_t shm_size, 25 | int shmget_flg = IPC_CREAT | SHM_R | SHM_W, 26 | int shmat_flg = 0, 27 | const void* want_address = nullptr 28 | ); 29 | 30 | //打开文件,进行映射, 简单,推荐使用这个函数 31 | int open(key_t sysv_key, 32 | std::size_t shm_size, 33 | bool fail_if_exist, 34 | bool read_only = false, 35 | const void* want_address = nullptr 36 | ); 37 | 38 | //关闭映射(文件) 39 | int close(); 40 | 41 | //删除映射的文件,当然正在映射(或者还有人在映射)的时候不能删除 42 | int remove(); 43 | 44 | //返回映射的内存地址 45 | void* addr(); 46 | 47 | protected: 48 | 49 | //key_t,共享内存的唯一标识。看作是个整数把。 50 | key_t sysv_key_; 51 | 52 | // 映射的文件句柄 53 | ZCE_HANDLE sysv_shmid_; 54 | 55 | //映射的共享内存大小 56 | std::size_t shm_size_; 57 | 58 | //映射的内存地址 59 | void* shm_addr_; 60 | }; 61 | } -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/timer/timer_handler.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2013 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/timer/timer_handler.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2008年10月6日 7 | * @brief Timer处理的基类 8 | * 9 | * 10 | * @details 11 | * 12 | * 13 | * 14 | * @note 为什么要单独讲NODE放入一个文件中间,因为我可能写多个反应器 15 | * 16 | */ 17 | 18 | #pragma once 19 | 20 | #include "zce/util/non_copyable.h" 21 | #include "zce/time/time_value.h" 22 | 23 | namespace zce 24 | { 25 | class timer_queue; 26 | 27 | /****************************************************************************************** 28 | class zce::Timer_Handler 29 | ******************************************************************************************/ 30 | class timer_handler 31 | { 32 | protected: 33 | 34 | //构造函数和析构函数 35 | timer_handler(zce::timer_queue* timer_queue); 36 | timer_handler(); 37 | virtual ~timer_handler(); 38 | 39 | public: 40 | 41 | //超时触发 42 | virtual int timer_timeout(const zce::time_value& now_timenow_time, 43 | int timer_id) = 0; 44 | //定时器关闭 45 | virtual int timer_close(); 46 | 47 | // 48 | zce::timer_queue* timer_queue(); 49 | 50 | // 51 | void timer_queue(zce::timer_queue* set_timer_queue); 52 | 53 | //考虑的半天,我觉得对于Timer的处理还是不用考虑实现一个event_close了。 54 | protected: 55 | // 56 | zce::timer_queue* timer_queue_ = nullptr; 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /src/commsvr/zergsvrd/zerg/app_timer.cpp: -------------------------------------------------------------------------------- 1 | #include "zerg/predefine.h" 2 | #include "zerg/svc_tcp.h" 3 | #include "zerg/comm_manager.h" 4 | #include "zerg/application.h" 5 | #include "zerg/app_timer.h" 6 | 7 | namespace zerg 8 | { 9 | /**************************************************************************************************** 10 | class app_timer 11 | ****************************************************************************************************/ 12 | 13 | ///ZERG服务器定时器ID, 14 | 15 | // 16 | app_timer::app_timer() : 17 | server_timer() 18 | { 19 | //主动重现链接的间隔时间 20 | const time_t AUTOCONNECT_RETRY_SEC = 5; 21 | zce::time_value connect_all_internal(AUTOCONNECT_RETRY_SEC, 0); 22 | 23 | add_app_timer(connect_all_internal); 24 | 25 | //主动重现链接的间隔时间 26 | const time_t RECORD_MONITOR_SEC = 60; 27 | zce::time_value monitor_internal(RECORD_MONITOR_SEC, 0); 28 | 29 | add_app_timer(monitor_internal); 30 | } 31 | 32 | app_timer::~app_timer() 33 | { 34 | } 35 | 36 | // 37 | int app_timer::timer_timeout(const zce::time_value& time_now, 38 | int timer_id) 39 | { 40 | //等到当前的时间 41 | server_timer::timer_timeout(time_now, timer_id); 42 | 43 | //心跳数据 44 | if (zan_timer_act_[0] == timer_id) 45 | { 46 | svc_tcp::reconnect_allserver(); 47 | } 48 | else if (zan_timer_act_[1] == timer_id) 49 | { 50 | //Buffer_Storage::instance()->monitor(); 51 | } 52 | return 0; 53 | } 54 | } -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/buf_storage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ogre 4 | { 5 | class buffer_storage 6 | { 7 | // 8 | typedef zce::lord_rings SAIL_FRAME_BUFFER_POOL; 9 | 10 | protected: 11 | 12 | //只声明不实现,避免错误 13 | buffer_storage(const buffer_storage&); 14 | //只声明不实现,避免错误 15 | buffer_storage& operator =(const buffer_storage&); 16 | 17 | public: 18 | //构造函数和析构函数 19 | buffer_storage(); 20 | ~buffer_storage(); 21 | 22 | //初始化 23 | void init_buffer_list(size_t szlist); 24 | //反初始化,是否所有的申请空间,结束后一定要调用 25 | void uninit_buffer_list(); 26 | 27 | //分配一个Buffer到List中 28 | soar::ogre4a_frame* allocate_byte_buffer(); 29 | //释放一个Buffer到List中 30 | void free_byte_buffer(soar::ogre4a_frame* ptrbuf); 31 | 32 | //扩展BufferList 33 | void extend_buffer_list(size_t szlist = EXTEND_NUM_OF_LIST); 34 | 35 | public: 36 | 37 | //为了SingleTon类准备 38 | //实例的赋值 39 | static void instance(buffer_storage*); 40 | //实例的获得 41 | static buffer_storage* instance(); 42 | //清除实例 43 | static void clear_inst(); 44 | 45 | protected: 46 | 47 | //每次如果BufferStroge不够用了,扩展的个数 48 | static const size_t EXTEND_NUM_OF_LIST = 256; 49 | 50 | protected: 51 | 52 | //我担心内存泄露,所以加个总数计数 53 | size_t size_buffer_alloc_; 54 | 55 | //BUFFER的池子 56 | SAIL_FRAME_BUFFER_POOL frame_buffer_ary_; 57 | 58 | protected: 59 | 60 | //instance函数使用的东西 61 | static buffer_storage* instance_; 62 | }; 63 | }//namespace ogre 64 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/mysql_com_server.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /* 17 | Definitions private to the server, 18 | used in the networking layer to notify specific events. 19 | */ 20 | 21 | #ifndef _mysql_com_server_h 22 | #define _mysql_com_server_h 23 | 24 | struct st_net_server; 25 | 26 | typedef void (*before_header_callback_fn) 27 | (struct st_net *net, void *user_data, size_t count); 28 | 29 | typedef void (*after_header_callback_fn) 30 | (struct st_net *net, void *user_data, size_t count, my_bool rc); 31 | 32 | struct st_net_server 33 | { 34 | before_header_callback_fn m_before_header; 35 | after_header_callback_fn m_after_header; 36 | void *m_user_data; 37 | }; 38 | 39 | typedef struct st_net_server NET_SERVER; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/mysql_com_server.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /* 17 | Definitions private to the server, 18 | used in the networking layer to notify specific events. 19 | */ 20 | 21 | #ifndef _mysql_com_server_h 22 | #define _mysql_com_server_h 23 | 24 | struct st_net_server; 25 | 26 | typedef void (*before_header_callback_fn) 27 | (struct st_net *net, void *user_data, size_t count); 28 | 29 | typedef void (*after_header_callback_fn) 30 | (struct st_net *net, void *user_data, size_t count, my_bool rc); 31 | 32 | struct st_net_server 33 | { 34 | before_header_callback_fn m_before_header; 35 | after_header_callback_fn m_after_header; 36 | void *m_user_data; 37 | }; 38 | 39 | typedef struct st_net_server NET_SERVER; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/commsvr/ogre4asvrd/ogre/auto_connect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ogre/configure.h" 4 | 5 | namespace ogre 6 | { 7 | class svc_tcp; 8 | 9 | class auto_connect 10 | { 11 | public: 12 | 13 | //构造函数 14 | auto_connect(); 15 | ~auto_connect(); 16 | 17 | ///读取配置 18 | int get_config(const configure* config); 19 | 20 | /*! 21 | * @brief 对所有的服务器进行重新链接 22 | * @return int == 0表示成功 23 | * @param num_vaild 仍然有效,无需连接的服务器梳理 24 | * @param num_succ 成功进行链接的服务器数量, 25 | * @param num_fail 失败的数量 26 | */ 27 | int connect_all_server(size_t& num_vaild, size_t& num_succ, size_t& num_fail); 28 | 29 | /*! 30 | * @brief 根据SVRINFO,检查是否是主动连接的服务.并进行连接 31 | * @return int == 0表示成功 32 | * @param peer_id 要链接服务器的PEER ID 33 | */ 34 | int connect_server_by_peerid(const soar::OGRE_PEER_ID& peer_id); 35 | 36 | protected: 37 | /*! 38 | * @brief 重链某个服务器 39 | * @return int == 0表示成功 40 | * @param peer_module 服务器的配置信息 41 | */ 42 | int connect_one_server(const TCP_PEER_MODULE_INFO& peer_module); 43 | 44 | protected: 45 | 46 | typedef std::unordered_set < TCP_PEER_MODULE_INFO, 47 | HASH_OF_PEER_MODULE, 48 | EQUAL_OF_PEER_MODULE > SET_OF_TCP_PEER_MODULE; 49 | 50 | ///连接器 51 | zce::skt::connector ogre_connector_; 52 | 53 | /// 54 | size_t auto_connect_num_ = 0; 55 | ///要主动链接的PEER的SET,用SET是查询方便 56 | SET_OF_TCP_PEER_MODULE autocnt_module_set_; 57 | }; 58 | }// namespace ogre 59 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/sslopt-case.h: -------------------------------------------------------------------------------- 1 | #ifndef SSLOPT_CASE_INCLUDED 2 | #define SSLOPT_CASE_INCLUDED 3 | 4 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; version 2 of the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 18 | 19 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) 20 | case OPT_SSL_KEY: 21 | case OPT_SSL_CERT: 22 | case OPT_SSL_CA: 23 | case OPT_SSL_CAPATH: 24 | case OPT_SSL_CIPHER: 25 | case OPT_SSL_CRL: 26 | case OPT_SSL_CRLPATH: 27 | /* 28 | Enable use of SSL if we are using any ssl option 29 | One can disable SSL later by using --skip-ssl or --ssl=0 30 | */ 31 | opt_use_ssl= 1; 32 | /* crl has no effect in yaSSL */ 33 | #ifdef HAVE_YASSL 34 | opt_ssl_crl= NULL; 35 | opt_ssl_crlpath= NULL; 36 | #endif 37 | break; 38 | #endif 39 | #endif /* SSLOPT_CASE_INCLUDED */ 40 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/sslopt-case.h: -------------------------------------------------------------------------------- 1 | #ifndef SSLOPT_CASE_INCLUDED 2 | #define SSLOPT_CASE_INCLUDED 3 | 4 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; version 2 of the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 18 | 19 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) 20 | case OPT_SSL_KEY: 21 | case OPT_SSL_CERT: 22 | case OPT_SSL_CA: 23 | case OPT_SSL_CAPATH: 24 | case OPT_SSL_CIPHER: 25 | case OPT_SSL_CRL: 26 | case OPT_SSL_CRLPATH: 27 | /* 28 | Enable use of SSL if we are using any ssl option 29 | One can disable SSL later by using --skip-ssl or --ssl=0 30 | */ 31 | opt_use_ssl= 1; 32 | /* crl has no effect in yaSSL */ 33 | #ifdef HAVE_YASSL 34 | opt_ssl_crl= NULL; 35 | opt_ssl_crlpath= NULL; 36 | #endif 37 | break; 38 | #endif 39 | #endif /* SSLOPT_CASE_INCLUDED */ 40 | -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/ogre/peer_id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #pragma pack (1) 4 | 5 | namespace soar 6 | { 7 | //服务信息,为了同时表示IP+端口的模式采用了UNION方式 8 | class OGRE_PEER_ID 9 | { 10 | public: 11 | //构造,析构函数,默认为0 12 | explicit OGRE_PEER_ID(unsigned int peer_ip_address = INVALID_PERR_IP_ADDRESS, 13 | unsigned short peer_port = INVALID_PERR_PORT); 14 | explicit OGRE_PEER_ID(const zce::skt::addr_in&); 15 | // 16 | ~OGRE_PEER_ID(); 17 | 18 | //设置 19 | void set(unsigned int peer_ip_address, unsigned short peer_port); 20 | //根据zce::skt::addr_in的IP地址设置 21 | void set(const zce::skt::addr_in&); 22 | 23 | //比较函数,services_type_,services_id_ 24 | bool operator ==(const OGRE_PEER_ID& others) const; 25 | //比较不同函数, 26 | bool operator !=(const OGRE_PEER_ID& others) const; 27 | //有个排序需求, 28 | bool operator <(const OGRE_PEER_ID& others) const; 29 | 30 | public: 31 | //无效的SERVICE 类型 32 | static const uint16_t INVALID_PERR_IP_ADDRESS = 0; 33 | //无效的SERVICE ID 34 | static const uint32_t INVALID_PERR_PORT = 0; 35 | 36 | public: 37 | 38 | //IP地址 39 | uint32_t peer_ip_address_ = INVALID_PERR_IP_ADDRESS; 40 | //端口号码 41 | uint16_t peer_port_ = INVALID_PERR_PORT; 42 | }; 43 | 44 | #pragma pack () 45 | 46 | class HASH_OF_OGREPEERID 47 | { 48 | public: 49 | size_t operator()(const OGRE_PEER_ID& peer_info) const 50 | { 51 | return (size_t(peer_info.peer_port_) << 16) + peer_info.peer_ip_address_; 52 | } 53 | }; 54 | }//namespace soar 55 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/sslopt-vars.h: -------------------------------------------------------------------------------- 1 | #ifndef SSLOPT_VARS_INCLUDED 2 | #define SSLOPT_VARS_INCLUDED 3 | 4 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; version 2 of the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 18 | 19 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) 20 | #ifdef SSL_VARS_NOT_STATIC 21 | #define SSL_STATIC 22 | #else 23 | #define SSL_STATIC static 24 | #endif 25 | SSL_STATIC my_bool opt_use_ssl = 0; 26 | SSL_STATIC char *opt_ssl_ca = 0; 27 | SSL_STATIC char *opt_ssl_capath = 0; 28 | SSL_STATIC char *opt_ssl_cert = 0; 29 | SSL_STATIC char *opt_ssl_cipher = 0; 30 | SSL_STATIC char *opt_ssl_key = 0; 31 | SSL_STATIC char *opt_ssl_crl = 0; 32 | SSL_STATIC char *opt_ssl_crlpath = 0; 33 | #ifdef MYSQL_CLIENT 34 | SSL_STATIC my_bool opt_ssl_verify_server_cert= 0; 35 | #endif 36 | #endif 37 | #endif /* SSLOPT_VARS_INCLUDED */ 38 | -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/fsm/fsmtask_fsmbase.h: -------------------------------------------------------------------------------- 1 | #include "soar/fsm/fsm_base.h" 2 | #include "soar/fsm/fsmtask_mgr.h" 3 | 4 | namespace soar 5 | { 6 | class FSMTask_FSMBase : public fsm_base 7 | { 8 | public: 9 | 10 | //这而要求传递的Transaction_Manager *是子类NotifyTrans_Manger的, 11 | //必须如此。 12 | //这儿是一个典型的设计两难,如果使用向下朔型DOWNCAST,无意是丑陋的。 13 | FSMTask_FSMBase(fsm_manager* trans_notify_mgr, unsigned int create_cmd) 14 | : fsm_base(trans_notify_mgr, create_cmd) 15 | , fsmtask_mgr_(nullptr) 16 | { 17 | //必须要求trans_notify_mgr至少是trans_notify_mgr的子类, 18 | fsmtask_mgr_ = dynamic_cast (trans_notify_mgr); 19 | ZCE_ASSERT(fsmtask_mgr_); 20 | } 21 | 22 | protected: 23 | // 24 | virtual ~FSMTask_FSMBase() 25 | { 26 | }; 27 | 28 | protected: 29 | 30 | // 31 | template 32 | int pushbak_mgr_sendqueue(uint32_t cmd, 33 | const T& info, 34 | uint32_t option = 0) 35 | { 36 | soar::SERVICES_ID proxy_svc(0, 0); 37 | return fsmtask_mgr_->enqueue_sendqueue(cmd, 38 | this->req_zerg_head_.user_id_, 39 | this->asyncobj_id_, 40 | 0, 41 | info, 42 | option); 43 | }; 44 | 45 | protected: 46 | 47 | //管理器 48 | fsmtask_manger* fsmtask_mgr_ = nullptr; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/sslopt-vars.h: -------------------------------------------------------------------------------- 1 | #ifndef SSLOPT_VARS_INCLUDED 2 | #define SSLOPT_VARS_INCLUDED 3 | 4 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; version 2 of the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 18 | 19 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) 20 | #ifdef SSL_VARS_NOT_STATIC 21 | #define SSL_STATIC 22 | #else 23 | #define SSL_STATIC static 24 | #endif 25 | SSL_STATIC my_bool opt_use_ssl = 0; 26 | SSL_STATIC char *opt_ssl_ca = 0; 27 | SSL_STATIC char *opt_ssl_capath = 0; 28 | SSL_STATIC char *opt_ssl_cert = 0; 29 | SSL_STATIC char *opt_ssl_cipher = 0; 30 | SSL_STATIC char *opt_ssl_key = 0; 31 | SSL_STATIC char *opt_ssl_crl = 0; 32 | SSL_STATIC char *opt_ssl_crlpath = 0; 33 | #ifdef MYSQL_CLIENT 34 | SSL_STATIC my_bool opt_ssl_verify_server_cert= 0; 35 | #endif 36 | #endif 37 | #endif /* SSLOPT_VARS_INCLUDED */ 38 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/mysql/innodb_priv.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ 15 | 16 | #ifndef INNODB_PRIV_INCLUDED 17 | #define INNODB_PRIV_INCLUDED 18 | 19 | /** @file Declaring server-internal functions that are used by InnoDB. */ 20 | 21 | #include 22 | 23 | class THD; 24 | 25 | int get_quote_char_for_identifier(THD *thd, const char *name, uint length); 26 | bool schema_table_store_record(THD *thd, TABLE *table); 27 | void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); 28 | bool check_global_access(THD *thd, ulong want_access); 29 | uint strconvert(CHARSET_INFO *from_cs, const char *from, 30 | CHARSET_INFO *to_cs, char *to, uint to_length, 31 | uint *errors); 32 | void sql_print_error(const char *format, ...); 33 | 34 | 35 | 36 | #endif /* INNODB_PRIV_INCLUDED */ 37 | -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/ogre/peer_id.cpp: -------------------------------------------------------------------------------- 1 | #include "soar/predefine.h" 2 | #include "soar/ogre/peer_id.h" 3 | 4 | namespace soar 5 | { 6 | OGRE_PEER_ID::OGRE_PEER_ID(unsigned int peer_ip_address, unsigned short peer_port) : 7 | peer_ip_address_(peer_ip_address), 8 | peer_port_(peer_port) 9 | { 10 | } 11 | 12 | OGRE_PEER_ID::OGRE_PEER_ID(const zce::skt::addr_in& inet_addr) : 13 | peer_ip_address_(inet_addr.get_ip_address()), 14 | peer_port_(inet_addr.get_port()) 15 | { 16 | } 17 | 18 | OGRE_PEER_ID::~OGRE_PEER_ID() 19 | { 20 | } 21 | 22 | // 23 | void OGRE_PEER_ID::set(unsigned int peer_ip_address, unsigned short peer_port) 24 | { 25 | peer_ip_address_ = peer_ip_address; 26 | peer_port_ = peer_port; 27 | } 28 | 29 | //根据ACE的IP地址设置 30 | void OGRE_PEER_ID::set(const zce::skt::addr_in& inet_addr) 31 | { 32 | peer_ip_address_ = inet_addr.get_ip_address(); 33 | peer_port_ = inet_addr.get_port(); 34 | } 35 | 36 | //比较函数, 37 | bool OGRE_PEER_ID::operator ==(const OGRE_PEER_ID& others) const 38 | { 39 | if (others.peer_ip_address_ == peer_ip_address_ && others.peer_port_ == peer_port_) 40 | { 41 | return true; 42 | } 43 | 44 | return false; 45 | } 46 | //比较不同函数, 47 | bool OGRE_PEER_ID::operator !=(const OGRE_PEER_ID& others) const 48 | { 49 | return !(*this == others); 50 | } 51 | //有个排序需求, 52 | bool OGRE_PEER_ID::operator <(const OGRE_PEER_ID& others) const 53 | { 54 | if (peer_ip_address_ + peer_port_ < others.peer_ip_address_ + others.peer_port_) 55 | { 56 | return true; 57 | } 58 | 59 | return false; 60 | } 61 | } -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/mysql/innodb_priv.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ 15 | 16 | #ifndef INNODB_PRIV_INCLUDED 17 | #define INNODB_PRIV_INCLUDED 18 | 19 | /** @file Declaring server-internal functions that are used by InnoDB. */ 20 | 21 | #include 22 | 23 | class THD; 24 | 25 | int get_quote_char_for_identifier(THD *thd, const char *name, uint length); 26 | bool schema_table_store_record(THD *thd, TABLE *table); 27 | void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); 28 | bool check_global_access(THD *thd, ulong want_access); 29 | uint strconvert(CHARSET_INFO *from_cs, const char *from, 30 | CHARSET_INFO *to_cs, char *to, uint to_length, 31 | uint *errors); 32 | void sql_print_error(const char *format, ...); 33 | 34 | 35 | 36 | #endif /* INNODB_PRIV_INCLUDED */ 37 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/src/google/protobuf/stubs/structurally_valid_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. All Rights Reserved. 2 | // Author: xpeng@google.com (Peter Peng) 3 | 4 | #include 5 | #include 6 | 7 | namespace google { 8 | namespace protobuf { 9 | namespace internal { 10 | namespace { 11 | 12 | TEST(StructurallyValidTest, ValidUTF8String) { 13 | // On GCC, this string can be written as: 14 | // "abcd 1234 - \u2014\u2013\u2212" 15 | // MSVC seems to interpret \u differently. 16 | string valid_str("abcd 1234 - \342\200\224\342\200\223\342\210\222 - xyz789"); 17 | EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data(), 18 | valid_str.size())); 19 | // Additional check for pointer alignment 20 | for (int i = 1; i < 8; ++i) { 21 | EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data() + i, 22 | valid_str.size() - i)); 23 | } 24 | } 25 | 26 | TEST(StructurallyValidTest, InvalidUTF8String) { 27 | const string invalid_str("abcd\xA0\xB0\xA0\xB0\xA0\xB0 - xyz789"); 28 | EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data(), 29 | invalid_str.size())); 30 | // Additional check for pointer alignment 31 | for (int i = 1; i < 8; ++i) { 32 | EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data() + i, 33 | invalid_str.size() - i)); 34 | } 35 | } 36 | 37 | } // namespace 38 | } // namespace internal 39 | } // namespace protobuf 40 | } // namespace google 41 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/event/handle_base.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/os_adapt/define.h" 3 | #include "zce/os_adapt/socket.h" 4 | #include "zce/event/handle_base.h" 5 | #include "zce/event/reactor_base.h" 6 | 7 | namespace zce 8 | { 9 | //构造函数和析构函数 10 | event_handler::event_handler() : 11 | zce_reactor_(nullptr), 12 | event_mask_(static_cast(RECTOR_EVENT::NULL_MASK)) 13 | { 14 | } 15 | event_handler::event_handler(zce::reactor* reactor) : 16 | zce_reactor_(reactor), 17 | event_mask_(static_cast(RECTOR_EVENT::NULL_MASK)) 18 | { 19 | } 20 | 21 | event_handler::~event_handler() 22 | { 23 | } 24 | 25 | //读事件 26 | void event_handler::read_event() 27 | { 28 | return; 29 | } 30 | 31 | //写事件 32 | void event_handler::write_event() 33 | { 34 | return; 35 | } 36 | //异常事件调用函数 37 | void event_handler::exception_event() 38 | { 39 | return; 40 | } 41 | 42 | //发生了链接的事件 43 | void event_handler::connect_event(bool /*success*/) 44 | { 45 | return; 46 | } 47 | 48 | //发生了accept的事件是调用 49 | void event_handler::accept_event() 50 | { 51 | return; 52 | } 53 | 54 | //发生了inotify的事件是调用 55 | void event_handler::inotify_event() 56 | { 57 | return; 58 | } 59 | 60 | // 61 | void event_handler::close_handle() 62 | { 63 | //移除自己,但是不判断返回,因为如果代码考虑的不细致,可能出现两次remove_handler 64 | reactor()->remove_handler(this, false); 65 | return; 66 | } 67 | 68 | void event_handler::reactor(zce::reactor* reactor) 69 | { 70 | zce_reactor_ = reactor; 71 | } 72 | 73 | /// Get the event demultiplexors. 74 | zce::reactor* event_handler::reactor(void) const 75 | { 76 | return zce_reactor_; 77 | } 78 | } -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lstate.h" 13 | 14 | 15 | /* Increments 'L->top', checking for stack overflows */ 16 | #define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ 17 | "stack overflow");} 18 | 19 | 20 | /* 21 | ** If a call returns too many multiple returns, the callee may not have 22 | ** stack space to accommodate all results. In this case, this macro 23 | ** increases its stack space ('L->ci->top'). 24 | */ 25 | #define adjustresults(L,nres) \ 26 | { if ((nres) <= LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } 27 | 28 | 29 | /* Ensure the stack has at least 'n' elements */ 30 | #define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ 31 | "not enough elements in the stack") 32 | 33 | 34 | /* 35 | ** To reduce the overhead of returning from C functions, the presence of 36 | ** to-be-closed variables in these functions is coded in the CallInfo's 37 | ** field 'nresults', in a way that functions with no to-be-closed variables 38 | ** with zero, one, or "all" wanted results have no overhead. Functions 39 | ** with other number of wanted results, as well as functions with 40 | ** variables to be closed, have an extra check. 41 | */ 42 | 43 | #define hastocloseCfunc(n) ((n) < LUA_MULTRET) 44 | 45 | /* Map [-1, inf) (range of 'nresults') into (-inf, -2] */ 46 | #define codeNresults(n) (-(n) - 3) 47 | #define decodeNresults(n) (-(n) - 3) 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/svrd/app_fsmtask.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "soar/svrd/app_bus.h" 4 | 5 | #define REGISTER_NOTIFYTRANS_CMD(fsmtask_fsm_class, cmd_word ) \ 6 | { \ 7 | int __ret_register_ = fsmtask_manger::instance()->register_trans_cmd(cmd_word, \ 8 | new fsmtask_fsm_class(zce::timer_queue::instance(),\ 9 | fsmtask_manger::instance())); \ 10 | if (__ret_register_ != 0) \ 11 | { \ 12 | return __ret_register_; \ 13 | } \ 14 | } 15 | 16 | namespace sosar 17 | { 18 | class fsmtask_taskbase; 19 | 20 | class svrdapp_fsmtask : public soar::app_buspipe 21 | { 22 | protected: 23 | 24 | //使用事务处理的Application 25 | svrdapp_fsmtask(); 26 | virtual ~svrdapp_fsmtask(); 27 | 28 | public: 29 | 30 | //增加调用register_func_cmd 31 | int app_start(int argc, const char* argv[]) override; 32 | 33 | //运行处理, 34 | int app_run() override; 35 | 36 | //退出处理 37 | int app_exit() override; 38 | 39 | protected: 40 | 41 | //注册要事务处理的命令, 42 | //可以使用宏REGISTER_NOTIFYTRANS_CMD注册命令 43 | virtual int register_notifytrans_cmd() = 0; 44 | 45 | //注册notify的处理线程,你把这几个参数赋值了就OK 46 | //clone_task,麻烦你new一个给我 47 | //task_num 不要用太多的线程,合理就OK,除非有大量的阻塞 48 | //task_stack_size 如果线程数量较多,切记控制堆栈大小 49 | virtual int register_notify_task(soar::fsmtask_taskbase*& clone_task, 50 | size_t& task_num, 51 | size_t& task_stack_size) = 0; 52 | }; 53 | } 54 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/lock/thread_spin.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2013 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/lock/thread_spin.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2013年1月31日 7 | * @brief SPIN 自旋锁的封装, 8 | * WINDOWS下用SPIN + 临界区封装 9 | * LINUX下用SPIN MUTEX封装 10 | * 11 | * @details 如果就是一些临界区保护,可以用这个封装实验一下, 12 | * 大部分性能数据,都表示大部分测试结果的反馈是还不错的。 13 | * 14 | * SPIN 在冲撞特别多的情况,使用要当心一点。 15 | * WINDOPWS 的实现可能更加优雅一点,他会在SPIN达到一定的数量的情况下 16 | * 进入等待, 17 | * 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "zce/lock/lock_base.h" 23 | #include "zce/lock/lock_guard.h" 24 | #include "zce/time/time_value.h" 25 | 26 | namespace zce 27 | { 28 | /*! 29 | * @brief SPIN自旋锁,线程互斥锁, 30 | * 如果你就是为了保护一段代码,某个数据。需求类似临界区,可以使用 31 | * 这个东东, 32 | * Windows下是用临界区+SPIN实现的,所以嘛,同时注意临界区是可递归的 33 | * LINUX下用的就是SPIN 锁 34 | */ 35 | class thread_spin_Mutex : public zce::lock_base 36 | { 37 | public: 38 | ///线程锁的GUARD 39 | typedef zce::lock_guard LOCK_GUARD; 40 | 41 | public: 42 | 43 | //构造函数 44 | thread_spin_Mutex() noexcept; 45 | ///析构函数 46 | virtual ~thread_spin_Mutex(void); 47 | 48 | ///锁定 49 | virtual void lock()noexcept override; 50 | 51 | ///尝试锁定 52 | virtual bool try_lock()noexcept override; 53 | 54 | ///解锁, 55 | virtual void unlock()noexcept override; 56 | 57 | ///取出内部的锁的指针 58 | pthread_spinlock_t* get_lock(); 59 | 60 | protected: 61 | 62 | ///SPIN线程锁 63 | pthread_spinlock_t lock_; 64 | }; 65 | } 66 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lzio.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.c $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #define lzio_c 8 | #define LUA_CORE 9 | 10 | #include "lprefix.h" 11 | 12 | 13 | #include 14 | 15 | #include "lua.h" 16 | 17 | #include "llimits.h" 18 | #include "lmem.h" 19 | #include "lstate.h" 20 | #include "lzio.h" 21 | 22 | 23 | int luaZ_fill (ZIO *z) { 24 | size_t size; 25 | lua_State *L = z->L; 26 | const char *buff; 27 | lua_unlock(L); 28 | buff = z->reader(L, z->data, &size); 29 | lua_lock(L); 30 | if (buff == NULL || size == 0) 31 | return EOZ; 32 | z->n = size - 1; /* discount char being returned */ 33 | z->p = buff; 34 | return cast_uchar(*(z->p++)); 35 | } 36 | 37 | 38 | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { 39 | z->L = L; 40 | z->reader = reader; 41 | z->data = data; 42 | z->n = 0; 43 | z->p = NULL; 44 | } 45 | 46 | 47 | /* --------------------------------------------------------------- read --- */ 48 | size_t luaZ_read (ZIO *z, void *b, size_t n) { 49 | while (n) { 50 | size_t m; 51 | if (z->n == 0) { /* no bytes in buffer? */ 52 | if (luaZ_fill(z) == EOZ) /* try to read more */ 53 | return n; /* no more input; return number of missing bytes */ 54 | else { 55 | z->n++; /* luaZ_fill consumed first byte; put it back */ 56 | z->p--; 57 | } 58 | } 59 | m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ 60 | memcpy(b, z->p, m); 61 | z->n -= m; 62 | z->p += m; 63 | b = (char *)b + m; 64 | n -= m; 65 | } 66 | return 0; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/examples/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains example code that uses Protocol Buffers to manage an 2 | address book. Two programs are provided, each with three different 3 | implementations, one written in each of C++, Java, and Python. The add_person 4 | example adds a new person to an address book, prompting the user to input 5 | the person's information. The list_people example lists people already in the 6 | address book. The examples use the exact same format in all three languages, 7 | so you can, for example, use add_person_java to create an address book and then 8 | use list_people_python to read it. 9 | 10 | You must install the protobuf package before you can build these. 11 | 12 | To build all the examples (on a unix-like system), simply run "make". This 13 | creates the following executable files in the current directory: 14 | add_person_cpp list_people_cpp 15 | add_person_java list_people_java 16 | add_person_python list_people_python 17 | 18 | If you only want to compile examples in one language, use "make cpp"*, 19 | "make java", or "make python". 20 | 21 | All of these programs simply take an address book file as their parameter. 22 | The add_person programs will create the file if it doesn't already exist. 23 | 24 | These examples are part of the Protocol Buffers tutorial, located at: 25 | https://developers.google.com/protocol-buffers/docs/tutorials 26 | 27 | * Note that on some platforms you may have to edit the Makefile and remove 28 | "-lpthread" from the linker commands (perhaps replacing it with something else). 29 | We didn't do this automatically because we wanted to keep the example simple. 30 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/socket/addr_any.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "zce/socket/addr_base.h" 4 | 5 | namespace zce::skt 6 | { 7 | //Socket地址的通用类,用于有时候,你要用第一个地址类型同时适配in,in6的时候。 8 | class addr_any : public zce::skt::addr_base 9 | { 10 | public: 11 | 12 | //构造函数,默认初始化为in的地址,使用是要记得改变 13 | addr_any(); 14 | //构造函数,根据family确定初始化的类型 15 | addr_any(int family); 16 | //析构函数,内部有virtual函数 17 | virtual ~addr_any(void); 18 | 19 | //设置sockaddr地址信息,设置成纯虚函数的原因不想让你使用addr_any 20 | virtual void set_sockaddr(sockaddr* sockaddr_ptr, 21 | socklen_t sockaddr_size) override; 22 | 23 | //通过IP取得域名 24 | virtual int getnameinfo(char* host_name, 25 | size_t name_len) const override; 26 | 27 | //通过域名得到IP地址 28 | virtual int getaddrinfo(const char* nodename, 29 | uint16_t port_number = 0) override; 30 | 31 | //根据family决定地址类型,然后再通过域名获取IP 32 | int getaddrinfo(int family, 33 | const char* node_name, 34 | uint16_t port_number = 0); 35 | 36 | ///设置端口号, 37 | virtual void set_port(uint16_t) override; 38 | ///取得端口号 39 | virtual uint16_t get_port(void) const override; 40 | 41 | //! 设置地址的family 42 | void set_family(int family); 43 | 44 | //! 检查地址是否相等 45 | bool operator == (const addr_any& others) const; 46 | //! 检查地址是否不相等 47 | bool operator != (const addr_any& others) const; 48 | 49 | public: 50 | 51 | union 52 | { 53 | //sockaddr_in 16个字节 54 | ::sockaddr_in in4_addr_; 55 | //sockaddr_in6 28个字节 56 | ::sockaddr_in6 in6_addr_; 57 | }; 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/logger/log_comm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace zce 4 | { 5 | //!日志输出级别,日志记录时使用的是级别, 6 | enum class LOG_PRIORITY 7 | { 8 | //!跟踪信息,默认Mask输出级别,默认全部输出 9 | LP_TRACE = 1, 10 | //!调试信息 11 | LP_DEBUG = 2, 12 | //!普通信息 13 | LP_INFO = 3, 14 | //!错误信息 15 | LP_ERROR = 4, 16 | //!告警类型的错误 17 | LP_ALERT = 5, 18 | //!致命错误 19 | LP_FATAL = 6, 20 | }; 21 | 22 | ///默认记录的数据,在每条日志的头部 23 | enum LOG_HEAD 24 | { 25 | ///什么都不纪录 26 | HEAD_NONE = 0, 27 | ///纪录当前的时间 28 | CURRENTTIME = (0x1 << 0), 29 | ///纪录日志的级别信息 30 | LOGLEVEL = (0x1 << 1), 31 | ///纪录进程ID 32 | PROCESS_ID = (0x1 << 2), 33 | ///纪录线程ID 34 | THREAD_ID = (0x1 << 3), 35 | }; 36 | 37 | ///选择输出的方式 38 | enum LOG_OUTPUT 39 | { 40 | ///不向任何地方输出 41 | OUTPUT_NONE = 0, 42 | ///同步不向其他地方输出,默认 43 | LOGFILE = (0x1 << 0), 44 | ///同步向标准输出输出.如果你的程序是CGI程序,慎用 45 | STDOUT = (0x1 << 1), 46 | ///同步向标准错误输出. 47 | ERROUT = (0x1 << 2), 48 | ///向共享内存文件里面输出 49 | MMAP_FILE = (0x1 << 3), 50 | ///同步向WINDOWS的调试窗口输出,仅仅在WIN32环境起作用 51 | WINDBG = (0x1 << 4) 52 | }; 53 | 54 | //!RS的缩写是用于纪念Richard steven 55 | #ifndef RS_TRACE 56 | #define RS_TRACE zce::LOG_PRIORITY::LP_TRACE 57 | #endif 58 | 59 | #ifndef RS_DEBUG 60 | #define RS_DEBUG zce::LOG_PRIORITY::LP_DEBUG 61 | #endif 62 | 63 | #ifndef RS_INFO 64 | #define RS_INFO zce::LOG_PRIORITY::LP_INFO 65 | #endif 66 | 67 | #ifndef RS_ERROR 68 | #define RS_ERROR zce::LOG_PRIORITY::LP_ERROR 69 | #endif 70 | 71 | #ifndef RS_ALERT 72 | #define RS_ALERT zce::LOG_PRIORITY::LP_ALERT 73 | #endif 74 | 75 | #ifndef RS_FATAL 76 | #define RS_FATAL zce::LOG_PRIORITY::LP_FATAL 77 | #endif 78 | }; 79 | -------------------------------------------------------------------------------- /src/commlib/soarlib/soar/svrd/cfg_fsm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "soar/zerg/services_info.h" 4 | #include "soar/svrd/cfg_base.h" 5 | 6 | struct FRAMEWORK_CONFIG 7 | { 8 | struct TaskInfo 9 | { 10 | public: /* members */ 11 | uint32_t task_thread_num_; // task线程数量 12 | uint32_t task_thread_stack_size_; // task线程堆栈大小 13 | uint32_t enqueue_timeout_sec_; // push数据到task队列时的超时时间秒 14 | uint32_t enqueue_timeout_usec_; // push数据到task队列时的超时时间微秒 15 | }; 16 | 17 | struct TransInfo 18 | { 19 | public: /* members */ 20 | uint32_t trans_num_; // 事务的数量 21 | uint32_t trans_cmd_num_; // 事务命令字的个数 22 | uint32_t func_cmd_num_; // 函数命令字的个数 23 | }; 24 | 25 | struct MonitorInfo 26 | { 27 | public: /* members */ 28 | uint32_t filter_statics_id_cnt_; // 要排除的统计ID个数 29 | uint32_t filter_statics_id_list_[100]; // 要排除的统计ID列表 30 | }; 31 | 32 | TransInfo trans_info_; // 事务的配置 33 | TaskInfo task_info_; // Task的配置,使用notifytrans时有效 34 | 35 | MonitorInfo monitor_info_; // 监控配置信息 36 | }; 37 | 38 | struct SVCID_CONFIG 39 | { 40 | }; 41 | 42 | /*! 43 | * @brief 框架业务服务器的配置 44 | * 45 | * @note 46 | */ 47 | class svrd_cfg_fsm : public soar::svrd_cfg_base 48 | { 49 | protected: 50 | //构造函数 51 | svrd_cfg_fsm(); 52 | virtual ~svrd_cfg_fsm(); 53 | 54 | public: 55 | 56 | /// 加载zerg framwork app的配置 57 | virtual int read_cfgfile(); 58 | 59 | protected: 60 | 61 | /// 使用帮助 62 | virtual int usage(const char* program_name); 63 | 64 | public: 65 | 66 | /// 67 | FRAMEWORK_CONFIG framework_config_; 68 | 69 | /// 70 | zce::propertytree framework_ptree_; 71 | }; 72 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/lock/process_mutex.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2013 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/lock/process_mutex.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2013年1月15日 7 | * @brief 进程的MUTEX,必须有名字, 8 | * 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "zce/lock/lock_base.h" 14 | #include "zce/lock/lock_guard.h" 15 | #include "zce/shared_mem/posix.h" 16 | 17 | namespace zce 18 | { 19 | /*! 20 | * @brief 进程Mutex锁,用于多进程间的互斥同步处理, 21 | * 在WINDOWS下,递归锁是用MUTEX模拟的(必须有名字),非递归锁是用信号灯模拟, 22 | * 在LINUX下,还是用pthread_mutex实现的,但是用共享内存存放,名字用于共享 23 | * 内存名字 24 | */ 25 | class process_mutex : public zce::lock_base 26 | { 27 | public: 28 | 29 | //进程锁的GUARD 30 | typedef zce::lock_guard LOCK_GUARD; 31 | 32 | public: 33 | ///构造函数 34 | process_mutex(const char* mutex_name, bool recursive = true); 35 | ///析构函数 36 | virtual ~process_mutex(void); 37 | 38 | ///锁定 39 | void lock() noexcept override; 40 | 41 | ///尝试锁定 42 | bool try_lock() noexcept override; 43 | 44 | ///解锁, 45 | void unlock() noexcept override; 46 | 47 | ///绝对时间超时的的锁定,超时后解锁 48 | bool try_lock_until(const zce::time_value& abs_time) noexcept override; 49 | 50 | ///相对时间的超时锁定,超时后,解锁 51 | bool try_lock_for(const zce::time_value& relative_time) noexcept override; 52 | 53 | ///取出内部的锁的指针 54 | pthread_mutex_t* get_lock(); 55 | 56 | protected: 57 | 58 | ///进程锁,注意,注意,注意,这个地方用的是一个指针, 59 | pthread_mutex_t* lock_; 60 | 61 | #if defined ZCE_OS_LINUX 62 | //共享内存,LINUX需要共享内存 63 | zce::shm_posix posix_sharemem_; 64 | #endif 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run this script to generate the configure script and other files that will 4 | # be included in the distribution. These files are not checked in because they 5 | # are automatically generated. 6 | 7 | set -e 8 | 9 | # Check that we're being run from the right directory. 10 | if test ! -f src/google/protobuf/stubs/common.h; then 11 | cat >&2 << __EOF__ 12 | Could not find source code. Make sure you are running this script from the 13 | root of the distribution tree. 14 | __EOF__ 15 | exit 1 16 | fi 17 | 18 | # Check that gtest is present. Usually it is already there since the 19 | # directory is set up as an SVN external. 20 | if test ! -e gtest; then 21 | echo "Google Test not present. Fetching gtest-1.5.0 from the web..." 22 | curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx 23 | mv gtest-1.5.0 gtest 24 | fi 25 | 26 | set -ex 27 | 28 | # Temporary hack: Must change C runtime library to "multi-threaded DLL", 29 | # otherwise it will be set to "multi-threaded static" when MSVC upgrades 30 | # the project file to MSVC 2005/2008. vladl of Google Test says gtest will 31 | # probably change their default to match, then this will be unnecessary. 32 | # One of these mappings converts the debug configuration and the other 33 | # converts the release configuration. I don't know which is which. 34 | sed -i -e 's/RuntimeLibrary="5"/RuntimeLibrary="3"/g; 35 | s/RuntimeLibrary="4"/RuntimeLibrary="2"/g;' gtest/msvc/*.vcproj 36 | 37 | # TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings. 38 | autoreconf -f -i -Wall,no-obsolete 39 | 40 | rm -rf autom4te.cache config.h.in~ 41 | exit 0 42 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/my_list.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef _list_h_ 17 | #define _list_h_ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef struct st_list { 24 | struct st_list *prev,*next; 25 | void *data; 26 | } LIST; 27 | 28 | typedef int (*list_walk_action)(void *,void *); 29 | 30 | extern LIST *list_add(LIST *root,LIST *element); 31 | extern LIST *list_delete(LIST *root,LIST *element); 32 | extern LIST *list_cons(void *data,LIST *root); 33 | extern LIST *list_reverse(LIST *root); 34 | extern void list_free(LIST *root,unsigned int free_data); 35 | extern unsigned int list_length(LIST *); 36 | extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); 37 | 38 | #define list_rest(a) ((a)->next) 39 | #define list_push(a,b) (a)=list_cons((b),(a)) 40 | #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); } 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif 46 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/shared_mem/posix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "zce/util/non_copyable.h" 4 | #include "zce/os_adapt/define.h" 5 | 6 | /*! 7 | * @brief 封装POSIX共享内存映射代码, 8 | * 9 | * note 10 | */ 11 | namespace zce 12 | { 13 | class shm_posix : public zce::non_copyable 14 | { 15 | public: 16 | //构造函数 17 | shm_posix(); 18 | ~shm_posix(); 19 | 20 | shm_posix(const shm_posix &) = delete; 21 | shm_posix& operator=(const shm_posix&) = delete; 22 | public: 23 | //打开文件,进行映射 24 | int open(const char* file_name, 25 | std::size_t shm_size, 26 | int file_open_mode = O_CREAT | O_RDWR, 27 | int file_perms_mode = ZCE_SHARE_FILE_PERMS, 28 | const void* want_address = nullptr, 29 | int mmap_prot = PROT_READ | PROT_WRITE, 30 | int mmap_flags = MAP_SHARED, 31 | std::size_t offset = 0 32 | ); 33 | 34 | //打开文件,进行映射, 简单,推荐使用这个函数 35 | int open(const char* file_name, 36 | std::size_t shm_size, 37 | bool if_restore, 38 | bool read_only = false, 39 | bool share_file = true, 40 | const void* want_address = nullptr, 41 | std::size_t offset = 0 42 | ); 43 | 44 | //关闭映射(文件) 45 | int close(); 46 | 47 | //删除映射的文件,当然正在映射(或者还有人在映射)的时候不能删除 48 | int remove(); 49 | 50 | //同步文件 51 | int flush(); 52 | 53 | //返回映射的内存地址 54 | void* addr(); 55 | 56 | protected: 57 | 58 | //映射文件的名称 59 | std::string shm_name_; 60 | 61 | //映射的内存地址 62 | void* mmap_addr_; 63 | 64 | // 映射的文件句柄 65 | ZCE_HANDLE mmap_handle_; 66 | 67 | //映射的共享内存大小 68 | std::size_t shm_size_; 69 | }; 70 | } -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/lmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lmem_h 8 | #define lmem_h 9 | 10 | 11 | #include 12 | 13 | #include "llimits.h" 14 | #include "lua.h" 15 | 16 | #define MEMERRMSG "not enough memory" 17 | 18 | 19 | #define luaM_reallocv(L,b,on,n,e) \ 20 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ 21 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ 22 | luaM_toobig(L)) 23 | 24 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) 25 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) 26 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) 27 | 28 | #define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) 29 | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) 30 | #define luaM_newvector(L,n,t) \ 31 | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) 32 | 33 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ 34 | if ((nelems)+1 > (size)) \ 35 | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) 36 | 37 | #define luaM_reallocvector(L, v,oldn,n,t) \ 38 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) 39 | 40 | 41 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, 42 | size_t size); 43 | LUAI_FUNC void *luaM_toobig (lua_State *L); 44 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, 45 | size_t size_elem, int limit, 46 | const char *errormsg); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/my_list.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef _list_h_ 17 | #define _list_h_ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef struct st_list { 24 | struct st_list *prev,*next; 25 | void *data; 26 | } LIST; 27 | 28 | typedef int (*list_walk_action)(void *,void *); 29 | 30 | extern LIST *list_add(LIST *root,LIST *element); 31 | extern LIST *list_delete(LIST *root,LIST *element); 32 | extern LIST *list_cons(void *data,LIST *root); 33 | extern LIST *list_reverse(LIST *root); 34 | extern void list_free(LIST *root,unsigned int free_data); 35 | extern unsigned int list_length(LIST *); 36 | extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); 37 | 38 | #define list_rest(a) ((a)->next) 39 | #define list_push(a,b) (a)=list_cons((b),(a)) 40 | #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); } 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif 46 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/os_adapt/stdlib.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/os_adapt/stdlib.h" 3 | 4 | //ecvt的线程安全版本,用于将一个double转换成一个10进制指数方式的字符串, 5 | //注意这个字符串是一个纯粹的数字字符串, 6 | //ndigits为要求返回数字的长度,是所有数字,这个参数fcvt_r有区别,尾数即使是0也会输出 7 | //返回参数,decpt返回指数,sign返回符号 8 | int zce::ecvt_r(double number, 9 | int ndigits, 10 | int* decpt, 11 | int* sign, 12 | char* buf, 13 | size_t len) 14 | { 15 | #ifdef ZCE_OS_WINDOWS 16 | return ::_ecvt_s(buf, 17 | len, 18 | number, 19 | ndigits, 20 | decpt, 21 | sign); 22 | #endif 23 | 24 | #ifdef ZCE_OS_LINUX 25 | return ::ecvt_r(number, 26 | ndigits, 27 | decpt, 28 | sign, 29 | buf, 30 | len); 31 | #endif 32 | } 33 | 34 | //fcvt的线程安全版本,用于将一个double转换成一个10进制数字的字符串, 35 | //注意这个字符串是一个纯粹的数字字符串, 36 | //ndigits为要求返回小数个数的长度,这个和ecvt_r有区别,注意是小数,小数即使是0也会输出 37 | //返回参数,decpt返回指数,sign返回符号 38 | int zce::fcvt_r(double number, 39 | int ndigits, 40 | int* decpt, 41 | int* sign, 42 | char* buf, 43 | size_t len) 44 | { 45 | #ifdef ZCE_OS_WINDOWS 46 | return _fcvt_s(buf, 47 | len, 48 | number, 49 | ndigits, 50 | decpt, 51 | sign); 52 | #endif 53 | 54 | #ifdef ZCE_OS_LINUX 55 | return ::fcvt_r(number, 56 | ndigits, 57 | decpt, 58 | sign, 59 | buf, 60 | len); 61 | #endif 62 | } -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lopnames.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lopnames.h $ 3 | ** Opcode names 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #if !defined(lopnames_h) 8 | #define lopnames_h 9 | 10 | #include 11 | 12 | 13 | /* ORDER OP */ 14 | 15 | static const char *const opnames[] = { 16 | "MOVE", 17 | "LOADI", 18 | "LOADF", 19 | "LOADK", 20 | "LOADKX", 21 | "LOADFALSE", 22 | "LFALSESKIP", 23 | "LOADTRUE", 24 | "LOADNIL", 25 | "GETUPVAL", 26 | "SETUPVAL", 27 | "GETTABUP", 28 | "GETTABLE", 29 | "GETI", 30 | "GETFIELD", 31 | "SETTABUP", 32 | "SETTABLE", 33 | "SETI", 34 | "SETFIELD", 35 | "NEWTABLE", 36 | "SELF", 37 | "ADDI", 38 | "ADDK", 39 | "SUBK", 40 | "MULK", 41 | "MODK", 42 | "POWK", 43 | "DIVK", 44 | "IDIVK", 45 | "BANDK", 46 | "BORK", 47 | "BXORK", 48 | "SHRI", 49 | "SHLI", 50 | "ADD", 51 | "SUB", 52 | "MUL", 53 | "MOD", 54 | "POW", 55 | "DIV", 56 | "IDIV", 57 | "BAND", 58 | "BOR", 59 | "BXOR", 60 | "SHL", 61 | "SHR", 62 | "MMBIN", 63 | "MMBINI", 64 | "MMBINK", 65 | "UNM", 66 | "BNOT", 67 | "NOT", 68 | "LEN", 69 | "CONCAT", 70 | "CLOSE", 71 | "TBC", 72 | "JMP", 73 | "EQ", 74 | "LT", 75 | "LE", 76 | "EQK", 77 | "EQI", 78 | "LTI", 79 | "LEI", 80 | "GTI", 81 | "GEI", 82 | "TEST", 83 | "TESTSET", 84 | "CALL", 85 | "TAILCALL", 86 | "RETURN", 87 | "RETURN0", 88 | "RETURN1", 89 | "FORLOOP", 90 | "FORPREP", 91 | "TFORPREP", 92 | "TFORCALL", 93 | "TFORLOOP", 94 | "SETLIST", 95 | "CLOSURE", 96 | "VARARG", 97 | "VARARGPREP", 98 | "EXTRAARG", 99 | NULL 100 | }; 101 | 102 | #endif 103 | 104 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) 21 | 22 | 23 | typedef struct Mbuffer { 24 | char *buffer; 25 | size_t n; 26 | size_t buffsize; 27 | } Mbuffer; 28 | 29 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 30 | 31 | #define luaZ_buffer(buff) ((buff)->buffer) 32 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 33 | #define luaZ_bufflen(buff) ((buff)->n) 34 | 35 | #define luaZ_buffremove(buff,i) ((buff)->n -= (i)) 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ 41 | (buff)->buffsize, size), \ 42 | (buff)->buffsize = size) 43 | 44 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 45 | 46 | 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 48 | void *data); 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ 50 | 51 | 52 | 53 | /* --------- Private Part ------------------ */ 54 | 55 | struct Zio { 56 | size_t n; /* bytes still unread */ 57 | const char *p; /* current position in buffer */ 58 | lua_Reader reader; /* reader function */ 59 | void *data; /* additional data */ 60 | lua_State *L; /* Lua state (for reader) */ 61 | }; 62 | 63 | 64 | LUAI_FUNC int luaZ_fill (ZIO *z); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/os_adapt/stdlib.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2013 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce_os_adopt_stdlib.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2012年3月3日 7 | * @brief stdlib.h文件中间的一些函数的跨平台实现 8 | * 9 | * @details ecvt_r 和 fcvt_r 函数是干嘛的,2012年以前,我也想不明白喔 10 | * 如果要搞掂浮点输出,这些方法是必须的, 11 | * 其实还有一些gcvt_r, 12 | * qfcvt_r,qecvt_r(用于long double) 13 | * 14 | * @note 15 | * 16 | */ 17 | 18 | #ifndef ZCE_OS_ADOPT_STDLIB_H_ 19 | #define ZCE_OS_ADOPT_STDLIB_H_ 20 | 21 | namespace zce 22 | { 23 | /*! 24 | * @brief ecvt的线程安全版本,用于将一个double转换成一个10进制指数方式的字符串, 25 | * @return int 0 成功 26 | * @param[in] number 输入参数,进行处理的double 27 | * @param[in] ndigits 为要求返回数字的长度,是所有数字,不是小数点后的数字,这和fcvt_r 有区别,尾数即使是0也会输出,精度是四舍五入 28 | * @param[out] decpt 返回指数, 29 | * @param[out] sign 返回符号 30 | * @param[out] buf 返回浮点数值的字符串,十进制, 31 | * @param[in] len 字符串的长度 32 | * @note 注意这个字符串是一个纯粹的数字字符串, 33 | */ 34 | int ecvt_r(double number, 35 | int ndigits, 36 | int* decpt, 37 | int* sign, 38 | char* buf, 39 | size_t len); 40 | 41 | /*! 42 | * @brief fcvt的线程安全版本,用于将一个double转换成一个10进制数字的字符串, 43 | * @return int 0 成功 44 | * @param[in] number 输入参数,进行处理的double 45 | * @param[in] ndigits 为要求返回小数个数的长度,这个和ecvt_r有区别,注意是小数,小数即使是0也会输出 46 | * @param[out] decpt 返回指数 47 | * @param[out] sign 返回符号 48 | * @param[out] buf 返回浮点数值的字符串,十进制, 49 | * @param[in] len 字符串的长度 50 | * @note 注意这个字符串是一个纯粹的数字字符串, 51 | */ 52 | int fcvt_r(double number, 53 | int ndigits, 54 | int* decpt, 55 | int* sign, 56 | char* buf, 57 | size_t len); 58 | }; 59 | 60 | #endif //ZCE_OS_ADOPT_STDLIB_H_ 61 | -------------------------------------------------------------------------------- /src/commsvr/wormholesvrd/wormhole/configture.cpp: -------------------------------------------------------------------------------- 1 | #include "predefine.h" 2 | #include "application.h" 3 | #include "configture.h" 4 | 5 | namespace wormhole 6 | { 7 | configure::configure() 8 | { 9 | } 10 | 11 | configure::~configure() 12 | { 13 | } 14 | 15 | int configure::read_cfgfile() 16 | { 17 | // 18 | int ret = 0; 19 | 20 | ret = svrd_cfg_base::read_cfgfile(); 21 | if (ret != 0) 22 | { 23 | return ret; 24 | } 25 | 26 | proxy_conf_tree_.clear(); 27 | ret = zce::cfg::read_ini(app_cfg_file_.c_str(), &proxy_conf_tree_); 28 | ZCE_LOG(RS_INFO, "[%s] read config file [%s] ret [%d].", 29 | application::instance()->get_app_basename(), 30 | app_cfg_file_.c_str(), ret); 31 | if (ret != 0) 32 | { 33 | return ret; 34 | } 35 | 36 | ret = get_log_cfg(&proxy_conf_tree_); 37 | if (ret != 0) 38 | { 39 | return ret; 40 | } 41 | 42 | ret = get_wormhole_cfg(&proxy_conf_tree_); 43 | if (ret != 0) 44 | { 45 | return ret; 46 | } 47 | 48 | return 0; 49 | } 50 | 51 | int configure::get_wormhole_cfg(const zce::propertytree* conf_tree) 52 | { 53 | int ret = 0; 54 | std::string temp_value; 55 | 56 | //最大Accept 数量 57 | ret = conf_tree->path_get_leaf("PROXY_CFG", "PROXY_TYPE", 58 | temp_value); 59 | if (0 != ret) 60 | { 61 | SOAR_CFG_READ_FAIL(RS_ERROR); 62 | return SOAR_RET::ERROR_GET_CFGFILE_CONFIG_FAIL; 63 | } 64 | 65 | proxy_type_ = proxy_interface::str_to_proxytype(temp_value.c_str()); 66 | if (proxy_type_ == proxy_interface::INVALID_PROXY_TYPE) 67 | { 68 | SOAR_CFG_READ_FAIL(RS_ERROR); 69 | return SOAR_RET::ERROR_GET_CFGFILE_CONFIG_FAIL; 70 | } 71 | 72 | return 0; 73 | } 74 | } -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/os_adapt/spin.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/os_adapt/define.h" 3 | #include "zce/os_adapt/error.h" 4 | #include "zce/os_adapt/mutex.h" 5 | #include "zce/os_adapt/spin.h" 6 | 7 | //SPIN 锁的初始化 8 | int zce::pthread_spin_init(pthread_spinlock_t* lock, 9 | int pshared) noexcept 10 | { 11 | #if defined (ZCE_OS_WINDOWS) 12 | ZCE_UNUSED_ARG(lock); 13 | if (pshared & PTHREAD_PROCESS_SHARED) 14 | { 15 | assert(false); 16 | } 17 | 18 | return 0; 19 | #elif defined (ZCE_OS_LINUX) 20 | return ::pthread_spin_init(lock, pshared); 21 | #endif 22 | } 23 | 24 | //SPIN 锁的销毁 25 | int zce::pthread_spin_destroy(pthread_spinlock_t* lock) noexcept 26 | { 27 | #if defined (ZCE_OS_WINDOWS) 28 | ZCE_UNUSED_ARG(lock); 29 | return 0; 30 | #elif defined (ZCE_OS_LINUX) 31 | return ::pthread_spin_destroy(lock); 32 | #endif 33 | } 34 | 35 | //SPIN 锁的加锁 36 | int zce::pthread_spin_lock(pthread_spinlock_t* lock)noexcept 37 | { 38 | #if defined (ZCE_OS_WINDOWS) 39 | while (lock->flag_.test_and_set()) 40 | { 41 | } 42 | return 0; 43 | #elif defined (ZCE_OS_LINUX) 44 | return ::pthread_spin_lock(lock); 45 | #endif 46 | } 47 | 48 | //SPIN 锁的尝试加锁 49 | int zce::pthread_spin_trylock(pthread_spinlock_t* lock) noexcept 50 | { 51 | #if defined (ZCE_OS_WINDOWS) 52 | if (lock->flag_.test_and_set()) 53 | { 54 | return 0; 55 | } 56 | return EBUSY; 57 | #elif defined (ZCE_OS_LINUX) 58 | return ::pthread_spin_trylock(lock); 59 | #endif 60 | } 61 | 62 | //SPIN 锁的解锁 63 | int zce::pthread_spin_unlock(pthread_spinlock_t* lock) noexcept 64 | { 65 | #if defined (ZCE_OS_WINDOWS) 66 | lock->flag_.clear(); 67 | return 0; 68 | #elif defined (ZCE_OS_LINUX) 69 | return ::pthread_spin_unlock(lock); 70 | #endif 71 | } -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/plugin_validate_password.h: -------------------------------------------------------------------------------- 1 | /* Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED 17 | #define MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED 18 | 19 | /* API for validate_password plugin. (MYSQL_VALIDATE_PASSWORD_PLUGIN) */ 20 | 21 | #include 22 | #define MYSQL_VALIDATE_PASSWORD_INTERFACE_VERSION 0x0100 23 | 24 | /* 25 | The descriptor structure for the plugin, that is referred from 26 | st_mysql_plugin. 27 | */ 28 | 29 | typedef void* mysql_string_handle; 30 | 31 | struct st_mysql_validate_password 32 | { 33 | int interface_version; 34 | /* 35 | This function retuns TRUE for passwords which satisfy the password 36 | policy (as choosen by plugin variable) and FALSE for all other 37 | password 38 | */ 39 | int (*validate_password)(mysql_string_handle password); 40 | /* 41 | This function returns the password strength (0-100) depending 42 | upon the policies 43 | */ 44 | int (*get_password_strength)(mysql_string_handle password); 45 | }; 46 | #endif 47 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/plugin_validate_password.h: -------------------------------------------------------------------------------- 1 | /* Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED 17 | #define MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED 18 | 19 | /* API for validate_password plugin. (MYSQL_VALIDATE_PASSWORD_PLUGIN) */ 20 | 21 | #include 22 | #define MYSQL_VALIDATE_PASSWORD_INTERFACE_VERSION 0x0100 23 | 24 | /* 25 | The descriptor structure for the plugin, that is referred from 26 | st_mysql_plugin. 27 | */ 28 | 29 | typedef void* mysql_string_handle; 30 | 31 | struct st_mysql_validate_password 32 | { 33 | int interface_version; 34 | /* 35 | This function retuns TRUE for passwords which satisfy the password 36 | policy (as choosen by plugin variable) and FALSE for all other 37 | password 38 | */ 39 | int (*validate_password)(mysql_string_handle password); 40 | /* 41 | This function returns the password strength (0-100) depending 42 | upon the policies 43 | */ 44 | int (*get_password_strength)(mysql_string_handle password); 45 | }; 46 | #endif 47 | -------------------------------------------------------------------------------- /third_party/include/mysql-linux-5.6.22/mysql/plugin_validate_password.h: -------------------------------------------------------------------------------- 1 | /* Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED 17 | #define MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED 18 | 19 | /* API for validate_password plugin. (MYSQL_VALIDATE_PASSWORD_PLUGIN) */ 20 | 21 | #include 22 | #define MYSQL_VALIDATE_PASSWORD_INTERFACE_VERSION 0x0100 23 | 24 | /* 25 | The descriptor structure for the plugin, that is referred from 26 | st_mysql_plugin. 27 | */ 28 | 29 | typedef void* mysql_string_handle; 30 | 31 | struct st_mysql_validate_password 32 | { 33 | int interface_version; 34 | /* 35 | This function retuns TRUE for passwords which satisfy the password 36 | policy (as choosen by plugin variable) and FALSE for all other 37 | password 38 | */ 39 | int (*validate_password)(mysql_string_handle password); 40 | /* 41 | This function returns the password strength (0-100) depending 42 | upon the policies 43 | */ 44 | int (*get_password_strength)(mysql_string_handle password); 45 | }; 46 | #endif 47 | -------------------------------------------------------------------------------- /third_party/include/mysql-win-5.6.22/mysql/plugin_validate_password.h: -------------------------------------------------------------------------------- 1 | /* Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED 17 | #define MYSQL_PLUGIN_VALIDATE_PASSWORD_INCLUDED 18 | 19 | /* API for validate_password plugin. (MYSQL_VALIDATE_PASSWORD_PLUGIN) */ 20 | 21 | #include 22 | #define MYSQL_VALIDATE_PASSWORD_INTERFACE_VERSION 0x0100 23 | 24 | /* 25 | The descriptor structure for the plugin, that is referred from 26 | st_mysql_plugin. 27 | */ 28 | 29 | typedef void* mysql_string_handle; 30 | 31 | struct st_mysql_validate_password 32 | { 33 | int interface_version; 34 | /* 35 | This function retuns TRUE for passwords which satisfy the password 36 | policy (as choosen by plugin variable) and FALSE for all other 37 | password 38 | */ 39 | int (*validate_password)(mysql_string_handle password); 40 | /* 41 | This function returns the password strength (0-100) depending 42 | upon the policies 43 | */ 44 | int (*get_password_strength)(mysql_string_handle password); 45 | }; 46 | #endif 47 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/examples/ListPeople.java: -------------------------------------------------------------------------------- 1 | // See README.txt for information and build instructions. 2 | 3 | import com.example.tutorial.AddressBookProtos.AddressBook; 4 | import com.example.tutorial.AddressBookProtos.Person; 5 | import java.io.FileInputStream; 6 | import java.io.IOException; 7 | import java.io.PrintStream; 8 | 9 | class ListPeople { 10 | // Iterates though all people in the AddressBook and prints info about them. 11 | static void Print(AddressBook addressBook) { 12 | for (Person person: addressBook.getPersonList()) { 13 | System.out.println("Person ID: " + person.getId()); 14 | System.out.println(" Name: " + person.getName()); 15 | if (person.hasEmail()) { 16 | System.out.println(" E-mail address: " + person.getEmail()); 17 | } 18 | 19 | for (Person.PhoneNumber phoneNumber : person.getPhoneList()) { 20 | switch (phoneNumber.getType()) { 21 | case MOBILE: 22 | System.out.print(" Mobile phone #: "); 23 | break; 24 | case HOME: 25 | System.out.print(" Home phone #: "); 26 | break; 27 | case WORK: 28 | System.out.print(" Work phone #: "); 29 | break; 30 | } 31 | System.out.println(phoneNumber.getNumber()); 32 | } 33 | } 34 | } 35 | 36 | // Main function: Reads the entire address book from a file and prints all 37 | // the information inside. 38 | public static void main(String[] args) throws Exception { 39 | if (args.length != 1) { 40 | System.err.println("Usage: ListPeople ADDRESS_BOOK_FILE"); 41 | System.exit(-1); 42 | } 43 | 44 | // Read the existing address book. 45 | AddressBook addressBook = 46 | AddressBook.parseFrom(new FileInputStream(args[0])); 47 | 48 | Print(addressBook); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.1.5/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define char2int(c) cast(int, cast(unsigned char, (c))) 21 | 22 | #define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) 23 | 24 | typedef struct Mbuffer { 25 | char *buffer; 26 | size_t n; 27 | size_t buffsize; 28 | } Mbuffer; 29 | 30 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 31 | 32 | #define luaZ_buffer(buff) ((buff)->buffer) 33 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 34 | #define luaZ_bufflen(buff) ((buff)->n) 35 | 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ 41 | (buff)->buffsize = size) 42 | 43 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 44 | 45 | 46 | LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 48 | void *data); 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ 50 | LUAI_FUNC int luaZ_lookahead (ZIO *z); 51 | 52 | 53 | 54 | /* --------- Private Part ------------------ */ 55 | 56 | struct Zio { 57 | size_t n; /* bytes still unread */ 58 | const char *p; /* current position in buffer */ 59 | lua_Reader reader; 60 | void* data; /* additional data */ 61 | lua_State *L; /* Lua state (for reader) */ 62 | }; 63 | 64 | 65 | LUAI_FUNC int luaZ_fill (ZIO *z); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | #include "lgc.h" 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | 14 | 15 | /* 16 | ** Memory-allocation error message must be preallocated (it cannot 17 | ** be created after memory is exhausted) 18 | */ 19 | #define MEMERRMSG "not enough memory" 20 | 21 | 22 | /* 23 | ** Size of a TString: Size of the header plus space for the string 24 | ** itself (including final '\0'). 25 | */ 26 | #define sizelstring(l) (offsetof(TString, contents) + ((l) + 1) * sizeof(char)) 27 | 28 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 29 | (sizeof(s)/sizeof(char))-1)) 30 | 31 | 32 | /* 33 | ** test whether a string is a reserved word 34 | */ 35 | #define isreserved(s) ((s)->tt == LUA_VSHRSTR && (s)->extra > 0) 36 | 37 | 38 | /* 39 | ** equality for short strings, which are always internalized 40 | */ 41 | #define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)) 42 | 43 | 44 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); 45 | LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); 46 | LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); 47 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 48 | LUAI_FUNC void luaS_clearcache (global_State *g); 49 | LUAI_FUNC void luaS_init (lua_State *L); 50 | LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); 51 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue); 52 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 53 | LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); 54 | LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); 55 | 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/net/ping.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2021 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/net/ping.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 7 | * @brief 完成IMCP里面的ping功能 8 | * @details 9 | * 10 | * 11 | * 12 | * @note 13 | * 14 | */ 15 | 16 | #pragma once 17 | 18 | #include "zce/os_adapt/socket.h" 19 | #include "zce/time/progress_timer.h" 20 | 21 | //------------------------------------------------------------------------------------- 22 | //socks 5 代理部分 23 | 24 | namespace zce 25 | { 26 | class ping 27 | { 28 | public: 29 | 30 | ping() = default; 31 | ~ping() = default; 32 | 33 | int initialize(::sockaddr *ping_addr, 34 | socklen_t addr_len); 35 | 36 | int initialize(int svr_family, 37 | const char *ping_svr); 38 | 39 | ZCE_SOCKET get_handle(); 40 | 41 | int send_echo(uint32_t ident, uint32_t seq); 42 | 43 | int recv_echo(uint32_t *ident, 44 | uint32_t *seq, 45 | uint64_t *take_msec, 46 | uint8_t *ttl, 47 | zce::time_value* timeout_tv); 48 | 49 | int ping_test(size_t test_num); 50 | 51 | //计算check sum 52 | static uint16_t checksum(char* buffer, size_t bytes); 53 | 54 | protected: 55 | //内部初始化 56 | int initialize(); 57 | 58 | protected: 59 | //PING 包的最大长度 60 | static constexpr size_t PING_PACKET_MAX_LEN = 256; 61 | //PING 头部长度 62 | static constexpr size_t DNS_HEADER_LEN = 12; 63 | 64 | protected: 65 | 66 | //! ping的地址的family 67 | int addr_family_ = 0; 68 | 69 | //!ping 服务器地址 70 | zce::sockaddr_any ping_addr_; 71 | //!本地地址 72 | zce::sockaddr_any local_addr_; 73 | 74 | socklen_t addr_len_ = 0; 75 | 76 | //!UDP socket 77 | ZCE_SOCKET ping_socket_ = ZCE_INVALID_SOCKET; 78 | }; 79 | } 80 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/os_adapt/dlfcn.cpp: -------------------------------------------------------------------------------- 1 | #include "zce/predefine.h" 2 | #include "zce/os_adapt/define.h" 3 | #include "zce/os_adapt/dlfcn.h" 4 | 5 | //---------------------------------------------------------------------------------------- 6 | //动态库使用的一部分函数封装 7 | //关闭动态库使用的函数 8 | int zce::dlclose(ZCE_SHLIB_HANDLE handle) 9 | { 10 | #if defined (ZCE_OS_WINDOWS) 11 | BOOL bret = ::FreeLibrary(handle); 12 | 13 | if (!bret) 14 | { 15 | return -1; 16 | } 17 | 18 | return 0; 19 | #endif //#if defined (ZCE_OS_WINDOWS) 20 | 21 | #if defined (ZCE_OS_LINUX) 22 | return ::dlclose(handle); 23 | #endif //#if defined (ZCE_OS_LINUX) 24 | } 25 | 26 | const char* zce::dlerror(void) 27 | { 28 | #if defined (ZCE_OS_WINDOWS) 29 | 30 | //仅仅是用于兼容 31 | const size_t ERROR_BUFFER_LEN = 256; 32 | static char error_buf[ERROR_BUFFER_LEN + 1]; 33 | error_buf[ERROR_BUFFER_LEN] = '\0'; 34 | 35 | snprintf(error_buf, ERROR_BUFFER_LEN, "error code %d", ::GetLastError()); 36 | return error_buf; 37 | 38 | #endif //#if defined (ZCE_OS_WINDOWS) 39 | 40 | #if defined (ZCE_OS_LINUX) 41 | return ::dlerror(); 42 | #endif //#if defined (ZCE_OS_LINUX) 43 | } 44 | 45 | ZCE_SHLIB_HANDLE zce::dlopen(const char* fname, 46 | int mode) 47 | { 48 | #if defined (ZCE_OS_WINDOWS) 49 | ZCE_UNUSED_ARG(mode); 50 | return ::LoadLibraryA(fname); 51 | #endif //#if defined (ZCE_OS_WINDOWS) 52 | 53 | #if defined (ZCE_OS_LINUX) 54 | return ::dlopen((fname), mode); 55 | #endif //#if defined (ZCE_OS_LINUX) 56 | } 57 | 58 | void* zce::dlsym(ZCE_SHLIB_HANDLE handle, 59 | const char* symbolname) 60 | { 61 | #if defined (ZCE_OS_WINDOWS) 62 | return ::GetProcAddress(handle, symbolname); 63 | #endif //#if defined (ZCE_OS_WINDOWS) 64 | 65 | #if defined (ZCE_OS_LINUX) 66 | return ::dlsym(handle, symbolname); 67 | #endif // 68 | } -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | Code generated by the Protocol Buffer compiler is owned by the owner 31 | of the input file used when generating it. This code is not 32 | standalone and requires a support library to be linked with it. This 33 | support library is itself covered by the above license. 34 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/logger/log_print.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "zce/logger/log_comm.h" 4 | 5 | namespace zce 6 | { 7 | //========================================================================================================== 8 | class log_printf 9 | { 10 | public: 11 | log_printf() = default; 12 | ~log_printf(); 13 | 14 | log_printf(const log_printf &) = delete; 15 | log_printf& operator=(const log_printf&) = delete; 16 | 17 | //输出va_list的参数信息 18 | void vwrite_logmsg(const char* str_format, 19 | va_list args); 20 | //写日志 21 | void write_logmsg(zce::LOG_PRIORITY outlevel, 22 | const char* str_format, ...); 23 | 24 | //!打开或者关闭文件输出 25 | void enable_fileout(bool enable_out); 26 | 27 | //打开日志输出开关 28 | void enable_output(bool enable_out); 29 | 30 | //设置日志输出Level 31 | zce::LOG_PRIORITY set_log_priority(zce::LOG_PRIORITY outlevel); 32 | 33 | //! 34 | static log_printf* instance(); 35 | //! 36 | void clear_inst(); 37 | 38 | protected: 39 | //!实例指针 40 | static log_printf* instance_; 41 | 42 | protected: 43 | //!打印输出的日志 44 | FILE * print_fp_ = nullptr; 45 | 46 | //!输出日志信息的Mask值,小于这个信息的信息不予以输出 47 | zce::LOG_PRIORITY permit_outlevel_ = RS_DEBUG; 48 | 49 | //!是否输出日志信息,可以用于暂时屏蔽 50 | bool is_output_log_ = true; 51 | }; 52 | } 53 | 54 | #define ZPRINT_ENABLE zce::log_printf::instance()->enable_output(true) 55 | #define ZPRINT_DISABLE zce::log_printf::instance()->enable_output(false) 56 | #define ZPRINT_ENABLE_FILEOUT zce::log_printf::instance()->enable_fileout(true) 57 | #define ZPRINT_DISABLE_FILEOUT zce::log_printf::instance()->enable_fileout(false) 58 | #define ZPRINT_SET_OUTLEVEL zce::log_printf::instance()->set_log_priority 59 | #define ZPRINT zce::log_printf::instance()->write_logmsg -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/thread/thread_wait_mgr.h: -------------------------------------------------------------------------------- 1 | #ifndef ZCE_LIB_THREAD_WAIT_MANAGER_H_ 2 | #define ZCE_LIB_THREAD_WAIT_MANAGER_H_ 3 | 4 | #include "zce/util/non_copyable.h" 5 | 6 | namespace zce 7 | { 8 | /*! 9 | * @brief 线程的等待管理器 10 | * 11 | * @note 本来是在线程ZCE_Thread_Base 内部处理的,但是嵌入过多,而且用大量的static 变量, 12 | * 也影响ZCE_Thread_Base的性能 13 | */ 14 | class thread_wait_manager : public zce::non_copyable 15 | { 16 | protected: 17 | 18 | //记录需要等待的线程信息,通过开关使用 19 | struct MANAGE_WAIT_INFO 20 | { 21 | public: 22 | 23 | MANAGE_WAIT_INFO(ZCE_THREAD_ID wait_thr_id, int wait_group_id) : 24 | wait_thr_id_(wait_thr_id), 25 | wait_group_id_(wait_group_id) 26 | { 27 | } 28 | ~MANAGE_WAIT_INFO() 29 | { 30 | } 31 | public: 32 | //线程的ID 33 | ZCE_THREAD_ID wait_thr_id_; 34 | //分组ID 35 | int wait_group_id_; 36 | }; 37 | 38 | protected: 39 | //用list管理,性能不是特别好,但考虑到要中间删除因素等等,忍了 40 | typedef std::list MANAGE_WAIT_THREAD_LIST; 41 | 42 | //单子实例 43 | static thread_wait_manager* instance_; 44 | 45 | protected: 46 | 47 | //所有希望等待的线程记录 48 | MANAGE_WAIT_THREAD_LIST wait_thread_list_; 49 | 50 | public: 51 | //构造函数,允许你拥有实例,但推荐你用单件处理 52 | thread_wait_manager(); 53 | ~thread_wait_manager(); 54 | 55 | //如果需要管理处理,要自己登记, 56 | void record_wait_thread(ZCE_THREAD_ID wait_thr_id, int wait_group_id = 0); 57 | //登记一个要进行等待处理等待线程 58 | void record_wait_thread(const zce::thread_task* wait_thr_task); 59 | 60 | //等所有的线程退出 61 | void wait_all(); 62 | 63 | // 64 | void wait_group(int group_id); 65 | 66 | public: 67 | 68 | //单子函数 69 | static thread_wait_manager* instance(); 70 | //清理单子的函数 71 | static void clear_inst(); 72 | }; 73 | } 74 | #endif //#ifndef ZCE_LIB_THREAD_WAIT_MANAGER_H_ 75 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/lock/process_semaphore.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2013 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/lock/process_semaphore.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2013年1月15日 7 | * @brief 进程间同步用的信号灯, 8 | * 9 | */ 10 | #pragma once 11 | 12 | #include "zce/lock/lock_base.h" 13 | #include "zce/lock/lock_guard.h" 14 | 15 | namespace zce 16 | { 17 | /*! 18 | * @brief 进程的信号灯类 19 | * LINUX下用有名信号灯, 20 | * WINDOWS下用带名称的信号灯, 21 | */ 22 | class process_semaphore : public zce::semaphore_base 23 | { 24 | public: 25 | 26 | ///线程锁的GUARD 27 | typedef zce::semaphore_guard LOCK_GUARD; 28 | 29 | public: 30 | 31 | /*! 32 | * @brief 构造函数,默认创建匿名信号灯, 33 | * @param init_value 信号灯初始化的值 34 | * @param sem_name 信号灯的名称 35 | */ 36 | process_semaphore(unsigned int init_value, 37 | const char* sem_name); 38 | virtual ~process_semaphore(void); 39 | 40 | ///锁定 41 | void acquire() noexcept override; 42 | 43 | ///尝试锁定 44 | bool try_acquire() noexcept override; 45 | 46 | //解锁, 47 | void release() noexcept override; 48 | 49 | /*! 50 | * @brief 绝对时间超时的的锁定,超时后解锁 51 | * @return bool true获得了锁,false,无法获得锁 52 | * @param abs_time 超时的绝对时间 53 | */ 54 | bool try_acquire_until( 55 | const zce::time_value& abs_time) noexcept override; 56 | 57 | /*! 58 | * @brief 相对时间的超时锁定,超时后,解锁 59 | * @return bool true获得了锁,false,无法获得锁 60 | * @param relative_time 超时的绝对时间 61 | */ 62 | bool try_acquire_for( 63 | const zce::time_value& relative_time) noexcept override; 64 | 65 | protected: 66 | 67 | ///信号灯对象 68 | sem_t* lock_; 69 | 70 | ///信号灯的名称,不得不记录下来,或者是共享内存的文件名称 71 | char sema_name_[PATH_MAX + 1]; 72 | }; 73 | } 74 | -------------------------------------------------------------------------------- /third_party/include/protobuf-2.6.1/gtest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "production.h" 35 | 36 | PrivateCode::PrivateCode() : x_(0) {} 37 | -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/lock/file_lock.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright 2004-2013 Apache License, Version 2.0 FULLSAIL 3 | * @filename zce/lock/file_lock.h 4 | * @author Sailzeng 5 | * @version 6 | * @date 2013年1月14日 7 | * @brief 文件锁,用于整个锁定文件,但实现其实是用记录锁实现的。 8 | * 因为Windows 没有真正意义上的文件锁 9 | * 记录锁清参考@ref zce/lock/record_lock.h 10 | * 11 | * @details 12 | * 13 | * @note 14 | * 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "zce/util/non_copyable.h" 20 | #include "zce/lock/lock_guard.h" 21 | 22 | namespace zce 23 | { 24 | /*! 25 | * @brief 文件锁,对于整个文件进行操作 26 | */ 27 | class file_lock 28 | { 29 | public: 30 | 31 | ///读锁的GUARD 32 | typedef shared_guard LOCK_SHARED_GUARD; 33 | ///写锁的GUARD 34 | typedef unique_guard LOCK_UNIQUE_GUARD; 35 | 36 | public: 37 | 38 | //构造函数 39 | file_lock(); 40 | ~file_lock(); 41 | 42 | file_lock(const file_lock&) = delete; 43 | file_lock& operator=(const file_lock &) = delete; 44 | 45 | public: 46 | 47 | //通过文件名称参数初始化文件锁,会打开这个文件 48 | int open(const char* file_name, 49 | int open_mode, 50 | mode_t perms = ZCE_DEFAULT_FILE_PERMS); 51 | 52 | //通过文件句柄初始化文件锁 53 | int open(ZCE_HANDLE file_handle); 54 | 55 | //关闭文件锁,如果是我打开的文件,我关闭, 56 | int close(); 57 | 58 | //得到锁文件的句柄 59 | ZCE_HANDLE get_file_handle(); 60 | 61 | //注意这儿的读写锁标识读写锁方式,而不是读写操作 62 | 63 | //读取锁 64 | void lock_read(); 65 | //尝试读取锁 66 | bool try_lock_read(); 67 | 68 | //写锁定 69 | void lock_write(); 70 | //尝试读取锁 71 | bool try_lock_write(); 72 | 73 | //解锁,如果是读写锁也只需要这一个函数 74 | void unlock(); 75 | 76 | protected: 77 | 78 | ///自己打开的这个文件,也就是调用过open函数 79 | bool open_by_self_ = false; 80 | 81 | /// 82 | size_t file_len_ = 0; 83 | 84 | ///文件锁句柄 85 | zce::file_lock_t file_lock_; 86 | }; 87 | } -------------------------------------------------------------------------------- /src/commlib/zcelib/zce/os_adapt/getopt.h: -------------------------------------------------------------------------------- 1 | #ifndef ZCE_LIB_OS_ADAPT_GET_OPT_H_ 2 | #define ZCE_LIB_OS_ADAPT_GET_OPT_H_ 3 | 4 | #include "zce/os_adapt/define.h" 5 | 6 | //这一段不放在zce/os_adapt/define.h里面的原因是因为有的代码也实现了这个函数,和这些全局变量 7 | //所以会引发冲突,所以除非明确你使用这些函数,否则不暴漏他们 8 | #if defined (ZCE_OS_WINDOWS) 9 | 10 | //getopt_long函数使用的选项 11 | struct option 12 | { 13 | // 14 | const char* name; 15 | // 16 | int has_arg; 17 | // 18 | int* flag; 19 | // 20 | int val; 21 | }; 22 | 23 | /* if error message should be printed */ 24 | extern int opterr; 25 | /* index into parent argv vector */ 26 | extern int optind; 27 | /* character checked for validity */ 28 | extern int optopt; 29 | /* argument associated with option */ 30 | extern const char* optarg; 31 | /* reset getopt */ 32 | extern int optreset; 33 | 34 | #define no_argument 0 35 | #define required_argument 1 36 | #define optional_argument 2 37 | 38 | #endif // #if defined (ZCE_OS_WINDOWS) 39 | 40 | namespace zce 41 | { 42 | //optstring string说明 43 | //1.单个字符,表示选项, 44 | //2.单个字符后接一个冒号:,表示该选项后必须跟一个参数。参数紧跟在选项后或者以空格隔开。该参数的指针赋给optarg。 45 | //3 单个字符后跟两个冒号::,表示该选项后必须跟一个参数。参数必须紧跟在选项后不能以空格隔开。该参数的指针赋给optarg。 46 | 47 | //还要注意的是默认情况下getopt会重新排列命令行参数的顺序,所以到最后所有不包含选项的命令行参数都排到最后。 48 | 49 | // 50 | int getopt(int argc, 51 | char* const* argv, 52 | const char* optstring); 53 | 54 | // 55 | int getopt_long(int argc, 56 | char* const* argv, 57 | const char* optstring, 58 | const struct option* longopts, 59 | int* longindex); 60 | 61 | // 62 | int getopt_long_only(int argc, 63 | char* const* argv, 64 | const char* optstring, 65 | const struct option* longopts, 66 | int* longindex); 67 | }; // end of namespace zce 68 | 69 | #endif //ZCE_LIB_OS_ADAPT_GET_OPT_H_ 70 | -------------------------------------------------------------------------------- /third_party/include/lualib-5.4.3/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c $ 3 | ** Initialization of libraries for lua.c and other clients 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | /* 12 | ** If you embed Lua in your program and need to open the standard 13 | ** libraries, call luaL_openlibs in your program. If you need a 14 | ** different set of libraries, copy this file to your project and edit 15 | ** it to suit your needs. 16 | ** 17 | ** You can also *preload* libraries, so that a later 'require' can 18 | ** open the library, which is already linked to the application. 19 | ** For that, do the following code: 20 | ** 21 | ** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); 22 | ** lua_pushcfunction(L, luaopen_modname); 23 | ** lua_setfield(L, -2, modname); 24 | ** lua_pop(L, 1); // remove PRELOAD table 25 | */ 26 | 27 | #include "lprefix.h" 28 | 29 | 30 | #include 31 | 32 | #include "lua.h" 33 | 34 | #include "lualib.h" 35 | #include "lauxlib.h" 36 | 37 | 38 | /* 39 | ** these libs are loaded by lua.c and are readily available to any Lua 40 | ** program 41 | */ 42 | static const luaL_Reg loadedlibs[] = { 43 | {LUA_GNAME, luaopen_base}, 44 | {LUA_LOADLIBNAME, luaopen_package}, 45 | {LUA_COLIBNAME, luaopen_coroutine}, 46 | {LUA_TABLIBNAME, luaopen_table}, 47 | {LUA_IOLIBNAME, luaopen_io}, 48 | {LUA_OSLIBNAME, luaopen_os}, 49 | {LUA_STRLIBNAME, luaopen_string}, 50 | {LUA_MATHLIBNAME, luaopen_math}, 51 | {LUA_UTF8LIBNAME, luaopen_utf8}, 52 | {LUA_DBLIBNAME, luaopen_debug}, 53 | {NULL, NULL} 54 | }; 55 | 56 | 57 | LUALIB_API void luaL_openlibs (lua_State *L) { 58 | const luaL_Reg *lib; 59 | /* "require" functions from 'loadedlibs' and set results to global table */ 60 | for (lib = loadedlibs; lib->func; lib++) { 61 | luaL_requiref(L, lib->name, lib->func, 1); 62 | lua_pop(L, 1); /* remove lib */ 63 | } 64 | } 65 | 66 | --------------------------------------------------------------------------------