summaryrefslogtreecommitdiff
path: root/libphysfs-serve.h
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2020-03-16 20:41:55 +0200
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-26 19:08:09 +0900
commit37095b599613c64825b33025b72251aaa97cf466 (patch)
tree745843bbbd38d96f694d6fd2eba26484b8521cad /libphysfs-serve.h
Initial commitHEADmaster
Diffstat (limited to 'libphysfs-serve.h')
-rw-r--r--libphysfs-serve.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/libphysfs-serve.h b/libphysfs-serve.h
new file mode 100644
index 0000000..bd9a2ae
--- /dev/null
+++ b/libphysfs-serve.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stddef.h>
+
+#ifndef ARRAY_SIZE
+# define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+#endif
+
+struct PHYSFS_Stat;
+
+struct physfs_serve {
+ int fd[16], nfds;
+ const char* (*content_type)(struct physfs_serve *serve, const char *path);
+ bool (*path_rewrite)(struct physfs_serve *serve, char buf[], const size_t bufsz, struct PHYSFS_Stat *st);
+};
+
+bool
+physfs_serve_init(struct physfs_serve *serve, const unsigned int port, const char *addr);
+
+bool
+physfs_serve_event(struct physfs_serve *serve, const int index);
+
+void
+physfs_serve_free(struct physfs_serve *serve);
+
+const char*
+physfs_default_content_type(struct physfs_serve *serve, const char *path);
+
+bool
+physfs_default_path_rewrite(struct physfs_serve *serve, char buf[], const size_t bufsz, struct PHYSFS_Stat *st);
+
+bool
+physfs_ends_with(const char *str, const char *suf);
+
+inline void
+physfs_append(char buf[], const size_t bufsz, const char *str);
+