Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions .github/workflows/build_nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: "0 12 1 * *"

jobs:
build:
Expand All @@ -20,6 +18,6 @@ jobs:

- name: "Build/Test"
run: |
curl -Lo mkn https://github.com/mkn/mkn/releases/download/latest/mkn_nix
curl -fL --retry 3 --retry-delay 2 -o mkn https://github.com/mkn/mkn/releases/download/latest/mkn_nix
chmod +x mkn
KLOG=3 ./mkn clean build run -dtOp test -a "-std=c++17 -fPIC" -l -pthread
4 changes: 1 addition & 3 deletions .github/workflows/build_osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: "0 12 1 * *"

jobs:
build:
Expand All @@ -24,5 +22,5 @@ jobs:
run: |
set -ex
export SSL_DIR=$(dirname $(dirname $(find /opt/homebrew/Cellar/openssl@3 | grep "libssl\.a")))
curl -Lo mkn https://github.com/mkn/mkn/releases/download/latest/mkn_arm_osx && chmod +x mkn
curl -fL --retry 3 --retry-delay 2 -o mkn https://github.com/mkn/mkn/releases/download/latest/mkn_arm_osx && chmod +x mkn
KLOG=3 ./mkn clean build run -dtOp test -a "-std=c++17 -fPIC" -b "${SSL_DIR}/include" -B "${SSL_DIR}/lib"
2 changes: 0 additions & 2 deletions .github/workflows/build_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: "0 12 1 * *"

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion inc/mkn/ram/asio/fcgi.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion inc/mkn/ram/html/def.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion inc/mkn/ram/html/page.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion inc/mkn/ram/html/tag.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion inc/mkn/ram/html4.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
12 changes: 6 additions & 6 deletions inc/mkn/ram/http.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -106,7 +106,7 @@ class Message {
bool header(std::string const& s) const { return _hs.count(s); }
};

class KUL_PUBLISH _1_1Response : public Message {
class MKN_KUL_PUBLISH _1_1Response : public Message {
protected:
uint16_t _s = 200;
std::string r = "OK";
Expand Down Expand Up @@ -154,7 +154,7 @@ inline std::ostream& operator<<(std::ostream& s, _1_1Response const& r) {
return s << r.toString();
}

class KUL_PUBLISH A1_1Request : public Message {
class MKN_KUL_PUBLISH A1_1Request : public Message {
protected:
uint16_t _port;
std::string _ip, _host, _path;
Expand Down Expand Up @@ -206,7 +206,7 @@ class KUL_PUBLISH A1_1Request : public Message {
}
};

class KUL_PUBLISH _1_1GetRequest : public A1_1Request {
class MKN_KUL_PUBLISH _1_1GetRequest : public A1_1Request {
public:
_1_1GetRequest(std::string const& host, std::string const& path = "", uint16_t const& port = 80,
std::string const& ip = "")
Expand All @@ -217,7 +217,7 @@ class KUL_PUBLISH _1_1GetRequest : public A1_1Request {
};
using Get = _1_1GetRequest;

class KUL_PUBLISH _1_1PostRequest : public A1_1Request {
class MKN_KUL_PUBLISH _1_1PostRequest : public A1_1Request {
public:
_1_1PostRequest(std::string const& host, std::string const& path = "", uint16_t const& port = 80,
std::string const& ip = "")
Expand All @@ -227,7 +227,7 @@ class KUL_PUBLISH _1_1PostRequest : public A1_1Request {
};
using Post = _1_1PostRequest;

class KUL_PUBLISH AServer : public mkn::ram::tcp::SocketServer<char> {
class MKN_KUL_PUBLISH AServer : public mkn::ram::tcp::SocketServer<char> {
protected:
std::function<_1_1Response(A1_1Request const&)> m_func;

Expand Down
2 changes: 1 addition & 1 deletion inc/mkn/ram/http/def.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion inc/mkn/ram/http/session.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion inc/mkn/ram/https.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion inc/mkn/ram/mpi.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
9 changes: 7 additions & 2 deletions inc/mkn/ram/os/nixish/http.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -111,7 +111,12 @@ class MultiServer : public mkn::ram::http::Server {
MultiServer(short const& p = 80, uint8_t const& acceptThreads = 1,
uint8_t const& workerThreads = 1)
: Server(p), _acceptThreads(acceptThreads), _workerThreads(workerThreads) {}
~MultiServer() { KUL_DBG_FUNC_ENTER }

~MultiServer() {
MKN_KUL_DBG_FUNC_ENTER;
_acceptPool.stop();
_workerPool.stop();
}

virtual void start() KTHROW(mkn::ram::tcp::Exception) override;

Expand Down
8 changes: 4 additions & 4 deletions inc/mkn/ram/os/nixish/https.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -112,7 +112,7 @@ class MultiServer : public mkn::ram::https::Server {
mkn::kul::ChroncurrentThreadPool<> _workerPool;

void operateAccept(size_t const& threadID) {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
std::map<int, uint8_t> fds;
fds.insert(std::make_pair(0, 0));
for (size_t i = threadID; i < _MKN_RAM_TCP_MAX_CLIENT_; i += _acceptThreads)
Expand All @@ -134,7 +134,7 @@ class MultiServer : public mkn::ram::https::Server {

virtual void handleBuffer(std::map<int, uint8_t>& fds, int const& fd, char* in, int const& read,
int& e) override {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
_workerPool.async(
std::bind(&MultiServer::operateBuffer, std::ref(*this), &fds, fd, in, read, e),
std::bind(&MultiServer::errorBuffer, std::ref(*this), std::placeholders::_1));
Expand All @@ -143,7 +143,7 @@ class MultiServer : public mkn::ram::https::Server {

void operateBuffer(std::map<int, uint8_t>* fds, int const& fd, char* in, int const& read,
int& e) {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
mkn::ram::https::Server::handleBuffer(*fds, fd, in, read, e);
if (e <= 0) {
getpeername(m_fds[fd].fd, (struct sockaddr*)&cli_addr, (socklen_t*)&clilen);
Expand Down
24 changes: 12 additions & 12 deletions inc/mkn/ram/os/nixish/tcp.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -68,13 +68,13 @@ class Socket : public ASocket<T> {
if (this->open) close();
}
virtual bool connect(std::string const& host, int16_t const& port) override {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
if (!SOCKET(sck) || !CONNECT(sck, host, port)) return false;
this->open = true;
return true;
}
virtual bool close() override {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
bool o1 = this->open;
if (this->open) {
::close(sck);
Expand All @@ -88,7 +88,7 @@ class Socket : public ASocket<T> {
}
virtual size_t read(T* data, size_t const& len, bool& more)
KTHROW(mkn::ram::tcp::Exception) override {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
struct timeval tv;
fd_set fds;
int64_t ret = 0, iof = -1;
Expand Down Expand Up @@ -157,13 +157,13 @@ class Socket : public ASocket<T> {

static bool SOCKET(int& sck, int16_t const& domain = AF_INET, int16_t const& type = SOCK_STREAM,
int16_t const& protocol = IPPROTO_TCP) {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
sck = socket(domain, type, protocol);
if (sck < 0) KLOG(ERR) << "SOCKET ERROR CODE: " << sck;
return sck >= 0;
}
static bool CONNECT(int const& sck, std::string const& host, int16_t const& port) {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
struct sockaddr_in servAddr;
memset(&servAddr, 0, sizeof(servAddr));
servAddr.sin_family = AF_INET;
Expand Down Expand Up @@ -235,7 +235,7 @@ class SocketServer : public ASocketServer<T> {
}
virtual bool receive(std::map<int, uint8_t>& fds, int const& fd) {
(void)fds;
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
T in[_MKN_RAM_TCP_READ_BUFFER_];
bzero(in, _MKN_RAM_TCP_READ_BUFFER_);
int16_t e = 0, read = readFrom(fd, in);
Expand Down Expand Up @@ -267,7 +267,7 @@ class SocketServer : public ASocketServer<T> {
return false;
}
void closeFDsNoCompress(std::map<int, uint8_t>& fds, std::vector<int>& del) {
KUL_DBG_FUNC_ENTER;
MKN_KUL_DBG_FUNC_ENTER;
for (auto const& fd : del) {
::close(m_fds[fd].fd);
m_fds[fd].fd = -1;
Expand All @@ -279,7 +279,7 @@ class SocketServer : public ASocketServer<T> {
closeFDsNoCompress(fds, del);
}
virtual void loop(std::map<int, uint8_t>& fds) KTHROW(mkn::ram::tcp::Exception) {
// KUL_DBG_FUNC_ENTER
// MKN_KUL_DBG_FUNC_ENTER;
auto ret = poll();
if (!s) return;
if (ret < 0)
Expand Down Expand Up @@ -332,7 +332,7 @@ class SocketServer : public ASocketServer<T> {
return ::accept(lisock, (struct sockaddr*)&cli_addr[fd], &clilen);
}
virtual void validAccept(std::map<int, uint8_t>& fds, int const& newlisock, int const& nfd) {
KUL_DBG_FUNC_ENTER;
MKN_KUL_DBG_FUNC_ENTER;
KOUT(DBG) << "New connection , socket fd is " << newlisock
<< ", is : " << inet_ntoa(cli_addr[nfd].sin_addr)
<< ", port : " << ntohs(cli_addr[nfd].sin_port);
Expand Down Expand Up @@ -380,7 +380,7 @@ class SocketServer : public ASocketServer<T> {
}
}
virtual void start() KTHROW(mkn::ram::tcp::Exception) {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
_started = mkn::kul::Now::MILLIS();
auto ret = listen(lisock, 256);
if (ret < 0) KEXCEPTION("Socket Server error on listen");
Expand All @@ -402,7 +402,7 @@ class SocketServer : public ASocketServer<T> {
}
}
virtual void stop() {
KUL_DBG_FUNC_ENTER
MKN_KUL_DBG_FUNC_ENTER;
s = 0;
::close(lisock);
for (int i = 0; i < _MKN_RAM_TCP_MAX_CLIENT_; i++)
Expand Down
6 changes: 3 additions & 3 deletions inc/mkn/ram/os/win/http.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -75,14 +75,14 @@ class Server : public mkn::ram::http::AServer {
return inBuffers[fd].get();
}

virtual KUL_PUBLISH bool receive(std::map<int, uint8_t>& fds, int const& fd) override;
virtual MKN_KUL_PUBLISH bool receive(std::map<int, uint8_t>& fds, int const& fd) override;

public:
Server(short const& p = 80) : AServer(p) {}
virtual ~Server() {}
};

class KUL_PUBLISH MultiServer : public mkn::ram::http::Server {
class MKN_KUL_PUBLISH MultiServer : public mkn::ram::http::Server {
protected:
uint8_t _acceptThreads, _workerThreads;
mkn::kul::Mutex m_mutex;
Expand Down
18 changes: 9 additions & 9 deletions inc/mkn/ram/os/win/https.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2024, Philip Deegan.
Copyright (c) 2026, Philip Deegan.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -77,13 +77,13 @@ class Server : public mkn::ram::http::Server {
mkn::kul::File crt, key;
std::string const cs;

virtual KUL_PUBLISH void loop(std::map<int, uint8_t>& fds)
virtual MKN_KUL_PUBLISH void loop(std::map<int, uint8_t>& fds)
KTHROW(mkn::ram::tcp::Exception) override;

virtual KUL_PUBLISH bool receive(std::map<int, uint8_t>& fds, int const& fd) override;
virtual MKN_KUL_PUBLISH bool receive(std::map<int, uint8_t>& fds, int const& fd) override;

virtual KUL_PUBLISH void handleBuffer(std::map<int, uint8_t>& fds, int const& fd, char* in,
int const& read, int& e);
virtual MKN_KUL_PUBLISH void handleBuffer(std::map<int, uint8_t>& fds, int const& fd, char* in,
int const& read, int& e);

public:
Server(short const& p, mkn::kul::File const& c, mkn::kul::File const& k,
Expand All @@ -94,12 +94,12 @@ class Server : public mkn::ram::http::Server {
virtual ~Server() {
if (s) stop();
}
KUL_PUBLISH void setChain(mkn::kul::File const& f);
KUL_PUBLISH Server& init();
KUL_PUBLISH virtual void stop() override;
MKN_KUL_PUBLISH void setChain(mkn::kul::File const& f);
MKN_KUL_PUBLISH Server& init();
MKN_KUL_PUBLISH virtual void stop() override;
};

class KUL_PUBLISH MultiServer : public mkn::ram::https::Server {
class MKN_KUL_PUBLISH MultiServer : public mkn::ram::https::Server {
protected:
uint8_t _acceptThreads, _workerThreads;
mkn::kul::Mutex m_mutex;
Expand Down
Loading
Loading