diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/qntan/Qntan.h | 127 |
1 files changed, 86 insertions, 41 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index 2624779..da7cc31 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -2,14 +2,27 @@ #define INCGUARD_aM91R0ljMWoqtn7F #if 0 + Qntan - A C module separations framework http://git.hiddenalpha.ch/qntan.git/tree/README.txt + Doc comments for structs FOLLOW the top of the structs body. Doc comments + for members FOLLOW its signature declaration. Eg: + + struct Foo { + /* Doc for 'Foo' goes here. + */ + int (*myFunc)( int x ); + /* Here goes description of 'myFunc'. + */ + }; + + #endif -#include <stddef.h> /* eg: size_t */ -#include <stdint.h> /* eg: uintptr_t */ +#include <stddef.h> /* size_t */ +#include <stdint.h> /* uintptr_t */ #if __cplusplus extern "C" { @@ -38,17 +51,18 @@ extern "C" { -#if 0 /* TODO any need for fwd decls? */ +/* data fwd decls */ struct Qntan_EvLoop; struct Qntan_Mallocator; struct Qntan_MemArena; struct Qntan_Executor; +struct Qntan_Scheduler; struct Qntan_IoMux; struct Qntan_File; +struct Qntan_FourierTransform; struct Qntan_Process; struct Qntan_HshTbl; struct Qntan_HshTbl_Cursor; -struct Qntan_HttpClient; struct Qntan_Socket; struct Qntan_TarEnc; struct Qntan_TarEnc_Hdr; @@ -62,17 +76,19 @@ struct Qntan_CsvIStream_Mentor; struct Qntan_JsonEnc; struct Qntan_JsonDec; struct Qntan_JsonDec_Mentor; -struct Qntan_JsonTreeDec_JsonNode; struct Qntan_JsonTreeDec; +struct Qntan_JsonTreeDec_JsonNode; struct Qntan_XmlDec; struct Qntan_XmlDec_Mentor; +struct Qntan_HttpClient; +struct Qntan_HttpClient_Exchg; +struct Qntan_HttpClient_Exchg_Opts; struct Qntan_JavaBytecodeParser; struct Qntan_JavaBytecodeParser_Mentor; struct Qntan_CamtAccount; struct Qntan_CamtTransaction; -struct Qntan_CamtDec_Mentor; struct Qntan_CamtDec; -#endif +struct Qntan_CamtDec_Mentor; @@ -395,6 +411,28 @@ struct Qntan_File { +#ifndef Qntan_FourierTransform_transform +# define Qntan_FourierTransform_transform(A, ...) (*A)->transform(A, __VA_ARGS__) +#endif + +struct Qntan_FourierTransform { + /**/ + int (*transform)( struct Qntan_FourierTransform**, float*samples, size_t samples_cnt, float*output ); + /* WARN: There may be implementations producing odd results if + * 'samples' and 'output' overlap. + * @return negative values on erorr. Zero on success. + */ +}; + + + + + + + + + + struct Qntan_Process { /* * Writes 'buf' to the childs stdin stream. @@ -977,66 +1015,73 @@ struct Qntan_XmlDec_Mentor { -/* - * WARN: HTTP IS EXPERMIMENTAL! DO NOT TRUST ANYTHING HERE! - */ struct Qntan_HttpClient_Exchg_Opts { - /* - * Eg: 'GET', 'POST', ... */ + /* WARN: HTTP IS EXPERMIMENTAL! DO NOT TRUST ANYTHING HERE! + */ char const *mthd; - /* - * Eg: 'example.com', '127.0.0.1', ... */ + /* Eg: 'GET', 'POST', ... + */ char const *host; - /**/ + /* Eg: 'example.com', '127.0.0.1', ... + */ uint16_t port; - /* - * Eg: "/foo/bar?blubb=true" */ + /* TCP port to connect to. + */ char const *url; - /* - * Like {"key1", "val1", "key2", "val2", NULL} */ + /* Eg: "/foo/bar?blubb=true" + */ char **hdrs; - /**/ + /* Eg: {"key1", "val1", "key2", "val2", NULL} + */ uint8_t isTls; - /* - * can be NULL, which means body gets written through separate calls. + /**/ + char const *body; + /* can be NULL, which means body gets written through separate calls. * MUST be null-byte-terminated. * MUST NOT contain null-bytes. If you have to, set NULL and use separate - * write calls instead. */ - char const *body; - /**/ + * write calls instead. + */ Qntan_Cls cls; /**/ void (*onRspHdr)( char const*proto, int code, char const*msg, char const*const*hdrs, Qntan_Cls ); - /* - * @param len + /* 'proto' looks like "HTTP/1.1". Is zero-terminated. + * 'code' eg 404, simply the http response code. + * 'msg' eg "Not Found", simply the http response phrase. Is zero-terminated. + * 'hdrs' response headers. Same format as the request headers. + */ + void (*onBodyChunk)( char const*buf, int len, int flgs, Qntan_Cls ); + /* @param len * Negative values indicate errors. * If positive, it indicates how long 'buf' is. * WARN: if zero or negative, value of 'buf' is unspecified! * @param flgs - * 'flgs & 4' means this is last buffer (EndOfMsg). */ - void (*onBodyChunk)( char const*buf, int len, int flgs, Qntan_Cls ); - /**/ + * 'flgs & 4' means this is last buffer (EndOfMsg). + * WARN: Other flags are reserved and may hold ANY value. + */ }; struct Qntan_HttpClient_Exchg { - /* - * Write another request body chunk. - * @param flgs - * 'flgs & 4' means this is the last buffer (aka EndOfMsg). */ + /* WARN: HTTP IS EXPERMIMENTAL! DO NOT TRUST ANYTHING HERE! + */ void (*write)( struct Qntan_HttpClient_Exchg**, void*buf, int len, int flgs, void(*onDone)(int,Qntan_Cls), Qntan_Cls ); - /* - * Set backpressure. This means that callbacks won't be called anymore. - * Events will be held back until resumed. */ + /* Write another request body chunk. + * @param flgs + * 'flgs & 4' means this is the last buffer (aka EndOfMsg). + * WARN: Other flags are reserved and may hold ANY value. + */ void (*pause)( struct Qntan_HttpClient_Exchg** ); - /* - * Reset backpressure. */ + /* Set backpressure. This means that callbacks won't be called anymore. + * Events will be held back until resumed. + */ void (*resume)( struct Qntan_HttpClient_Exchg** ); - /**/ + /* Cancel backpressure. + */ }; struct Qntan_HttpClient { - /**/ + /* WARN: HTTP IS EXPERMIMENTAL! DO NOT TRUST ANYTHING HERE! + */ void (*httpReq)( struct Qntan_HttpClient**, struct Qntan_HttpClient_Exchg_Opts*, void(*onDone)( int err, struct Qntan_HttpClient_Exchg**exchg, void(*unref)(struct Qntan_HttpClient_Exchg**), |
