From 37095b599613c64825b33025b72251aaa97cf466 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 20:41:55 +0200 Subject: Initial commit --- libphysfs-serve.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 libphysfs-serve.h (limited to 'libphysfs-serve.h') 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 +#include + +#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); + -- cgit v1.2.3