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:
@@ -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;
|
||||
@@ -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
|
||||
{
|
||||
@@ -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;
|
||||
16
include/wsfs/provider/api.h
Normal file
16
include/wsfs/provider/api.h
Normal 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
|
||||
44
include/wsfs/provider/client.h
Normal file
44
include/wsfs/provider/client.h
Normal 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
|
||||
32
include/wsfs/provider/client_protocol.h
Normal file
32
include/wsfs/provider/client_protocol.h
Normal 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
|
||||
32
include/wsfs/provider/dirbuffer.h
Normal file
32
include/wsfs/provider/dirbuffer.h
Normal 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
|
||||
31
include/wsfs/provider/operation/close.h
Normal file
31
include/wsfs/provider/operation/close.h
Normal 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
|
||||
21
include/wsfs/provider/operation/error.h
Normal file
21
include/wsfs/provider/operation/error.h
Normal 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
|
||||
32
include/wsfs/provider/operation/getattr.h
Normal file
32
include/wsfs/provider/operation/getattr.h
Normal 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
|
||||
32
include/wsfs/provider/operation/lookup.h
Normal file
32
include/wsfs/provider/operation/lookup.h
Normal 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
|
||||
38
include/wsfs/provider/operation/open.h
Normal file
38
include/wsfs/provider/operation/open.h
Normal 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
|
||||
44
include/wsfs/provider/operation/read.h
Normal file
44
include/wsfs/provider/operation/read.h
Normal 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
|
||||
32
include/wsfs/provider/operation/readdir.h
Normal file
32
include/wsfs/provider/operation/readdir.h
Normal 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
|
||||
34
include/wsfs/provider/provider.h
Normal file
34
include/wsfs/provider/provider.h
Normal 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
|
||||
Reference in New Issue
Block a user