1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2026-03-02 04:09:18 +00:00

reorganized project: prepared to extract common functionality

This commit is contained in:
Falk Werner
2019-02-25 20:17:13 +01:00
parent c7c28416db
commit 1976841334
88 changed files with 217 additions and 218 deletions

View File

@@ -1,7 +1,7 @@
#ifndef WSFS_SERVER_H
#define WSFS_SERVER_H
#include "wsfs/api.h"
#include "wsfs/adapter/api.h"
struct wsfs_server;
struct wsfs_server_config;

View File

@@ -1,7 +1,7 @@
#ifndef WSFS_SERVER_CONFIG_H
#define WSFS_SERVER_CONFIG_H
#include "wsfs/api.h"
#include "wsfs/adapter/api.h"
struct wsfs_server_config
{

View File

@@ -1,7 +1,7 @@
#ifndef WSFS_SERVER_PROTOCOL_H
#define WSFS_SERVER_PROTOCOL_H
#include "wsfs/api.h"
#include "wsfs/adapter/api.h"
struct wsfs_server_protocol;
struct lws_protocols;

View File

@@ -0,0 +1,16 @@
#ifndef WSFSP_API_H
#define WSFSP_API_H
#ifndef WSFSP_API
#define WSFSP_API
#endif
#ifndef WSFSP_EXPORT
#ifdef __GNUC__
#define WSFSP_EXPORT __attribute__ ((visibility ("default")))
#else
#define WSFSP_EXPORT
#endif
#endif
#endif

View File

@@ -0,0 +1,44 @@
#ifndef WSFSP_CLIENT_H
#define WSFSP_CLIENT_H
#include "wsfs/provider/api.h"
struct wsfsp_provider;
struct wsfsp_client;
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSP_API struct wsfsp_client * wsfsp_client_create(
struct wsfsp_provider * provider,
void * user_data);
extern WSFSP_API void wsfsp_client_connect(
struct wsfsp_client * client,
char const * url);
extern WSFSP_API void wsfsp_client_disconnect(
struct wsfsp_client * client);
extern WSFSP_API void wsfsp_client_settimeout(
struct wsfsp_client * client,
unsigned int timepoint);
extern WSFSP_API void wsfsp_client_dispose(
struct wsfsp_client * client);
extern WSFSP_API void wsfsp_client_run(
struct wsfsp_client * client);
extern WSFSP_API void wsfsp_client_shutdown(
struct wsfsp_client * client);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,32 @@
#ifndef WSFSP_CLIENT_PROTOCOL_H
#define WSFSP_CLIENT_PROTOCOL_H
#include "wsfs/provider/api.h"
struct wsfsp_client_protocol;
struct wsfsp_provider;
struct lws_protocols;
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSP_API struct wsfsp_client_protocol * wsfsp_client_protocol_create(
struct wsfsp_provider const * provider,
void * user_data);
extern WSFSP_API void wsfsp_client_protocol_dispose(
struct wsfsp_client_protocol * protocol);
extern WSFSP_API void wsfsp_client_protocol_init_lws(
struct wsfsp_client_protocol * protocol,
struct lws_protocols * lws_protocol);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,32 @@
#ifndef WSFSP_DIRBUFFER_H
#define WSFSP_DIRBUFFER_H
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "wsfs/provider/api.h"
struct wsfsp_dirbuffer;
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSP_API struct wsfsp_dirbuffer * wsfsp_dirbuffer_init(void);
extern WSFSP_API void wsfsp_dirbuffer_dispose(
struct wsfsp_dirbuffer * buffer);
extern WSFSP_API void wsfsp_dirbuffer_add(
struct wsfsp_dirbuffer * buffer,
char const * name,
ino_t inode);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,31 @@
#ifndef WSFSP_OPERATION_CLOSE_H
#define WSFSP_OPERATION_CLOSE_H
#ifndef __cplusplus
#include <inttypes.h>
#else
#include <cinttypes>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "wsfs/provider/api.h"
typedef void wsfsp_close_fn(
ino_t inode,
uint32_t handle,
int flags,
void * user_data);
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,21 @@
#ifndef WSFSP_OPERATION_ERROR_H
#define WSFSP_OPERATION_ERROR_H
#include "wsfs/provider/api.h"
struct wsfsp_request;
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSP_API void wsfsp_respond_error(
struct wsfsp_request * request,
int status);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,32 @@
#ifndef WSFSP_OPERATION_GETATTR_H
#define WSFSP_OPERATION_GETATTR_H
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "wsfs/provider/api.h"
struct wsfsp_request;
typedef void wsfsp_getattr_fn(
struct wsfsp_request * request,
ino_t inode,
void * user_data);
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSP_API void wsfsp_respond_getattr(
struct wsfsp_request * request,
struct stat const * stat);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,32 @@
#ifndef WSFSP_OPERATION_LOOKUP_H
#define WSFSP_OPERATION_LOOKUP_H
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "wsfs/provider/api.h"
struct wsfsp_request;
typedef void wsfsp_lookup_fn(
struct wsfsp_request * request,
ino_t parent,
char const * name,
void * user_data);
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSP_API void wsfsp_respond_lookup(
struct wsfsp_request * request,
struct stat const * stat);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,38 @@
#ifndef WSFSP_OPERATION_OPEN_H
#define WSFSP_OPERATION_OPEN_H
#ifndef __cplusplus
#include <inttypes.h>
#else
#include <cinttypes>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "wsfs/provider/api.h"
struct wsfsp_request;
typedef void wsfsp_open_fn(
struct wsfsp_request * request,
ino_t inode,
int flags,
void * user_data);
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSP_API void wsfsp_respond_open(
struct wsfsp_request * request,
uint32_t handle);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,44 @@
#ifndef WSFSP_OPERATION_READ_H
#define WSFSP_OPERATION_READ_H
#ifndef __cplusplus
#include <stddef.h>
#include <inttypes.h>
#else
#include <cstddef>
#include <cinttypes>
using std::size_t;
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "wsfs/provider/api.h"
struct wsfsp_request;
typedef void wsfsp_read_fn(
struct wsfsp_request * request,
ino_t inode,
uint32_t handle,
size_t offset,
size_t length,
void * user_data);
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSP_API void wsfsp_respond_read(
struct wsfsp_request * request,
char const * data,
size_t length);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,32 @@
#ifndef WSFSP_OPERATION_READDIR_H
#define WSFSP_OPERATION_READDIR_H
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "wsfs/provider/api.h"
struct wsfsp_dirbuffer;
struct wsfsp_request;
typedef void wsfsp_readdir_fn(
struct wsfsp_request * request,
ino_t directory,
void * user_data);
#ifdef __cplusplus
extern "C"
{
#endif
extern WSFSP_API void wsfsp_respond_readdir(
struct wsfsp_request * request,
struct wsfsp_dirbuffer * dirbuffer);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,34 @@
#ifndef WSFSP_PROVIDER_H
#define WSFSP_PROVIDER_H
#include <wsfs/provider/operation/lookup.h>
#include <wsfs/provider/operation/getattr.h>
#include <wsfs/provider/operation/readdir.h>
#include <wsfs/provider/operation/open.h>
#include <wsfs/provider/operation/close.h>
#include <wsfs/provider/operation/read.h>
typedef void wsfsp_connected_fn(
void * user_data);
typedef void wsfsp_disconnected_fn(
void * user_data);
typedef void wsfsp_ontimer_fn(
void * user_data);
struct wsfsp_provider
{
wsfsp_connected_fn * connected;
wsfsp_disconnected_fn * disconnected;
wsfsp_ontimer_fn * ontimer;
wsfsp_lookup_fn * lookup;
wsfsp_getattr_fn * getattr;
wsfsp_readdir_fn * readdir;
wsfsp_open_fn * open;
wsfsp_close_fn * close;
wsfsp_read_fn * read;
};
#endif