summaryrefslogtreecommitdiff
path: root/uclient-backend.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-03-20 20:39:47 +0100
committerFelix Fietkau <nbd@openwrt.org>2014-03-20 20:39:47 +0100
commitc280d54e1bc79de4424fabc3fad011cc15587b81 (patch)
treeee2bcfa5dc9fbc298b5038a148fb6793ee9c8d69 /uclient-backend.h
downloaduclient-c280d54e1bc79de4424fabc3fad011cc15587b81.tar.gz
Initial import
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'uclient-backend.h')
-rw-r--r--uclient-backend.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/uclient-backend.h b/uclient-backend.h
new file mode 100644
index 0000000..f72c11f
--- /dev/null
+++ b/uclient-backend.h
@@ -0,0 +1,35 @@
+#ifndef __UCLIENT_INTERNAL_H
+#define __UCLIENT_INTERNAL_H
+
+struct uclient_url;
+
+struct uclient_backend {
+ const char * const * prefix;
+
+ struct uclient *(*alloc)(void);
+ void (*free)(struct uclient *cl);
+
+ int (*connect)(struct uclient *cl);
+ int (*request)(struct uclient *cl);
+
+ int (*read)(struct uclient *cl, char *buf, unsigned int len);
+ int (*write)(struct uclient *cl, char *buf, unsigned int len);
+ int (*set_write_len)(struct uclient *cl, unsigned int len);
+};
+
+struct uclient_url {
+ const struct uclient_backend *backend;
+ int prefix;
+
+ const char *host;
+ const char *port;
+ const char *location;
+
+ const char *auth;
+};
+
+extern const struct uclient_backend uclient_backend_http;
+void uclient_backend_set_eof(struct uclient *cl);
+void uclient_backend_reset_state(struct uclient *cl);
+
+#endif