Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
dd65bd6
add notes
zpeng11 Jul 31, 2025
398de1e
Add signalfd
zpeng11 Aug 2, 2025
a0b8354
io handle logic redesign, signal redesin
zpeng11 Aug 3, 2025
78ad82e
Rebuilt core components
zpeng11 Aug 4, 2025
eb15743
Readme update
zpeng11 Aug 4, 2025
e405bf1
re-organize structure
zpeng11 Aug 4, 2025
543013c
re structure the project finished
zpeng11 Aug 4, 2025
e40db01
prepare for test
zpeng11 Aug 4, 2025
c00bcc7
vibe coding unit test
zpeng11 Aug 4, 2025
1270914
thread tests
zpeng11 Aug 4, 2025
b4f80a0
vibe tests
zpeng11 Aug 4, 2025
866030e
vibe test blocking queue
zpeng11 Aug 4, 2025
6227694
continue vibe testing
zpeng11 Aug 4, 2025
12b9ea2
vibe testing io
zpeng11 Aug 4, 2025
bd7f430
vibe testing for core
zpeng11 Aug 4, 2025
c83c492
vibe testing
zpeng11 Aug 4, 2025
6b0198d
vibe signal test
zpeng11 Aug 4, 2025
c002073
Add goals
zpeng11 Aug 4, 2025
b954d7a
solved timer but have signal problem
zpeng11 Aug 5, 2025
570801b
Finished debugging for signal
zpeng11 Aug 5, 2025
969ce8c
temios interactive
zpeng11 Aug 5, 2025
cde4261
Keyboard handle ready
zpeng11 Aug 6, 2025
f14ea79
socket api updates
zpeng11 Aug 6, 2025
05f786a
socket echo example works
zpeng11 Aug 6, 2025
fea64d3
UDP ready
zpeng11 Aug 6, 2025
3690734
optimize client
zpeng11 Aug 6, 2025
123206a
optimize connect()
zpeng11 Aug 6, 2025
ccb16bc
add udp server and snake game example
zpeng11 Aug 6, 2025
0737817
update snake game
zpeng11 Aug 6, 2025
f57ef22
start working on tcp connector
zpeng11 Aug 6, 2025
43a0d0b
TCP connector completed
zpeng11 Aug 7, 2025
099e71a
TCP connector working good now
zpeng11 Aug 7, 2025
b306100
update and works
zpeng11 Aug 8, 2025
20d86dd
interface update
zpeng11 Aug 8, 2025
642df59
acceptor working
zpeng11 Aug 9, 2025
6b6927c
core updates
zpeng11 Aug 9, 2025
ab90cc9
buffer ready
zpeng11 Aug 9, 2025
074d844
IOHandler does not need to pass and lock weak at some point
zpeng11 Aug 9, 2025
b330cdb
updates
zpeng11 Aug 9, 2025
7d413de
update iohandle interface
zpeng11 Aug 9, 2025
0a592b3
tcp connection
zpeng11 Aug 10, 2025
b998eeb
adapt connection to connector and acceptor
zpeng11 Aug 10, 2025
7602a4a
updated TCP echo example
zpeng11 Aug 10, 2025
b9ac1e1
solved recursive write bug
zpeng11 Aug 10, 2025
614acf4
2 benchmarks
zpeng11 Aug 10, 2025
17e952b
wrk test working
zpeng11 Aug 10, 2025
565a354
ci license and readme update
zpeng11 Aug 10, 2025
9467f3a
connection ptr update
zpeng11 Aug 10, 2025
2ad807b
updated ptr interface
zpeng11 Aug 10, 2025
de46bfc
interface update
zpeng11 Aug 10, 2025
c4a663d
Readme update
zpeng11 Aug 10, 2025
c345f20
badges
zpeng11 Aug 10, 2025
522a9e7
ci/cd
zpeng11 Aug 10, 2025
11cd20e
fix asserts
zpeng11 Aug 10, 2025
fb93878
add specification
zpeng11 Aug 10, 2025
36b2a1a
solving for ci
zpeng11 Aug 10, 2025
bda8bd3
removed log file test since keep failing on ci
zpeng11 Aug 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
155 changes: 155 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: CI/CD Pipeline

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build_and_test:
runs-on: ubuntu-latest
name: Build Library and Run Tests

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential

- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=Release

- name: Build project
run: cmake --build build --parallel

- name: Run tests
run: |
cd build
ctest --output-on-failure --parallel

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: hohnor-library
path: build/libhohnor.a
retention-days: 1

build_examples:
runs-on: ubuntu-latest
name: Build Examples
needs: build_and_test

strategy:
matrix:
example: [TCPEcho, UDPEcho, keyboard, SnakeGame]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: hohnor-library
path: build/

- name: Configure and build main library
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel

- name: Build example - ${{ matrix.example }}
run: |
cd example/${{ matrix.example }}
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel

- name: Upload example artifacts
uses: actions/upload-artifact@v4
with:
name: example-${{ matrix.example }}
path: example/${{ matrix.example }}/build/
retention-days: 1

build_benchmarks:
runs-on: ubuntu-latest
name: Build Benchmarks
needs: build_and_test

strategy:
matrix:
benchmark: [iperf3, wrk]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: hohnor-library
path: build/

- name: Configure and build main library
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel

- name: Build benchmark - ${{ matrix.benchmark }}
run: |
cd benchmark/${{ matrix.benchmark }}
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel

- name: Upload benchmark artifacts
uses: actions/upload-artifact@v4
with:
name: benchmark-${{ matrix.benchmark }}
path: benchmark/${{ matrix.benchmark }}/build/
retention-days: 1

summary:
runs-on: ubuntu-latest
name: Build Summary
needs: [build_and_test, build_examples, build_benchmarks]
if: always()

steps:
- name: Check build results
run: |
echo "Build and Test: ${{ needs.build_and_test.result }}"
echo "Build Examples: ${{ needs.build_examples.result }}"
echo "Build Benchmarks: ${{ needs.build_benchmarks.result }}"

if [[ "${{ needs.build_and_test.result }}" != "success" ]]; then
echo "❌ Main library build or tests failed"
exit 1
fi

if [[ "${{ needs.build_examples.result }}" != "success" ]]; then
echo "❌ Examples build failed"
exit 1
fi

if [[ "${{ needs.build_benchmarks.result }}" != "success" ]]; then
echo "❌ Benchmarks build failed"
exit 1
fi

echo "✅ All builds completed successfully!"
74 changes: 74 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: "CodeQL Security Analysis"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '30 2 * * 1' # Run weekly on Mondays at 2:30 AM UTC

jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
language: [ 'c-cpp' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - name: Manual build
# run: |
# cmake -B build -DCMAKE_BUILD_TYPE=Release
# cmake --build build --parallel

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode
build
playground
41 changes: 29 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
cmake_minimum_required(VERSION 3.1)

project(Hohnor)
project(hohnor)

set(CMAKE_EXPORT_COMPILE_COMMANDS True)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

#add directory, they will run the cmake file in the directory automatically
include(GNUInstallDirs)

#add directory, they will run the cmake file in the directory automatically
add_subdirectory(hohnor)
add_subdirectory(example)
file(GLOB SOURCES
"src/thread/*.cpp"
"src/time/*.cpp"
"src/log/*.cpp"
"src/file/*.cpp"
"src/process/*.cpp"
"src/net/*.cpp"
"src/io/*.cpp"
"src/core/*.cpp"
)

list(APPEND libs THREAD)
list(APPEND libs TIME)
list(APPEND libs LOG)
list(APPEND libs FILE)
list(APPEND libs PROCESS)
list(APPEND libs NET)
list(APPEND libs IO)
list(APPEND libs CORE)
add_library(${PROJECT_NAME} STATIC ${SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)

option(ENABLE_UNIT_TEST "ENABLE_UNIT_TEST" ON) #in case cmake does not supporting FetchContent or compiler does not support C++14
if(ENABLE_UNIT_TEST)
enable_testing()
add_subdirectory(test)
endif()

install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(DIRECTORY include/hohnor/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Hohnor Project Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading