IXP_LISTEN(3)

πŸ“¦ version 0-unstable-2022-04, in nixos 26.05, nixpkgs unstable

πŸ’– IXP_LISTEN(3) πŸ’–

okay so bestie, welcome to the Library Functions Manual corner of the group chat β€” this one is literally IXP_LISTEN(3), and it's giving β€œlet's start a server listening sitch” energy. no cap. πŸ’…

🌸 NAME 🌸

ixp_listen, IxpConn β€” the listen-y function and the connection struct it hands you back. slay. ✨

✨ SYNOPSIS ✨

#include <ixp.h>

IxpConn *ixp_listen(IxpServer *srv, int fd, void *aux, void (*read)(IxpConn *), void (*close)(IxpConn *));

typedef struct IxpConn IxpConn;
struct IxpConn {
        IxpServer*      srv;
        void*           aux;    /* Arbitrary pointer, to be used by handlers. */
        int             fd;     /* The file descriptor of the connection. */
        void            (*read)(IxpConn *);
        void            (*close)(IxpConn *);
        char            closed; /* Non-zero when fd has been closed. */

        /* Private members */
        ...
}

πŸŽ€ PARAMETERS πŸŽ€

  • fs β€” the file descriptor on which to listen. yes bestie, that's the exact name in this list; the synopsis says fd, so iykyk. πŸ’…
  • aux β€” a piece of data to store in the connection's aux member of the IxpConn data structure. cute little stash spot for your handlers.
  • read β€” the function called when the connection has data available to read. it's giving β€œhey bestie, there's stuff to read” energy. πŸ“–
  • close β€” a cleanup function called when the connection is closed. self-care for your connection. 🧚

πŸ¦‹ DESCRIPTION πŸ¦‹

Starts the server srv listening on fd. The optional read and close callbacks are called with the IxpConn structure for the connection as their sole argument. that's literally it, bestie β€” main character server-loop behavior, no extra lore. ✨

🌈 RETURN VALUE 🌈

Returns the connection's new IxpConn data structure. so you get a fresh little connection struct back β€” obsessed. πŸ’–

πŸ”₯ SEE ALSO πŸ”₯

go read these next, bestie 🫢


and that's the whole vibe πŸ’œ β€” this page comes from the libixp Manual, dated 2012 Dec, and it's literally IXP_LISTEN(3). periodt. πŸ’…

πŸ“¦ where this page comes from