summaryrefslogtreecommitdiffstats
path: root/src/roof-read.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/roof-read.h')
-rw-r--r--src/roof-read.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/roof-read.h b/src/roof-read.h
new file mode 100644
index 0000000..1ab846a
--- /dev/null
+++ b/src/roof-read.h
@@ -0,0 +1,45 @@
+#ifndef __ROOF_READ_H
+#define __ROOF_READ_H
+
+typedef struct _RoofRead RoofRead;
+
+#include "roof-config.h"
+
+G_BEGIN_DECLS
+
+typedef struct _RoofReadContext RoofReadContext;
+typedef struct _RoofReadInterface RoofReadInterface;
+typedef struct _RoofReadInterfaceSettings RoofReadInterfaceSettings;
+
+typedef guint (*RoofReaderRead)(RoofReadInterface *reader, uint8_t **buf, GError **error);
+typedef void (*RoofReaderClose)(RoofReadInterface *reader);
+
+struct _RoofReadInterfaceSettings {
+ guint padding; // Packet size + padding
+};
+
+struct _RoofReadInterface {
+ RoofReaderRead read;
+ RoofReaderClose close;
+
+ RoofReadInterfaceSettings settings;
+};
+
+struct _RoofReadContext {
+ RoofConfig *cfg;
+ RoofReadInterface *rdi;
+
+ void *rdbuf; // The buffer we are currently processing
+ guint n_packets; // Number of packets in the buffer
+ guint packet_id; // Last processed packet in the buffer
+ guint fragment_id; // Last processed fragment in the packet
+};
+
+RoofReadContext *roof_read_context_new(RoofConfig *cfg, RoofReadInterface *rdi, GError **error);
+void roof_read_context_free(RoofReadContext *ctx);
+const RoofReadInterfaceSettings *roof_read_get_settings(UFORoofRead *ctx, GError **error);
+
+
+G_END_DECLS
+
+#endif /* __ROOF_READ_H */