Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fc5a6ec
Merge pull request #25 from GauthierMalfilatre/dev
GauthierMalfilatre Jun 27, 2026
f8af768
Merge pull request #26 from GauthierMalfilatre/dev
GauthierMalfilatre Jun 27, 2026
a520545
Enhance README with multi-protocol support details
GauthierMalfilatre Jun 28, 2026
30cb4e5
Merge pull request #28 from GauthierMalfilatre/dev
GauthierMalfilatre Jul 1, 2026
dc111af
[UP] Update CMakeLists.txt to include heracles (for tests)
GauthierMalfilatre Jul 3, 2026
e7c2b71
[ADD] Add tests
GauthierMalfilatre Jul 3, 2026
4820b7e
[ADD] Add more tests, and switch to Heracles framework
GauthierMalfilatre Jul 3, 2026
fa3d2a7
Add PR template
erenworld Jul 7, 2026
48d7c0a
Add bug report template
erenworld Jul 7, 2026
eb80efd
Add feature request template
erenworld Jul 7, 2026
34fcdf0
Add question template
erenworld Jul 7, 2026
2448a7e
Merge pull request #31 from erenworld/pr-template
GauthierMalfilatre Jul 7, 2026
133fa10
Merge pull request #32 from erenworld/issue-template
GauthierMalfilatre Jul 7, 2026
b9bd5fb
Merge branch 'main' into feature/tests
GauthierMalfilatre Jul 8, 2026
0bfb1cf
Merge branch 'main' into feature/tests
GauthierMalfilatre Jul 8, 2026
67b56c6
[UP] Update tests.
GauthierMalfilatre Jul 8, 2026
72eb57b
Merge pull request #33 from kronkorp/feature/tests
GauthierMalfilatre Jul 8, 2026
eba48cf
[UP] Update heracles to kronklab in cmakelists
GauthierMalfilatre Jul 10, 2026
df0b0c2
Merge pull request #34 from kronkorp/feature/tests
GauthierMalfilatre Jul 10, 2026
456c407
[FIX] Fix tests and kronklab fetching.
GauthierMalfilatre Sep 23, 2026
b5d9e5b
[DEL] Remove old folders mkn/
GauthierMalfilatre Sep 23, 2026
6a19b05
[UP] The knServer is now evolving around a epoll() call.
GauthierMalfilatre Sep 23, 2026
92e47d5
[ADD] Add some tests
GauthierMalfilatre Sep 23, 2026
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
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report of the bug you've encountered
title: "[BUG] - ISSUE_TITLE"
labels: bug
assignees: kronkcorp

---

## Description

A clear and concise description of what the bug is.

## Steps to reproduce

Steps to reproduce the bug you encountered

## Expected behaviour

A clear and concise description of what you expected to happen.

## Environment

- OS: [e.g. GNU/Linux Debian 10]
- Architecture [Arm, x86_64, ...]
- C version
- library version
- Protocol used
- Remote server version and name

## Additional information

Add any other context about the problem here.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea to improve kronkcorp
title: "[Feature Request] - FEATURE_TITLE"
labels: "new feature"
assignees: kronkcorp

---

## Description

Put here a brief introduction to your suggestion.

### Changes

The following changes to the application are expected

- ...

## Implementation

Provide any kind of suggestion you propose on how to implement the feature.
If you have none, delete this section.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Question
about: Ask what you want about the project
title: "[QUESTION] - TITLE"
labels: question
assignees: kronkcorp

---
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Description of the change.

## Related Issue

Closes # ?

## Type of Change

- [ ] Bug fix
- [ ] Refactor
- [ ] Performance improvement
- [ ] New feature
- [ ] Tests
- [ ] CI/CD
- [ ] Documentation

## Tests
25 changes: 8 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ file(GLOB_RECURSE KRONKNET_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
)

set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

add_library(kronknet-obj OBJECT ${KRONKNET_SOURCES})

set_target_properties(kronknet-obj PROPERTIES
C_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
POSITION_INDEPENDENT_CODE ON
)

target_include_directories(kronknet-obj
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
Expand All @@ -26,29 +29,17 @@ target_compile_options(kronknet-obj PRIVATE
-O3
)

set_target_properties(kronknet-obj PROPERTIES
POSITION_INDEPENDENT_CODE ON
)

add_library(kronknet-static STATIC $<TARGET_OBJECTS:kronknet-obj>)
target_link_libraries(kronknet-static PUBLIC kronknet-obj)

add_library(kronknet-shared SHARED $<TARGET_OBJECTS:kronknet-obj>)
target_link_libraries(kronknet-shared PUBLIC kronknet-obj)

target_compile_definitions(kronknet-shared PRIVATE KRONKNET_BUILD_DLL)

add_library(kronknet ALIAS kronknet-static)

set_target_properties(kronknet-static PROPERTIES
OUTPUT_NAME kronknet
)

set_target_properties(kronknet-shared PROPERTIES
OUTPUT_NAME kronknet
)

# NOTE: Installation
set_target_properties(kronknet-static PROPERTIES OUTPUT_NAME kronknet)
set_target_properties(kronknet-shared PROPERTIES OUTPUT_NAME kronknet)

include(GNUInstallDirs)

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ Key Features:

- **O(1) Binding**: Dual-pointer (user_data) system for lookup-free interaction between the network engine and application entities.

- **Multi-protocol support**: Currently, kronknet supports both TCP and UDP. In TCP mode, connections are stored in a dynamic array, whereas in UDP mode, they are kept in a hash table, offering O(1) lookup complexity in most cases.

<p align="right">(<a href="#readme-top">back to top</a>)</p>


Expand Down
26 changes: 0 additions & 26 deletions include/kronknet/mkn/new.h

This file was deleted.

79 changes: 0 additions & 79 deletions include/kronknet/mkn/object.h

This file was deleted.

52 changes: 0 additions & 52 deletions include/kronknet/mkn/server.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/connection/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typedef struct kronknet_connection_s {
void *user_ptr; //!< The user datas (eg User struct ...)
knRBuff *out_buff; //!< The out buffer
knConnection_sendHook sendHook; //!< The send hook
short int *evtptr; //!< The ptr to the events in the pool
int epollfd; //!< The epoll fd of the server pool
union {
struct {} on_udp; //!< On UDP datas
struct {} on_tcp; //!< On tcp datas
Expand All @@ -54,6 +54,6 @@ void knConnection_destroy(knConnection *conn);

knConnection *knConnection_create(const struct sockaddr_in* addr, knFlags flags);

int knConnection_setEvents(knConnection *conn, short int events);
int knConnection_setEvents(knConnection *conn, uint32_t events);

#endif /* KRONKNET_CONNECTION_IMPL_H */
4 changes: 2 additions & 2 deletions src/connection/hooks/tcp/conn_tcpSend.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/poll.h>
#include <sys/epoll.h>
#include <sys/socket.h>
#include <sys/types.h>

Expand Down Expand Up @@ -44,6 +44,6 @@ int knConnection_tcpSendHook(
if (knRBuff_push(conn->out_buff, data + written, remaining) == -1) {
return KNEVTERR;
}
knConnection_setEvents(conn, POLLOUT | POLLIN);
knConnection_setEvents(conn, EPOLLOUT | EPOLLIN);
return KNEVTOK;
}
4 changes: 2 additions & 2 deletions src/connection/hooks/udp/conn_udpSend.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/poll.h>
#include <sys/epoll.h>
#include <sys/socket.h>
#include <sys/types.h>

Expand Down Expand Up @@ -44,6 +44,6 @@ int knConnection_udpSendHook(
if (knRBuff_push(conn->out_buff, data + written, remaining) == -1) {
return KNEVTERR;
}
knConnection_setEvents(conn, POLLOUT | POLLIN);
knConnection_setEvents(conn, EPOLLOUT | EPOLLIN);
return KNEVTOK;
}
1 change: 1 addition & 0 deletions src/connection/init/conn_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static void __knConnection_statics(

conn->addr_length = sizeof(conn->addr);
conn->fd = -1;
conn->epollfd = -1;
conn->port = ntohs(conn->addr.sin_port);
conn->id = id++;
conn->last_data = monotonic();
Expand Down
14 changes: 12 additions & 2 deletions src/connection/setters/conn_setEvents.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@
*/
#include "../connection.h"
#include "kronknet/macros/errdef.h"
#include "kronknet/macros/types.h"
#include <stddef.h>
#include <sys/epoll.h>

int knConnection_setEvents(
knConnection *conn,
short int events
uint32_t events
)
{
struct epoll_event ev;

if (!conn) {
return KNEVTARGS;
}
*(conn->evtptr) = events;
// NOTE: In UDP, conn->fd is the server socket, so data.ptr stays NULL
ev.events = events;
ev.data.ptr = (conn->flags & knUDP) ? NULL : conn;
if (epoll_ctl(conn->epollfd, EPOLL_CTL_MOD, conn->fd, &ev) == -1) {
return KNEVTNET;
}
return KNEVTOK;
}
Loading
Loading