aboutsummaryrefslogtreecommitdiffstats
path: root/src/prot.h
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2018-09-10 12:00:18 +0200
committerJose Bollo <jose.bollo@iot.bzh>2018-09-10 12:00:18 +0200
commit11654afcb5753a54a033db12e1ed4a19b3f7c86e (patch)
tree0d493c80584392eec2c5dc0f1c1c68c9057cf043 /src/prot.h
Initial commit
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/prot.h')
-rw-r--r--src/prot.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/prot.h b/src/prot.h
new file mode 100644
index 0000000..a1ded3b
--- /dev/null
+++ b/src/prot.h
@@ -0,0 +1,85 @@
+#pragma once
+
+struct prot;
+typedef struct prot prot_t;
+
+#define MAXBUFLEN 2000
+#define MAXARGS 20
+#define FS ' '
+#define RS '\n'
+#define ESC '\\'
+
+
+extern
+int
+prot_create(
+ prot_t **prot
+);
+
+extern
+void
+prot_destroy(
+ prot_t *prot
+);
+
+extern
+void
+prot_reset(
+ prot_t *prot
+);
+
+extern
+int
+prot_put(
+ prot_t *prot,
+ unsigned count,
+ const char **fields
+);
+
+extern
+int
+prot_putx(
+ prot_t *prot,
+ ...
+);
+
+extern
+int
+prot_should_write(
+ prot_t *prot
+);
+
+extern
+int
+prot_write(
+ prot_t *prot,
+ int fdout
+);
+
+extern
+int
+prot_can_read(
+ prot_t *prot
+);
+
+extern
+int
+prot_read(
+ prot_t *prot,
+ int fdin
+);
+
+extern
+int
+prot_get(
+ prot_t *prot,
+ const char ***fields
+);
+
+extern
+void
+prot_next(
+ prot_t *prot
+);
+
+