├── .clang-format ├── .clang-format-ignore ├── .clang-tidy ├── .dockerignore ├── .gitattributes ├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ └── bug_report.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── build-macos.sh │ ├── build-ubuntu.sh │ ├── build.yml │ └── ci.yml ├── .gitignore ├── .gitmodules ├── 3rdparty ├── CMakeLists.txt ├── README.md └── json │ └── json.hpp ├── CMakeLists.txt ├── Dockerfile ├── LICENSE ├── README.md ├── README_CN.md ├── VERSION ├── build ├── README.md ├── binlog │ └── .gitignore ├── conf │ ├── bus.plugin.conf │ ├── consul.plugin.conf │ ├── db.app.conf │ ├── dir.app.conf │ ├── freebird.app.conf │ ├── game.app.conf │ ├── http.plugin.conf │ ├── http_client_sample.app.conf │ ├── kernel.plugin.conf │ ├── log.conf │ ├── login.app.conf │ ├── master.app.conf │ ├── mysql.plugin.conf │ ├── mysql_sample.app.conf │ ├── oss.app.conf │ ├── physic.app.conf │ ├── proxy.app.conf │ ├── realm.example.app.conf │ ├── realm.example.plugin.conf │ ├── realm.game.app.conf │ ├── realm.master.app.conf │ ├── realm.plugin.conf │ ├── redis.plugin.conf │ ├── redis_sample.app.conf │ ├── remote_log.app.conf │ ├── router.app.conf │ ├── sample1.app.conf │ ├── sample2.app.conf │ ├── sample3.app.conf │ ├── sample4.app.conf │ ├── sample5.app.conf │ ├── simulate.app.conf │ ├── terraria.game.app.conf │ ├── terraria.game.plugin.conf │ └── world.app.conf ├── kill.bat ├── kill.sh ├── mysql_sample.sh ├── resource │ ├── README.md │ ├── client │ │ └── .gitignore │ ├── code │ │ └── .gitignore │ ├── excel │ │ ├── attribute.xlsx │ │ ├── entity_class.xlsx │ │ ├── item.xlsx │ │ ├── language.xlsx │ │ └── map.xlsx │ ├── meta │ │ └── .gitignore │ ├── mysql │ │ ├── ARK.sql │ │ └── ARKClass.sql │ ├── photon │ │ ├── build.sh │ │ ├── common.xml │ │ ├── photon.xml │ │ ├── proto │ │ │ ├── createTable.sql │ │ │ ├── createTable_single.sql │ │ │ └── protocol.proto │ │ ├── protocol.xml │ │ └── xml-parse │ │ │ ├── xml-parse-darwin │ │ │ └── xml-parse-linux │ ├── physic │ │ ├── PhysicConfig.xml │ │ └── scene │ │ │ └── town │ │ │ └── Collider.xml │ ├── script │ │ ├── README.md │ │ ├── ReadMe.txt │ │ ├── TestModule.lua │ │ ├── TestModule2.lua │ │ ├── script_init.lua │ │ ├── script_list.lua │ │ ├── script_module.lua │ │ └── script_reload.lua │ └── server │ │ ├── .gitignore │ │ ├── common │ │ ├── AwardPackConfig.xml │ │ ├── EqupConfig.xml │ │ ├── GuildConfig.xml │ │ └── PlayerLevelConfig.xml │ │ ├── map │ │ ├── 1.xml │ │ ├── 2.xml │ │ ├── 3.xml │ │ ├── 4.xml │ │ ├── 5.xml │ │ └── 6.xml │ │ └── npc │ │ └── README.md ├── run.bat ├── run.sh ├── rund.bat ├── rund.sh ├── sample1.sh ├── sample5http_test.sh ├── tools │ ├── README.md │ ├── config_tool │ │ ├── README.md │ │ ├── config_excel.py │ │ ├── config_param.py │ │ ├── config_tool.py │ │ └── config_xml.py │ ├── gcm │ │ └── conf │ │ │ ├── app.xml │ │ │ ├── bus_relation.xml │ │ │ ├── conf.ini │ │ │ └── host.xml │ ├── gen-config.bat │ ├── gen-config.sh │ ├── gen-plugin-and-module.bat │ └── plugin_and_module_tool │ │ ├── pack.sh │ │ ├── plugin_and_module_param.py │ │ ├── plugin_and_module_tool │ │ └── plugin_and_module_tool.py └── vc_clear.bat ├── cmake ├── FindGcov.cmake ├── FindLZ4.cmake ├── FindLcov.cmake ├── FindZstd.cmake ├── Findcodecov.cmake ├── Findlibrdkafka.cmake ├── llvm-cov-wrapper.txt └── utils.cmake ├── docker ├── ark-alpine-build └── ark-alpine-runtime ├── examples ├── CMakeLists.txt ├── http_client │ ├── CMakeLists.txt │ ├── HttpClientSampleModule.cpp │ ├── HttpClientSampleModule.h │ ├── HttpClientSamplePlugin.cpp │ └── HttpClientSamplePlugin.h ├── kcptool │ ├── AFPhotonSS_pb2.py │ ├── CMakeLists.txt │ ├── demo.py │ ├── gen_proto.sh │ └── tool.cpp ├── mysql_sample │ ├── CMakeLists.txt │ ├── MysqlSampleModule.cpp │ ├── MysqlSampleModule.h │ ├── MysqlSamplePlugin.cpp │ └── MysqlSamplePlugin.h ├── redis_sample │ ├── CMakeLists.txt │ ├── RedisSampleModule.cpp │ ├── RedisSampleModule.h │ ├── RedisSamplePlugin.cpp │ └── RedisSamplePlugin.h ├── sample1 │ ├── CMakeLists.txt │ ├── Sample1Module.cpp │ ├── Sample1Module.h │ ├── Sample1Plugin.cpp │ └── Sample1Plugin.h ├── sample2 │ ├── CMakeLists.txt │ ├── Sample2Module.cpp │ ├── Sample2Module.h │ ├── Sample2Plugin.cpp │ └── Sample2Plugin.h ├── sample3 │ ├── CMakeLists.txt │ ├── Sample3Module.cpp │ ├── Sample3Module.h │ ├── Sample3Plugin.cpp │ └── Sample3Plugin.h ├── sample4 │ ├── CMakeLists.txt │ ├── Sample4Module.cpp │ ├── Sample4Module.h │ ├── Sample4Plugin.cpp │ └── Sample4Plugin.h └── sample5 │ ├── CMakeLists.txt │ ├── Sample5Module.cpp │ ├── Sample5Module.h │ ├── Sample5Plugin.cpp │ └── Sample5Plugin.h ├── kubernetes ├── ark_consul.yaml ├── photon_config.yaml ├── photon_game_deployment.yaml └── photon_master_deployment.yaml ├── scripts ├── clang_tidy.sh ├── format.sh └── travis_compiler.sh ├── sonar-project.properties ├── src ├── app │ ├── AFMain.cpp │ └── CMakeLists.txt ├── base │ ├── AFApp.hpp │ ├── AFArrayPod.hpp │ ├── AFBuffer.hpp │ ├── AFBus.hpp │ ├── AFClientConnect.hpp │ ├── AFCoreDef.hpp │ ├── AFCron.hpp │ ├── AFDefine.hpp │ ├── AFDep.hpp │ ├── AFDynLib.hpp │ ├── AFEnum.hpp │ ├── AFError.hpp │ ├── AFErrorCode.hpp │ ├── AFEventDefine.hpp │ ├── AFGUID128.hpp │ ├── AFLogger.hpp │ ├── AFMacros.hpp │ ├── AFMetaDefine.hpp │ ├── AFMisc.hpp │ ├── AFNoncopyable.hpp │ ├── AFPlatform.hpp │ ├── AFPluginManager.hpp │ ├── AFSocketFunc.hpp │ ├── AFString.hpp │ ├── AFStringPod.hpp │ ├── AFStringUtils.hpp │ ├── AFUidGenerator.hpp │ ├── AFXml.hpp │ ├── compress │ │ ├── AFLZ4.hpp │ │ ├── AFZStd.hpp │ │ └── AFZlib.hpp │ ├── container │ │ ├── AFArrayMap.hpp │ │ ├── AFBitValue.hpp │ │ ├── AFCConsistentHash.hpp │ │ ├── AFList.hpp │ │ ├── AFLockFreeQueue.hpp │ │ ├── AFLruMap.hpp │ │ ├── AFMap.hpp │ │ ├── AFQueue.hpp │ │ ├── AFThreadSafeQueue.hpp │ │ └── AFVector.hpp │ ├── crypto │ │ └── AFXXTea.hpp │ ├── hash │ │ ├── AFBase64.hpp │ │ ├── AFCRC.hpp │ │ └── AFMurmurHash.hpp │ ├── lexical_cast.hpp │ ├── lock │ │ ├── AFRWLock.hpp │ │ └── AFSpinLock.hpp │ ├── math │ │ └── AFVector3D.hpp │ ├── pattern │ │ └── AFSingleton.hpp │ ├── random │ │ ├── AFRandom.hpp │ │ └── AFRandomXoshiro.hpp │ ├── spdlog │ │ └── sinks │ │ │ ├── README.md │ │ │ ├── date_and_hour_file_sink.h │ │ │ ├── rotating_file_with_date_sink-inl.h │ │ │ └── rotating_file_with_date_sink.h │ └── time │ │ ├── AFDateTime.hpp │ │ └── AFTimer.hpp ├── interface │ ├── AFIModule.hpp │ └── AFIPlugin.hpp ├── plugin │ ├── CMakeLists.txt │ ├── README.md │ ├── bus │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFBusPlugin.hpp │ │ │ ├── AFCBusModule.hpp │ │ │ └── AFCMsgModule.hpp │ │ ├── interface │ │ │ ├── AFIBusModule.hpp │ │ │ └── AFIMsgModule.hpp │ │ └── src │ │ │ ├── AFBusPlugin.cpp │ │ │ ├── AFCBusModule.cpp │ │ │ └── AFCMsgModule.cpp │ ├── consul │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCConsulModule.hpp │ │ │ └── AFConsulPlugin.hpp │ │ ├── interface │ │ │ └── AFIConsulModule.hpp │ │ └── src │ │ │ ├── AFCConsulModule.cpp │ │ │ └── AFConsulPlugin.cpp │ ├── etcd_client │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCEtcdClient.hpp │ │ │ ├── AFCEtcdClientModule.hpp │ │ │ └── AFEtcdClientPlugin.hpp │ │ ├── interface │ │ │ ├── AFIEtcdClient.hpp │ │ │ └── AFIEtcdClientModule.hpp │ │ └── src │ │ │ ├── AFCEtcdClient.cpp │ │ │ ├── AFCEtcdClientModule.cpp │ │ │ └── AFEtcdClientPlugin.cpp │ ├── http │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCHttpServerModule.hpp │ │ │ └── AFHttpPlugin.hpp │ │ ├── interface │ │ │ └── AFIHttpServerModule.hpp │ │ └── src │ │ │ ├── AFCHttpServerModule.cpp │ │ │ └── AFHttpPlugin.cpp │ ├── kafka │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCKafkaModule.hpp │ │ │ ├── AFKafka.hpp │ │ │ └── AFKafkaPlugin.hpp │ │ ├── interface │ │ │ └── AFIKafkaModule.hpp │ │ └── src │ │ │ ├── AFCKafkaModule.cpp │ │ │ └── AFKafkaPlugin.cpp │ ├── kernel │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCClassMetaModule.hpp │ │ │ ├── AFCConfigModule.hpp │ │ │ ├── AFCContainer.hpp │ │ │ ├── AFCContainerManager.hpp │ │ │ ├── AFCData.hpp │ │ │ ├── AFCDataList.hpp │ │ │ ├── AFCEntity.hpp │ │ │ ├── AFCEventManager.hpp │ │ │ ├── AFCKernelModule.hpp │ │ │ ├── AFCMapModule.hpp │ │ │ ├── AFCNode.hpp │ │ │ ├── AFCRow.hpp │ │ │ ├── AFCStaticEntity.hpp │ │ │ ├── AFCTable.hpp │ │ │ ├── AFClassCallBackManager.hpp │ │ │ ├── AFClassMeta.hpp │ │ │ ├── AFClassMetaManager.hpp │ │ │ ├── AFContainerMeta.hpp │ │ │ ├── AFKernelPlugin.hpp │ │ │ ├── AFNodeManager.hpp │ │ │ ├── AFNodeMeta.hpp │ │ │ ├── AFStaticEntityManager.hpp │ │ │ ├── AFTableManager.hpp │ │ │ └── AFTableMeta.hpp │ │ ├── interface │ │ │ ├── AFIClassMetaModule.hpp │ │ │ ├── AFIComponent.hpp │ │ │ ├── AFIConfigModule.hpp │ │ │ ├── AFIContainer.hpp │ │ │ ├── AFIContainerManager.hpp │ │ │ ├── AFIData.hpp │ │ │ ├── AFIDataList.hpp │ │ │ ├── AFIEntity.hpp │ │ │ ├── AFIEventManager.hpp │ │ │ ├── AFIKernelModule.hpp │ │ │ ├── AFIMapModule.hpp │ │ │ ├── AFINode.hpp │ │ │ ├── AFIStaticEntity.hpp │ │ │ └── AFITable.hpp │ │ └── src │ │ │ ├── AFCClassMetaModule.cpp │ │ │ ├── AFCConfigModule.cpp │ │ │ ├── AFCContainer.cpp │ │ │ ├── AFCContainerManager.cpp │ │ │ ├── AFCEntity.cpp │ │ │ ├── AFCKernelModule.cpp │ │ │ ├── AFCMapModule.cpp │ │ │ ├── AFCRow.cpp │ │ │ ├── AFCStaticEntity.cpp │ │ │ ├── AFCTable.cpp │ │ │ ├── AFClassCallBackManager.cpp │ │ │ ├── AFClassMeta.cpp │ │ │ ├── AFKernelPlugin.cpp │ │ │ ├── AFNodeManager.cpp │ │ │ └── AFTableMeta.cpp │ ├── mysql │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCMysqlDriverManagerModule.hpp │ │ │ ├── AFCMysqlDriverModule.hpp │ │ │ ├── AFCMysqlModule.hpp │ │ │ └── AFMysqlPlugin.hpp │ │ ├── interface │ │ │ ├── AFIMysqlDriverManagerModule.hpp │ │ │ ├── AFIMysqlDriverModule.hpp │ │ │ └── AFIMysqlModule.hpp │ │ └── src │ │ │ ├── AFCMysqlDriverManagerModule.cpp │ │ │ ├── AFCMysqlDriverModule.cpp │ │ │ ├── AFCMysqlModule.cpp │ │ │ └── AFMysqlPlugin.cpp │ ├── net │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCHttpClientModule.hpp │ │ │ ├── AFCHttpServer.hpp │ │ │ ├── AFCNetClientService.hpp │ │ │ ├── AFCNetServerService.hpp │ │ │ ├── AFCNetServiceManagerModule.hpp │ │ │ ├── AFCRDPClient.hpp │ │ │ ├── AFCRDPServer.hpp │ │ │ ├── AFCTCPClient.hpp │ │ │ ├── AFCTCPServer.hpp │ │ │ ├── AFCWebSocketClient.hpp │ │ │ ├── AFCWebSocketServer.hpp │ │ │ ├── AFNetDefine.hpp │ │ │ ├── AFNetEvent.hpp │ │ │ ├── AFNetMsg.hpp │ │ │ ├── AFNetPlugin.hpp │ │ │ └── AFNetSession.hpp │ │ ├── interface │ │ │ ├── AFIHttpClientModule.hpp │ │ │ ├── AFINet.hpp │ │ │ ├── AFINetClientService.hpp │ │ │ ├── AFINetServerService.hpp │ │ │ └── AFINetServiceManagerModule.hpp │ │ └── src │ │ │ ├── AFCHttpClientModule.cpp │ │ │ ├── AFCHttpServer.cpp │ │ │ ├── AFCNetClientService.cpp │ │ │ ├── AFCNetServerService.cpp │ │ │ ├── AFCNetServiceManagerModule.cpp │ │ │ ├── AFCRDPClient.cpp │ │ │ ├── AFCRDPServer.cpp │ │ │ ├── AFCTCPClient.cpp │ │ │ ├── AFCTCPServer.cpp │ │ │ ├── AFCWebSocketClient.cpp │ │ │ ├── AFCWebSocketServer.cpp │ │ │ └── AFNetPlugin.cpp │ ├── osssdk │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCOssSDKModule.hpp │ │ │ └── AFOssSDKPlugin.hpp │ │ ├── interface │ │ │ └── AFIOssSDKModule.hpp │ │ └── src │ │ │ ├── AFCOssSDKModule.cpp │ │ │ └── AFOssSDKPlugin.cpp │ ├── physic │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCPhysicConfigModule.hpp │ │ │ ├── AFCPhysicModule.hpp │ │ │ ├── AFPhysicDefine.hpp │ │ │ ├── AFPhysicPlugin.hpp │ │ │ ├── AFWaveFront.cpp │ │ │ └── AFWaveFront.hpp │ │ ├── interface │ │ │ ├── AFIPhysicConfigModule.hpp │ │ │ └── AFIPhysicModule.hpp │ │ └── src │ │ │ ├── AFCPhysicConfigModule.cpp │ │ │ ├── AFCPhysicModule.cpp │ │ │ └── AFPhysicPlugin.cpp │ ├── redis │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ ├── AFCRedisModule.hpp │ │ │ ├── AFRedisManager.hpp │ │ │ └── AFRedisPlugin.hpp │ │ ├── interface │ │ │ └── AFIRedisModule.hpp │ │ └── src │ │ │ ├── AFCRedisModule.cpp │ │ │ └── AFRedisPlugin.cpp │ └── utility │ │ ├── CMakeLists.txt │ │ ├── include │ │ ├── AFCCompressModule.hpp │ │ ├── AFCGUIDModule.hpp │ │ ├── AFCScheduleModule.hpp │ │ ├── AFCTimerModule.hpp │ │ ├── AFScheduler.hpp │ │ ├── AFUtilityPlugin.hpp │ │ ├── ctpl.h │ │ └── ctpl_stl.h │ │ ├── interface │ │ ├── AFICompressModule.hpp │ │ ├── AFIGUIDModule.hpp │ │ ├── AFIScheduleModule.hpp │ │ └── AFITimerModule.hpp │ │ └── src │ │ ├── AFCCompressModule.cpp │ │ ├── AFCGUIDModule.cpp │ │ ├── AFCScheduleModule.cpp │ │ ├── AFCTimerModule.cpp │ │ └── AFUtilityPlugin.cpp ├── proto │ ├── AFProtoCPP.hpp │ ├── CMakeLists.txt │ ├── avro │ │ └── AFEscortOSS.avro │ ├── codec │ │ ├── AFCodecProto.cpp │ │ ├── AFCodecProto.hpp │ │ └── AFICodec.hpp │ ├── cpp │ │ └── .gitignore │ ├── cs │ │ └── .gitignore │ ├── js │ │ └── .gitignore │ └── proto │ │ ├── AFCSMsg.proto │ │ ├── AFCommonCSMsg.proto │ │ ├── AFCommonMsg.proto │ │ ├── AFCommonMsgNew.proto │ │ ├── AFCommonSSMsg.proto │ │ ├── AFConsul.proto │ │ ├── AFDBMsg.proto │ │ ├── AFErrorCode.proto │ │ ├── AFEventCode.proto │ │ ├── AFMsgMysql.proto │ │ ├── AFMsgURl.proto │ │ ├── AFOss.proto │ │ └── AFSSMsg.proto └── server │ ├── CMakeLists.txt │ ├── db │ └── .gitignore │ ├── dir │ ├── CMakeLists.txt │ ├── include │ │ ├── AFCDirNetModule.hpp │ │ └── AFDirPlugin.hpp │ ├── interface │ │ └── AFIDirNetModule.hpp │ └── src │ │ ├── AFCDirNetModule.cpp │ │ └── AFDirPlugin.cpp │ ├── game │ ├── CMakeLists.txt │ ├── include │ │ ├── AFCGameNetModule.hpp │ │ └── AFGamePlugin.hpp │ ├── interface │ │ └── AFIGameNetModule.hpp │ └── src │ │ ├── AFCGameNetModule.cpp │ │ └── AFGamePlugin.cpp │ ├── login │ ├── CMakeLists.txt │ ├── include │ │ ├── AFCLoginNetModule.hpp │ │ └── AFLoginPlugin.hpp │ ├── interface │ │ └── AFILoginNetModule.hpp │ └── src │ │ ├── AFCLoginNetModule.cpp │ │ └── AFLoginPlugin.cpp │ ├── master │ ├── CMakeLists.txt │ ├── include │ │ ├── AFCMasterNetModule.hpp │ │ └── AFMasterPlugin.hpp │ ├── interface │ │ └── AFIMasterNetModule.hpp │ └── src │ │ ├── AFCMasterNetModule.cpp │ │ └── AFMasterPlugin.cpp │ ├── oss │ └── .gitignore │ ├── proxy │ ├── CMakeLists.txt │ ├── include │ │ ├── AFCProxyNetModule.hpp │ │ └── AFProxyPlugin.hpp │ ├── interface │ │ └── AFIProxyNetModule.hpp │ └── src │ │ ├── AFCProxyNetModule.cpp │ │ └── AFProxyPlugin.cpp │ ├── router │ ├── CMakeLists.txt │ ├── include │ │ ├── AFCRouterNetModule.hpp │ │ └── AFRouterPlugin.hpp │ ├── interface │ │ └── AFIRouterNetModule.hpp │ └── src │ │ ├── AFCRouterNetModule.cpp │ │ └── AFRouterPlugin.cpp │ ├── simulate │ ├── CMakeLists.txt │ ├── include │ │ ├── AFCSimulateModule.hpp │ │ ├── AFCSimulateNetModule.hpp │ │ ├── AFSimulateDefine.hpp │ │ ├── AFSimulateMsgDefine.hpp │ │ └── AFSimulatePlugin.hpp │ ├── interface │ │ ├── AFISimulateModule.hpp │ │ └── AFISimulateNetModule.hpp │ └── src │ │ ├── AFCSimulateModule.cpp │ │ ├── AFCSimulateNetModule.cpp │ │ └── AFSimulatePlugin.cpp │ └── world │ ├── CMakeLists.txt │ ├── include │ ├── AFCWorldNetModule.hpp │ └── AFWorldPlugin.hpp │ ├── interface │ └── AFIWorldNetModule.hpp │ └── src │ ├── AFCWorldNetModule.cpp │ └── AFWorldPlugin.cpp └── test ├── .gitignore ├── CMakeLists.txt ├── catch.hpp ├── test_base64.cpp ├── test_datetime.cpp ├── test_hex.cpp ├── test_lz4.cpp ├── test_random.cpp ├── test_singleton.cpp ├── test_xxtea.cpp ├── test_zlib.cpp └── test_zstd.cpp /.clang-format-ignore: -------------------------------------------------------------------------------- 1 | # ignore some code from clang-format checks 2 | 3 | src/base/AFMetaDefine.hpp 4 | src/proto/.* 5 | 3rdparty/.* -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: 'modernize-*,modernize-use-override,google-*,-google-runtime-references,misc-*,clang-analyzer-*' 2 | WarningsAsErrors: '' 3 | HeaderFilterRegex: 'async.h|async_logger.h|common.h|details|formatter.h|logger.h|sinks|spdlog.h|tweakme.h|version.h' 4 | AnalyzeTemporaryDtors: false 5 | FormatStyle: none 6 | 7 | CheckOptions: 8 | - key: google-readability-braces-around-statements.ShortStatementLines 9 | value: '1' 10 | - key: google-readability-function-size.StatementThreshold 11 | value: '800' 12 | - key: google-readability-namespace-comments.ShortNamespaceLines 13 | value: '10' 14 | - key: google-readability-namespace-comments.SpacesBeforeComments 15 | value: '2' 16 | - key: modernize-loop-convert.MaxCopySize 17 | value: '16' 18 | - key: modernize-loop-convert.MinConfidence 19 | value: reasonable 20 | - key: modernize-loop-convert.NamingStyle 21 | value: CamelCase 22 | - key: modernize-pass-by-value.IncludeStyle 23 | value: llvm 24 | - key: modernize-replace-auto-ptr.IncludeStyle 25 | value: llvm 26 | - key: modernize-use-nullptr.NullMacros 27 | value: 'NULL' 28 | 29 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | *.md 2 | .git 3 | .circleci 4 | .github 5 | .idea 6 | .vscode 7 | build/*.sh 8 | build/*.bat 9 | scripts 10 | docker 11 | kubernetes 12 | cmake-build-debug 13 | test 14 | examples 15 | src/proto/proto-gen 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.html linguist-language=C++ 2 | *.c linguist-language=C++ 3 | *.cc linguist-language=C++ -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | # Describe the bug 8 | 9 | A clear and concise description of what the bug is. 10 | 11 | ## Branch or tag or release 12 | 13 | - branch: [e.g. develop] 14 | - tag: [e.g. 0.8.0] 15 | 16 | ## Arc h(x86 or x64) 17 | 18 | - Arch: [e.g. amd64] 19 | 20 | ## Desktop (Windows or Linux with version) 21 | 22 | - OS: [e.g. Windows 10] 23 | 24 | ## To Reproduce 25 | 26 | 1. do something 27 | 2. do something 28 | 3. ... 29 | 30 | ## Expected behavior 31 | 32 | A clear and concise description of what you expected to happen. 33 | 34 | ## Actual behavior 35 | 36 | A clear and concise description of what really happened. 37 | 38 | ## Screenshots (optional) 39 | 40 | If you have screenshots, please upload it here. 41 | 42 | ## Logs (optional) 43 | 44 | Parse your log here please. 45 | 46 | ## Additional context (optional) 47 | 48 | Add any other context about the problem here. 49 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Fixes **OR** Add new function 2 | 3 | #### Change propose: 4 | - 5 | - 6 | - 7 | - 8 | 9 | > **Some notes:** 10 | > I change it for ... -------------------------------------------------------------------------------- /.github/workflows/build-macos.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | #zstd 4 | brew install zstd 5 | 6 | #zlib 7 | brew install zlib 8 | 9 | #Protobuf 10 | brew install protobuf 11 | 12 | #boost 13 | brew install boost 14 | 15 | # git submodules 16 | git submodule sync 17 | git submodule update --init --recursive 18 | 19 | # build ark 20 | if [ -d "cmake-build" ]; then rm -rf cmake-build; fi 21 | # shellcheck disable=SC2164 22 | mkdir cmake-build && cd cmake-build 23 | cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DARK_BUILD_EXAMPLES=OFF -DARK_BUILD_TESTS=OFF .. 24 | make -j 4 25 | cd .. -------------------------------------------------------------------------------- /.github/workflows/build-ubuntu.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | #zstd 4 | sudo apt install libzstd-dev -y 5 | 6 | #zlib 7 | sudo apt-get install zlib1g-dev -y 8 | 9 | #Protobuf 10 | sudo apt install protobuf-compiler -y 11 | 12 | #boost 13 | sudo apt install libboost-dev 14 | 15 | # git submodules 16 | git submodule sync 17 | git submodule update --init --recursive 18 | 19 | # build ark 20 | if [ -d "cmake-build" ]; then rm -rf cmake-build; fi 21 | # shellcheck disable=SC2164 22 | mkdir cmake-build && cd cmake-build 23 | cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DARK_BUILD_EXAMPLES=OFF -DARK_BUILD_TESTS=OFF .. 24 | make -j 4 25 | cd .. -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - develop 7 | pull_request: 8 | types: [opened, synchronize, reopened] 9 | jobs: 10 | sonarcloud: 11 | name: SonarCloud 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | with: 16 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis 17 | # - name: SonarCloud Scan 18 | # uses: SonarSource/sonarcloud-github-action@master 19 | # env: 20 | # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any 21 | # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 22 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Github-CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | matrix: 10 | os: [ubuntu-latest, macOS-latest] 11 | 12 | steps: 13 | - uses: actions/checkout@v1 14 | - name: Build ARK 15 | run: | 16 | if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then 17 | chmod -x .github/workflows/build-ubuntu.sh && sh .github/workflows/build-ubuntu.sh 18 | elif [ "${{ matrix.os }}" = "macOS-latest" ]; then 19 | chmod -x .github/workflows/build-macos.sh && sh .github/workflows/build-macos.sh 20 | fi 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Compiled Dynamic libraries 8 | *.so 9 | *.dylib 10 | *.dll 11 | 12 | # Compiled Static libraries 13 | *.lai 14 | *.la 15 | *.a 16 | *.lib 17 | 18 | # Executables 19 | *.exe 20 | *.out 21 | *.app 22 | 23 | # Visaul Studio 24 | *.iobj 25 | *.ipdb 26 | *.idb 27 | *.pdb 28 | *.tlog 29 | *.log 30 | *.ilk 31 | 32 | # Codeblocks 33 | *.layout 34 | *.depend 35 | 36 | 37 | 3rdparty/lib 38 | temp 39 | *.opendb 40 | *.user 41 | *.vscode 42 | .DS_Store 43 | *.pyc 44 | *.pb.cc 45 | *.pb.h 46 | *.cs 47 | *.js 48 | *.exp 49 | cmake_build 50 | out 51 | src/proto/proto-gen/protoc 52 | src/proto/proto-gen/protoc-3.10.1.0 53 | build/bin/app_d 54 | build/bin/protoc 55 | build/bin/protoc-3.10.1.0 56 | build/bin/test_* 57 | app 58 | /cmake-build-debug/ 59 | /cmake-build-release/ 60 | .idea 61 | .DS_Store 62 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "rapidxml"] 2 | path = 3rdparty/rapidxml 3 | url = https://github.com/ArkNX/rapidxml.git 4 | [submodule "args"] 5 | path = 3rdparty/args 6 | url = https://github.com/Taywee/args.git 7 | [submodule "spdlog"] 8 | path = 3rdparty/spdlog 9 | url = https://github.com/gabime/spdlog.git 10 | [submodule "zephyr"] 11 | path = 3rdparty/zephyr 12 | url = https://github.com/ArkNX/zephyr.git 13 | [submodule "readerwriterqueue"] 14 | path = 3rdparty/readerwriterqueue 15 | url = https://github.com/cameron314/readerwriterqueue 16 | [submodule "cpp-bredis"] 17 | path = 3rdparty/cpp-bredis 18 | url = https://github.com/basiliscos/cpp-bredis.git 19 | -------------------------------------------------------------------------------- /3rdparty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "Add 3rdparty projects...") 2 | 3 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Set dependencies as release mode" FORCE) 4 | 5 | # zephyr 6 | add_subdirectory(zephyr) 7 | 8 | #------------------------------------------------------------------------------ 9 | # set output folder 10 | #------------------------------------------------------------------------------ 11 | #set(THIRD_PARTY_TARGET some_project_name) 12 | 13 | 14 | #foreach (target_index ${THIRD_PARTY_TARGET}) 15 | # set_target_properties(${target_index} PROPERTIES 16 | # FOLDER "3rdparty" 17 | # ARCHIVE_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 18 | # RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 19 | # LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR}) 20 | #endforeach (target_index) 21 | -------------------------------------------------------------------------------- /3rdparty/README.md: -------------------------------------------------------------------------------- 1 | # 3rdparty libraries 2 | 3 | | lib | branch | tag | 4 | | ---------------------------------------------------------------------------------------- | ------ | ------ | 5 | | [google protobuf](https://github.com/protocolbuffers/protobuf/releases/tag/v3.14.0) | 3.14.x | 3.14.0 | 6 | | [zephyr](https://github.com/ArkNX/zephyr) | master | | 7 | | [rapidxml](https://github.com/ArkNX/rapidxml) | master | | 8 | | [args](https://github.com/Taywee/args/releases/tag/6.2.2) | | 6.2.2 | 9 | | [spdlog](https://github.com/gabime/spdlog/releases/tag/v1.8.2) | v1.x | v1.8.2 | 10 | | [json](https://github.com/nlohmann/json/releases/download/v3.9.1/json.hpp) | v3.9.1 | | 11 | | [cpp-bredis](https://github.com/basiliscos/cpp-bredis/releases/tag/v0.11) | | v0.11 | 12 | | [readerwriterqueue](https://github.com/cameron314/readerwriterqueue/releases/tag/v1.0.3) | | v1.0.3 | 13 | | [librdkafka](https://github.com/edenhill/librdkafka/releases/tag/v1.6.0) | | v1.6.0 | 14 | | [mysqlpp](https://tangentsoft.com/mysqlpp/home) | | v3.2.5 | 15 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # --build-arg 来设置参数 2 | # docker build -t ark:escort --build-arg -f ./Dockerfile . 3 | 4 | FROM docker/ark-alpine-build:latest AS Builder 5 | 6 | WORKDIR /server/escort 7 | 8 | COPY . /server/escort 9 | 10 | RUN rm -rf ./build/bin/* \ 11 | && cd ./src/proto \ 12 | #&& sh ./gen-proto.sh \ 13 | && cd ../../ \ 14 | && rm -rf ./cmake-build | true \ 15 | && mkdir cmake-build \ 16 | && cd cmake-build \ 17 | && cmake -DARK_OPEN_FILE_LOG=OFF -DARK_BUILD_TESTS=OFF -DARK_BUILD_EXAMPLES=OFF .. \ 18 | && make -j16 \ 19 | && cd ../ \ 20 | && mkdir -p /home/server/escort \ 21 | && cp -r ./build/bin /home/server/escort \ 22 | && cp -r ./build/conf /home/server/escort 23 | 24 | FROM docker/ark-alpine-build:latest 25 | 26 | WORKDIR /home/server/escort 27 | 28 | #COPY --from=Builder /usr/lib/x86_64-linux-gnu/librdkafka++.so.1 /usr/lib/x86_64-linux-gnu/librdkafka++.so.1 29 | #COPY --from=Builder /usr/lib/x86_64-linux-gnu/librdkafka.so.1 /usr/lib/x86_64-linux-gnu/librdkafka.so.1 30 | COPY --from=Builder /home/server/escort /home/server/escort 31 | 32 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #define ARK_VER_MAJOR 1 24 | #define ARK_VER_MINOR 0 25 | #define ARK_VER_PATCH 0 26 | 27 | #define ARK_VERSION (ARK_VER_MAJOR * 10000 + ARK_VER_MINOR * 100 + ARK_VER_PATCH) 28 | -------------------------------------------------------------------------------- /build/README.md: -------------------------------------------------------------------------------- 1 | # Binary 2 | 3 | This folder is the runtime folder, include 4 | 5 | - bin 6 | - binlog 7 | - bus_conf 8 | - plugin_conf 9 | - resource 10 | - tools 11 | 12 | ## Batch/shell 13 | 14 | | name | descriptor | 15 | | -------- | ------------------------------------- | 16 | | rund.bat | run debug version in Windows | 17 | | run.bat | run release version in Windows | 18 | | kill.bat | kill debug & release version in Linux | 19 | | | | 20 | | run.sh | run release version in Linux | 21 | | rund.sh | run debug version in Linux | 22 | | kill.sh | kill debug & release version in Linux | 23 | -------------------------------------------------------------------------------- /build/binlog/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/binlog/.gitignore -------------------------------------------------------------------------------- /build/conf/consul.plugin.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /build/conf/db.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/conf/dir.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /build/conf/freebird.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /build/conf/game.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /build/conf/http.plugin.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /build/conf/http_client_sample.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /build/conf/kernel.plugin.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /build/conf/log.conf: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /build/conf/login.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/conf/master.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/conf/mysql.plugin.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /build/conf/mysql_sample.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/conf/oss.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /build/conf/physic.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /build/conf/proxy.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/conf/realm.example.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/conf/realm.example.plugin.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /build/conf/realm.game.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /build/conf/realm.master.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/conf/redis.plugin.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /build/conf/redis_sample.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build/conf/remote_log.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/conf/router.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/conf/sample1.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/conf/sample2.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build/conf/sample3.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build/conf/sample4.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build/conf/sample5.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build/conf/simulate.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/conf/terraria.game.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /build/conf/terraria.game.plugin.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /build/conf/world.app.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /build/kill.bat: -------------------------------------------------------------------------------- 1 | cd /d %~dp0 2 | 3 | @echo off 4 | 5 | taskkill /f /im app* -------------------------------------------------------------------------------- /build/kill.sh: -------------------------------------------------------------------------------- 1 | kill -9 $(pidof *_server) 2 | 3 | ps aux | grep *_server -------------------------------------------------------------------------------- /build/mysql_sample.sh: -------------------------------------------------------------------------------- 1 | export LC_ALL="C" 2 | 3 | # The default zone is 1001 4 | 5 | CHANNEL_ID=1 6 | ZONE_ID=1 7 | 8 | echo Starting http_server... 9 | ./bin/app_d --busid=1.0.1.1 --name=mysql_sample --app_conf=conf/mysql_sample.app.conf 10 | 11 | echo All processes are launching... 12 | 13 | ps aux | grep app_d 14 | -------------------------------------------------------------------------------- /build/resource/README.md: -------------------------------------------------------------------------------- 1 | ARK resource introduce: 2 | ============= 3 | 4 | We put logic and data configuration in this directory, support to edit with excel(Format = `XLS/XLSX`) files for non-developers, then use Tool/FileProcessor.exe to translate excel files to `XML` files. 5 | 6 | ###Directories and files introduction : 7 | 1. `excel` - excel configuration. 8 | 2. `ini` - some other data configuration. 9 | 3. `res` - XML data configuration. 10 | 4. `struct` - XML logic configuration. 11 | 5. `struct/LogicClass.xml` - the main logic configuration, every excel in folder `excel` can generates an element. 12 | 6. `struct/class` - generated XML files from every excel in folder `excel` by tool. 13 | 7. `mysql` - MySQL storage file, generated by tool. 14 | 8. `proto` - Google Protobuf file, contains all DataNode and DataTable name, generated by tool. 15 | 16 | ##### More info will be added! -------------------------------------------------------------------------------- /build/resource/client/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/client/.gitignore -------------------------------------------------------------------------------- /build/resource/code/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/code/.gitignore -------------------------------------------------------------------------------- /build/resource/excel/attribute.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/excel/attribute.xlsx -------------------------------------------------------------------------------- /build/resource/excel/entity_class.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/excel/entity_class.xlsx -------------------------------------------------------------------------------- /build/resource/excel/item.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/excel/item.xlsx -------------------------------------------------------------------------------- /build/resource/excel/language.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/excel/language.xlsx -------------------------------------------------------------------------------- /build/resource/excel/map.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/excel/map.xlsx -------------------------------------------------------------------------------- /build/resource/meta/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/meta/.gitignore -------------------------------------------------------------------------------- /build/resource/photon/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./xml-parse/xml-parse-darwin -out=./proto -xml=./protocol.xml -gen -------------------------------------------------------------------------------- /build/resource/photon/common.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /build/resource/photon/proto/createTable.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE photon_oss; 2 | 3 | CREATE TABLE `photon_oss`.`player_change_operation` ( 4 | `type` Int32, 5 | `base_server_id` String, 6 | `base_event_time` DateTime, 7 | `player_open_id` String, 8 | `player_player_name` String 9 | ) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/{shard}/photon_oss.player_change_operation', '{replica}') 10 | PARTITION BY `base_event_time` 11 | ORDER BY (event_time) 12 | SETTINGS index_granularity = 8192; 13 | 14 | CREATE TABLE `photon_oss`.`player_change_operation_all` AS `photon_oss`.`player_change_operation` ENGINE = Distributed(xdoss, photon_oss, player_change_operation, rand()); 15 | 16 | CREATE TABLE `photon_oss`.`room_count_change` ( 17 | `type` Int32, 18 | `base_server_id` String, 19 | `base_event_time` DateTime, 20 | `old_computer_open_id` String, 21 | `old_computer_player_name` String, 22 | `new_computer_open_id` String, 23 | `new_computer_player_name` String 24 | ) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/{shard}/photon_oss.room_count_change', '{replica}') 25 | PARTITION BY `base_event_time` 26 | ORDER BY (event_time) 27 | SETTINGS index_granularity = 8192; 28 | 29 | CREATE TABLE `photon_oss`.`room_count_change_all` AS `photon_oss`.`room_count_change` ENGINE = Distributed(xdoss, photon_oss, room_count_change, rand()); 30 | -------------------------------------------------------------------------------- /build/resource/photon/proto/createTable_single.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE photon_oss; 2 | 3 | CREATE TABLE `photon_oss`.`player_change_operation_all` ( 4 | `type` Int32, 5 | `base_server_id` String, 6 | `base_event_time` DateTime, 7 | `player_open_id` String, 8 | `player_player_name` String 9 | ) ENGINE = ReplacingMergeTree() 10 | PARTITION BY `base_event_time` 11 | ORDER BY (event_time) 12 | SETTINGS index_granularity = 8192; 13 | 14 | CREATE TABLE `photon_oss`.`room_count_change_all` ( 15 | `type` Int32, 16 | `base_server_id` String, 17 | `base_event_time` DateTime, 18 | `old_computer_open_id` String, 19 | `old_computer_player_name` String, 20 | `new_computer_open_id` String, 21 | `new_computer_player_name` String 22 | ) ENGINE = ReplacingMergeTree() 23 | PARTITION BY `base_event_time` 24 | ORDER BY (event_time) 25 | SETTINGS index_granularity = 8192; 26 | -------------------------------------------------------------------------------- /build/resource/photon/protocol.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /build/resource/photon/xml-parse/xml-parse-darwin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/photon/xml-parse/xml-parse-darwin -------------------------------------------------------------------------------- /build/resource/photon/xml-parse/xml-parse-linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/photon/xml-parse/xml-parse-linux -------------------------------------------------------------------------------- /build/resource/physic/PhysicConfig.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /build/resource/script/README.md: -------------------------------------------------------------------------------- 1 | # NoahGameFrame.NFCLuaScriptMudule 2 | ##### Copyright © http://www.noahframe.com 3 | 4 | [![Join the chat at https://gitter.im/ketoo/NoahGameFrame](https://badges.gitter.im/ketoo/NoahGameFrame.svg)](https://gitter.im/ketoo/NoahGameFrame?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 5 | 6 | #####交流QQ群:341159815 7 | 8 | ### How to Create a New LuaScriptModule 9 | 10 | ##Step 1 11 | Create a Lua Script File, and Must Contain following functions 12 | - Init() 13 | - AfterInit() 14 | - Execute() 15 | - BeforeShut() 16 | - Shut() 17 | 18 | Mostly like this 19 | # [TestModule2.lua](https://github.com/ketoo/NoahGameFrame/tree/develop/_Out/Server/NFDataCfg/ScriptModule/TestModule2.lua) 20 | 21 | ```lua 22 | TestModule2 = {} 23 | 24 | function TestModule2.Init() 25 | io.write("TestModule2 Init!\n"); 26 | end 27 | 28 | function TestModule2.AfterInit() 29 | io.write("TestModule2 AfterInit!\n"); 30 | end 31 | 32 | function TestModule2.Execute() 33 | io.write("TestModule2 Execute!\n"); 34 | end 35 | 36 | function TestModule2.BeforeShut() 37 | io.write("TestModule2 BeforeShut!\n"); 38 | end 39 | 40 | function TestModule2.Shut() 41 | io.write("TestModule2 Shut!\n"); 42 | end 43 | 44 | return TestModule2 --Do not forget return this 45 | ``` 46 | ##Step 2 47 | Add your LuaScriptModule Infomation into [script_list.lua](https://github.com/ketoo/NoahGameFrame/tree/develop/_Out/Server/NFDataCfg/ScriptModule/script_list.lua) 48 | ```lua 49 | ScriptList={ 50 | {tbl=nil, tblName="TestModule"}, 51 | {tbl=nil, tblName="TestModule2"}, 52 | } 53 | 54 | load_script_file(ScriptList) 55 | ``` 56 | ##Enjoy it! 57 | -------------------------------------------------------------------------------- /build/resource/script/TestModule2.lua: -------------------------------------------------------------------------------- 1 | TestModule2 = {} 2 | 3 | register_module(TestModule2,"TestModule2"); 4 | 5 | function TestModule2.Init() 6 | io.write("TestModule2 Init!\n"); 7 | end 8 | 9 | function TestModule2.AfterInit() 10 | io.write("TestModule2 AfterInit!" .. tostring(pLuaScriptModule) .. "\n"); 11 | end 12 | 13 | function TestModule2.Execute() 14 | io.write("TestModule2 Execute!\n"); 15 | end 16 | 17 | function TestModule2.BeforeShut() 18 | io.write("TestModule2 BeforeShut!\n"); 19 | end 20 | 21 | function TestModule2.Shut() 22 | io.write("TestModule2 Shut!\n"); 23 | end -------------------------------------------------------------------------------- /build/resource/script/script_list.lua: -------------------------------------------------------------------------------- 1 | ScriptList={ 2 | {tbl=nil, tblName="TestModule"}, 3 | {tbl=nil, tblName="TestModule2"}, 4 | } 5 | 6 | load_script_file(ScriptList) -------------------------------------------------------------------------------- /build/resource/script/script_module.lua: -------------------------------------------------------------------------------- 1 | ScriptModule = {} 2 | function ScriptModule.Init(...) 3 | for i=1, #(ScriptList) do 4 | ScriptList[i].tbl.Init(...); 5 | end 6 | end 7 | 8 | function ScriptModule.AfterInit(...) 9 | for i=1, #(ScriptList) do 10 | ScriptList[i].tbl.AfterInit(...); 11 | end 12 | end 13 | 14 | function ScriptModule.Execute(...) 15 | for i=1, #(ScriptList) do 16 | ScriptList[i].tbl.Execute(...); 17 | end 18 | end 19 | 20 | function ScriptModule.BeforeShut(...) 21 | for i=1, #(ScriptList) do 22 | ScriptList[i].tbl.BeforeShut(...); 23 | end 24 | end 25 | 26 | function ScriptModule.Shut(...) 27 | for i=1, #(ScriptList) do 28 | ScriptList[i].tbl.Shut(...); 29 | end 30 | end -------------------------------------------------------------------------------- /build/resource/script/script_reload.lua: -------------------------------------------------------------------------------- 1 | io.write("Start reload!\n"); 2 | ScriptReloadList={ 3 | {tbl=nil, tblName="TestModule"}, 4 | {tbl=nil, tblName="TestModule2"}, 5 | } 6 | 7 | reload_script_table(ScriptReloadList) 8 | 9 | --clear the data of this file 10 | -------------------------------------------------------------------------------- /build/resource/server/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/resource/server/.gitignore -------------------------------------------------------------------------------- /build/resource/server/common/GuildConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /build/resource/server/common/PlayerLevelConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /build/resource/server/map/1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/resource/server/map/2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/resource/server/map/3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/resource/server/map/4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/resource/server/map/5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/resource/server/map/6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/resource/server/npc/README.md: -------------------------------------------------------------------------------- 1 | Please use ***"NFDataCfg/Tool/FileProcess.exe"*** to generate configuration files. -------------------------------------------------------------------------------- /build/run.bat: -------------------------------------------------------------------------------- 1 | cd /d %~dp0 2 | 3 | @echo off 4 | 5 | REM the default zone is 1001 6 | 7 | set CHANNEL_ID=1 8 | set ZONE_ID=1 9 | 10 | cd Release 11 | 12 | echo Starting master... 13 | start "master" bin/app.exe -x --busid=1.0.1.1 --name=master_server --app_conf=plugin_conf/master.app.conf 14 | choice /t 5 /d y /n >nul 15 | 16 | echo Starting world... 17 | start "world" bin/app.exe -x --busid=1.1.30.1 --name=world_server --app_conf=plugin_conf/world.app.conf 18 | choice /t 5 /d y /n >nul 19 | 20 | echo Starting login... 21 | start "login" bin/app.exe -x --busid=1.1.31.1 --name=login_server --app_conf=plugin_conf/login.app.conf 22 | choice /t 5 /d y /n >nul 23 | 24 | echo Starting proxy... 25 | start "proxy" bin/app.exe -x --busid=1.1.32.1 --name=proxy_server --app_conf=plugin_conf/proxy.app.conf 26 | choice /t 5 /d y /n >nul 27 | 28 | echo Starting game... 29 | start "game" bin/app.exe -x --busid=1.1.33.1 --name=game_server --app_conf=plugin_conf/game.app.conf 30 | choice /t 5 /d y /n >nul 31 | 32 | echo All processes are launching... 33 | 34 | cd -------------------------------------------------------------------------------- /build/run.sh: -------------------------------------------------------------------------------- 1 | cd bin 2 | 3 | export LC_ALL="C" 4 | 5 | #The default zone is 1001 6 | 7 | CHANNEL_ID=1 8 | ZONE_ID=1 9 | 10 | echo Starting master... 11 | ./bin/app -d --busid=1.0.1.1 --name=master_server --app_conf=plugin_conf/master.app.conf 12 | 13 | echo Starting world... 14 | ./bin/app -d --busid=1.1.30.1 --name=world_server --app_conf=plugin_conf/world.app.conf 15 | 16 | echo Starting login... 17 | ./bin/app -d --busid=1.1.31.1 --name=login_server --app_conf=plugin_conf/login.app.conf 18 | 19 | echo Starting proxy... 20 | ./bin/app -d --busid=1.1.32.1 --name=proxy_server --app_conf=plugin_conf/proxy.app.conf 21 | 22 | echo Starting game... 23 | ./bin/app -d --busid=1.1.33.1 --name=game_server --app_conf=plugin_conf/game.app.conf 24 | 25 | echo All processes are launching... 26 | 27 | ps aux | grep app 28 | 29 | cd ../ -------------------------------------------------------------------------------- /build/rund.bat: -------------------------------------------------------------------------------- 1 | REM This file is generated by gcm tools. 2 | REM Please DO NOT modify it manually. 3 | 4 | cd /d %~dp0 5 | 6 | @echo off 7 | 8 | REM the default zone is 1001 9 | 10 | echo Starting master... 11 | start "master" bin/app_d.exe -x --busid=1.0.1.1 --name=master_server --app_conf=plugin_conf/master.app.conf 12 | choice /t 5 /d y /n >nul 13 | 14 | echo Starting world... 15 | start "world" bin/app_d.exe -x --busid=1.1.30.1 --name=world_server --app_conf=plugin_conf/world.app.conf 16 | choice /t 5 /d y /n >nul 17 | 18 | echo Starting login... 19 | start "login" bin/app_d.exe -x --busid=1.1.32.1 --name=login_server --app_conf=plugin_conf/login.app.conf 20 | choice /t 5 /d y /n >nul 21 | 22 | echo Starting proxy... 23 | start "proxy" bin/app_d.exe -x --busid=1.1.33.1 --name=proxy_server --app_conf=plugin_conf/proxy.app.conf 24 | choice /t 5 /d y /n >nul 25 | 26 | echo Starting game... 27 | start "game" bin/app_d.exe -x --busid=1.1.31.1 --name=game_server --app_conf=plugin_conf/game.app.conf 28 | choice /t 5 /d y /n >nul 29 | 30 | echo All processes started... 31 | 32 | cd ../ -------------------------------------------------------------------------------- /build/rund.sh: -------------------------------------------------------------------------------- 1 | cd debug 2 | 3 | export LC_ALL="C" 4 | 5 | #The default zone is 1001 6 | 7 | CHANNEL_ID=1 8 | ZONE_ID=1 9 | 10 | echo Starting master... 11 | ./bin/app_d -d --busid=1.0.1.1 --name=master_server --app_conf=plugin_conf/master.app.conf 12 | 13 | echo Starting world... 14 | ./bin/app_d -d --busid=1.1.30.1 --name=world_server --app_conf=plugin_conf/world.app.conf 15 | 16 | echo Starting login... 17 | ./bin/app_d -d --busid=1.1.31.1 --name=login_server --app_conf=plugin_conf/login.app.conf 18 | 19 | echo Starting proxy... 20 | ./bin/app_d -d --busid=1.1.32.1 --name=proxy_server --app_conf=plugin_conf/proxy.app.conf 21 | 22 | echo Starting game... 23 | ./bin/app_d -d --busid=1.1.33.1 --name=game_server --app_conf=plugin_conf/game.app.conf 24 | 25 | echo All processes are launching... 26 | 27 | ps aux | grep app_d 28 | 29 | cd ../ -------------------------------------------------------------------------------- /build/sample1.sh: -------------------------------------------------------------------------------- 1 | export LC_ALL="C" 2 | 3 | # The default zone is 1001 4 | 5 | CHANNEL_ID=1 6 | ZONE_ID=1 7 | 8 | echo Starting sample1... 9 | ./bin/app_d --busid=1.0.1.1 --name=sample1 --app_conf=conf/sample1.app.conf 10 | 11 | echo All processes are launching... 12 | 13 | ps aux | grep app_d 14 | -------------------------------------------------------------------------------- /build/sample5http_test.sh: -------------------------------------------------------------------------------- 1 | export LC_ALL="C" 2 | 3 | # The default zone is 1001 4 | 5 | CHANNEL_ID=1 6 | ZONE_ID=1 7 | 8 | echo Starting http_server... 9 | ./bin/app_d -d --busid=1.0.1.1 --name=sample5 --app_conf=conf/Sample5.app.conf 10 | 11 | echo All processes are launching... 12 | 13 | ps aux | grep app_d 14 | -------------------------------------------------------------------------------- /build/tools/README.md: -------------------------------------------------------------------------------- 1 | # Tools folder 2 | 3 | 1. config_tool - generate config from excel files 4 | 2. gcm, create an runtime environment quickly 5 | -------------------------------------------------------------------------------- /build/tools/config_tool/README.md: -------------------------------------------------------------------------------- 1 | # Config tool 2 | 3 | ## Introduction 4 | 5 | This tool is used to generate configurations from excel, try to be nice between designers and developpers. 6 | 7 | ## Prameters 8 | 9 | TODO: 10 | 11 | ## Dependencies 12 | 13 | Before you use this tools, you need install those dependencies below, 14 | 15 | | python libs | install cmd | note | 16 | | - | - | - | 17 | | openyxl | pip install openpyxl | operate excel files | 18 | | pyinstaller | pip install pyinstaller | pack python to excute file `pyinstaller -F config_tool.py` | 19 | 20 | ## Note 21 | -------------------------------------------------------------------------------- /build/tools/config_tool/config_param.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # encoding=utf-8 3 | 4 | # resource path 5 | resource_path = "../../resource" 6 | 7 | # special file 8 | special_file_name = "entity_class" 9 | special_file = "entity_class.xlsx" 10 | 11 | # some extensions 12 | excel_ext = ".xls" 13 | excel_new_ext = ".xlsx" 14 | 15 | meta_ext = ".meta" 16 | config_ext = ".config" 17 | csv_ext = ".csv" 18 | 19 | # target for different staff 20 | target_all = "A" # for all 21 | target_server = "S" # for server side 22 | target_client = "C" # for client 23 | target_design = "D" # for design 24 | 25 | # some path 26 | excel_path = "excel/" 27 | meta_path = "meta/" 28 | server_res_path = "server/" 29 | client_res_path = "client/" 30 | config_class_file = "meta/config_class.config" 31 | entity_class_file = "meta/entity_class.config" 32 | cpp_meta_file = "code/AFMetaDefine.hpp" 33 | cs_meta_file = "code/AFMetaDefine.cs" 34 | 35 | # excel form header, after this row, the content is config data 36 | config_form_head_list = ['', 'field', 'type', 'target', 'refer', 'desc'] 37 | config_form_head_row = 5 38 | 39 | #field_index 40 | field_index="field_index" 41 | 42 | # entity class form header 43 | entity_form_head_row = 3 44 | entity_unused_flag = 'unused' 45 | 46 | entity_field_name_col = 2 47 | entity_field_type_col = 3 48 | entity_field_sub_class_col = 4 49 | 50 | nonentity_form_head_row = 5 51 | -------------------------------------------------------------------------------- /build/tools/gcm/conf/bus_relation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /build/tools/gcm/conf/conf.ini: -------------------------------------------------------------------------------- 1 | [cluster 1] 2 | MASTER_NUM=1 3 | MASTER[0].host=ark_test_1 4 | MASTER[0].port=10000 5 | 6 | [zone 1] 7 | GAME_NUM=2 8 | GAME[0].host=ark_test_1 9 | GAME[0].port=15000 10 | GAME[1].host=ark_test_2 11 | GAME[1].port=15000 -------------------------------------------------------------------------------- /build/tools/gcm/conf/host.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /build/tools/gen-config.bat: -------------------------------------------------------------------------------- 1 | python config_tool\config_tool.py -p ..\resource 2 | copy ..\resource\code\AFMetaDefine.hpp ..\..\src\base\ /Y -------------------------------------------------------------------------------- /build/tools/gen-config.sh: -------------------------------------------------------------------------------- 1 | python config_tool/config_tool.py -p ../resource 2 | cp ../resource/code/AFMetaDefine.hpp ../../src/base/ -------------------------------------------------------------------------------- /build/tools/gen-plugin-and-module.bat: -------------------------------------------------------------------------------- 1 | python3 plugin_and_module_tool/plugin_and_module_tool.py 2 | -------------------------------------------------------------------------------- /build/tools/plugin_and_module_tool/pack.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # install first if not 4 | # pip install pyinstaller 5 | 6 | pyinstaller -F ./plugin_and_module_tool.py -------------------------------------------------------------------------------- /build/tools/plugin_and_module_tool/plugin_and_module_param.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # encoding=utf-8 3 | 4 | base_dir = "../../../src" 5 | plugin_dir = "plugin,server,special" 6 | 7 | # resource path 8 | # plugin_path = "../../../src/plugin" 9 | # server_path = "../../../src/server" 10 | 11 | # some path 12 | include_path = "include/" 13 | interface_path = "interface/" 14 | src_path = "src/" 15 | 16 | # special file 17 | cmake_file = "CMakeLists.txt" 18 | readme_file = "README.md" 19 | 20 | # some extention 21 | hpp_ext = ".hpp" 22 | cpp_ext = ".cpp" 23 | -------------------------------------------------------------------------------- /build/tools/plugin_and_module_tool/plugin_and_module_tool: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/build/tools/plugin_and_module_tool/plugin_and_module_tool -------------------------------------------------------------------------------- /build/vc_clear.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo clearing the building temp files, please wait for a while. 3 | 4 | del /f /q /s *.obj 5 | del /f /q /s *.pdb 6 | del /f /q /s *.idb 7 | del /f /q /s *.pch 8 | del /f /q /s *.ilk 9 | del /f /q /s *.dll 10 | del /f /q /s *.exe 11 | 12 | 13 | echo clear finished 14 | pause -------------------------------------------------------------------------------- /cmake/FindLZ4.cmake: -------------------------------------------------------------------------------- 1 | # Finds liblz4. 2 | # 3 | # This module defines: 4 | # LZ4_FOUND 5 | # LZ4_INCLUDE_DIR 6 | # LZ4_LIBRARY 7 | # 8 | 9 | find_path(LZ4_INCLUDE_DIR NAMES lz4.h) 10 | find_library(LZ4_LIBRARY NAMES lz4) 11 | 12 | # We require LZ4_compress_default() which was added in v1.7.0 13 | if (LZ4_LIBRARY) 14 | include(CheckCSourceRuns) 15 | set(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR}) 16 | set(CMAKE_REQUIRED_LIBRARIES ${LZ4_LIBRARY}) 17 | check_c_source_runs(" 18 | #include 19 | int main() { 20 | int good = (LZ4_VERSION_MAJOR > 1) || 21 | ((LZ4_VERSION_MAJOR == 1) && (LZ4_VERSION_MINOR >= 7)); 22 | return !good; 23 | }" LZ4_GOOD_VERSION) 24 | set(CMAKE_REQUIRED_INCLUDES) 25 | set(CMAKE_REQUIRED_LIBRARIES) 26 | endif() 27 | 28 | include(FindPackageHandleStandardArgs) 29 | FIND_PACKAGE_HANDLE_STANDARD_ARGS( 30 | LZ4 DEFAULT_MSG 31 | LZ4_LIBRARY LZ4_INCLUDE_DIR LZ4_GOOD_VERSION) 32 | 33 | if (NOT LZ4_FOUND) 34 | message(STATUS "Using third-party bundled LZ4") 35 | else() 36 | message(STATUS "Found LZ4: ${LZ4_LIBRARY}") 37 | endif (NOT LZ4_FOUND) 38 | 39 | mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY) 40 | -------------------------------------------------------------------------------- /cmake/FindZstd.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # 16 | # - Try to find Facebook zstd library 17 | # This will define 18 | # ZSTD_FOUND 19 | # ZSTD_INCLUDE_DIR 20 | # ZSTD_LIBRARIES 21 | # 22 | 23 | find_path( 24 | ZSTD_INCLUDE_DIRS zstd.h 25 | HINTS 26 | $ENV{ZSTD_ROOT}/include 27 | ${ZSTD_ROOT}/include 28 | ) 29 | 30 | find_library( 31 | ZSTD_LIBRARIES zstd 32 | HINTS 33 | $ENV{ZSTD_ROOT}/lib 34 | ${ZSTD_ROOT}/lib 35 | ) 36 | 37 | mark_as_advanced(ZSTD_INCLUDE_DIRS ZSTD_LIBRARIES) 38 | 39 | include(FindPackageHandleStandardArgs) 40 | find_package_handle_standard_args(Zstd ZSTD_INCLUDE_DIRS ZSTD_LIBRARIES) 41 | 42 | if(ZSTD_FOUND AND NOT ZSTD_FIND_QUIETLY) 43 | message(STATUS "ZSTD_include: ${ZSTD_INCLUDE_DIRS}") 44 | message(STATUS "ZSTD_lib: ${ZSTD_LIBRARIES}") 45 | endif() 46 | -------------------------------------------------------------------------------- /cmake/llvm-cov-wrapper.txt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This file is part of CMake-codecov. 4 | # 5 | # Copyright (c) 6 | # 2015-2017 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # See the LICENSE file in the package base directory for details 9 | # 10 | # Written by Alexander Haase, alexander.haase@rwth-aachen.de 11 | # 12 | 13 | if [ -z "$LLVM_COV_BIN" ] 14 | then 15 | echo "LLVM_COV_BIN not set!" >& 2 16 | exit 1 17 | fi 18 | 19 | 20 | # Get LLVM version to find out. 21 | LLVM_VERSION=$($LLVM_COV_BIN -version | grep -i "LLVM version" \ 22 | | sed "s/^\([A-Za-z ]*\)\([0-9]\).\([0-9]\).*$/\2.\3/g") 23 | 24 | if [ "$1" = "-v" ] 25 | then 26 | echo "llvm-cov-wrapper $LLVM_VERSION" 27 | exit 0 28 | fi 29 | 30 | 31 | if [ -n "$LLVM_VERSION" ] 32 | then 33 | MAJOR=$(echo $LLVM_VERSION | cut -d'.' -f1) 34 | MINOR=$(echo $LLVM_VERSION | cut -d'.' -f2) 35 | 36 | if [ $MAJOR -eq 3 ] && [ $MINOR -le 4 ] 37 | then 38 | if [ -f "$1" ] 39 | then 40 | filename=$(basename "$1") 41 | extension="${filename##*.}" 42 | 43 | case "$extension" in 44 | "gcno") exec $LLVM_COV_BIN --gcno="$1" ;; 45 | "gcda") exec $LLVM_COV_BIN --gcda="$1" ;; 46 | esac 47 | fi 48 | fi 49 | 50 | if [ $MAJOR -eq 3 ] && [ $MINOR -le 5 ] 51 | then 52 | exec $LLVM_COV_BIN $@ 53 | fi 54 | fi 55 | 56 | exec $LLVM_COV_BIN gcov $@ 57 | -------------------------------------------------------------------------------- /docker/ark-alpine-build: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | RUN apk add --no-cache boost-dev libexecinfo-dev protobuf-dev zstd-dev zlib-dev protobuf gcc g++ make cmake bash openssl openssl-dev libssl1.1 lz4 lz4-dev 4 | 5 | #RUN wget https://tangentsoft.com/mysqlpp/releases/mysql++-3.2.5.tar.gz \ 6 | # && tar -zxvf ./mysql++-3.2.5.tar.gz \ 7 | # && cd mysql++-3.2.5/ \ 8 | # && ./configure \ 9 | # && make install 10 | RUN wget https://github.com/edenhill/librdkafka/archive/v1.5.0.tar.gz \ 11 | && tar -zxvf ./v1.5.0.tar.gz \ 12 | && cd librdkafka-1.5.0 \ 13 | && ./configure \ 14 | && make -j8 \ 15 | && make install \ 16 | && cd .. 17 | -------------------------------------------------------------------------------- /docker/ark-alpine-runtime: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | RUN apk add --no-cache libstdc++ protobuf zstd-dev bash 4 | 5 | RUN wget https://github.com/edenhill/librdkafka/archive/v1.5.0.tar.gz \ 6 | && tar -zxvf ./v1.5.0.tar.gz \ 7 | && cd librdkafka-1.5.0 \ 8 | && ./configure \ 9 | && make -j8 \ 10 | && make install \ 11 | && cd .. 12 | -------------------------------------------------------------------------------- /examples/http_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_PLUGIN_MACRO(HttpClientSamplePlugin) -------------------------------------------------------------------------------- /examples/http_client/HttpClientSampleModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFPluginManager.hpp" 24 | #include "net/interface/AFIHttpClientModule.hpp" 25 | #include "plugin/etcd_client/interface/AFIEtcdClientModule.hpp" 26 | 27 | namespace ark { 28 | 29 | class HttpClientSampleModule final : public AFIModule 30 | { 31 | ARK_DECLARE_MODULE_FUNCTIONS 32 | private: 33 | AFIHttpClientModule* httpCli_; 34 | std::shared_ptr etcdCli_; 35 | 36 | public: 37 | bool Init() override; 38 | bool PostInit() override; 39 | }; 40 | 41 | } // namespace ark 42 | -------------------------------------------------------------------------------- /examples/http_client/HttpClientSamplePlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "HttpClientSampleModule.h" 22 | #include "HttpClientSamplePlugin.h" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(HttpClientSamplePlugin) 27 | 28 | void HttpClientSamplePlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(HttpClientSampleModule, HttpClientSampleModule); 31 | } 32 | 33 | void HttpClientSamplePlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(HttpClientSampleModule, HttpClientSampleModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /examples/http_client/HttpClientSamplePlugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | 27 | namespace ark { 28 | 29 | ARK_DECLARE_PLUGIN(HttpClientSamplePlugin) 30 | 31 | } // namespace ark 32 | -------------------------------------------------------------------------------- /examples/kcptool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | function(BUILD_PLUGIN_MACRO project_name) 2 | if(UNIX AND (NOT APPLE)) 3 | #Set rpath 4 | set(CMAKE_INSTALL_RPATH ".") 5 | set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 6 | endif(UNIX AND (NOT APPLE)) 7 | 8 | file(GLOB_RECURSE PLUGIN_SRC 9 | tool.cpp 10 | ${CMAKE_SOURCE_DIR}/src/plugin/net/src/kcp_client.cpp 11 | ${CMAKE_SOURCE_DIR}/src/plugin/net/src/AFCKcpClient.cpp 12 | ) 13 | add_library(${project_name} SHARED ${PLUGIN_SRC}) 14 | set_target_properties(${project_name} PROPERTIES PREFIX "") 15 | set_target_properties(${project_name} PROPERTIES 16 | FOLDER "plugins" 17 | ARCHIVE_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 18 | RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 19 | LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR}) 20 | 21 | # add_dependencies(${project_name} AFProto) 22 | target_link_libraries(${project_name} ${ARGN}) 23 | endfunction(BUILD_PLUGIN_MACRO) 24 | 25 | 26 | 27 | if(WIN32) 28 | BUILD_PLUGIN_MACRO(KcpTool kcp) 29 | elseif(APPLE) 30 | BUILD_PLUGIN_MACRO(KcpTool kcp) 31 | else(UNIX) 32 | BUILD_PLUGIN_MACRO(KcpTool kcp) 33 | endif() -------------------------------------------------------------------------------- /examples/kcptool/gen_proto.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | function py_protocol() 4 | { 5 | protoc -I /Users/qinhan/c++/ARK/src/proto/proto \ 6 | --python_out=./ \ 7 | /Users/qinhan/c++/ARK/src/proto/proto/AFPhotonSS.proto 8 | } 9 | 10 | py_protocol -------------------------------------------------------------------------------- /examples/mysql_sample/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${ROOT_DIR}/3rdparty/mysqlpp/mysql) 2 | include_directories(${ROOT_DIR}/3rdparty/mysqlpp) 3 | BUILD_PLUGIN_MACRO(MysqlSamplePlugin) -------------------------------------------------------------------------------- /examples/mysql_sample/MysqlSampleModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFPluginManager.hpp" 24 | #include "mysql/interface/AFIMysqlModule.hpp" 25 | 26 | namespace ark { 27 | 28 | class MysqlSampleModule final : public AFIModule 29 | { 30 | ARK_DECLARE_MODULE_FUNCTIONS 31 | private: 32 | AFIMysqlModule* mysql_module_ptr_; 33 | 34 | public: 35 | bool Init() override; 36 | bool PostInit() override; 37 | }; 38 | 39 | } // namespace ark 40 | -------------------------------------------------------------------------------- /examples/mysql_sample/MysqlSamplePlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "MysqlSamplePlugin.h" 22 | #include "MysqlSampleModule.h" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(MysqlSamplePlugin) 27 | 28 | void MysqlSamplePlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(MysqlSampleModule, MysqlSampleModule); 31 | } 32 | 33 | void MysqlSamplePlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(MysqlSampleModule, MysqlSampleModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /examples/mysql_sample/MysqlSamplePlugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | 27 | namespace ark { 28 | 29 | ARK_DECLARE_PLUGIN(MysqlSamplePlugin) 30 | 31 | } // namespace ark 32 | -------------------------------------------------------------------------------- /examples/redis_sample/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${ROOT_DIR}/3rdparty/redisclient/src) 2 | BUILD_PLUGIN_MACRO(RedisSamplePlugin) -------------------------------------------------------------------------------- /examples/redis_sample/RedisSampleModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFPluginManager.hpp" 24 | #include "redis/interface/AFIRedisModule.hpp" 25 | 26 | namespace ark { 27 | 28 | class RedisSampleModule final : public AFIModule 29 | { 30 | ARK_DECLARE_MODULE_FUNCTIONS 31 | public: 32 | bool Init() override; 33 | bool PostInit() override; 34 | 35 | protected: 36 | AFIRedisModule* m_pRedisModule; 37 | }; 38 | 39 | } // namespace ark 40 | -------------------------------------------------------------------------------- /examples/redis_sample/RedisSamplePlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "RedisSamplePlugin.h" 22 | #include "RedisSampleModule.h" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(RedisSamplePlugin) 27 | 28 | void RedisSamplePlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(RedisSampleModule, RedisSampleModule); 31 | } 32 | 33 | void RedisSamplePlugin::Uninstall() 34 | { 35 | ARK_DEREGISTER_MODULE(RedisSampleModule, RedisSampleModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /examples/redis_sample/RedisSamplePlugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | 27 | namespace ark { 28 | 29 | ARK_DECLARE_PLUGIN(RedisSamplePlugin) 30 | 31 | } // namespace ark 32 | -------------------------------------------------------------------------------- /examples/sample1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_PLUGIN_MACRO("Sample1Plugin") -------------------------------------------------------------------------------- /examples/sample1/Sample1Plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "Sample1Plugin.h" 22 | #include "Sample1Module.h" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(Sample1Plugin) 27 | 28 | void Sample1Plugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(Sample1Module, Sample1Module); 31 | } 32 | 33 | void Sample1Plugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(Sample1Module, Sample1Module); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /examples/sample1/Sample1Plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(Sample1Plugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /examples/sample2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_PLUGIN_MACRO("Sample2Plugin") -------------------------------------------------------------------------------- /examples/sample2/Sample2Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | #include "kernel/interface/AFIData.hpp" 27 | 28 | namespace ark { 29 | 30 | class Sample2Module final : public AFIModule 31 | { 32 | ARK_DECLARE_MODULE_FUNCTIONS 33 | public: 34 | explicit Sample2Module() = default; 35 | 36 | bool Init() override; 37 | bool PostInit() override; 38 | bool PreShut() override; 39 | bool Shut() override; 40 | 41 | protected: 42 | int OnDataNodeCB(const guid_t& self, const std::string& node_name, const AFIData& old_var, const AFIData& new_var); 43 | }; 44 | 45 | } // namespace ark 46 | -------------------------------------------------------------------------------- /examples/sample2/Sample2Plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "Sample2Plugin.h" 22 | #include "Sample2Module.h" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(Sample2Plugin) 27 | 28 | void Sample2Plugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(Sample2Module, Sample2Module); 31 | } 32 | 33 | void Sample2Plugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(Sample2Module, Sample2Module); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /examples/sample2/Sample2Plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(Sample2Plugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /examples/sample3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_PLUGIN_MACRO("Sample3Plugin") -------------------------------------------------------------------------------- /examples/sample3/Sample3Plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "Sample3Plugin.h" 22 | #include "Sample3Module.h" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(Sample3Plugin) 27 | 28 | void Sample3Plugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(Sample3Module, Sample3Module); 31 | } 32 | 33 | void Sample3Plugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(Sample3Module, Sample3Module); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /examples/sample3/Sample3Plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | 27 | namespace ark { 28 | 29 | ARK_DECLARE_PLUGIN(Sample3Plugin) 30 | 31 | } // namespace ark 32 | -------------------------------------------------------------------------------- /examples/sample4/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${ROOT_DIR}/3rdparty/physX/include) 3 | 4 | BUILD_PLUGIN_MACRO("Sample4Plugin") -------------------------------------------------------------------------------- /examples/sample4/Sample4Plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "Sample4Plugin.h" 22 | #include "Sample4Module.h" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(Sample4Plugin) 27 | 28 | void Sample4Plugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(Sample4Module, Sample4Module); 31 | } 32 | 33 | void Sample4Plugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(Sample4Module, Sample4Module); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /examples/sample4/Sample4Plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | 27 | namespace ark { 28 | 29 | ARK_DECLARE_PLUGIN(Sample4Plugin) 30 | 31 | } // namespace ark 32 | -------------------------------------------------------------------------------- /examples/sample5/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${ROOT_DIR}/3rdparty/BeastHttp/BeastHttp/include) 2 | BUILD_PLUGIN_MACRO(Sample5Plugin) -------------------------------------------------------------------------------- /examples/sample5/Sample5Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "Sample5Module.h" 22 | 23 | namespace ark { 24 | 25 | bool Sample5Module::Init() 26 | { 27 | m_pHttpServerModule = FindModule(); 28 | 29 | return true; 30 | } 31 | 32 | bool Sample5Module::PostInit() 33 | { 34 | m_pHttpServerModule->StartServer("0.0.0.0", 8080, 4); 35 | return true; 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /examples/sample5/Sample5Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFPluginManager.hpp" 24 | #include "http/interface/AFIHttpServerModule.hpp" 25 | 26 | namespace ark { 27 | 28 | class Sample5Module final : public AFIModule 29 | { 30 | ARK_DECLARE_MODULE_FUNCTIONS 31 | public: 32 | bool Init() override; 33 | bool PostInit() override; 34 | 35 | protected: 36 | AFIHttpServerModule* m_pHttpServerModule; 37 | }; 38 | 39 | } // namespace ark 40 | -------------------------------------------------------------------------------- /examples/sample5/Sample5Plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "Sample5Plugin.h" 22 | #include "Sample5Module.h" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(Sample5Plugin) 27 | 28 | void Sample5Plugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(Sample5Module, Sample5Module); 31 | } 32 | 33 | void Sample5Plugin::Uninstall() 34 | { 35 | ARK_DEREGISTER_MODULE(Sample5Module, Sample5Module); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /examples/sample5/Sample5Plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | 27 | namespace ark { 28 | 29 | ARK_DECLARE_PLUGIN(Sample5Plugin) 30 | 31 | } // namespace ark 32 | -------------------------------------------------------------------------------- /kubernetes/photon_game_deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: StatefulSet 4 | metadata: 5 | name: sts-photon-game 6 | namespace: default 7 | labels: 8 | app: photon-game 9 | spec: 10 | # to match k8s service name 11 | serviceName: "svc-photon-game" 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app: photon-game 16 | template: 17 | metadata: 18 | labels: 19 | app: photon-game 20 | spec: 21 | # nodeSelector: 22 | # type: pvp 23 | containers: 24 | - name: photon-game 25 | image: ark:photon 26 | imagePullPolicy: Never 27 | command: ["./bin/app"] 28 | args: 29 | - "--busid=1.0.31.${HOSTNAME##*-}" 30 | - "--name=photon_game" 31 | - "--app_conf=conf/photon.game.app.conf" 32 | env: 33 | - name: MY_POD_NAME 34 | valueFrom: 35 | fieldRef: 36 | fieldPath: metadata.name 37 | - name: MY_POD_IP 38 | valueFrom: 39 | fieldRef: 40 | fieldPath: status.podIP 41 | - name: MY_POD_NAMESPACE 42 | valueFrom: 43 | fieldRef: 44 | fieldPath: metadata.namespace 45 | volumeMounts: 46 | - name: tz-config 47 | mountPath: /etc/localtime 48 | - name: photon-config 49 | mountPath: /root/build/conf 50 | volumes: 51 | - name: tz-config 52 | hostPath: 53 | path: /usr/share/zoneinfo/Asia/Shanghai 54 | - name: photon-config 55 | configMap: 56 | name: photon-config 57 | -------------------------------------------------------------------------------- /scripts/clang_tidy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clang-tidy example/example.cpp -- -I ./include 3 | -------------------------------------------------------------------------------- /scripts/format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo -n "Running dos2unix " 3 | find ../src -name "*\.h" -o -name "*\.hpp" -o -name "*\.cpp"|grep -v bundled|xargs -I {} sh -c "dos2unix '{}' 2>/dev/null; echo -n '.'" 4 | find ../samples -name "*\.h" -o -name "*\.hpp" -o -name "*\.cpp"|grep -v bundled|xargs -I {} sh -c "dos2unix '{}' 2>/dev/null; echo -n '.'" 5 | echo 6 | echo -n "Running clang-format " 7 | find ../src -name "*\.h" -o -name "*\.hpp" -o -name "*\.cpp"|grep -v bundled|xargs -I {} sh -c "clang-format -i -style=file {}; echo -n '.'" 8 | find ../samples -name "*\.h" -o -name "*\.hpp" -o -name "*\.cpp"|grep -v bundled|xargs -I {} sh -c "clang-format -i -style=file {}; echo -n '.'" 9 | echo 10 | 11 | 12 | -------------------------------------------------------------------------------- /scripts/travis_compiler.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # git submodules 4 | git submodule sync 5 | git submodule update --init 6 | 7 | os_name=`uname` 8 | 9 | # build ark 10 | if [ -d "build" ]; then rm -rf build; fi 11 | mkdir build && cd build 12 | cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DENABLE_COVERAGE=OFF -DBUILD_SAMPLES=ON -DBUILD_TESTS=ON .. 13 | make -j 4 14 | 15 | if [ "$USE_CXX" != g++-9 ]; then 16 | exit 0 17 | fi 18 | 19 | # make and sonar scanner 20 | if [ "$os_name" = Linux ]; then 21 | build-wrapper-linux-x86-64 --out-dir bw-output make -j 4 22 | elif [ "$os_name" = Darwin ]; then 23 | build-wrapper-macosx-x86 --out-dir bw-output make -j 4 24 | fi 25 | 26 | sonar-scanner #-X 27 | 28 | cd .. 29 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=ArkNX_ARK 2 | sonar.organization=openark 3 | 4 | # This is the name and version displayed in the SonarCloud UI. 5 | sonar.projectName=ARK 6 | sonar.projectVersion=1.0.0 7 | 8 | # Encoding of the source code. Default is default system encoding 9 | #sonar.sourceEncoding=UTF-8 10 | sonar.language=c++ 11 | #sonar.login="mT56Sj2ebjbZ2uQOlNWM96WC+TG9RqZL5221oaMqagBDdcBTYwk0wdOgTl6CYukt7XYFyf1Okx96WF36hWiGJbLVDsrvB3hEgPwWMtEL1az66jNc/yWB1tCyMX+R+pJIQC7CK4MnKCoMAHaTdRBT8fCVxGaJtD6SdR1uI4VqREZO/FUq8Pa4qXwzY0XT64jGpe2gxKgRp4jAFGhTUngk3ePZ1NtGiTHpAscgNRJtn2pctJwxGQWGk3+z28XvZWlHvRAilkIfrHpfkiira6lo1Bx0cqlGo26d125xZ9otOgHA1OIcgLtaEpqRcrBGvK8BcJtm6p3ZCSH7BZGOzwnlzJJVzWIE8/8aDKe5eQGewNvGP7INWgu2YeF4okFR46L145Acz6m8UZ5zkaPrzQDyOpxge+Cq/XzatNQyyDHoBgrYJgBCM3COsVOngvamXAHi+v4U2TY7dpF8AwZCA1Sr1A85xDbZxxlw3/JPd9gbUO7dBXNrFuE/FOgNVkC/suEFvDHcJgbAgcVbQBMALqJT9YWXGE2JEL0nAAxMrbvfUs7B3RdRDhki3jodejIuNH/So1YgBJIZsa+V9Bv7XXUY8FMxKKCPiQb5+63fBkDpkk7my+VOABhfnMxSL/cg0k6HPmM28blYM8PsqwAUkrtTnyhchqVwjg2s1T5dO8v0URo=" 12 | 13 | # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. 14 | # This property is optional if sonar.modules is set. 15 | sonar.sources=src 16 | sonar.exclusions=**src/proto** 17 | #sonar.cfamily.threads=4 18 | #sonar.cfamily.build-wrapper-output=./build/bw-output 19 | -------------------------------------------------------------------------------- /src/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(project_name app) 2 | 3 | if(UNIX AND (NOT APPLE)) 4 | #Set rpath 5 | set(CMAKE_INSTALL_RPATH ".") 6 | set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 7 | endif(UNIX AND (NOT APPLE)) 8 | 9 | file(GLOB_RECURSE APP_SRC AFMain.cpp) 10 | add_executable(${project_name} ${APP_SRC}) 11 | 12 | if(WIN32) 13 | target_link_libraries(${project_name}) 14 | else(UNIX) 15 | target_link_libraries(${project_name} pthread dl --coverage) 16 | endif() 17 | 18 | set_target_properties(${project_name} PROPERTIES OUTPUT_NAME_DEBUG "app_d") 19 | set_target_properties(${project_name} PROPERTIES 20 | FOLDER "app" 21 | ARCHIVE_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 22 | RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 23 | LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR}) 24 | -------------------------------------------------------------------------------- /src/base/AFDep.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include "base/lexical_cast.hpp" 26 | 27 | #define ARK_LEXICAL_CAST lexical_cast 28 | -------------------------------------------------------------------------------- /src/base/AFErrorCode.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ArkNX 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | namespace ark { 24 | 25 | enum class AFErrorCode : uint32_t 26 | { 27 | SUCCESS = 0, 28 | 29 | KCP_SERVER_DISCONNECT = 1000, // kcp server disconnect when dtor 30 | KCP_TIME_OUT_DISCONNECT = 1001, // kcp timeout disconnect 31 | KCP_FORCE_DISCONNECT = 1002, // force disconnect 32 | KCP_CONNECT_TIMEOUT = 1003, // connect timeout 33 | PEER_DISCONNECT = 1004, // peer(client/server) disconnect 34 | 35 | // will add error code 36 | LOGIC_ERROR_CODE_START = 10000, 37 | }; 38 | } -------------------------------------------------------------------------------- /src/base/AFEventDefine.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | namespace ark { 24 | 25 | enum AFEventDefine 26 | { 27 | ////////////////Has Self---logic////////////////////////////////////////////////////////// 28 | // arg[0]:object 29 | AFED_ON_CLIENT_LEAVE_SCENE, 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /src/base/AFNoncopyable.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | namespace ark { 24 | 25 | class AFNoncopyable 26 | { 27 | protected: 28 | AFNoncopyable() = default; 29 | ~AFNoncopyable() = default; 30 | 31 | public: 32 | AFNoncopyable(const AFNoncopyable&) = delete; 33 | AFNoncopyable& operator=(const AFNoncopyable&) = delete; 34 | AFNoncopyable(AFNoncopyable&&) = delete; 35 | AFNoncopyable& operator=(AFNoncopyable&&) = delete; 36 | }; 37 | 38 | } // namespace ark -------------------------------------------------------------------------------- /src/base/container/AFLockFreeQueue.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "readerwriterqueue/readerwriterqueue.h" 24 | #include "base/AFPlatform.hpp" 25 | 26 | namespace ark { 27 | 28 | template 29 | class AFLockFreeQueue 30 | { 31 | public: 32 | AFLockFreeQueue() = default; 33 | ~AFLockFreeQueue() = default; 34 | 35 | bool Push(const T& object) 36 | { 37 | return queue_.enqueue(object); 38 | } 39 | 40 | bool Pop(T& object) 41 | { 42 | return queue_.try_dequeue(object); 43 | } 44 | 45 | size_t Count() 46 | { 47 | return queue_.size_approx(); 48 | } 49 | 50 | private: 51 | moodycamel::BlockingReaderWriterQueue queue_; 52 | }; 53 | 54 | } // namespace ark 55 | -------------------------------------------------------------------------------- /src/base/container/AFThreadSafeQueue.hpp: -------------------------------------------------------------------------------- 1 | #include "base/AFPlatform.hpp" 2 | 3 | namespace ark { 4 | 5 | template 6 | class AFThreadSafeQueue 7 | { 8 | private: 9 | std::queue data_queue; 10 | std::mutex mutex_; 11 | 12 | public: 13 | AFThreadSafeQueue() = default; 14 | 15 | size_t size() 16 | { 17 | std::lock_guard guard(mutex_); 18 | return data_queue.size(); 19 | } 20 | 21 | void push(T new_value) 22 | { 23 | std::lock_guard guard(mutex_); 24 | data_queue.push(new_value); 25 | } 26 | bool try_pop(T& value) 27 | { 28 | std::lock_guard guard(mutex_); 29 | if (data_queue.empty()) 30 | { 31 | return false; 32 | } 33 | 34 | value = data_queue.front(); 35 | data_queue.pop(); 36 | return true; 37 | } 38 | 39 | std::queue grab_all() 40 | { 41 | std::queue ret; 42 | { 43 | std::lock_guard guard(mutex_); 44 | std::swap(ret, data_queue); 45 | } 46 | return ret; 47 | } 48 | 49 | bool empty() const 50 | { 51 | std::lock_guard guard(mutex_); 52 | return data_queue.empty(); 53 | } 54 | }; 55 | } // namespace ark -------------------------------------------------------------------------------- /src/base/lock/AFSpinLock.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFPlatform.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFSpinLock 28 | { 29 | public: 30 | AFSpinLock() 31 | : atomic_lock_(false) 32 | { 33 | } 34 | AFSpinLock(AFSpinLock const&) = default; 35 | AFSpinLock(AFSpinLock&&) = default; 36 | AFSpinLock& operator=(AFSpinLock const&) = default; 37 | AFSpinLock& operator=(AFSpinLock&&) = default; 38 | 39 | ~AFSpinLock(void) = default; 40 | 41 | inline void lock() 42 | { 43 | while (atomic_lock_.exchange(true)) 44 | ; 45 | } 46 | 47 | inline void unlock() 48 | { 49 | atomic_lock_ = false; 50 | } 51 | 52 | inline bool isLocked() const 53 | { 54 | return atomic_lock_; 55 | } 56 | 57 | private: 58 | std::atomic_bool atomic_lock_; 59 | }; 60 | 61 | } // namespace ark -------------------------------------------------------------------------------- /src/base/spdlog/sinks/README.md: -------------------------------------------------------------------------------- 1 | # spdlog custom sinks 2 | 3 | - date_and_hour_file_sink, rotate by hour, put the log into date directory, like: `log/20190710/test_14.log` 4 | - rotating_file_with_date_sink, rotate by file size, put the log into date directory, like: `log/20190710/test.1.log` -------------------------------------------------------------------------------- /src/interface/AFIPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFPlatform.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFPluginManager; 28 | 29 | class AFIPlugin 30 | { 31 | public: 32 | virtual ~AFIPlugin() = default; 33 | virtual int GetPluginVersion() = 0; 34 | virtual const std::string GetPluginName() = 0; 35 | 36 | virtual void Install() = 0; 37 | virtual void Uninstall() = 0; 38 | 39 | virtual AFPluginManager* GetPluginManager() const = 0; 40 | virtual void SetPluginManager(AFPluginManager* p) = 0; 41 | 42 | virtual void SetPluginConf(std::string const& value) = 0; 43 | }; 44 | 45 | } // namespace ark 46 | -------------------------------------------------------------------------------- /src/plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | function(BUILD_PLUGIN_MACRO project_name) 2 | if (UNIX AND (NOT APPLE)) 3 | #Set rpath 4 | set(CMAKE_INSTALL_RPATH ".") 5 | set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 6 | endif (UNIX AND (NOT APPLE)) 7 | 8 | file(GLOB_RECURSE PLUGIN_SRC *.h *.hpp *.cpp *.cc *.c) 9 | add_library(${project_name} SHARED ${PLUGIN_SRC}) 10 | set_target_properties(${project_name} PROPERTIES PREFIX "") 11 | set_target_properties(${project_name} PROPERTIES 12 | FOLDER "plugins" 13 | ARCHIVE_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 14 | RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 15 | LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR}) 16 | 17 | add_dependencies(${project_name} AFProto) 18 | target_link_libraries(${project_name} ${ARGN}) 19 | endfunction(BUILD_PLUGIN_MACRO) 20 | 21 | #--------------------------------------------------------------------------------------- 22 | # sub projects 23 | #--------------------------------------------------------------------------------------- 24 | # Main plugins 25 | add_subdirectory(kernel) 26 | add_subdirectory(bus) 27 | add_subdirectory(net) 28 | add_subdirectory(utility) 29 | add_subdirectory(etcd_client) 30 | #add_subdirectory(consul) 31 | 32 | # Special plugins 33 | #add_subdirectory(osssdk) 34 | #add_subdirectory(physic) 35 | 36 | #add_subdirectory(http) 37 | #add_subdirectory(redis) 38 | 39 | #add_subdirectory(mysql) 40 | #add_subdirectory(kafka) -------------------------------------------------------------------------------- /src/plugin/README.md: -------------------------------------------------------------------------------- 1 | # All common plugins 2 | 3 | | Plugin | Description | 4 | | ------- | -------------------------------------------------------------------- | 5 | | consul | Service discovery plugin, use Consul | 6 | | log | Log plugin, supporting dev-log and oss-log | 7 | | net | Network plugin, supporting TCP&WebSocket server and client | 8 | | utility | Utility plugin, some utils module like GUID, timer, schedule, etc. | 9 | | bus | Bus plugin, logic relationship manangement | 10 | | kernel | Kernel plugin, with game logic data and configration data management | 11 | 12 | ## Plan 13 | 14 | - redis 15 | - mysql 16 | -------------------------------------------------------------------------------- /src/plugin/bus/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(WIN32) 2 | BUILD_PLUGIN_MACRO(AFBusPlugin 3 | debug AFProto_d.lib 4 | optimized AFProto.lib 5 | ${PROTOBUF_LIBRARIES}) 6 | elseif(APPLE) 7 | BUILD_PLUGIN_MACRO(AFBusPlugin 8 | debug ${BIN_OUTPUT_DIR}/AFProto_d.a 9 | optimized ${BIN_OUTPUT_DIR}/AFProto.a 10 | ${PROTOBUF_LIBRARIES}) 11 | else(UNIX) 12 | BUILD_PLUGIN_MACRO(AFBusPlugin 13 | debug :AFProto_d.a 14 | optimized :AFProto.a 15 | ${PROTOBUF_LIBRARIES}) 16 | endif() 17 | -------------------------------------------------------------------------------- /src/plugin/bus/include/AFBusPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFBusPlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/plugin/bus/src/AFBusPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "bus/include/AFBusPlugin.hpp" 22 | #include "bus/include/AFCBusModule.hpp" 23 | #include "bus/include/AFCMsgModule.hpp" 24 | 25 | namespace ark { 26 | 27 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFBusPlugin) 28 | 29 | void AFBusPlugin::Install() 30 | { 31 | ARK_REGISTER_MODULE(AFIBusModule, AFCBusModule); 32 | ARK_REGISTER_MODULE(AFIMsgModule, AFCMsgModule); 33 | } 34 | 35 | void AFBusPlugin::Uninstall() 36 | { 37 | ARK_UNREGISTER_MODULE(AFIMsgModule, AFCMsgModule); 38 | ARK_UNREGISTER_MODULE(AFIBusModule, AFCBusModule); 39 | } 40 | 41 | } // namespace ark 42 | -------------------------------------------------------------------------------- /src/plugin/consul/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(WIN32) 2 | BUILD_PLUGIN_MACRO(AFConsulPlugin 3 | debug AFProto_d.lib 4 | optimized AFProto.lib 5 | ${PROTOBUF_LIBRARIES}) 6 | elseif(APPLE) 7 | BUILD_PLUGIN_MACRO(AFConsulPlugin 8 | debug ${BIN_OUTPUT_DIR}/AFProto_d.a 9 | optimized ${BIN_OUTPUT_DIR}/AFProto.a 10 | ${PROTOBUF_LIBRARIES}) 11 | else(UNIX) 12 | BUILD_PLUGIN_MACRO(AFConsulPlugin 13 | debug :AFProto_d.a 14 | optimized :AFProto.a 15 | ${PROTOBUF_LIBRARIES}) 16 | endif() 17 | -------------------------------------------------------------------------------- /src/plugin/consul/include/AFCConsulModule.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "base/AFPluginManager.hpp" 4 | #include "net/interface/AFIHttpClientModule.hpp" 5 | #include "consul/interface/AFIConsulModule.hpp" 6 | 7 | namespace ark { 8 | 9 | class AFCConsulModule final : public AFIConsulModule 10 | { 11 | ARK_DECLARE_MODULE_FUNCTIONS 12 | public: 13 | bool Init() override; 14 | 15 | // void SetRegisterCenter(const std::string& center_ip, const uint16_t center_port) override; 16 | 17 | ananas::Future> RegisterService(const consul::service_data& service) override; 18 | 19 | ananas::Future> DeregisterService(const std::string& service_id) override; 20 | 21 | ananas::Future> GetHealthServices( 22 | const std::string& service_name, const std::string& tag_filter) override; 23 | 24 | //bool GetHealthServices(const std::string& service_name, const std::vector& tag_filter_list, 25 | // consul::service_set& services) override; 26 | 27 | ananas::Future> GetKeyValue(const std::string& key) override; 28 | ananas::Future> SetKeyValue(const std::string& key, const std::string& value) override; 29 | ananas::Future> DelKeyValue(const std::string& key) override; 30 | 31 | protected: 32 | bool LoadConfig(); 33 | 34 | private: 35 | std::string consul_ip_{}; 36 | uint16_t consul_port_{8500}; 37 | 38 | AFIHttpClientModule* m_pHttpClientModule; 39 | }; 40 | 41 | } // namespace ark 42 | -------------------------------------------------------------------------------- /src/plugin/consul/include/AFConsulPlugin.hpp: -------------------------------------------------------------------------------- 1 | #include "interface/AFIPlugin.hpp" 2 | #include "base/AFPluginManager.hpp" 3 | 4 | namespace ark { 5 | 6 | ARK_DECLARE_PLUGIN(AFConsulPlugin) 7 | 8 | } // namespace ark 9 | -------------------------------------------------------------------------------- /src/plugin/consul/interface/AFIConsulModule.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "interface/AFIModule.hpp" 5 | #include "proto/cpp/AFConsul.pb.h" 6 | 7 | namespace ark { 8 | 9 | class AFIConsulModule : public AFIModule 10 | { 11 | public: 12 | // Set register center url(You should call this function first) 13 | // virtual void SetRegisterCenter(const std::string& center_ip, const uint16_t center_port) = 0; 14 | 15 | // Register a service to register center 16 | virtual ananas::Future> RegisterService(const consul::service_data& service) = 0; 17 | 18 | // Unregister service form register center 19 | virtual ananas::Future> DeregisterService(const std::string& service_id) = 0; 20 | 21 | // Get all health service with tag filter 22 | virtual ananas::Future> GetHealthServices( 23 | const std::string& service_name, const std::string& tag_filter) = 0; 24 | 25 | //virtual bool GetHealthServices(const std::string& service_name, const std::vector& tag_filter_list, 26 | // consul::service_set& services) = 0; 27 | 28 | // Get/Set value 29 | virtual ananas::Future> GetKeyValue(const std::string& key) = 0; 30 | virtual ananas::Future> SetKeyValue( 31 | const std::string& key, const std::string& value) = 0; 32 | virtual ananas::Future> DelKeyValue(const std::string& key) = 0; 33 | }; 34 | 35 | } // namespace ark 36 | -------------------------------------------------------------------------------- /src/plugin/consul/src/AFConsulPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "consul/include/AFConsulPlugin.hpp" 2 | #include "consul/include/AFCConsulModule.hpp" 3 | 4 | namespace ark { 5 | 6 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFConsulPlugin) 7 | 8 | void AFConsulPlugin::Install() 9 | { 10 | ARK_REGISTER_MODULE(AFIConsulModule, AFCConsulModule); 11 | } 12 | 13 | void AFConsulPlugin::Uninstall() 14 | { 15 | ARK_UNREGISTER_MODULE(AFIConsulModule, AFCConsulModule); 16 | } 17 | 18 | } // namespace ark 19 | -------------------------------------------------------------------------------- /src/plugin/etcd_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_PLUGIN_MACRO(AFEtcdClientPlugin) 2 | -------------------------------------------------------------------------------- /src/plugin/etcd_client/include/AFCEtcdClient.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "base/random/AFRandom.hpp" 4 | #include "net/interface/AFIHttpClientModule.hpp" 5 | #include "etcd_client/interface/AFIEtcdClient.hpp" 6 | 7 | namespace ark { 8 | 9 | /** 10 | * AFCEtcdClient is NOT thread-safe, please create an AFCEtcdClient object per thread, or use a lock mechanism. 11 | */ 12 | class AFCEtcdClient final : public AFIEtcdClient { 13 | public: 14 | /** 15 | * Constructor 16 | * @param httpClient 17 | * @param endpoints { "172.20.3.74:2379", "172.20.3.75:2379" } for example 18 | * @param connectTimeout in seconds 19 | * @param ioTimeout in seconds 20 | */ 21 | AFCEtcdClient(AFIHttpClientModule* httpClient, std::vector endpoints, int connectTimeout, int ioTimeout); 22 | 23 | void Grant(std::function)> cb, int ttl) override; 24 | void Keepalive(std::function)> cb, int64_t leaseID) override; 25 | 26 | private: 27 | void post(std::function)> cb, const std::string& api, std::shared_ptr body, size_t epIdx, size_t triedCnt); 28 | 29 | private: 30 | AFIHttpClientModule* const httpClient_; 31 | int const connectTimeout_; 32 | int const ioTimeout_; 33 | 34 | AFRandom rand_; // TODO might not need this 35 | size_t selectedEndpointIndex_; 36 | std::vector> endpoints_; 37 | }; 38 | 39 | } // namespace ark 40 | -------------------------------------------------------------------------------- /src/plugin/etcd_client/include/AFCEtcdClientModule.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "base/AFPluginManager.hpp" 4 | #include "net/interface/AFIHttpClientModule.hpp" 5 | #include "etcd_client/interface/AFIEtcdClientModule.hpp" 6 | 7 | namespace ark { 8 | 9 | class AFCEtcdClientModule final : public AFIEtcdClientModule { 10 | ARK_DECLARE_MODULE_FUNCTIONS 11 | 12 | public: 13 | virtual bool Init() override; 14 | 15 | virtual std::shared_ptr CreateEtcdClient(std::vector endpoints, int ioTimeout = 5, int connectTimeout = 2) override; 16 | 17 | private: 18 | AFIHttpClientModule* httpClientModule_; 19 | }; 20 | 21 | } // namespace ark 22 | -------------------------------------------------------------------------------- /src/plugin/etcd_client/include/AFEtcdClientPlugin.hpp: -------------------------------------------------------------------------------- 1 | #include "interface/AFIPlugin.hpp" 2 | #include "base/AFPluginManager.hpp" 3 | 4 | namespace ark { 5 | 6 | ARK_DECLARE_PLUGIN(AFEtcdClientPlugin) 7 | 8 | } // namespace ark 9 | -------------------------------------------------------------------------------- /src/plugin/etcd_client/interface/AFIEtcdClient.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace ark { 7 | 8 | class AFIEtcdClient { 9 | public: 10 | virtual ~AFIEtcdClient() = default; 11 | 12 | /** 13 | * Grant a lease 14 | * @param cb will be called in the same thread where AFIHttpClientModule::Update is called. 15 | * . Success if LeaseID >= 0, otherwise ErrorMessage containers the error message. 16 | * @param ttl in seconds 17 | */ 18 | virtual void Grant(std::function)> cb, int ttl) = 0; 19 | /** 20 | * Keep the lease alive 21 | * @param cb will be called in the same thread where AFIHttpClientModule::Update is called. 22 | * . Success if Result == true, otherwise ErrorMessage containers the error message. 23 | * @param leaseID 24 | */ 25 | virtual void Keepalive(std::function)> cb, int64_t leaseID) = 0; 26 | }; 27 | 28 | } // namespace ark 29 | -------------------------------------------------------------------------------- /src/plugin/etcd_client/interface/AFIEtcdClientModule.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "interface/AFIModule.hpp" 4 | #include "AFIEtcdClient.hpp" 5 | 6 | namespace ark { 7 | 8 | class AFIEtcdClientModule : public AFIModule { 9 | public: 10 | virtual std::shared_ptr CreateEtcdClient(std::vector endpoints, int ioTimeout = 5, int connectTimeout = 2) = 0; 11 | }; 12 | 13 | } // namespace ark 14 | -------------------------------------------------------------------------------- /src/plugin/etcd_client/src/AFCEtcdClientModule.cpp: -------------------------------------------------------------------------------- 1 | #include "etcd_client/include/AFCEtcdClient.hpp" 2 | #include "etcd_client/include/AFCEtcdClientModule.hpp" 3 | 4 | namespace ark { 5 | 6 | bool AFCEtcdClientModule::Init() 7 | { 8 | httpClientModule_ = FindModule(); 9 | return httpClientModule_ != nullptr; 10 | } 11 | 12 | std::shared_ptr AFCEtcdClientModule::CreateEtcdClient(std::vector endpoints, int ioTimeout, int connectTimeout) 13 | { 14 | return std::make_shared(httpClientModule_, std::move(endpoints), connectTimeout, ioTimeout); 15 | } 16 | 17 | } // namespace ark 18 | -------------------------------------------------------------------------------- /src/plugin/etcd_client/src/AFEtcdClientPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "etcd_client/include/AFEtcdClientPlugin.hpp" 2 | #include "etcd_client/include/AFCEtcdClientModule.hpp" 3 | 4 | namespace ark { 5 | 6 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFEtcdClientPlugin) 7 | 8 | void AFEtcdClientPlugin::Install() 9 | { 10 | ARK_REGISTER_MODULE(AFIEtcdClientModule, AFCEtcdClientModule); 11 | } 12 | 13 | void AFEtcdClientPlugin::Uninstall() 14 | { 15 | ARK_UNREGISTER_MODULE(AFIEtcdClientModule, AFCEtcdClientModule); 16 | } 17 | 18 | } // namespace ark 19 | -------------------------------------------------------------------------------- /src/plugin/http/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${ROOT_DIR}/3rdparty/BeastHttp/BeastHttp/include) 2 | BUILD_PLUGIN_MACRO(AFHttpPlugin) -------------------------------------------------------------------------------- /src/plugin/http/include/AFHttpPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFHttpPlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/plugin/http/src/AFHttpPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "http/include/AFHttpPlugin.hpp" 22 | #include "http/include/AFCHttpServerModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFHttpPlugin) 27 | 28 | void AFHttpPlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(AFIHttpServerModule, AFCHttpServerModule); 31 | } 32 | 33 | void AFHttpPlugin::Uninstall() 34 | { 35 | ARK_DEREGISTER_MODULE(AFIHttpServerModule, AFCHttpServerModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /src/plugin/kafka/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (WIN32) 2 | include_directories( 3 | ) 4 | 5 | BUILD_PLUGIN_MACRO(AFKafkaPlugin 6 | ) 7 | else () 8 | find_package(librdkafka REQUIRED) 9 | find_package(OpenSSL REQUIRED) 10 | find_package(Zstd REQUIRED) 11 | find_package(LZ4 REQUIRED) 12 | find_package(ZLIB REQUIRED) 13 | 14 | 15 | include_directories( 16 | ${LIBRDKAFKA_INCLUDE_DIR} 17 | ${OPENSSL_INCLUDE_DIR} 18 | ${ZSTD_INCLUDE_DIRS} 19 | ${LZ4_INCLUDE_DIR} 20 | ${ZLIB_INCLUDE_DIRS} 21 | ) 22 | 23 | BUILD_PLUGIN_MACRO(AFKafkaPlugin 24 | ${LIBRDKAFKA_CPP_LIBRARIES} 25 | ${LIBRDKAFKA_LIBRARIES} 26 | ${OPENSSL_LIBRARIES} 27 | ${ZSTD_LIBRARIES} 28 | ${LZ4_LIBRARY} 29 | ${ZLIB_LIBRARIES} 30 | ) 31 | endif () 32 | -------------------------------------------------------------------------------- /src/plugin/kafka/include/AFCKafkaModule.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "base/AFPluginManager.hpp" 4 | #include "base/container/AFArrayMap.hpp" 5 | #include "kafka/include/AFKafka.hpp" 6 | #include "kafka/interface/AFIKafkaModule.hpp" 7 | 8 | namespace ark { 9 | 10 | class AFCKafkaModule 11 | : public AFIKafkaModule 12 | , public RdKafka::DeliveryReportCb 13 | , public RdKafka::EventCb 14 | { 15 | ARK_DECLARE_MODULE_FUNCTIONS 16 | public: 17 | bool Init() override; 18 | bool Update() override; 19 | 20 | bool InitProducer(std::string const& brokers, std::string const& topic) override; 21 | int Produce(std::string const& topic, std::string const& payload, void* user_data) override; 22 | 23 | protected: 24 | void dr_cb(RdKafka::Message& message) override; 25 | void event_cb(RdKafka::Event& event) override; 26 | 27 | private: 28 | AFArrayMap producers_; 29 | }; 30 | 31 | } // namespace ark -------------------------------------------------------------------------------- /src/plugin/kafka/include/AFKafkaPlugin.hpp: -------------------------------------------------------------------------------- 1 | #include "interface/AFIPlugin.hpp" 2 | #include "base/AFPluginManager.hpp" 3 | 4 | namespace ark { 5 | 6 | ARK_DECLARE_PLUGIN(AFKafkaPlugin) 7 | 8 | } // namespace ark 9 | -------------------------------------------------------------------------------- /src/plugin/kafka/interface/AFIKafkaModule.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "interface/AFIModule.hpp" 4 | 5 | namespace ark { 6 | 7 | class AFIKafkaModule : public AFIModule 8 | { 9 | public: 10 | // single producer 11 | virtual bool InitProducer(std::string const& brokers, std::string const& topic) = 0; 12 | virtual int Produce(std::string const& topic, std::string const& payload, void* user_data) = 0; 13 | 14 | // producer pool 15 | //virtual bool InitProducerPool(size_t pool_size, std::string const& brokers, std::string const& topic) = 0; 16 | }; 17 | 18 | } // namespace ark 19 | -------------------------------------------------------------------------------- /src/plugin/kafka/src/AFKafkaPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "kafka/include/AFKafkaPlugin.hpp" 2 | #include "kafka/include/AFCKafkaModule.hpp" 3 | 4 | namespace ark { 5 | 6 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFKafkaPlugin) 7 | 8 | void AFKafkaPlugin::Install() 9 | { 10 | ARK_REGISTER_MODULE(AFIKafkaModule, AFCKafkaModule); 11 | } 12 | 13 | void AFKafkaPlugin::Uninstall() 14 | { 15 | ARK_UNREGISTER_MODULE(AFIKafkaModule, AFCKafkaModule); 16 | } 17 | 18 | } // namespace ark 19 | -------------------------------------------------------------------------------- /src/plugin/kernel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(WIN32) 2 | BUILD_PLUGIN_MACRO(AFKernelPlugin 3 | debug AFProto_d.lib 4 | optimized AFProto.lib 5 | ${PROTOBUF_LIBRARIES}) 6 | elseif(APPLE) 7 | BUILD_PLUGIN_MACRO(AFKernelPlugin 8 | debug ${BIN_OUTPUT_DIR}/AFProto_d.a 9 | optimized ${BIN_OUTPUT_DIR}/AFProto.a 10 | ${PROTOBUF_LIBRARIES}) 11 | else(UNIX) 12 | BUILD_PLUGIN_MACRO(AFKernelPlugin 13 | debug :AFProto_d.a 14 | optimized :AFProto.a 15 | ${PROTOBUF_LIBRARIES}) 16 | endif() 17 | -------------------------------------------------------------------------------- /src/plugin/kernel/include/AFCConfigModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "kernel/interface/AFIConfigModule.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | #include "kernel/interface/AFIClassMetaModule.hpp" 26 | 27 | namespace ark { 28 | 29 | class AFCConfigModule final : public AFIConfigModule 30 | { 31 | ARK_DECLARE_MODULE_FUNCTIONS 32 | public: 33 | bool Init() override; 34 | bool Shut() override; 35 | 36 | bool Load() override; 37 | bool Save() override; 38 | bool Clear() override; 39 | 40 | std::shared_ptr FindStaticEntity(const ID_TYPE config_id) override; 41 | 42 | protected: 43 | bool LoadConfig(std::shared_ptr pClassMeta); 44 | 45 | private: 46 | bool loaded_{false}; 47 | 48 | AFIClassMetaModule* m_pClassModule{nullptr}; 49 | AFStaticEntityManager* m_pStaticEntityManager{nullptr}; 50 | }; 51 | 52 | } // namespace ark 53 | -------------------------------------------------------------------------------- /src/plugin/kernel/include/AFCContainerManager.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ArkNX 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "kernel/interface/AFIContainerManager.hpp" 24 | #include "AFCContainer.hpp" 25 | 26 | namespace ark { 27 | 28 | class AFCContainerManager final : public AFIContainerManager 29 | { 30 | private: 31 | // container 32 | ContainerList container_data_; 33 | 34 | public: 35 | explicit AFCContainerManager() = default; 36 | 37 | // find container 38 | std::shared_ptr FindContainer(const uint32_t index) const override; 39 | 40 | std::shared_ptr CreateContainer( 41 | std::shared_ptr pClassMeta, const uint32_t index, const guid_t& parent_id) override; 42 | 43 | bool DestroyContainer(const uint32_t index) override; 44 | 45 | const ContainerList& GetContainerList() const override; 46 | }; 47 | 48 | } // namespace ark 49 | -------------------------------------------------------------------------------- /src/plugin/kernel/include/AFKernelPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFKernelPlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/plugin/kernel/interface/AFIConfigModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | #include "AFIStaticEntity.hpp" 25 | #include "kernel/include/AFStaticEntityManager.hpp" 26 | 27 | namespace ark { 28 | 29 | class AFIConfigModule : public AFIModule 30 | { 31 | public: 32 | virtual bool Load() = 0; 33 | virtual bool Save() = 0; 34 | virtual bool Clear() = 0; 35 | 36 | // find config 37 | virtual std::shared_ptr FindStaticEntity(const ID_TYPE config_id) = 0; 38 | }; 39 | 40 | } // namespace ark 41 | -------------------------------------------------------------------------------- /src/plugin/kernel/interface/AFIContainerManager.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ArkNX 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "AFIContainer.hpp" 24 | #include "kernel/include/AFClassMeta.hpp" 25 | 26 | namespace ark { 27 | 28 | class AFIContainerManager 29 | { 30 | public: 31 | using ContainerList = AFSmartPtrMap; 32 | 33 | virtual ~AFIContainerManager() = default; 34 | 35 | virtual std::shared_ptr FindContainer(const uint32_t index) const = 0; 36 | virtual std::shared_ptr CreateContainer( 37 | std::shared_ptr pClassMeta, const uint32_t index, const guid_t& parent_id) = 0; 38 | virtual bool DestroyContainer(const uint32_t index) = 0; 39 | virtual const ContainerList& GetContainerList() const = 0; 40 | }; 41 | 42 | } // namespace ark 43 | -------------------------------------------------------------------------------- /src/plugin/mysql/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${ROOT_DIR}/3rdparty/mysqlpp/mysql) 2 | 3 | if(WIN32) 4 | # BUILD_PLUGIN_MACRO(AFMysqlPlugin /usr/local/lib/libmysqlpp.so) 5 | elseif(APPLE) 6 | BUILD_PLUGIN_MACRO(AFMysqlPlugin /usr/local/lib/libmysqlpp.dylib) 7 | else(UNIX) 8 | BUILD_PLUGIN_MACRO(AFMysqlPlugin /usr/local/lib/libmysqlpp.so) 9 | endif() -------------------------------------------------------------------------------- /src/plugin/mysql/include/AFMysqlPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2019 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFMysqlPlugin) 29 | 30 | } // namespace ark -------------------------------------------------------------------------------- /src/plugin/mysql/interface/AFIMysqlDriverManagerModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2019 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | #include "mysql/interface/AFIMysqlDriverModule.hpp" 25 | 26 | namespace ark { 27 | 28 | class AFIMysqlDriverManagerModule : public AFIModule 29 | { 30 | public: 31 | virtual bool AddMySQLServer(const int nServerID, const std::string& strDns, const std::string& strIP, 32 | const int nPort, const std::string strDBName, const std::string strDBUser, const std::string strDBPwd, 33 | const int nRconnectTime = 10, const int nRconneCount = -1) = 0; 34 | virtual AFIMysqlDriverModule* GetMySQLDriver() = 0; 35 | virtual void CheckMySQL() = 0; 36 | }; 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /src/plugin/net/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (WIN32) 2 | BUILD_PLUGIN_MACRO(AFNetPlugin 3 | debug AFProto_d.lib 4 | optimized AFProto.lib 5 | ${PROTOBUF_LIBRARIES}) 6 | elseif (APPLE) 7 | BUILD_PLUGIN_MACRO(AFNetPlugin 8 | debug ${BIN_OUTPUT_DIR}/AFProto_d.a 9 | optimized ${BIN_OUTPUT_DIR}/AFProto.a 10 | ${PROTOBUF_LIBRARIES}) 11 | else (UNIX) 12 | BUILD_PLUGIN_MACRO(AFNetPlugin 13 | debug :AFProto_d.a 14 | optimized :AFProto.a 15 | ${PROTOBUF_LIBRARIES}) 16 | endif () -------------------------------------------------------------------------------- /src/plugin/net/include/AFCHttpServer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "net/interface/AFINet.hpp" 5 | 6 | namespace ark { 7 | 8 | #ifndef ASIO_STANDALONE 9 | 10 | class AFCHttpServer 11 | { 12 | private: 13 | std::shared_ptr server_; 14 | 15 | public: 16 | AFCHttpServer(); 17 | ~AFCHttpServer(); 18 | }; 19 | 20 | #endif //ASIO_STANDALONE 21 | 22 | } // namespace ark 23 | -------------------------------------------------------------------------------- /src/plugin/net/include/AFNetPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFNetPlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/plugin/net/src/AFCHttpServer.cpp: -------------------------------------------------------------------------------- 1 | #include "net/include/AFCHttpServer.hpp" 2 | 3 | namespace ark { 4 | 5 | #ifndef ASIO_STANDALONE 6 | 7 | AFCHttpServer::AFCHttpServer() 8 | { 9 | server_ = std::make_shared(); 10 | //server_-> 11 | } 12 | 13 | AFCHttpServer::~AFCHttpServer() 14 | { 15 | // TODO 16 | } 17 | 18 | #endif //ASIO_STANDALONE 19 | 20 | } // namespace ark -------------------------------------------------------------------------------- /src/plugin/net/src/AFNetPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "net/include/AFNetPlugin.hpp" 22 | #include "net/include/AFCHttpClientModule.hpp" 23 | #include "net/include/AFCNetServiceManagerModule.hpp" 24 | 25 | namespace ark { 26 | 27 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFNetPlugin) 28 | 29 | void AFNetPlugin::Install() 30 | { 31 | ARK_REGISTER_MODULE(AFIHttpClientModule, AFCHttpClientModule); 32 | ARK_REGISTER_MODULE(AFINetServiceManagerModule, AFCNetServiceManagerModule); 33 | } 34 | 35 | void AFNetPlugin::Uninstall() 36 | { 37 | ARK_UNREGISTER_MODULE(AFINetServiceManagerModule, AFCNetServiceManagerModule); 38 | ARK_UNREGISTER_MODULE(AFIHttpClientModule, AFCHttpClientModule); 39 | } 40 | 41 | } // namespace ark 42 | -------------------------------------------------------------------------------- /src/plugin/osssdk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_PLUGIN_MACRO(AFOssSDKPlugin) -------------------------------------------------------------------------------- /src/plugin/osssdk/include/AFCOssSDKModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFPluginManager.hpp" 24 | #include "osssdk/interface/AFIOssSDKModule.hpp" 25 | 26 | namespace ark { 27 | 28 | class AFCOssSDKModule final : public AFIOssSDKModule 29 | { 30 | ARK_DECLARE_MODULE_FUNCTIONS 31 | public: 32 | // TODO 33 | 34 | private: 35 | // TODO 36 | }; 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /src/plugin/osssdk/include/AFOssSDKPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFOssSDKPlugin) 29 | 30 | } // namespace ark -------------------------------------------------------------------------------- /src/plugin/osssdk/interface/AFIOssSDKModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFIOssSDKModule : public AFIModule 28 | { 29 | public: 30 | //virtual method 31 | }; 32 | 33 | } // namespace ark 34 | -------------------------------------------------------------------------------- /src/plugin/osssdk/src/AFCOssSDKModule.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "osssdk/include/AFCOssSDKModule.hpp" 22 | 23 | namespace ark { 24 | //method realization 25 | 26 | } // namespace ark 27 | -------------------------------------------------------------------------------- /src/plugin/osssdk/src/AFOssSDKPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "osssdk/include/AFOssSDKPlugin.hpp" 22 | #include "osssdk/include/AFCOssSDKModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFOssSDKPlugin) 27 | 28 | void AFOssSDKPlugin::Install() 29 | { 30 | // install module 31 | ARK_REGISTER_MODULE(AFIOssSDKModule, AFCOssSDKModule); 32 | } 33 | 34 | void AFOssSDKPlugin::Uninstall() 35 | { 36 | // uninstall module 37 | ARK_DEREGISTER_MODULE(AFIOssSDKModule, AFCOssSDKModule); 38 | } 39 | 40 | } // namespace ark 41 | -------------------------------------------------------------------------------- /src/plugin/physic/include/AFPhysicPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFPhysicPlugin) 29 | 30 | } // namespace ark -------------------------------------------------------------------------------- /src/plugin/physic/interface/AFIPhysicConfigModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | #include "plugin/physic/include/AFPhysicDefine.hpp" 25 | 26 | namespace ark { 27 | 28 | class AFIPhysicConfigModule : public AFIModule 29 | { 30 | public: 31 | ///get scene by config id 32 | virtual bool GetPhysicScene(const std::string& scene_id, PhysicScene& scene) const = 0; 33 | virtual const PhysicSceneList& GetPhysicSceneList() const = 0; 34 | virtual const PhysicConfig& GetPhysicConfig() const = 0; 35 | }; 36 | 37 | } // namespace ark 38 | -------------------------------------------------------------------------------- /src/plugin/physic/src/AFPhysicPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "plugin/physic/include/AFPhysicPlugin.hpp" 22 | #include "plugin/physic/include/AFCPhysicModule.hpp" 23 | #include "plugin/physic/include/AFCPhysicConfigModule.hpp" 24 | 25 | namespace ark { 26 | 27 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFPhysicPlugin) 28 | 29 | void AFPhysicPlugin::Install() 30 | { 31 | // install module 32 | ARK_REGISTER_MODULE(AFIPhysicConfigModule, AFCPhysicConfigModule); 33 | ARK_REGISTER_MODULE(AFIPhysicModule, AFCPhysicModule); 34 | } 35 | 36 | void AFPhysicPlugin::Uninstall() 37 | { 38 | // uninstall module 39 | ARK_DEREGISTER_MODULE(AFIPhysicModule, AFCPhysicModule); 40 | ARK_DEREGISTER_MODULE(AFIPhysicConfigModule, AFCPhysicConfigModule); 41 | } 42 | 43 | } // namespace ark 44 | -------------------------------------------------------------------------------- /src/plugin/redis/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${ROOT_DIR}/3rdparty/cpp-bredis/include) 2 | 3 | BUILD_PLUGIN_MACRO(AFRedisPlugin) 4 | 5 | -------------------------------------------------------------------------------- /src/plugin/redis/include/AFRedisPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFRedisPlugin) 29 | 30 | } // namespace ark -------------------------------------------------------------------------------- /src/plugin/redis/src/AFRedisPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "redis/include/AFRedisPlugin.hpp" 22 | #include "redis/include/AFCRedisModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFRedisPlugin) 27 | 28 | void AFRedisPlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(AFIRedisModule, AFCRedisModule); 31 | } 32 | 33 | void AFRedisPlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(AFIRedisModule, AFCRedisModule); 36 | } 37 | 38 | } // namespace ark -------------------------------------------------------------------------------- /src/plugin/utility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Zstd REQUIRED) 2 | include_directories(${ZSTD_INCLUDE_DIRS}) 3 | 4 | # find_package(LZ4 REQUIRED) 5 | # include_directories(${LZ4_INCLUDE_DIR}) 6 | 7 | find_package(ZLIB REQUIRED) 8 | if (ZLIB_FOUND) 9 | mark_as_advanced(ZLIB_FOUND ZLIB_LIBRARIES ZLIB_INCLUDE_DIR) 10 | message(STATUS "Found ZLib add_library: ${ZLIB_LIBRARIES}") 11 | message(STATUS "Found ZLib headers: ${ZLIB_INCLUDE_DIR}") 12 | else() 13 | message(FATAL_ERROR "Zlib not found") 14 | endif(ZLIB_FOUND) 15 | 16 | include_directories(${ZLIB_INCLUDE_DIRS}) 17 | 18 | BUILD_PLUGIN_MACRO(AFUtilityPlugin ${ZSTD_LIBRARIES} ${ZLIB_LIBRARIES}) 19 | # BUILD_PLUGIN_MACRO(AFUtilityPlugin ${LZ4_LIBRARY}) -------------------------------------------------------------------------------- /src/plugin/utility/include/AFCGUIDModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFUidGenerator.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | #include "utility/interface/AFIGUIDModule.hpp" 26 | 27 | namespace ark { 28 | 29 | class AFCGUIDModule final : public AFIGUIDModule 30 | { 31 | ARK_DECLARE_MODULE_FUNCTIONS 32 | public: 33 | bool Init() override; 34 | 35 | guid_t CreateGUID() override; 36 | std::string ParseUID(const guid_t& id) override; 37 | 38 | private: 39 | #ifdef ARK_THREAD_SAFE 40 | std::unique_ptr uid_generator_{nullptr}; 41 | #else 42 | std::unique_ptr uid_generator_{nullptr}; 43 | #endif // ARK_THREAD_SAFE 44 | }; 45 | 46 | } // namespace ark 47 | -------------------------------------------------------------------------------- /src/plugin/utility/include/AFCScheduleModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFPluginManager.hpp" 24 | #include "utility/include/AFScheduler.hpp" 25 | #include "utility/interface/AFIScheduleModule.hpp" 26 | 27 | namespace ark { 28 | 29 | class AFCScheduleModule final : public AFIScheduleModule 30 | { 31 | ARK_DECLARE_MODULE_FUNCTIONS 32 | public: 33 | bool Init() override; 34 | 35 | protected: 36 | void AddIntervalSchedule(const std::chrono::system_clock::duration interval, SCHEDULER_FUNCTOR&& cb) override; 37 | 38 | void AddAtSchedule(const std::string& target_time, SCHEDULER_FUNCTOR&& cb) override; 39 | void AddCronSchedule(const std::string& cron_expression, SCHEDULER_FUNCTOR&& cb) override; 40 | 41 | private: 42 | std::shared_ptr scheduler{nullptr}; 43 | }; 44 | 45 | } // namespace ark 46 | -------------------------------------------------------------------------------- /src/plugin/utility/include/AFUtilityPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFUtilityPlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/plugin/utility/interface/AFICompressModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFEnum.hpp" 24 | #include "interface/AFIModule.hpp" 25 | 26 | namespace ark { 27 | 28 | class AFICompressModule : public AFIModule 29 | { 30 | public: 31 | virtual bool Compress(IN const ArkCompressType type, IN const char* in_data, IN std::size_t in_size, OUT std::string& compressed_buff, 32 | IN uint8_t compress_level = 1) = 0; 33 | 34 | virtual bool Decompress(IN const ArkCompressType type, 35 | IN const char* in_data, IN std::size_t in_size, OUT std::string& decompressed_buff) = 0; 36 | }; 37 | 38 | } // namespace ark -------------------------------------------------------------------------------- /src/plugin/utility/interface/AFIGUIDModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFIGUIDModule : public AFIModule 28 | { 29 | public: 30 | virtual guid_t CreateGUID() = 0; 31 | virtual std::string ParseUID(const guid_t& id) = 0; 32 | }; 33 | 34 | } // namespace ark -------------------------------------------------------------------------------- /src/plugin/utility/src/AFCScheduleModule.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "utility/include/AFCScheduleModule.hpp" 22 | 23 | namespace ark { 24 | 25 | bool AFCScheduleModule::Init() 26 | { 27 | scheduler = std::make_shared(16); 28 | return true; 29 | } 30 | 31 | void AFCScheduleModule::AddCronSchedule(const std::string& cron_expression, SCHEDULER_FUNCTOR&& cb) 32 | { 33 | scheduler->cron(cron_expression, std::move(cb)); 34 | } 35 | 36 | void AFCScheduleModule::AddIntervalSchedule(const std::chrono::system_clock::duration interval, SCHEDULER_FUNCTOR&& cb) 37 | { 38 | scheduler->interval(interval, std::move(cb)); 39 | } 40 | 41 | void AFCScheduleModule::AddAtSchedule(const std::string& target_time, SCHEDULER_FUNCTOR&& cb) 42 | { 43 | scheduler->at(target_time, std::move(cb)); 44 | } 45 | 46 | } // namespace ark 47 | -------------------------------------------------------------------------------- /src/proto/AFProtoCPP.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "google/protobuf/util/json_util.h" 24 | #include "proto/cpp/AFCSMsg.pb.h" 25 | #include "proto/cpp/AFSSMsg.pb.h" 26 | #include "proto/cpp/AFMsgURl.pb.h" 27 | #include "proto/cpp/AFMsgMysql.pb.h" 28 | 29 | #include "proto/cpp/AFCommonMsgNew.pb.h" 30 | #include "proto/cpp/AFDBMsg.pb.h" 31 | 32 | #include "proto/cpp/AFConsul.pb.h" 33 | -------------------------------------------------------------------------------- /src/proto/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(project_name AFProto) 2 | 3 | if (UNIX AND (NOT APPLE)) 4 | #Set rpath 5 | set(CMAKE_INSTALL_RPATH ".") 6 | set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 7 | endif (UNIX AND (NOT APPLE)) 8 | 9 | file(GLOB PROTO_DEFINATION proto/*.proto) 10 | MY_PROTOBUF_GENERATE_CPP(${CMAKE_CURRENT_SOURCE_DIR}/cpp PROTO_SRC PROTO_HEADER ${PROTO_DEFINATION}) 11 | add_library(${project_name} STATIC ${PROTO_HEADER} ${PROTO_SRC}) 12 | 13 | set_target_properties(${project_name} PROPERTIES PREFIX "") 14 | set_target_properties(${project_name} PROPERTIES 15 | FOLDER "proto" 16 | ARCHIVE_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 17 | RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR} 18 | LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIR}) 19 | 20 | target_link_libraries(${project_name} ${PROTOBUF_LIBRARIES}) -------------------------------------------------------------------------------- /src/proto/codec/AFCodecProto.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ArkNX 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "AFCodecProto.hpp" 22 | 23 | namespace ark { 24 | 25 | ark::ARK_CODEC_STATUS AFCodecProto::Encode() 26 | { 27 | // TODO: 28 | return ARK_CODEC_STATUS::CODEC_STATUS_OK; 29 | } 30 | 31 | ark::ARK_CODEC_STATUS AFCodecProto::Decode() 32 | { 33 | // TODO: 34 | return ARK_CODEC_STATUS::CODEC_STATUS_OK; 35 | } 36 | 37 | ARK_CODEC_TYPE AFCodecProto::GetCodecType() const 38 | { 39 | return ARK_CODEC_TYPE::CODEC_PROTO; 40 | } 41 | 42 | void AFCodecProto::SetCodecType(ARK_CODEC_TYPE type) 43 | { 44 | type_ = ARK_CODEC_TYPE::CODEC_PROTO; 45 | } 46 | 47 | } // namespace ark 48 | -------------------------------------------------------------------------------- /src/proto/codec/AFCodecProto.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ArkNX 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "AFICodec.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFCodecProto : public AFICodec 28 | { 29 | public: 30 | ARK_CODEC_STATUS Encode() override; 31 | ARK_CODEC_STATUS Decode() override; 32 | 33 | ARK_CODEC_TYPE GetCodecType() const override; 34 | void SetCodecType(ARK_CODEC_TYPE type) override; 35 | 36 | private: 37 | ARK_CODEC_TYPE type_{ARK_CODEC_TYPE::CODEC_UNKNOWN}; 38 | }; 39 | 40 | } // namespace ark 41 | -------------------------------------------------------------------------------- /src/proto/cpp/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/src/proto/cpp/.gitignore -------------------------------------------------------------------------------- /src/proto/cs/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/src/proto/cs/.gitignore -------------------------------------------------------------------------------- /src/proto/js/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/src/proto/js/.gitignore -------------------------------------------------------------------------------- /src/proto/proto/AFCommonCSMsg.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package AFMsg; 3 | -------------------------------------------------------------------------------- /src/proto/proto/AFCommonSSMsg.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package AFMsg; 3 | 4 | enum e_ss_common_msg_id { 5 | E_SS_MSG_ID_DEFAULT = 0; 6 | // start 7 | // E_SS_MSG_ID_COMMON_START = 100; 8 | 9 | // Please add your msg in the range 10 | E_SS_MSG_ID_SERVER_REPORT = 101; // ss之间注册 11 | E_SS_MSG_ID_SERVER_NOTIFY = 102; // ss之间注册后广播给相关服务器 12 | 13 | // E_SS_MSG_ID_COMMON_END = 500; 14 | // end 15 | } 16 | 17 | enum e_ss_server_state { 18 | E_ST_CRASH = 0; 19 | E_ST_NARMAL = 1; 20 | E_ST_BUSY = 2; 21 | E_ST_FIRE = 3; 22 | E_ST_MAINTEN = 4; 23 | } 24 | 25 | message msg_ss_server_report { 26 | int32 bus_id = 1; 27 | string url = 2; 28 | int32 max_online = 3; 29 | int32 cur_online = 4; 30 | e_ss_server_state logic_status = 5; 31 | } 32 | 33 | message msg_ss_server_notify { 34 | repeated msg_ss_server_report server_list = 1; 35 | } -------------------------------------------------------------------------------- /src/proto/proto/AFConsul.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package consul; 3 | 4 | message check_data { 5 | string ID = 1; 6 | string Name = 2; 7 | string Note = 3; 8 | string Timeout = 4; 9 | string Interval = 5; 10 | string TCP = 6; 11 | } 12 | 13 | message service_data { 14 | string ID = 1; 15 | string Name = 2; 16 | string Address = 3; 17 | int32 Port = 4; 18 | repeated string Tags = 5; 19 | map Meta = 6; 20 | check_data Check = 7; 21 | } 22 | 23 | message service_set { 24 | repeated service_data services = 1; 25 | } 26 | 27 | message kv { 28 | string key = 1; 29 | string value = 2; 30 | } -------------------------------------------------------------------------------- /src/proto/proto/AFDBMsg.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package AFMsg; 3 | 4 | message pb_db_array { 5 | repeated pb_db_entity_data datas_value = 1; 6 | } 7 | 8 | message pb_db_table { 9 | map datas_value = 1; 10 | } 11 | 12 | message pb_db_container { 13 | map datas_value = 1; 14 | } 15 | 16 | message pb_db_entity_data { 17 | map datas_bool = 1; // bool 18 | map datas_int32 = 2; // int32 19 | map datas_uint32 = 3; // uint32 20 | map datas_int64 = 4; // int64 21 | map datas_uint64 = 5; // uint64 22 | map datas_float = 6; // float 23 | map datas_double = 7; // double 24 | map datas_string = 8; // string 25 | map datas_array = 9; // array 26 | map datas_table = 10; // table 27 | map datas_entity = 11; // multi-data 28 | } 29 | 30 | message pb_db_entity{ 31 | int64 id = 1; 32 | uint32 config_id = 2; 33 | int32 map_id = 3; 34 | int32 map_inst_id = 4; 35 | string class_name = 5; 36 | pb_db_entity_data data = 6; 37 | } 38 | -------------------------------------------------------------------------------- /src/proto/proto/AFErrorCode.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package AFMsg; 3 | 4 | enum e_error_code_id { 5 | E_EC_DEFAULT_ID = 0; 6 | // TO ADD 7 | } -------------------------------------------------------------------------------- /src/proto/proto/AFMsgMysql.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package AFMsg; 4 | 5 | message PackMysqlParam { 6 | string strRecordName = 1; 7 | string strKey = 2; 8 | string fieldVecList = 3; 9 | string valueVecList = 4; 10 | int64 bExit = 5; 11 | int64 nreqid = 6; 12 | int64 nRet = 7; 13 | int64 eType = 8; 14 | } 15 | 16 | message PackMysqlServerInfo { 17 | int64 nRconnectTime = 1; 18 | int64 nRconneCount = 2; 19 | int64 nPort = 3; 20 | string strDBName = 4; 21 | string strDnsIp = 5; 22 | string strDBUser = 6; 23 | string strDBPwd = 7; 24 | int64 nServerID = 8; 25 | } 26 | -------------------------------------------------------------------------------- /src/proto/proto/AFMsgURl.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package AFMsg; 4 | 5 | // URL plugin 6 | message PackSURLParam { 7 | string strUrl = 1; 8 | string strGetParams = 2; 9 | string strBodyData = 3; 10 | string strCookies = 4; 11 | double fTimeOutSec = 5; 12 | string strRsp = 6; 13 | int64 nRet = 7; 14 | int64 nReqID = 8; 15 | } 16 | -------------------------------------------------------------------------------- /src/proto/proto/AFOss.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package osslog; 3 | 4 | //--------------------------------------------- 5 | // 因pb转json中将int64/uint64/fixed64为string类型 6 | // 故如果有使用64位长类型,请定义为double类型 7 | //--------------------------------------------- 8 | 9 | //登录、登出日志 10 | message login { 11 | string logid = 1; 12 | // TODO 13 | } 14 | 15 | //新帐号创建日志 16 | message create_account { 17 | int32 cid = 1; 18 | int32 sid = 2; 19 | string account = 3; 20 | int32 time = 4; 21 | double ms = 5; 22 | string ts = 6; 23 | string ip = 7; 24 | string adv = 8; 25 | string ad = 9; 26 | int32 guest = 10; 27 | string device = 11; 28 | } -------------------------------------------------------------------------------- /src/proto/proto/AFSSMsg.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package AFMsg; 3 | 4 | // Import all ss proto files in here. 5 | import "AFEventCode.proto"; 6 | import "AFErrorCode.proto"; 7 | import "AFCommonSSMsg.proto"; 8 | 9 | enum e_ss_msg_id { 10 | E_SS_MSG_ID_DEFUALT = 0; 11 | E_SS_MSG_ID_HEART_BEAT = 1; 12 | 13 | E_SS_MSG_ID_COMMON_START = 100; 14 | E_SS_MSG_ID_COMMON_END = 500; 15 | 16 | E_SS_MSG_ID_DIR_START = 501; 17 | E_SS_MSG_ID_DIR_END = 600; 18 | 19 | E_SS_MSG_ID_REG_TO_SERVER = 65535; 20 | } -------------------------------------------------------------------------------- /src/server/db/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/src/server/db/.gitignore -------------------------------------------------------------------------------- /src/server/dir/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_SERVER_MACRO(AFDirPlugin) -------------------------------------------------------------------------------- /src/server/dir/include/AFCDirNetModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/AFPluginManager.hpp" 24 | #include "proto/AFProtoCPP.hpp" 25 | #include "bus/interface/AFIMsgModule.hpp" 26 | #include "bus/interface/AFIBusModule.hpp" 27 | #include "net/interface/AFINetServiceManagerModule.hpp" 28 | #include "dir/interface/AFIDirNetModule.hpp" 29 | 30 | namespace ark { 31 | 32 | class AFCDirNetModule final : public AFIDirNetModule 33 | { 34 | ARK_DECLARE_MODULE_FUNCTIONS 35 | public: 36 | bool Init() override; 37 | bool PostInit() override; 38 | 39 | std::shared_ptr GetNetServer() override; 40 | 41 | protected: 42 | int StartServer(); 43 | 44 | private: 45 | AFIBusModule* m_pBusModule; 46 | AFINetServiceManagerModule* m_pNetServiceManagerModule; 47 | 48 | std::shared_ptr m_pNetServer; 49 | }; 50 | 51 | } // namespace ark 52 | -------------------------------------------------------------------------------- /src/server/dir/include/AFDirPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | 27 | namespace ark { 28 | 29 | ARK_DECLARE_PLUGIN(AFDirPlugin) 30 | 31 | } // namespace ark 32 | -------------------------------------------------------------------------------- /src/server/dir/interface/AFIDirNetModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFINetServerService; 28 | 29 | class AFIDirNetModule : public AFIModule 30 | { 31 | public: 32 | virtual std::shared_ptr GetNetServer() = 0; 33 | }; 34 | 35 | } // namespace ark 36 | -------------------------------------------------------------------------------- /src/server/dir/src/AFDirPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "dir/include/AFDirPlugin.hpp" 22 | #include "dir/include/AFCDirNetModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFDirPlugin) 27 | 28 | void AFDirPlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(AFIDirNetModule, AFCDirNetModule); 31 | } 32 | 33 | void AFDirPlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(AFIDirNetModule, AFCDirNetModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /src/server/game/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_SERVER_MACRO(AFGamePlugin) -------------------------------------------------------------------------------- /src/server/game/include/AFGamePlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | 27 | namespace ark { 28 | 29 | ARK_DECLARE_PLUGIN(AFGamePlugin) 30 | 31 | } // namespace ark 32 | -------------------------------------------------------------------------------- /src/server/game/src/AFGamePlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "game/include/AFGamePlugin.hpp" 22 | #include "game/include/AFCGameNetModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFGamePlugin) 27 | 28 | void AFGamePlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(AFIGameNetModule, AFCGameNetModule); 31 | } 32 | 33 | void AFGamePlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(AFIGameNetModule, AFCGameNetModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /src/server/login/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_SERVER_MACRO(AFLoginPlugin) -------------------------------------------------------------------------------- /src/server/login/include/AFLoginPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "base/AFPluginManager.hpp" 26 | 27 | namespace ark { 28 | 29 | ARK_DECLARE_PLUGIN(AFLoginPlugin) 30 | 31 | } // namespace ark 32 | -------------------------------------------------------------------------------- /src/server/login/interface/AFILoginNetModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "base/container/AFMap.hpp" 24 | #include "proto/AFProtoCPP.hpp" 25 | #include "interface/AFIModule.hpp" 26 | 27 | namespace ark { 28 | 29 | class AFILoginNetModule : public AFIModule 30 | { 31 | }; 32 | 33 | } // namespace ark 34 | -------------------------------------------------------------------------------- /src/server/login/src/AFLoginPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "login/include/AFLoginPlugin.hpp" 22 | #include "login/include/AFCLoginNetModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFLoginPlugin) 27 | 28 | void AFLoginPlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(AFILoginNetModule, AFCLoginNetModule); 31 | } 32 | 33 | void AFLoginPlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(AFILoginNetModule, AFCLoginNetModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /src/server/master/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_SERVER_MACRO(AFMasterPlugin) -------------------------------------------------------------------------------- /src/server/master/include/AFMasterPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFMasterPlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/server/master/interface/AFIMasterNetModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFIMasterNetModule : public AFIModule 28 | { 29 | }; 30 | 31 | } // namespace ark -------------------------------------------------------------------------------- /src/server/master/src/AFMasterPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "master/include/AFMasterPlugin.hpp" 22 | #include "master/include/AFCMasterNetModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFMasterPlugin) 27 | 28 | void AFMasterPlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(AFIMasterNetModule, AFCMasterNetModule); 31 | } 32 | 33 | void AFMasterPlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(AFIMasterNetModule, AFCMasterNetModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /src/server/oss/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/src/server/oss/.gitignore -------------------------------------------------------------------------------- /src/server/proxy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_SERVER_MACRO(AFProxyPlugin) -------------------------------------------------------------------------------- /src/server/proxy/include/AFProxyPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFProxyPlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/server/proxy/interface/AFIProxyNetModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFIProxyNetModule : public AFIModule 28 | { 29 | public: 30 | virtual bool VerifyConnectData(const std::string& strAccount, const std::string& strKey) = 0; 31 | }; 32 | 33 | } // namespace ark 34 | -------------------------------------------------------------------------------- /src/server/proxy/src/AFProxyPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "proxy/include/AFProxyPlugin.hpp" 22 | #include "proxy/include/AFCProxyNetModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFProxyPlugin) 27 | 28 | void AFProxyPlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(AFIProxyNetModule, AFCProxyNetModule); 31 | } 32 | 33 | void AFProxyPlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(AFIProxyNetModule, AFCProxyNetModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /src/server/router/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_SERVER_MACRO(AFRouterPlugin) -------------------------------------------------------------------------------- /src/server/router/include/AFRouterPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFRouterPlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/server/router/interface/AFIRouterNetModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFINetServerService; 28 | 29 | class AFIRouterNetModule : public AFIModule 30 | { 31 | public: 32 | virtual std::shared_ptr GetNetServer() = 0; 33 | }; 34 | 35 | } // namespace ark -------------------------------------------------------------------------------- /src/server/router/src/AFRouterPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "router/include/AFRouterPlugin.hpp" 22 | #include "router/include/AFCRouterNetModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFRouterPlugin) 27 | 28 | void AFRouterPlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(AFIRouterNetModule, AFCRouterNetModule); 31 | } 32 | 33 | void AFRouterPlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(AFIRouterNetModule, AFCRouterNetModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /src/server/simulate/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${ROOT_DIR}/3rdparty/physX/include 3 | ${ROOT_DIR}/3rdparty/msgpack/include) 4 | 5 | BUILD_SERVER_MACRO(AFSimulatePlugin) 6 | -------------------------------------------------------------------------------- /src/server/simulate/include/AFSimulatePlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFSimulatePlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/server/simulate/interface/AFISimulateNetModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIModule.hpp" 24 | 25 | namespace ark { 26 | 27 | class AFISimulateNetModule : public AFIModule 28 | { 29 | public: 30 | //virtual method 31 | }; 32 | 33 | } // namespace ark 34 | -------------------------------------------------------------------------------- /src/server/simulate/src/AFSimulatePlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "simulate/include/AFSimulatePlugin.hpp" 22 | #include "simulate/include/AFCSimulateNetModule.hpp" 23 | #include "simulate/include/AFCSimulateModule.hpp" 24 | 25 | namespace ark { 26 | 27 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFSimulatePlugin) 28 | 29 | void AFSimulatePlugin::Install() 30 | { 31 | // install module 32 | ARK_REGISTER_MODULE(AFISimulateNetModule, AFCSimulateNetModule); 33 | ARK_REGISTER_MODULE(AFISimulateModule, AFCSimulateModule); 34 | } 35 | 36 | void AFSimulatePlugin::Uninstall() 37 | { 38 | // uninstall module 39 | ARK_UNREGISTER_MODULE(AFISimulateModule, AFCSimulateModule); 40 | ARK_UNREGISTER_MODULE(AFISimulateNetModule, AFCSimulateNetModule); 41 | } 42 | 43 | } // namespace ark 44 | -------------------------------------------------------------------------------- /src/server/world/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | BUILD_SERVER_MACRO(AFWorldPlugin) -------------------------------------------------------------------------------- /src/server/world/include/AFWorldPlugin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "interface/AFIPlugin.hpp" 24 | #include "base/AFPluginManager.hpp" 25 | 26 | namespace ark { 27 | 28 | ARK_DECLARE_PLUGIN(AFWorldPlugin) 29 | 30 | } // namespace ark 31 | -------------------------------------------------------------------------------- /src/server/world/interface/AFIWorldNetModule.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "proto/AFProtoCPP.hpp" 24 | #include "interface/AFIModule.hpp" 25 | #include "net/interface/AFINetClientService.hpp" 26 | 27 | namespace ark { 28 | class AFINetServerService; 29 | 30 | class AFIWorldNetModule : public AFIModule 31 | { 32 | public: 33 | virtual bool SendMsgToGame(const int nGameID, const AFMsg::EGameMsgID eMsgID, google::protobuf::Message& xData, 34 | const guid_t nPlayer = guid_t()) = 0; 35 | virtual bool SendMsgToGame(const AFIDataList& argObjectVar, const AFIDataList& argGameID, 36 | const AFMsg::EGameMsgID eMsgID, google::protobuf::Message& xData) = 0; 37 | 38 | // virtual std::shared_ptr GetSuitProxyForEnter() = 0; 39 | virtual std::shared_ptr GetSuitProxyForEnter() = 0; 40 | virtual std::shared_ptr GetNetServer() = 0; 41 | }; 42 | 43 | } // namespace ark 44 | -------------------------------------------------------------------------------- /src/server/world/src/AFWorldPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #include "world/include/AFWorldPlugin.hpp" 22 | #include "world/include/AFCWorldNetModule.hpp" 23 | 24 | namespace ark { 25 | 26 | ARK_DECLARE_PLUGIN_DLL_FUNCTION(AFWorldPlugin) 27 | 28 | void AFWorldPlugin::Install() 29 | { 30 | ARK_REGISTER_MODULE(AFIWorldNetModule, AFCWorldNetModule); 31 | } 32 | 33 | void AFWorldPlugin::Uninstall() 34 | { 35 | ARK_UNREGISTER_MODULE(AFIWorldNetModule, AFCWorldNetModule); 36 | } 37 | 38 | } // namespace ark 39 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenArkStudio/ARK/5334fd48b3c3d00f8cf37b6ac9042456ad3fd748/test/.gitignore -------------------------------------------------------------------------------- /test/test_hex.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #define CATCH_CONFIG_MAIN 22 | #include "catch.hpp" 23 | #include "base/AFMisc.hpp" 24 | 25 | using namespace ark; 26 | 27 | TEST_CASE("ToHexDumpText", "[ToHexDumpText]") 28 | { 29 | std::string value = AFMisc::make_test_str(256); 30 | std::cout << "value_size=" << value.length() << std::endl << AFMisc::ToHexDumpText(value, 32) << std::endl; 31 | } -------------------------------------------------------------------------------- /test/test_singleton.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #define CATCH_CONFIG_MAIN 22 | #include "catch.hpp" 23 | #include "base/pattern/AFSingleton.hpp" 24 | 25 | using namespace ark; 26 | 27 | class test_singleton : public AFSingleton 28 | { 29 | public: 30 | int value; 31 | }; 32 | 33 | TEST_CASE("singleton", "[singleton]") 34 | { 35 | test_singleton* pl = test_singleton::instance(); 36 | test_singleton& pr = test_singleton::get_instance(); 37 | 38 | pl->value = 1024; 39 | 40 | REQUIRE(pr.value == 1024); 41 | REQUIRE(&pr == pl); 42 | } 43 | -------------------------------------------------------------------------------- /test/test_xxtea.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file is part of ARK 3 | * For the latest info, see https://github.com/ArkNX 4 | * 5 | * Copyright (c) 2013-2020 ArkNX authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"), 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | #define CATCH_CONFIG_MAIN 22 | #include "catch.hpp" 23 | #include "base/crypto/AFXXTea.hpp" 24 | 25 | using namespace ark; 26 | 27 | TEST_CASE("xxtea", "[xxtea]") 28 | { 29 | const std::string text = "Hello World! 你好,中国!"; 30 | const char* key = "1234567890"; 31 | size_t len; 32 | std::string encrypted_value; 33 | auto ret = AFXXTea::xxtea_encrypt(text, key, encrypted_value); 34 | REQUIRE(ret == true); 35 | 36 | std::string decrypted_value; 37 | ret = AFXXTea::xxtea_decrypt(encrypted_value, key, decrypted_value); 38 | REQUIRE(ret == true); 39 | std::cout << decrypted_value << std::endl; 40 | REQUIRE(text == decrypted_value); 41 | } --------------------------------------------------------------------------------