diff options
| author | hiddenalpha.ch | 2026-09-09 19:05:47 +0200 |
|---|---|---|
| committer | hiddenalpha.ch | 2026-09-09 19:05:47 +0200 |
| commit | e2e26425a1d956bccef1aeb5c1bf8773efbbd6cf (patch) | |
| tree | 4dd0bd2636b30ee8f3d081c6ee1934c0b26dc482 /include/qntan/Qntan.h | |
| parent | 0facf62acfcfa5535e0595c43d7ebe45bc6a6c70 (diff) | |
| download | Qntan-e2e26425a1d956bccef1aeb5c1bf8773efbbd6cf.tar.gz Qntan-e2e26425a1d956bccef1aeb5c1bf8773efbbd6cf.zip | |
Introduce `IpcServer` and `IpcClient`.
Diffstat (limited to 'include/qntan/Qntan.h')
| -rw-r--r-- | include/qntan/Qntan.h | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index cee1af1..f89f008 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -68,6 +68,8 @@ struct Qntan_Scheduler; struct Qntan_Logger; struct Qntan_LoggerFactory; struct Qntan_IoMux; +struct Qntan_IpcClient; +struct Qntan_IpcServer; struct Qntan_File; struct Qntan_FileSystem_Dirent; struct Qntan_FileSystem; @@ -545,6 +547,129 @@ struct Qntan_IoMux { +struct Qntan_IpcClient { + /**/ + void (*recv)( struct Qntan_IpcClient**, void*buf, int sz, int cnt, + void(*onDone)(int ret,void*buf,Qntan_Cls), Qntan_Cls ); + /* Concepts & basics see + * - "https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html" + * - "https://pubs.opengroup.org/onlinepubs/9699919799/functions/fread.html" + * + * @param onDone.buf + * MUST be the same ptr as passed via 'buf' initially. + */ + void (*send)( struct Qntan_IpcClient**, void*buf, int sz, int cnt, int flgs, + void(*onDone)(int ret,void*rbuf,Qntan_Cls), Qntan_Cls ); + /* Concept & basics see + * - "https://pubs.opengroup.org/onlinepubs/000095399/functions/send.html" + * - "https://pubs.opengroup.org/onlinepubs/000095399/functions/fwrite.html" + * + * @param buf, sz, cnt + * The octets (and how many of them) to write. This 'buf' MUST stay + * valid until onDone got called. + * + * @param flgs + * (flgs & 1) indicates that data should be flushed. + * (flgs & 2) indicates that after sending buf we have to act like a + * call to + * "https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html" + * with SHUT_WR. + * All not specified flags MUST be set to zero. Passing any other flag + * is UNDEFINED BEHAVIOR! + * + * @param onDone + * The function that gets called when the send operation has completed. + * Negative 'ret' indicates errors. 'rbuf' MUST be the same as 'buf'. + */ + void (*shutdown)( struct Qntan_IpcClient**, int how, + void(*onDone)(int ret,Qntan_Cls), Qntan_Cls ); + /* Concepts & basics see + * - "https://pubs.opengroup.org/onlinepubs/000095399/functions/shutdown.html" + * + * @param how + * For SHUT_WR pass `4`. + * For SHUT_RD pass `8`. + * For SHUT_RDWR pass `4|8`. + */ +}; + + + + + + + + + + +struct Qntan_IpcServer { + /**/ + void (*accept)( struct Qntan_IpcServer**, + void(*onDone)(int ret,Qntan_Cls clientHdl,Qntan_Cls), + Qntan_Cls ); + /* Conceptually same idea as + * "https://pubs.opengroup.org/onlinepubs/009696799/functions/accept.html". + */ + void (*send)( struct Qntan_IpcServer**, Qntan_Cls clientHdl, + void*buf, int sz, int cnt, int flgs, + void(*onDone)(int ret,void*rbuf,Qntan_Cls), Qntan_Cls ); + /* Based on "https://pubs.opengroup.org/onlinepubs/000095399/functions/send.html". + * + * @param buf, sz, cnt + * The data (and how much) to write. This 'buf' MUST stay valid + * until onDone got called. + * `sz` indicates how large ONE object is. + * `cnt` indicates how many of those objects to write. + * + * @param flgs + * (flgs & 1) indicates that data should be flushed. + * (flgs & 2) indicates that after sending `buf` we have to act like + * a call to + * "https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html" + * with SHUT_WR. + * All not specified flags MUST be set to zero! + * + * @param onDone + * The function that gets called when the send operation has completed. + * Negative 'ret' indicates errors. 'rbuf' MUST be the same as 'buf'. + */ + void (*recv)( struct Qntan_IpcServer**, Qntan_Cls clientHdl, + void*buf, int sz, int cnt, + void(*onDone)(int ret,void*buf,Qntan_Cls), Qntan_Cls ); + /* Based on "https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html". + * + * @param onDone.buf + * MUST be the same ptr as passed via 'buf' initially. + */ + void (*shutdownClient)( struct Qntan_IpcServer**, Qntan_Cls clientHdl, int how, + void(*onDone)(int ret,Qntan_Cls), Qntan_Cls ); + /* Based on "https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html" + * + * @param how + * For SHUT_WR pass `4`. + * For SHUT_RD pass `8`. + * For SHUT_RDWR pass `4|8`. + */ + void (*shutdownServer)( struct Qntan_IpcServer**, int how, + void(*onDone)(int ret,Qntan_Cls), Qntan_Cls ); + /* Based on "https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html". + * + * @param how + * For SHUT_WR pass `4`. + * For SHUT_RD pass `8`. + * For SHUT_RDWR pass `4|8`. + */ +}; + + + + + + + + + + #ifndef Qntan_File_flush # define Qntan_File_flush(A, B, C) (*A)->flush(A, B, C) #endif |
