summaryrefslogtreecommitdiff
path: root/include/qntan
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2025-10-15 23:34:18 +0200
committerAndreas Fankhauser hiddenalpha.ch2025-10-15 23:34:27 +0200
commit81331396f76c316a35e217505ab55f489c163f2c (patch)
treeba56a2f583dce3e4fda55005c44fb6c70ad5dce0 /include/qntan
parent4a2c7bbdfd97c5185c08a2a755bed87bae637b4e (diff)
downloadQntan-81331396f76c316a35e217505ab55f489c163f2c.tar.gz
Qntan-81331396f76c316a35e217505ab55f489c163f2c.zip
Thinker around an HttpClient.
Diffstat (limited to 'include/qntan')
-rw-r--r--include/qntan/Qntan.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h
index c8f6382..9cc79a3 100644
--- a/include/qntan/Qntan.h
+++ b/include/qntan/Qntan.h
@@ -962,6 +962,69 @@ struct Qntan_XmlDec_Mentor {
+/*
+ * WARN: HTTP IS EXPERMIMENTAL! DO NOT TRUST ANYTHING HERE!
+ */
+struct Qntan_HttpClient_Req_Opts {
+ /*
+ * Eg: 'GET', 'POST', ... */
+ char *mthd;
+ /*
+ * Eg: 'example.com', '127.0.0.1', ... */
+ char *host;
+ /**/
+ uint16_t port;
+ /*
+ * Eg: "/foo/bar?blubb=true" */
+ char *url;
+ /*
+ * Like {"key1", "val1", "key2", "val2", NULL} */
+ char **hdrs;
+ /*
+ * 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 *body;
+ /**/
+ Qntan_Cls cls;
+ /**/
+ void (*onRspHdr)( char const*proto, int code, char const*msg, char const**hdrs, Qntan_Cls );
+ /*
+ * @param len
+ * Negative values indicate errors.
+ * If positive, it indicates how long 'buf' is.
+ * WARN: if zero, 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 );
+ /**/
+};
+
+struct Qntan_HttpClient_Req {
+ /*
+ * @param flgs
+ * 'flgs & 4' means this is the last buffer (aka EndOfMsg). */
+ void (*write)( struct Qntan_HttpClient**, req, void*buf, int len, int flgs,
+ void(*onDone)(int,Qntan_Cls), Qntan_Cls );
+};
+
+struct Qntan_HttpClient {
+ /**/
+ void (*httpReq)( struct Qntan_HttpClient**, struct Qntan_HttpClient_Req_Opts*,
+ void(*onDone)(int,struct Qntan_HttpClient_Req**,Qntan_Cls), Qntan_Cls );
+ /**/
+};
+
+
+
+
+
+
+
+
+
+
struct Qntan_JavaBytecodeParser {
/*
* @param flgs