├── .idea
├── .name
├── scopes
│ └── Sources.xml
├── .gitignore
├── externalDependencies.xml
├── copyright
│ ├── profiles_settings.xml
│ └── libsese_Default_Copyright.xml
└── icon.svg
├── .vscode
├── .gitignore
├── extensions.json
└── readme.md
├── scripts
├── .gitignore
├── README.md
├── do_websocket.py
├── dns_client.py
├── do_http2_request.py
└── cmake_format.py
├── package
├── ports
│ └── sese
│ │ ├── vcpkg.json
│ │ └── usage
├── main.cpp
├── vcpkg.json
└── CMakeLists.txt
├── .github
├── ISSUE_TEMPLATE
│ ├── config.yml
│ ├── general.yml
│ ├── new_feature.yml
│ └── bug_report.yml
└── workflows
│ └── gh-pages.yml
├── sese
├── test
│ ├── TestResource
│ │ ├── .gitignore
│ │ ├── Resource.json
│ │ └── TestResource.cpp
│ ├── Data
│ │ ├── data-0.txt
│ │ ├── logo.ico
│ │ ├── archive.zip
│ │ ├── data.ini
│ │ ├── checksum-size-112.txt
│ │ ├── checksum-size-122.txt
│ │ ├── checksum-size-128.txt
│ │ ├── data.xml
│ │ ├── data.json
│ │ ├── data-1.txt
│ │ └── test-ca.crt
│ ├── manifest.json
│ ├── README.md
│ ├── TestDB
│ │ └── Config.h
│ ├── AllTest.cpp
│ ├── TestUniReader.cpp
│ ├── TestPlugin
│ │ └── Module.m.cpp
│ ├── TestSymbol.cpp
│ ├── TestWebsocketService.cpp
│ ├── TestIPC
│ │ └── IPC.d.cpp
│ ├── TestStrCaseMap.cpp
│ ├── TestEncodingConverter.cpp
│ └── TestNetworkUtil.cpp
├── security
│ ├── evp
│ │ ├── README.md
│ │ ├── SM3Context.h
│ │ ├── Context.h
│ │ ├── MD5Context.h
│ │ ├── SHA1Context.h
│ │ ├── SHA256Context.h
│ │ ├── SHA384Context.h
│ │ ├── SHA512Context.h
│ │ └── SM3Context.cpp
│ ├── SecurityConfig.cpp
│ ├── SecurityConfig.h
│ └── SSLContextBuilder.cpp
├── example
│ ├── manifest.json
│ └── CMakeLists.txt
├── manifest.json
├── archive
│ ├── CMakeLists.txt
│ ├── ArchiveInputStream.cpp
│ ├── ArchiveOutputStream.cpp
│ ├── ArchiveInputStream.h
│ ├── ArchiveOutputStream.h
│ └── Config.h
├── Log.h
├── Util.h
├── Init.h
├── net
│ ├── AddressPool.cpp
│ ├── http
│ │ ├── HeaderBuilder.cpp
│ │ ├── Response.cpp
│ │ ├── HttpConverter.h
│ │ ├── Request.cpp
│ │ ├── Request.h
│ │ ├── Response.h
│ │ ├── HeaderBuilder.h
│ │ ├── RequestParser.h
│ │ └── HttpServletContext.h
│ ├── IPAddress.cpp
│ └── dns
│ │ └── DnsPackage_Flags.cpp
├── types
│ ├── defines.h
│ ├── is_pair.h
│ └── is_iterable.h
├── service
│ ├── Service.cpp
│ ├── dns
│ │ └── Config.h
│ └── Service.h
├── benchmark
│ ├── CMakeLists.txt
│ └── BM_StringBuilder.cpp
├── util
│ ├── ErrorCode.cpp
│ ├── ZlibConfig.h
│ ├── EncodingConverter.cpp
│ ├── StopWatch.cpp
│ ├── NotInstantiable.h
│ ├── Noncopyable.h
│ ├── StopWatch.h
│ ├── EncodingConverter.h
│ ├── UuidBuilder.h
│ ├── GZipFileInputStream.cpp
│ ├── Singleton.h
│ ├── ErrorCode.h
│ └── TimestampHandler.h
├── io
│ ├── File.h
│ ├── NullOutputStream.cpp
│ ├── ConsoleOutputStream.cpp
│ ├── InputBuffer.h
│ ├── OutputStream.cpp
│ ├── OutputBuffer.h
│ ├── Closeable.h
│ ├── RandomInputStream.h
│ ├── FixedBuilder.h
│ ├── Stream.h
│ ├── ConsoleOutputStream.h
│ ├── NullOutputStream.h
│ ├── RandomInputStream.cpp
│ ├── InputStream.h
│ ├── ByteBuilder.h
│ ├── InputStreamReader.h
│ ├── PeekableStream.h
│ ├── OutputBufferWrapper.h
│ └── FixedBuffer.h
├── log
│ ├── AbstractAppender.cpp
│ ├── AbstractFormatter.h
│ ├── FileAppender.cpp
│ ├── Marco.h
│ ├── ConsoleAppender.h
│ └── FileAppender.h
├── internal
│ ├── unix
│ │ ├── thread
│ │ │ └── GlobalThreadPool.cpp
│ │ ├── system
│ │ │ └── Path.cpp
│ │ └── security
│ │ │ └── evp
│ │ │ ├── MD5Context.cpp
│ │ │ ├── SHA1Context.cpp
│ │ │ ├── SHA256Context.cpp
│ │ │ ├── SHA384Context.cpp
│ │ │ └── SHA512Context.cpp
│ ├── service
│ │ └── http
│ │ │ ├── ConnType.h
│ │ │ └── Handleable.h
│ ├── win
│ │ └── thread
│ │ │ └── GlobalThreadPool.cpp
│ └── net
│ │ └── AsioSSLContextConvert.h
├── db
│ ├── Config.h
│ ├── Metadata.h
│ ├── Util.h
│ ├── Util.cpp
│ └── DriverManager.h
├── thread
│ ├── SpinLock.cpp
│ ├── SpinLock.h
│ └── Locker.h
├── res
│ ├── ResourceManager.cpp
│ └── Resource.cpp
├── text
│ ├── String.h
│ ├── Util.h
│ ├── Util.cpp
│ └── TextReader.h
├── system
│ ├── FileNotifier.cpp
│ ├── Library.cpp
│ ├── ProcessBuilder.cpp
│ ├── CommandLine.cpp
│ ├── Paths.h
│ ├── NetworkUtil.h
│ ├── SharedMemory.cpp
│ └── CommandLine.h
├── plugin
│ ├── BaseClass.h
│ ├── ModuleInfo.h
│ └── ClassFactory.cpp
├── CATALOG.md
├── config
│ ├── ini
│ │ └── IniConfig.h
│ └── CSVWriter.cpp
├── container
│ └── StrCaseMap.cpp
└── DarwinConfig.h
├── docs
└── Meta.txt
├── .cmake-format.yaml
├── .devcontainer
├── Alpine-x64
│ └── devcontainer.json
└── StandardConfig
│ └── devcontainer.json
├── AUTHORS.md
├── .tokeignore
├── cmake
├── Coverage.cmake
├── sese-config.cmake.in
├── Manifest.cmake
├── Options.cmake
└── Asan.cmake
├── .editorconfig
├── .gitattributes
├── CMakeLists.txt
├── requirements.txt
├── .gitlab
└── merge_request_templates
│ └── default.md
├── gcovr.cfg
├── docker
├── docker-compose.yml
├── alpine-x64.dockerfile
└── ubuntu-arm64.dockerfile
├── SECURITY.md
├── schema
├── resource.schema.json
└── manifest.schema.json
├── ROADMAP.md
├── static
└── image
│ └── logo.svg
└── CMakePresets.json
/.idea/.name:
--------------------------------------------------------------------------------
1 | Sese Framework
--------------------------------------------------------------------------------
/.vscode/.gitignore:
--------------------------------------------------------------------------------
1 | /settings.json
--------------------------------------------------------------------------------
/scripts/.gitignore:
--------------------------------------------------------------------------------
1 | *.tar.gz
2 | *.zip
--------------------------------------------------------------------------------
/package/ports/sese/vcpkg.json:
--------------------------------------------------------------------------------
1 | ../../../vcpkg.json
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
--------------------------------------------------------------------------------
/sese/test/TestResource/.gitignore:
--------------------------------------------------------------------------------
1 | /Resource.*
2 |
3 | !/Resource.json
--------------------------------------------------------------------------------
/sese/test/Data/data-0.txt:
--------------------------------------------------------------------------------
1 | Hello
2 |
3 | 你好
4 |
5 | こんにちは
6 |
7 | привет
--------------------------------------------------------------------------------
/sese/test/Data/logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libsese/sese/HEAD/sese/test/Data/logo.ico
--------------------------------------------------------------------------------
/sese/test/Data/archive.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libsese/sese/HEAD/sese/test/Data/archive.zip
--------------------------------------------------------------------------------
/docs/Meta.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/sese/test/Data/data.ini:
--------------------------------------------------------------------------------
1 | ; default section
2 | name = "Test File 嘿嘿"
3 |
4 | [server]
5 | address = 127.0.0.1
6 | port = 7890
--------------------------------------------------------------------------------
/.cmake-format.yaml:
--------------------------------------------------------------------------------
1 | line_width: 120
2 | line_ending: windows
3 | tab_size: 4
4 | autosort: true
5 | dangle_parens: true
6 | enable_markup: true
--------------------------------------------------------------------------------
/sese/test/Data/checksum-size-112.txt:
--------------------------------------------------------------------------------
1 | J2kqzRtl+QiVAjfUEJPLp&KYK2_#taIcXyvucyrmM#LfF_V=Ymu2xScSA60C%y_Io#93yZpKhsWcKn3gmbys9m9hXGN*p27YfIiC3HGyWat-_4Wy
--------------------------------------------------------------------------------
/package/ports/sese/usage:
--------------------------------------------------------------------------------
1 | sese provides CMake targets:
2 |
3 | find_package(sese CONFIG REQUIRED)
4 | target_link_libraries(main PRIVATE Sese::Core)
5 |
--------------------------------------------------------------------------------
/sese/test/Data/checksum-size-122.txt:
--------------------------------------------------------------------------------
1 | eZNiojRQFHDk$S*7VRNotGsay=ROpcXTp+b_wfZDTbI*alYag#YcD*B7&8fvqE&CXtmaSCcDf1c6qZZYUYS6MZF+k9spUxhR+r@9!qhq#mI8qpDlxD@fipAz$m
--------------------------------------------------------------------------------
/sese/test/Data/checksum-size-128.txt:
--------------------------------------------------------------------------------
1 | h%s9whzHz$7R$pOk@Fvsv$IQC%fBB@S4jnVkH!hcOHvAz_Td2-H6BkKZIo!V29sB=RhVR9PYmniCziWcpGRUKd41ra35z7$nW1hIFj^n=IP_H6#Po+hd8W2TN$G+1XUW
--------------------------------------------------------------------------------
/.devcontainer/Alpine-x64/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Alpine-x64",
3 | "build": {
4 | "context": "../../",
5 | "dockerfile": "../../docker/alpine-x64.dockerfile"
6 | }
7 | }
--------------------------------------------------------------------------------
/.idea/scopes/Sources.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.devcontainer/StandardConfig/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "StandardConfig",
3 | "build": {
4 | "context": "../../",
5 | "dockerfile": "../../docker/ubuntu-x64.dockerfile"
6 | }
7 | }
--------------------------------------------------------------------------------
/package/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char **argv) {
5 | sese::initCore(argc, argv);
6 | SESE_INFO("hello sese");
7 | return 0;
8 | }
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | /fileTemplates
2 |
3 | *.xml
4 | *.iml
5 |
6 | !/copyright/libsese_Default_Copyright.xml
7 | !/copyright/profiles_settings.xml
8 | !/scopes/Sources.xml
9 | !/externalDependencies.xml
10 |
--------------------------------------------------------------------------------
/package/vcpkg.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": [
3 | {
4 | "name": "sese",
5 | "features": [
6 | "archive",
7 | "mysql",
8 | "psql"
9 | ]
10 | }
11 | ]
12 | }
--------------------------------------------------------------------------------
/sese/test/TestResource/Resource.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/libsese/sese/refs/heads/main/schema/resource.schema.json",
3 | "icon": "Data/logo.ico",
4 | "binaries": {
5 | "hello": "Data/data.xml"
6 | }
7 | }
--------------------------------------------------------------------------------
/AUTHORS.md:
--------------------------------------------------------------------------------
1 | # AUTHORS
2 |
3 | This list includes individuals who have contributed code and maintained this project.
4 |
5 | If there are any omissions, please contact the address below.
6 |
7 | > mail: shiina_kaoru@outlook.com
8 |
9 | - SHIINASAMA
10 | - DreamerQcl
11 |
--------------------------------------------------------------------------------
/.idea/externalDependencies.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.tokeignore:
--------------------------------------------------------------------------------
1 | /.github
2 | /.gitlab
3 | /.vscode
4 | /.idea
5 | /docker
6 | /docs
7 | /package
8 | /scripts
9 |
10 | /sese/test
11 | /sese/benchmark
12 |
13 | /build
14 | /build-*
15 | /cmake-build-*
16 |
17 | LICENSE
18 | NOTICE
19 | requirements.txt
20 | *.md
21 | *.json
22 | *.cfg
23 | *.yml
24 | *.svg
--------------------------------------------------------------------------------
/cmake/Coverage.cmake:
--------------------------------------------------------------------------------
1 | if(SESE_ENABLE_COVERAGE)
2 | if(MSVC)
3 | message(WARNING "Coverage test flags are used on unsupported compilers and have been forced to be disabled.")
4 | else()
5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-update=atomic")
6 | endif()
7 | endif()
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # The line splitter should be specified in `.gitattributes`
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 4
7 | insert_final_newline = false
8 | trim_trailing_whitespace = true
9 | charset = utf-8
10 |
11 | [*.{yml,yaml,json,clang-format,clang-tidy}]
12 | indent_size = 2
13 |
--------------------------------------------------------------------------------
/scripts/README.md:
--------------------------------------------------------------------------------
1 | # Functional Scripts
2 |
3 | > [!WARNING]
4 | > Git cannot and does not manage file permissions. So, please ensure that submitted files retain their original attributes.
5 |
6 | Run the following command to ignore related file mode changes:
7 |
8 | ```bash
9 | git config core.filemode false
10 | ```
11 |
--------------------------------------------------------------------------------
/sese/security/evp/README.md:
--------------------------------------------------------------------------------
1 | # Encryption and Decryption Functions
2 |
3 | Hash digest algorithms can use a unified interface based on Context implementations such as MD5Context, SHA256Context, and SM3Context.
4 |
5 | For encryption and decryption related algorithms, such as AES, RSA, and SM4, please directly use the EVP module implemented within OpenSSL.
6 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.md text eol=crlf
2 | *.txt text eol=crlf
3 | *.cmake text eol=crlf
4 | *.c text eol=crlf
5 | *.h text eol=crlf
6 | *.cpp text eol=crlf
7 | *.hpp text eol=crlf
8 | *.json text eol=crlf
9 | *.xml text eol=crlf
10 | *.yml text eol=crlf
11 | *.in text eol=crlf
12 | *.sh text eol=lf
13 | *.bash text eol=lf
14 | *.sql text eol=lf
--------------------------------------------------------------------------------
/sese/example/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/libsese/sese/refs/heads/main/schema/manifest.schema.json",
3 | "author": "Kaoru - SHIINASAMA2001@gmail.com",
4 | "productName": "example",
5 | "internalName": "example",
6 | "version": "0.1.0",
7 | "description": "Sese Framework - https://github.com/libsese/sese-core.git",
8 | "copyright": "(c) 2022-2024 libsese"
9 | }
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.21)
2 |
3 | include(cmake/Options.cmake)
4 | project(
5 | sese
6 | VERSION 3.0.0
7 | LANGUAGES CXX
8 | )
9 | set(CMAKE_CXX_STANDARD 20)
10 | set(SESE_ROOT_PROJECT ON)
11 | include(cmake/Dependencies.cmake)
12 | include(cmake/Git.cmake)
13 | include(cmake/Coverage.cmake)
14 | include(cmake/Asan.cmake)
15 |
16 | add_subdirectory(sese)
17 |
--------------------------------------------------------------------------------
/sese/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/libsese/sese/refs/heads/main/schema/manifest.schema.json",
3 | "author": "Kaoru - SHIINASAMA2001@gmail.com",
4 | "productName": "Sese Core",
5 | "internalName": "Sese Core",
6 | "version": "3.0.0",
7 | "description": "Sese Framework - https://github.com/libsese/sese-core.git",
8 | "copyright": "(c) 2022-2024 libsese"
9 | }
10 |
--------------------------------------------------------------------------------
/sese/test/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/libsese/sese/refs/heads/main/schema/manifest.schema.json",
3 | "author": "Kaoru - SHIINASAMA2001@gmail.com",
4 | "productName": "AllTestsInMain",
5 | "internalName": "AllTestsInMain",
6 | "version": "0.1.0",
7 | "description": "Sese Framework - https://github.com/libsese/sese-core.git",
8 | "copyright": "(c) 2022-2024 libsese"
9 | }
--------------------------------------------------------------------------------
/sese/test/Data/data.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - Hello
5 | - Hi
6 |
7 |
8 |
9 |
10 | TestXmlUtil
11 | 1.0
12 |
13 | Hello World
14 |
15 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "ms-vscode.cpptools-extension-pack",
4 | "ms-vscode.cmake-tools",
5 | "llvm-vs-code-extensions.vscode-clangd",
6 | "matepek.vscode-catch2-test-adapter",
7 | "ms-python.vscode-pylance",
8 | "ms-python.python",
9 | "editorconfig.editorconfig",
10 | "github.vscode-github-actions",
11 | "jeff-hykin.better-cpp-syntax",
12 | "cheshirekow.cmake-format"
13 | ]
14 | }
--------------------------------------------------------------------------------
/sese/test/README.md:
--------------------------------------------------------------------------------
1 | # Unit Testing
2 |
3 | | Directory | Description |
4 | |-----------|-------------------------------|
5 | | Data | Directory for test data |
6 | | Test* | Independent test environments |
7 |
8 | | Test Target Name | Description |
9 | |:-----------------|:------------------------|
10 | | * | Test executable files |
11 | | *.m | Test module files |
12 | | *.d | Test daemon executables |
13 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | black==24.8.0
2 | certifi==2024.8.30
3 | charset-normalizer==3.3.2
4 | click==8.1.7
5 | cmakelang==0.6.13
6 | colorama==0.4.6
7 | colorlog==6.8.2
8 | dnspython==2.7.0
9 | gcovr==7.2
10 | idna==3.10
11 | Jinja2==3.1.5
12 | junit2html==31.0.2
13 | lxml==5.3.0
14 | MarkupSafe==2.1.5
15 | mypy-extensions==1.0.0
16 | packaging==24.1
17 | pathspec==0.12.1
18 | platformdirs==4.3.6
19 | Pygments==2.17.2
20 | PyYAML==6.0.1
21 | requests==2.32.3
22 | six==1.16.0
23 | urllib3==2.2.3
24 | websocket-client==1.7.0
25 |
--------------------------------------------------------------------------------
/sese/archive/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(
2 | Archive OBJECT
3 | ./ArchiveInputStream.cpp
4 | ./ArchiveInputStream.h
5 | ./ArchiveOutputStream.cpp
6 | ./ArchiveOutputStream.h
7 | ./ArchiveReader.cpp
8 | ./ArchiveReader.h
9 | ./ArchiveWriter.cpp
10 | ./ArchiveWriter.h
11 | ./Config.cpp
12 | ./Config.h
13 | )
14 |
15 | if(UNIX)
16 | set_target_properties(Archive PROPERTIES POSITION_INDEPENDENT_CODE ON)
17 | endif()
18 | target_link_libraries(Archive PRIVATE LibArchive::LibArchive)
19 |
--------------------------------------------------------------------------------
/.gitlab/merge_request_templates/default.md:
--------------------------------------------------------------------------------
1 | # Default merge template | 默认合并模板
2 |
3 | Thank you for your contributions to this project. This is an internal backup repository.
4 |
5 | Currently, we do not support initiating merge requests or pull requests on GitLab.
6 |
7 | Please visit the GitHub project [homepage](https://github.com/libsese/sese-core) for further information.
8 |
9 | ---
10 |
11 | 感谢你对项目的付出,这是一个内部备份仓库,
12 |
13 | 我们暂时不支持在 GitLab 中发起 merge_request/pull_request,
14 |
15 | 请移步至 GitHub 项目[主页](https://github.com/libsese/sese-core)。
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/gcovr.cfg:
--------------------------------------------------------------------------------
1 | filter = sese
2 | exclude = sese/test
3 | exclude = sese/event
4 | exclude = sese/benchmark
5 | exclude = sese/native/linux/event
6 | exclude = sese/native/darwin/event
7 | exclude = sese/native/win/event
8 | exclude = sese/service/TcpTransporter
9 | exclude-unreachable-branches = yes
10 | exclude-throw-branches = yes
11 | exclude-noncode-lines = yes
12 |
13 | html = build/coverage/html/index.html
14 | html-title = Sese Core Main Test Coverage
15 | html-theme = github.green
16 | html-details = yes
17 |
18 | cobertura = build/coverage/coverage.xml
19 | cobertura-pretty = yes
--------------------------------------------------------------------------------
/.vscode/readme.md:
--------------------------------------------------------------------------------
1 | # Usage
2 |
3 | To disable the CTest index brought by the CMake extension and automatically enable TestMate, you need to modify the user's configuration file by adding the following settings:
4 |
5 | ```json
6 | {
7 | "testMate.cpp.discovery.loadOnStartup": true,
8 | "cmake.ctest.testExplorerIntegrationEnabled": false
9 | }
10 | ```
11 |
12 | # Note
13 |
14 | This folder is only for default configurations in codespaces and local development with VSCode.
15 |
16 | If you use VSCode in any scenario, you should not commit or change this folder.
17 |
--------------------------------------------------------------------------------
/sese/example/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${MSVC})
2 | add_compile_options(/utf-8)
3 | endif()
4 |
5 | include(${PROJECT_SOURCE_DIR}/cmake/Manifest.cmake)
6 |
7 | add_definitions("-DPROJECT_PATH=\"${PROJECT_SOURCE_DIR}\"")
8 | add_definitions("-DPROJECT_BINARY_PATH=\"${CMAKE_CURRENT_BINARY_DIR}\"")
9 |
10 | add_executable(HttpServer HttpServer.cpp)
11 | target_link_libraries(HttpServer PRIVATE Core)
12 | target_manifest(HttpServer manifest.json)
13 |
14 | add_executable(Json2yml Json2yml.cpp)
15 | target_link_libraries(Json2yml PRIVATE Core)
16 | target_manifest(Json2yml manifest.json)
17 |
--------------------------------------------------------------------------------
/package/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.13)
2 |
3 | set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/ports")
4 |
5 | project(package_test)
6 |
7 | set(CMAKE_CXX_STANDARD 17)
8 |
9 | if (MSVC AND VCPKG_TARGET_TRIPLET STREQUAL "x64-windows-static")
10 | set(CMAKE_CXX_FLAGS_DEBUG /MTd)
11 | set(CMAKE_CXX_FLAGS_MINSIZEREL /MT)
12 | set(CMAKE_CXX_FLAGS_RELEASE /MT)
13 | set(CMAKE_CXX_FLAGS_RELWITHDEBUGINFO /MT)
14 | endif ()
15 |
16 | add_executable(main main.cpp)
17 |
18 | find_package(Sese CONFIG REQUIRED)
19 | target_link_libraries(main PRIVATE Sese::Core)
--------------------------------------------------------------------------------
/sese/test/Data/data.json:
--------------------------------------------------------------------------------
1 | {
2 | "string": "a testing\n text\"",
3 | "value": 0,
4 | "nullable": null,
5 | "boolean": true,
6 | "object": {
7 | "object_value1": "value1",
8 | "object_value2": "value2",
9 | "null_array": [],
10 | "null_object": {}
11 | },
12 | "mixin_array": [
13 | 1,
14 | 2,
15 | {
16 | "object_value1": "value3",
17 | "object_value2": "value4"
18 | },
19 | 3,
20 | [
21 | 4,
22 | 5
23 | ],
24 | null
25 | ]
26 | }
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/general.yml:
--------------------------------------------------------------------------------
1 | name: General Issues
2 | description: 此模板用于反馈通用问题
3 | assignees:
4 | - SHIINASAMA
5 |
6 | title: "[general]: "
7 | body:
8 | - type: markdown
9 | attributes:
10 | value: |
11 | 在描述你的问题之前请先尝试自己解决或者查找相似的 issue
12 | - type: textarea
13 | id: description
14 | attributes:
15 | label: 问题描述
16 | - type: input
17 | id: version
18 | attributes:
19 | label: 版本
20 | value: |
21 | 出现该问题的具体版本
22 | - type: textarea
23 | id: record
24 | attributes:
25 | label: 描述复现步骤(如果有)
26 | value: |
27 | 在这里编写步骤
28 |
--------------------------------------------------------------------------------
/sese/Log.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #pragma once
16 |
17 | #include
--------------------------------------------------------------------------------
/sese/Util.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #pragma once
16 |
17 | #include
--------------------------------------------------------------------------------
/sese/Init.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #pragma once
16 |
17 | #include
--------------------------------------------------------------------------------
/docker/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | mariadb:
4 | image: mariadb
5 | environment:
6 | - MARIADB_ROOT_HOST=%
7 | - MARIADB_USER=libsese
8 | - MARIADB_PASSWORD=libsese
9 | - MARIADB_ROOT_PASSWORD=libsese
10 | restart: on-failure
11 | ports:
12 | - '127.0.0.1:18806:3306'
13 | volumes:
14 | - ../scripts/mysql_dump.sql:/docker-entrypoint-initdb.d/mysql_dump.sql:ro
15 | postgresql:
16 | image: postgres
17 | environment:
18 | - POSTGRES_PASSWORD=libsese
19 | restart: on-failure
20 | ports:
21 | - '127.0.0.1:18080:5432'
22 | volumes:
23 | - ../scripts/postgres_dump.sql:/docker-entrypoint-initdb.d/postgres_dump.sql:ro
--------------------------------------------------------------------------------
/sese/net/AddressPool.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 |
17 | using namespace sese::net;
18 |
--------------------------------------------------------------------------------
/sese/test/Data/data-1.txt:
--------------------------------------------------------------------------------
1 | Once upon a time there was a sweet little girl.
2 | Everyone who saw her liked her, but most of all her grandmother, who did not know what to give the child next.
3 | Once she gave her a little cap made of red velvet.
4 | Because it suited her so well, and she wanted to wear it all the time, she came to be known as Little Red Riding Hood.
5 | One day her mother said to her:
6 | "Come Little Red Riding Hood. Here is a piece of cake and a bottle of wine. Take them to your grandmother. She is sick and weak, and they will do her well. Mind your manners and give her my greetings. Behave yourself on the way, and do not leave the path, or you might fall down and break the glass, and then there will be nothing for your sick grandmother."
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | The project as a whole uses a rolling release,
6 | and the latest version always receives more comprehensive and fast security support.
7 | Therefore, we recommend that you always use a newer version,
8 | only the immediately preceding stable version will receive security support,
9 | while previous stable versions will not benefit from this security support.
10 |
11 | ## Reporting a Vulnerability
12 |
13 | Please report any code vulnerabilities using GitHub Issues.
14 | We will promptly analyze the reported issues.
15 | Your active cooperation is also required for the correct resolution of the issues.
16 | Once the issues are fixed, we will mark them and close the related GitHub Issues.
17 |
--------------------------------------------------------------------------------
/docker/alpine-x64.dockerfile:
--------------------------------------------------------------------------------
1 | FROM amd64/alpine:3.20.1
2 |
3 | RUN apk add samurai autoconf automake git cmake gcc compiler-rt pkgconfig linux-headers bison flex tzdata-utils
4 |
5 | RUN apk add libtool python3 py3-pip bash
6 |
7 | RUN apk add doxygen mariadb-client postgresql-client
8 |
9 | RUN apk add build-base cmake ninja zip unzip curl git
10 |
11 | ENV VCPKG_FORCE_SYSTEM_BINARIES=1
12 |
13 | RUN git config --global http.version HTTP/1.1 && \
14 | git clone https://github.com/microsoft/vcpkg /opt/vcpkg && \
15 | /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics
16 |
17 | ENV VCPKG_ROOT=/opt/vcpkg
18 |
19 | COPY ./requirements.txt /tmp/requirements.txt
20 |
21 | RUN pip install -r /tmp/requirements.txt --break-system-packages && \
22 | pip cache purge
23 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/new_feature.yml:
--------------------------------------------------------------------------------
1 | name: New Feature
2 | description: 此模板用于请求添加新的功能
3 | labels: ["feature"]
4 | assignees:
5 | - DreamerQcl
6 | title: "[feature]: "
7 | body:
8 | - type: markdown
9 | attributes:
10 | value: |
11 | 在描述你的问题之前请先尝试自己解决或者查找相似的 issue。
12 | - type: checkboxes
13 | id: checklist
14 | attributes:
15 | label: 确认清单
16 | options:
17 | - label: 我已尝试自己去解决这个问题,但不在我的能力或者职责范围之内。
18 | required: true
19 | - type: textarea
20 | id: description
21 | attributes:
22 | label: 请在这里描述你的需求
23 | validations:
24 | required: true
25 | - type: textarea
26 | id: impact
27 | attributes:
28 | label: 此功能为项目或功能带来的影响(好的或者坏的)
29 | validations:
30 | required: true
--------------------------------------------------------------------------------
/schema/resource.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "type": "object",
4 | "additionalProperties": false,
5 | "properties": {
6 | "$schema": {
7 | "type": "string"
8 | },
9 | "binaries": {
10 | "type": "object",
11 | "patternProperties": {
12 | "^.*$": {
13 | "type": "string"
14 | }
15 | },
16 | "additionalProperties": false,
17 | "description": "The binaries to be embedd, the key is the name of the binary and the value is the path to the binary."
18 | },
19 | "icon": {
20 | "type": "string",
21 | "description": "Path to the icon file, it's a Windows Only feature."
22 | }
23 | },
24 | "required": [
25 | "binaries"
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/schema/manifest.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "type": "object",
4 | "additionalProperties": false,
5 | "properties": {
6 | "$schema": {
7 | "type": "string"
8 | },
9 | "author": {
10 | "type": "string"
11 | },
12 | "description": {
13 | "type": "string"
14 | },
15 | "productName": {
16 | "type": "string"
17 | },
18 | "internalName": {
19 | "type": "string"
20 | },
21 | "version": {
22 | "type": "string"
23 | },
24 | "copyright": {
25 | "type": "string"
26 | }
27 | },
28 | "required": [
29 | "author",
30 | "description",
31 | "productName",
32 | "internalName",
33 | "version",
34 | "copyright"
35 | ]
36 | }
--------------------------------------------------------------------------------
/sese/types/defines.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #pragma once
16 |
17 | #include
18 |
19 | namespace sese {
20 |
21 | template
22 | using void_t = void;
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/docker/ubuntu-arm64.dockerfile:
--------------------------------------------------------------------------------
1 | FROM arm64v8/ubuntu:jammy
2 |
3 | ENV TERM=xterm-256color
4 | ENV DEBIAN_FRONTEND=noninteractive
5 |
6 | #COPY ./scripts/install_ubuntu_deps.sh /tmp/install_deps.sh
7 |
8 | RUN yes | unminimize && \
9 | # bash ./tmp/install_deps.sh && \
10 | apt install -y --no-install-recommends build-essential cmake curl zip unzip tar git g++ mysql-client postgresql-client sqlite3 python3-pip doxygen pkg-config bison flex autoconf ninja-build && \
11 | apt autoremove -y && \
12 | rm -rf /var/lib/apt/lists/*
13 |
14 | RUN git clone https://github.com/microsoft/vcpkg /opt/vcpkg && \
15 | /opt/vcpkg/bootstrap-vcpkg.sh -disableMetrics
16 |
17 | ENV VCPKG_ROOT=/opt/vcpkg
18 |
19 | COPY ./requirements.txt /tmp/requirements.txt
20 |
21 | RUN pip install -r /tmp/requirements.txt && \
22 | pip cache purge
--------------------------------------------------------------------------------
/sese/service/Service.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include "Service.h"
16 |
17 | sese::ErrorCode sese::service::Service::getErrorCode() {
18 | return {this->getLastError(), this->getLastErrorMessage()};
19 | }
20 |
--------------------------------------------------------------------------------
/sese/benchmark/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | find_package(benchmark CONFIG REQUIRED)
2 | find_package(GTest CONFIG REQUIRED)
3 |
4 | if(MSVC)
5 | add_compile_options(/utf-8)
6 | endif()
7 |
8 | macro(bm_link_libraries target)
9 | target_link_libraries(${target} PRIVATE benchmark::benchmark GTest::gtest Core)
10 | endmacro()
11 |
12 | add_executable(BM_StringBuilder BM_StringBuilder.cpp)
13 | bm_link_libraries(BM_StringBuilder)
14 |
15 | add_executable(BM_PostgresPreparedStatement BM_PostgresPreparedStatement.cpp)
16 | bm_link_libraries(BM_PostgresPreparedStatement)
17 |
18 | add_executable(BM_FormatParse BM_FormatParse.cpp)
19 | bm_link_libraries(BM_FormatParse)
20 |
21 | add_executable(BM_Format BM_Format.cpp)
22 | bm_link_libraries(BM_Format)
23 |
24 | add_executable(BM_JsonParse BM_JsonParse.cpp)
25 | bm_link_libraries(BM_JsonParse)
26 |
--------------------------------------------------------------------------------
/sese/util/ErrorCode.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include "ErrorCode.h"
16 |
17 | #include
18 |
19 | sese::ErrorCode::ErrorCode(int32_t error, std::string msg) noexcept
20 | : error(error), msg(std::move(msg)) {
21 | }
22 |
--------------------------------------------------------------------------------
/ROADMAP.md:
--------------------------------------------------------------------------------
1 | # Roadmap Publicity
2 |
3 | ## Short intro
4 |
5 | 1. ❌ Canceled
6 | 2. ⭕️ Done
7 | 3. 🛠️ In Processing
8 |
9 | ## Version 2.1.0
10 |
11 | - ❌ Crypto Wrapper(RSA, SM4 etc.)
12 | - ⭕️ Better web-related support
13 | - ⭕️ Improve test coverage
14 | - ⭕️ Gitlab workflow improvements
15 |
16 | ## Version 2.1.1
17 |
18 | - ⭕️ Static Links
19 | - ⭕️ Upload to builtin repos
20 |
21 | ## Version 2.3.0
22 |
23 | - ⭕️ HPACK(RFC7541)
24 | - ⭕️ HTTP2(RFC7540)
25 | - ⭕️ Better web-related support
26 | - ⭕️ IP/TCP based filters
27 |
28 | ## Version 3.0.0
29 |
30 | - ⭕️ DNS module decoupling and refactoring
31 | - ⭕️️ Better Exception
32 | - ⭕️️ Support ~~std::error_code~~ sese::ErrorCode & sese::Result
33 | - ⭕️ Binary description manifest
34 | - ⭕️ Embedded resource management
35 | - ️️⭕️ Replaces the previous recursive algorithm
--------------------------------------------------------------------------------
/sese/io/File.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | * @file File.h
17 | * @author kaoru
18 | * @version 0.1
19 | * @brief File class
20 | * @date September 13, 2023
21 | */
22 |
23 | #pragma once
24 |
25 | #include
--------------------------------------------------------------------------------
/sese/io/NullOutputStream.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 |
17 | int64_t sese::io::NullOutputStream::write([[maybe_unused]] const void *buffer, size_t length) {
18 | return static_cast(length);
19 | }
20 |
--------------------------------------------------------------------------------
/sese/log/AbstractAppender.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include "sese/log/AbstractAppender.h"
16 |
17 | namespace sese::log {
18 | AbstractAppender::AbstractAppender(Level level) noexcept {
19 | this->level = level;
20 | }
21 | } // namespace sese::log
--------------------------------------------------------------------------------
/sese/io/ConsoleOutputStream.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include "sese/io/ConsoleOutputStream.h"
16 |
17 | int64_t sese::io::ConsoleOutputStream::write(const void *buffer, size_t length) {
18 | return static_cast(fwrite(buffer, 1, length, stdout));
19 | }
--------------------------------------------------------------------------------
/.idea/copyright/libsese_Default_Copyright.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/sese/internal/unix/thread/GlobalThreadPool.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 |
17 | void sese::GlobalThreadPool::postTask(const std::function &func) {
18 | auto pool = globalThreadPool.getInstance();
19 | pool->postTask(func);
20 | }
--------------------------------------------------------------------------------
/sese/internal/service/http/ConnType.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #pragma once
16 |
17 | #include
18 |
19 | namespace sese::internal::service::http {
20 |
21 | enum class ConnType {
22 | FILTER,
23 | FILE_DOWNLOAD,
24 | CONTROLLER,
25 | NONE
26 | };
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/sese/types/is_pair.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #pragma once
16 |
17 | #include
18 |
19 | namespace sese {
20 |
21 | template
22 | struct is_pair : std::false_type {};
23 |
24 | template
25 | struct is_pair> : std::true_type {};
26 |
27 | } // namespace sese
28 |
--------------------------------------------------------------------------------
/sese/db/Config.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | /// \file Config.h
16 | /// \author kaoru
17 | /// \brief Database-related configuration files
18 | /// \version 0.1
19 |
20 | #pragma once
21 |
22 | #define SESE_DB_API
23 |
24 | #ifdef _MSC_VER
25 | #pragma warning(disable : 4251)
26 | #endif
27 |
28 | #include
29 | #include
--------------------------------------------------------------------------------
/sese/thread/SpinLock.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 |
17 | using namespace sese;
18 |
19 | void SpinLock::lock() {
20 | bool expect = false;
21 | while (!flag.compare_exchange_weak(expect, true)) {
22 | expect = false;
23 | }
24 | }
25 |
26 | void SpinLock::unlock() {
27 | flag.store(false);
28 | }
--------------------------------------------------------------------------------
/sese/io/InputBuffer.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | /// @file InputBuffer.h
16 | /// @brief Input buffer wrapper
17 | /// @author kaoru
18 | /// @date April 20, 2024
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace sese::io {
25 |
26 | /// \brief Input buffer wrapper
27 | using InputBuffer = InputBufferWrapper;
28 |
29 | }
--------------------------------------------------------------------------------
/sese/io/OutputStream.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 |
17 | int64_t sese::io::OutputStream::write(const std::string_view &buffer) {
18 | return write(buffer.data(), buffer.size());
19 | }
20 |
21 | int64_t sese::io::OutputStream::write(const text::StringView &buffer) {
22 | return write(buffer.data(), buffer.size());
23 | }
24 |
--------------------------------------------------------------------------------
/sese/res/ResourceManager.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 |
17 | sese::res::Resource::Ptr sese::res::ResourceManager::getResource(const std::string &name) const {
18 | auto iterator = resourceMap.find(name);
19 | if (iterator == resourceMap.end()) {
20 | return nullptr;
21 | }
22 | return iterator->second;
23 | }
--------------------------------------------------------------------------------
/sese/util/ZlibConfig.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | * @file ZlibConfig.h
17 | * @author kaoru
18 | * @version 0.1
19 | * @brief ZLIB configuration declarations
20 | * @date September 13, 2023
21 | */
22 |
23 | #pragma once
24 |
25 | namespace sese {
26 | enum class CompressionType {
27 | RAW = -30,
28 | ZLIB = 0,
29 | GZIP = 16
30 | };
31 | }
--------------------------------------------------------------------------------
/scripts/do_websocket.py:
--------------------------------------------------------------------------------
1 | # Copyright 2024 libsese
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 | import websocket
17 | import sys
18 |
19 |
20 | def test(port: str):
21 | ws = websocket.WebSocket()
22 | ws.connect("ws://localhost:{}/chat".format(port))
23 | ws.send("Hello")
24 | buf = ws.recv()
25 | print(buf)
26 | ws.close()
27 |
28 |
29 | if __name__ == "__main__":
30 | p = sys.argv[1]
31 | test(p)
32 |
--------------------------------------------------------------------------------
/sese/io/OutputBuffer.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | /// @file OutputBuffer.h
16 | /// @brief Output buffer wrapper
17 | /// @author kaoru
18 | /// @date April 20, 2024
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace sese::io {
25 |
26 | /// \brief Output buffer wrapper
27 | using OutputBuffer = OutputBufferWrapper;
28 |
29 | }
--------------------------------------------------------------------------------
/sese/db/Metadata.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #pragma once
16 |
17 | namespace sese::db {
18 | enum class MetadataType {
19 | TEXT,
20 | BOOLEAN,
21 | CHAR,
22 | SHORT,
23 | INTEGER,
24 | LONG,
25 | FLOAT,
26 | DOUBLE,
27 | DATE,
28 | TIME,
29 | DATE_TIME,
30 | UNKNOWN
31 | };
32 | }
--------------------------------------------------------------------------------
/sese/io/Closeable.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | * @file Closeable.h
17 | * @date July 5, 2023
18 | * @author kaoru
19 | * @brief The closeable interface
20 | * @version 0.1
21 | */
22 |
23 | #pragma once
24 |
25 | namespace sese::io {
26 | /// The closeable interface
27 | class Closeable {
28 | public:
29 | virtual ~Closeable() = default;
30 | virtual void close() = 0;
31 | };
32 | } // namespace sese::io
--------------------------------------------------------------------------------
/sese/net/http/HeaderBuilder.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 |
17 | using sese::net::http::Header;
18 | using sese::net::http::HeaderBuilder;
19 |
20 | HeaderBuilder::HeaderBuilder(Header &header) : header(header) {}
21 |
22 | HeaderBuilder &&HeaderBuilder::set(const std::string &key, const std::string &value) && {
23 | header.set(key, value);
24 | return std::move(*this);
25 | }
26 |
--------------------------------------------------------------------------------
/sese/res/Resource.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 | #include
17 |
18 | // GCOVR_EXCL_START
19 |
20 | sese::res::Resource::Resource(std::string name, const void *buf, size_t size)
21 | : name(std::move(name)), buf(buf), size(size) {}
22 |
23 | // GCOVR_EXCL_STOP
24 |
25 | sese::res::ResourceStream::Ptr sese::res::Resource::getStream() {
26 | return SESE_MAKE_RES_STREAM(buf, size);
27 | }
--------------------------------------------------------------------------------
/sese/security/SecurityConfig.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 |
17 | #include
18 |
19 | int32_t sese::security::SecurityInitTask::init() noexcept {
20 | SSL_library_init();
21 | SSL_load_error_strings();
22 | return 0;
23 | }
24 |
25 | int32_t sese::security::SecurityInitTask::destroy() noexcept {
26 | OPENSSL_thread_stop();
27 | OPENSSL_cleanup();
28 | return 0;
29 | }
--------------------------------------------------------------------------------
/sese/text/String.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | * @file String.h
17 | * @author kaoru
18 | * @version 0.1
19 | * @brief UTF-8 String
20 | * @date September 13, 2023
21 | */
22 |
23 | #pragma once
24 |
25 | #include
26 | #include
27 |
28 | namespace sese::text {
29 | using Char = sstr::SChar;
30 | using String = sstr::SString;
31 | using StringView = sstr::SStringView;
32 | } // namespace sese::text
--------------------------------------------------------------------------------
/sese/net/http/Response.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #include
16 |
17 | // GCOVR_EXCL_START
18 |
19 | void sese::net::http::Response::swap(sese::net::http::Response &another) noexcept {
20 | std::swap(version, another.version);
21 | std::swap(statusCode, another.statusCode);
22 | std::swap(cookies, another.cookies);
23 | std::swap(headers, another.headers);
24 | body.swap(another.body);
25 | }
26 |
27 | // GCOVR_EXCL_STOP
--------------------------------------------------------------------------------
/sese/service/dns/Config.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #pragma once
16 |
17 | #include
18 | #include
19 |
20 | #include
21 |
22 | namespace sese::service::dns {
23 |
24 | using Callback = std::function;
29 |
30 | } // namespace sese::service::dns
--------------------------------------------------------------------------------
/sese/test/TestDB/Config.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | #pragma once
16 |
17 | #ifndef SQLITE_CONNECTION_STRING
18 | #define SQLITE_CONNECTION_STRING PATH_TO_DB
19 | #endif
20 |
21 | #ifndef MYSQL_CONNECTION_STRING
22 | #define MYSQL_CONNECTION_STRING "host=127.0.0.1;port=18806;user=root;pwd=libsese;db=db_test;"
23 | #endif
24 |
25 | #ifndef PSQL_CONNECTION_STRING
26 | #define PSQL_CONNECTION_STRING "host=127.0.0.1;port=18080;user=postgres;pwd=libsese;db=db_test;"
27 | #endif
--------------------------------------------------------------------------------
/sese/db/Util.h:
--------------------------------------------------------------------------------
1 | // Copyright 2024 libsese
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 | /// \file Util.h
16 | /// \brief Utility Collection
17 | /// \author kaoru
18 | /// \version 0.1
19 |
20 | #pragma once
21 |
22 | #include