1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00
falk-werner_webfuse-provider/include/wsfsp/provider.h

116 lines
2.3 KiB
C
Raw Normal View History

2019-02-16 15:08:17 +00:00
#ifndef _WSFSp_H
#define _WSFSp_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>
2019-02-17 13:31:04 +00:00
#include "wsfsp/api.h"
2019-02-16 15:08:17 +00:00
struct wsfsp_request;
2019-02-16 15:28:14 +00:00
struct wsfsp_dirbuffer;
2019-02-16 15:08:17 +00:00
typedef void wsfsp_lookup_fn(
struct wsfsp_request * request,
ino_t parent,
char const * name,
void * user_data);
typedef void wsfsp_getattr_fn(
struct wsfsp_request * request,
ino_t inode,
void * user_data);
typedef void wsfsp_readdir_fn(
struct wsfsp_request * request,
ino_t directory,
struct wsfsp_dirbuffer * dirbuffer,
void * user_data);
typedef void wsfsp_open_fn(
struct wsfsp_request * request,
ino_t inode,
int flags,
void * user_data);
typedef void wsfsp_close_fn(
ino_t inode,
uint32_t handle,
int flags,
void * user_data);
typedef void wsfsp_read_fn(
struct wsfsp_request * request,
ino_t inode,
uint32_t handle,
size_t offset,
size_t length,
void * user_data);
typedef void wsfsp_connected_fn(
void * user_data);
typedef void wsfsp_disconnected_fn(
void * user_data);
typedef void wsfsp_ontimer_fn(
void * user_data);
2019-02-16 15:28:14 +00:00
struct wsfsp_provider
2019-02-16 15:08:17 +00:00
{
wsfsp_connected_fn * connected;
2019-02-16 15:28:14 +00:00
wsfsp_disconnected_fn * disconnected;
2019-02-16 15:08:17 +00:00
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;
};
#ifdef __cplusplus
extern "C"
{
#endif
2019-02-17 13:31:04 +00:00
extern WSFSP_API void wsfsp_respond_error(
2019-02-16 15:08:17 +00:00
struct wsfsp_request * request,
int status);
2019-02-17 13:31:04 +00:00
extern WSFSP_API void wsfsp_respond_lookup(
2019-02-16 15:08:17 +00:00
struct wsfsp_request * request,
2019-02-16 15:28:14 +00:00
struct stat const * stat);
2019-02-16 15:08:17 +00:00
2019-02-17 13:31:04 +00:00
extern WSFSP_API void wsfsp_respond_getattr(
2019-02-16 15:08:17 +00:00
struct wsfsp_request * request,
struct stat const * stat);
2019-02-17 13:31:04 +00:00
extern WSFSP_API void wsfsp_respond_readdir(
2019-02-16 15:08:17 +00:00
struct wsfsp_request * request,
struct wsfsp_dirbuffer * dirbuffer);
2019-02-17 13:31:04 +00:00
extern WSFSP_API void wsfsp_respond_open(
2019-02-16 15:08:17 +00:00
struct wsfsp_request * request,
uint32_t handle);
2019-02-17 13:31:04 +00:00
extern WSFSP_API void wsfsp_respond_read(
2019-02-16 15:08:17 +00:00
struct wsfsp_request * request,
char const * data,
size_t length);
#ifdef __cplusplus
}
#endif
#endif