Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Garbage In -- Gospel Out.


devel / comp.unix.programmer / Poser - a framework for (simple) POsix SERvices in C

SubjectAuthor
* Poser - a framework for (simple) POsix SERvices in CFelix Palmen
+* Poser - a framework for (simple) POsix SERvices in CRainer Weikusat
|+* Poser - a framework for (simple) POsix SERvices in CKenny McCormack
||`- Poser - a framework for (simple) POsix SERvices in CPhilip Guenther
|`- Poser - a framework for (simple) POsix SERvices in CFelix Palmen
`- Poser - a framework for (simple) POsix SERvices in CFelix Palmen

1
Poser - a framework for (simple) POsix SERvices in C

<i79clj-9st.ln1@mail.home.palmen-it.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10783&group=comp.unix.programmer#10783

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: fel...@palmen-it.de (Felix Palmen)
Newsgroups: comp.unix.programmer
Subject: Poser - a framework for (simple) POsix SERvices in C
Date: Fri, 9 Jun 2023 20:56:18 +0200
Organization: palmen-it.de
Lines: 102
Message-ID: <i79clj-9st.ln1@mail.home.palmen-it.de>
Injection-Date: Fri, 9 Jun 2023 20:56:18 +0200
Injection-Info: dont-email.me; posting-host="20e1d302b347f13109cf5a53dc474a21";
logging-data="2095256"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/o2lGWeGy4uoPda0TdJCQz"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (FreeBSD/13.2-RELEASE (amd64)) tinews.pl/1.1.61
Cancel-Lock: sha256:kI0W5DHHljAVWVCXzqc8xR2U1O+FJzLB76S4oOSCkyw=
sha1:nonXvXnwSeo2c+Cz19UKAad/GGw=
X-PGP-Hash: SHA256
X-PGP-Sig: GnuPG-v2 From,Newsgroups,Subject,Date,Injection-Date,Message-ID
iNUEARYIAH0WIQRpNhPVW79IN7ISOsxUreAGmHnyMQUCZIN1018UgAAAAAAuAChp
c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0Njkz
NjEzRDU1QkJGNDgzN0IyMTIzQUNDNTRBREUwMDY5ODc5RjIzMQAKCRBUreAGmHny
MRSAAP9D9i2uZ2FSSIDLt1FXVMEbDz5Jjh+SuhdpbPQiqXrLRgEA4aBn3G6viPvy
CEH1R0iBNJNnb4XkA9GeCTImd3TcfwA=
=LKCN
X-PGP-Key: 693613D55BBF4837B2123ACC54ADE0069879F231
 by: Felix Palmen - Fri, 9 Jun 2023 18:56 UTC

Announing my new project: poser.

# WWW

https://zirias.github.io/poser/

# License

BSD 2-clause

# Description

This is a simple no-dependencies framework for implementing your typical
(networking) service in C. It's designed to only use POSIX APIs, so it
should be portable without platform-specific code to any OS that
conforms to POSIX.

It optionally offers TLS, in which case OpenSSL or some API-compatible
library like LibreSSL is needed.

# Design

Poser works fully event-driven and async. It uses async/non-blocking
POSIX APIs where available, and simulates async behavior using a
threadpool when needed.

The main event loop is built around pselect(), which means there's a
hard scalability limit. Although the alternative in POSIX, ppoll(),
wouldn't have this hard limit, it IMHO wouldn't be a huge gain, as
ppoll() needs to copy more data on each call and therefore might perform
even worse. In practice, it just won't perform well for more than around
100 concurrent connections, so if you need this, better use libraries
like e.g. libuv instead.

The API is fully object-oriented and designed for stability, so new
features are unlikely to break API or even ABI. All public type names,
functions and even enum members are prefixed with a (short) "namespace"
to avoid clashes with consumer code or other libraries.

# Why?

This project kind of "happened". When I had the need to write my own
services for some specific use cases, I didn't find any library doing
exactly what I want, so I instead implemented everything myself ... and
a lot of generic code was copy&pasted from one project to the next.

"Backporting" improvements in a new project to an older one became a
real hassle, so I finally decided to pull all the generic code out into
a new library/framework project.

# Features

Currently, there's just one library, libposercore. It offers

* Generic daemonizing code, correctly handling a pidfile
* A simple event-handling mechanism based on direct calls
* A simple logging mechanism with configurable writers
* A main service loop around pselect(), also handling typical signals
* A threadpool to schedule jobs on
* Abstractions for TCP or local Unix domain socket connections, servers
and clients
* Optional TLS support
* Several utility classes and functions

# Dependencies

Well, I said "no-dependencies" and that's true for runtime when built
without TLS support. Still:

* [build] gcc or clang supporting C11
* [build] GNU make
* [build] doxygen to build reference API docs
* [build/run] OpenSSL or compatible, when built WITH_TLS=1 (default)

# Roadmap

Short term: Currently working on some abstractions to describe a
structure for configuration. This should provide a single source of
truth, be able to parse from different sources (like, commandline
arguments and/or a config file), be able to auto-generate usage and
help output as well as a sample config file. Kind of likely to be
completed.

Long term: Add more specialized libs. Currently thinking of a
"libposerweb" implementing HTTP (server/client) and maybe offering some
helper stuff for HTML/JSON/... Also, there might be a "libposerirc" some
day implementing the IRC protocol. Likeliness of realization: we will
see.

# Final words

Purpose of this post is both to actually announce this project, hoping
someone might have some use for it, and of course, to collect feedback
if you want, thanks!

Cheers, Felix

--
Dipl.-Inform. Felix Palmen <felix@palmen-it.de> ,.//..........
{web} http://palmen-it.de {jabber} [see email] ,//palmen-it.de
{pgp public key} http://palmen-it.de/pub.txt // """""""""""
{pgp fingerprint} 6936 13D5 5BBF 4837 B212 3ACC 54AD E006 9879 F231

Re: Poser - a framework for (simple) POsix SERvices in C

<874jncv94z.fsf@doppelsaurus.mobileactivedefense.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10785&group=comp.unix.programmer#10785

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweiku...@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Poser - a framework for (simple) POsix SERvices in C
Date: Mon, 12 Jun 2023 19:16:28 +0100
Lines: 9
Message-ID: <874jncv94z.fsf@doppelsaurus.mobileactivedefense.com>
References: <i79clj-9st.ln1@mail.home.palmen-it.de>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net /udEaCsXEx6tVBvfunRl5Qig0BEkgc7x79epP52ob8Gn5rprw=
Cancel-Lock: sha1:Whoz1nEZz+d4mC8L/ONYV4NprDs= sha1:aCZ57cV/LUtLBPtPYnELjUGGSVU=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
 by: Rainer Weikusat - Mon, 12 Jun 2023 18:16 UTC

felix@palmen-it.de (Felix Palmen) writes:

[...]

> The main event loop is built around pselect(), which means there's a
> hard scalability limit. Although the alternative in POSIX, ppoll(),

JFTR: ppoll is not a POSIX interface.

Re: Poser - a framework for (simple) POsix SERvices in C

<u67vre$t6hb$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10786&group=comp.unix.programmer#10786

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.programmer
Subject: Re: Poser - a framework for (simple) POsix SERvices in C
Date: Mon, 12 Jun 2023 20:40:14 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <u67vre$t6hb$1@news.xmission.com>
References: <i79clj-9st.ln1@mail.home.palmen-it.de> <874jncv94z.fsf@doppelsaurus.mobileactivedefense.com>
Injection-Date: Mon, 12 Jun 2023 20:40:14 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="956971"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Mon, 12 Jun 2023 20:40 UTC

In article <874jncv94z.fsf@doppelsaurus.mobileactivedefense.com>,
Rainer Weikusat <rweikusat@talktalk.net> wrote:
>felix@palmen-it.de (Felix Palmen) writes:
>
>[...]
>
>
>> The main event loop is built around pselect(), which means there's a
>> hard scalability limit. Although the alternative in POSIX, ppoll(),
>
>JFTR: ppoll is not a POSIX interface.

Yes. The manpage says: ppoll() is Linux-specific.

--
After Using Gender Slur Against AOC, GOP Rep. Yoyo Won't Apologize 'For Loving God'.

That's so sweet...

Re: Poser - a framework for (simple) POsix SERvices in C

<155549c8-deeb-4977-8533-38f9ba4beaadn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10787&group=comp.unix.programmer#10787

  copy link   Newsgroups: comp.unix.programmer
X-Received: by 2002:a05:622a:91:b0:3f9:b3b3:4114 with SMTP id o17-20020a05622a009100b003f9b3b34114mr3798576qtw.7.1686638292642;
Mon, 12 Jun 2023 23:38:12 -0700 (PDT)
X-Received: by 2002:a05:6830:141a:b0:6b1:6c54:d6ab with SMTP id
v26-20020a056830141a00b006b16c54d6abmr3397245otp.5.1686638292331; Mon, 12 Jun
2023 23:38:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.programmer
Date: Mon, 12 Jun 2023 23:38:12 -0700 (PDT)
In-Reply-To: <u67vre$t6hb$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=76.247.182.84; posting-account=bzpegQoAAABnTq5JDqg52UTZOtil5p5c
NNTP-Posting-Host: 76.247.182.84
References: <i79clj-9st.ln1@mail.home.palmen-it.de> <874jncv94z.fsf@doppelsaurus.mobileactivedefense.com>
<u67vre$t6hb$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <155549c8-deeb-4977-8533-38f9ba4beaadn@googlegroups.com>
Subject: Re: Poser - a framework for (simple) POsix SERvices in C
From: guent...@gmail.com (Philip Guenther)
Injection-Date: Tue, 13 Jun 2023 06:38:12 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Philip Guenther - Tue, 13 Jun 2023 06:38 UTC

On Monday, June 12, 2023 at 1:40:18 PM UTC-7, Kenny McCormack wrote:
> In article <874jncv...@doppelsaurus.mobileactivedefense.com>,
> Rainer Weikusat <rwei...@talktalk.net> wrote:
> >fe...@palmen-it.de (Felix Palmen) writes:
....
> >> The main event loop is built around pselect(), which means there's a
> >> hard scalability limit. Although the alternative in POSIX, ppoll(),
> >
> >JFTR: ppoll is not a POSIX interface.
> Yes. The manpage says: ppoll() is Linux-specific.

In spring 2021, ppoll() was accepted for inclusion in issue 8 of the SUS/POSIX standard, with prototype

int ppoll(struct pollfd fds[], nfds_t nfds, const struct timespec *restrict timeout, const sigset_t *restrict sigmask);

(pselect() was added in issue 6. No, I don't know when issue 8 will be published)

Philip Guenther

Re: Poser - a framework for (simple) POsix SERvices in C

<0crmlj-g2k2.ln1@mail.home.palmen-it.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10788&group=comp.unix.programmer#10788

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: fel...@palmen-it.de (Felix Palmen)
Newsgroups: comp.unix.programmer
Subject: Re: Poser - a framework for (simple) POsix SERvices in C
Date: Tue, 13 Jun 2023 21:07:12 +0200
Organization: palmen-it.de
Lines: 13
Message-ID: <0crmlj-g2k2.ln1@mail.home.palmen-it.de>
References: <i79clj-9st.ln1@mail.home.palmen-it.de> <874jncv94z.fsf@doppelsaurus.mobileactivedefense.com>
Injection-Date: Tue, 13 Jun 2023 21:07:12 +0200
Injection-Info: dont-email.me; posting-host="f37b6026bcd2838d06b593d2d8d0fdd6";
logging-data="3882341"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XpjOZBmmrTI++SONcy34l"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (FreeBSD/13.2-RELEASE (amd64)) tinews.pl/1.1.61
Cancel-Lock: sha256:l4gUVGPH9X9EIQtvRa11Hcp5TzzmvrNF0ypiqgnJFHw=
sha1:qxVVvc8wvWC683GKK55cmoJlxN4=
X-PGP-Sig: GnuPG-v2 From,Newsgroups,Subject,Date,Injection-Date,Message-ID
iNUEARYIAH0WIQRpNhPVW79IN7ISOsxUreAGmHnyMQUCZIi+YV8UgAAAAAAuAChp
c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0Njkz
NjEzRDU1QkJGNDgzN0IyMTIzQUNDNTRBREUwMDY5ODc5RjIzMQAKCRBUreAGmHny
MdmCAQCE0xWax9aOuOkHe4vhoIFPwjN1pmkrx9WTyQ8WL8LuQQD9F4fm8OfCwtbe
KwMgSsReSGi9DNSYSwHc8ae80/Bg4gM=
=pvzK
X-PGP-Hash: SHA256
X-PGP-Key: 693613D55BBF4837B2123ACC54ADE0069879F231
 by: Felix Palmen - Tue, 13 Jun 2023 19:07 UTC

* Rainer Weikusat <rweikusat@talktalk.net>:
> JFTR: ppoll is not a POSIX interface.

Thanks. From time to time, I'm amazed what's *not* in POSIX ;)

So, pselect() was the safe choice anyways for something that should work
without platform-specific code paths on any POSIX system.

--
Dipl.-Inform. Felix Palmen <felix@palmen-it.de> ,.//..........
{web} http://palmen-it.de {jabber} [see email] ,//palmen-it.de
{pgp public key} http://palmen-it.de/pub.txt // """""""""""
{pgp fingerprint} 6936 13D5 5BBF 4837 B212 3ACC 54AD E006 9879 F231

Re: Poser - a framework for (simple) POsix SERvices in C

<emsmlj-7tk2.ln1@mail.home.palmen-it.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10790&group=comp.unix.programmer#10790

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: fel...@palmen-it.de (Felix Palmen)
Newsgroups: comp.unix.programmer
Subject: Re: Poser - a framework for (simple) POsix SERvices in C
Date: Tue, 13 Jun 2023 21:29:50 +0200
Organization: palmen-it.de
Lines: 22
Message-ID: <emsmlj-7tk2.ln1@mail.home.palmen-it.de>
References: <i79clj-9st.ln1@mail.home.palmen-it.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 13 Jun 2023 21:29:50 +0200
Injection-Info: dont-email.me; posting-host="f37b6026bcd2838d06b593d2d8d0fdd6";
logging-data="3887687"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hX4ztG5p2LbiBrqQaq240"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (FreeBSD/13.2-RELEASE (amd64)) tinews.pl/1.1.61
Cancel-Lock: sha256:AHyI2TlNja2uYOgeZaihc0YQR4DnmVkKhDPwpQIk6co=
sha1:E4kir3Z+aW3WrJ0YBQZO9qvlyvI=
X-PGP-Key: 693613D55BBF4837B2123ACC54ADE0069879F231
X-PGP-Sig: GnuPG-v2 From,Newsgroups,Subject,Date,Injection-Date,Message-ID
iNUEARYIAH0WIQRpNhPVW79IN7ISOsxUreAGmHnyMQUCZIjDrl8UgAAAAAAuAChp
c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0Njkz
NjEzRDU1QkJGNDgzN0IyMTIzQUNDNTRBREUwMDY5ODc5RjIzMQAKCRBUreAGmHny
MVS5AQDPAgbzlPgsbE0jVverIbUzs5J9tBxPL17QQ2fV9NSIcgEA2Igvpw8M6HB1
Cr+R7PUrNuCnuWbI6ViNIzUovV0raQc=
=ktcL
X-PGP-Hash: SHA256
 by: Felix Palmen - Tue, 13 Jun 2023 19:29 UTC

* Felix Palmen <felix@palmen-it.de>:
> Announing my new project: poser.

A little addendum: If you happen to use FreeBSD, poser is already
available there as a port in devel/poser.

That's not because I want to push it upon FreeBSD users, but because I
earlier added tlsc (port: security/tlsc) after getting some positive
feedback. In a nutshell, tlsc is a *very* simplified alternative to
stunnel, under a BSD license and compatible with LibreSSL. It's one of
the projects I refactored so far to use poser instead of my copy&pasted
code, so poser just became a new dependency...

I've also noticed poser is available in AUR, as it seems for the same
reason (to support the latest version of tlsc) – can't tell anything
about the quality of that package, I don't use Arch myself.

--
Dipl.-Inform. Felix Palmen <felix@palmen-it.de> ,.//..........
{web} http://palmen-it.de {jabber} [see email] ,//palmen-it.de
{pgp public key} http://palmen-it.de/pub.txt // """""""""""
{pgp fingerprint} 6936 13D5 5BBF 4837 B212 3ACC 54AD E006 9879 F231

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor