str_to_gensio_accepter(3)
π str_to_gensio_accepter β the gensio accepter manual, bestie edition π
okay so this is str_to_gensio_accepter(3), from the Library Functions Manual, and it's genuinely one of the most useful little pages in the gensio family. if you're building accepters out of strings, you are SO in the right place. let's get into it π«Ά
β¨ NAME β¨
str_to_gensio_accepter β Create a gensio accepter from a string
like, the whole vibe of the function is literally in the name. string in, accepter out. iconic behavior. π
πΈ SYNOPSIS πΈ
#include <gensio/gensio.h>
int str_to_gensio_accepter(const char *str,
struct gensio_os_funcs *o,
gensio_accepter_event cb,
void *user_data,
struct gensio_accepter **acc);
int str_to_gensio_accepter_child(struct gensio_accepter *child,
const char *str,
struct gensio_os_funcs *o,
gensio_accepter_event cb,
void *user_data,
struct gensio_accepter **acc);
int gensio_terminal_acc_alloc(const char *gensiotype,
const void *gdata,
const char * const args[],
struct gensio_os_funcs *o,
gensio_accepter_event cb, void *user_data,
struct gensio_accepter **accepter);
int gensio_filter_acc_alloc(const char *gensiotype,
struct gensio_accepter *child,
const char * const args[],
struct gensio_os_funcs *o,
gensio_accepter_event cb, void *user_data,
struct gensio_accepter **accepter);
four functions. one header. <gensio/gensio.h> carrying the whole friend group fr fr. π
π¦ DESCRIPTION π¦
str_to_gensio_accepter allocates a brand-new gensio accepter stack, and it builds the whole thing based on the string you hand it in str. that's the tea. you give it a string, it gives you a whole accepter stack. β¨
str_to_gensio_accepter_child does the same allocate-a-new-gensio-accepter-stack-based-on-str thing, but then it stacks that new stack on top of the child accepter you already have. it's giving "we're adding a layer, and the layer has a parent." main character stacking energy. π
π allocating directly (no string, just vibes)
if you wanna allocate an accepter directly instead of going through a string, you use one of gensio_terminal_acc_alloc or gensio_filter_acc_alloc. pick your fighter.
- a terminal accepter is one sitting at the bottom of the stack. it's the foundation, the bedrock, the one holding everyone up. π
- the
gdataparameter depends on the particular gensio. like, it is NOT one-size-fits-all, bestie. for instance:- for
tcpit's a pointer to agensio_addrstructure. - for
stdioit's anargvarray. - and for the specifics of what
gdatais for whatever particular gensio you're using, go readgensio.5under "Direct Allocation". that's where the answers live. π
- for
a filter accepter is one that has a child. yes, exactly like str_to_gensio_accepter_child sets up. so if you want to allocate an accepter stack directly β no string format involved at all β these two functions are your girls. π
π the callback situation
the cb and user_data parameters set up a function that gets called when events come in on the gensio accepter. so like, events happen, your function hears about it. very demure, very mindful.
and here's the cute part: user_data is unused by the gensio stack itself. it's there purely for you. it can be anything the user wishes. literally anything. it's your little pocket of personal space and gensio will not touch it. π
β the return
the new gensio accepter comes back to you in acc.
and important detail bestie, do not skip this: it will be in the shutdown state. so don't expect it to be up and running the second you get it back, okay? it's freshly allocated and it's chillin in shutdown. π
π₯ RETURN VALUES π₯
zero is returned on success, or a gensio error on failure.
that's it. 0 = slay. anything else = a gensio error, go check it. β¨
π SEE ALSO π
go read these. iykyk. π
and that's the whole page, bestie!! this one's from the Library Functions Manual, dated 27 Feb 2019, and it ate, no crumbs. now go build an accepter stack and be the main character of your own network code. periodt. π πβ¨
π¦ where this page comes from
- alpine 3.22: gensio-doc 2.8.14-r0 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- alpine 3.23: gensio-doc 2.8.14-r0 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- alpine 3.24: gensio-doc 2.8.14-r0 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- arch rolling: gensio 3.0.4-1 Β· GPL
- debian bookworm: libgensio-dev 2.6.2-4 Β· GPL-2.0-only
- debian trixie: libgensio-dev 2.8.13-7 Β· GPL-2.0-only
- epel 9: libgensio-devel 2.8.15-1.el9 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 2.8.15-5.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 2.8.15-5.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 3.0.4-1.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 3.0.4-1.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 44: libgensio-devel 3.0.2-1.fc44 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 44: libgensio-devel 3.0.2-1.fc44 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 44: libgensio-devel 3.0.4-1.fc44 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 44: libgensio-devel 3.0.4-1.fc44 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- nixos 26.05: gensio 3.0.2
- nixpkgs unstable: gensio 3.0.2
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- ubuntu noble: libgensio-dev 2.8.2-6.1build1 Β· GPL-2.0-only
- ubuntu questing: libgensio-dev 2.8.13-7
- ubuntu resolute: libgensio-dev 3.0.0-1build1 Β· GPL-2.0-only
- ubuntu stonking: libgensio-dev 3.0.0-1ubuntu1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms