parent
32829a9f76
commit
39874f733a
@ -0,0 +1,9 @@
|
||||
#ifndef _WSFSP_H
|
||||
#define _WSFSP_H
|
||||
|
||||
#include "wsfsp/api.h"
|
||||
#include "wsfsp/provider.h"
|
||||
#include "wsfsp/client.h"
|
||||
#include "wsfsp/client_protocol.h"
|
||||
|
||||
#endif
|
@ -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
|
@ -0,0 +1,44 @@
|
||||
#ifndef _WSFSP_CLIENT_H
|
||||
#define _WSFSP_CLIENT_H
|
||||
|
||||
#include "wsfs/api.h"
|
||||
|
||||
struct wsfs_provider;
|
||||
struct wsfs_provider_client_config;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern WSFS_API struct wsfs_provider_client * wsfs_provider_client_create(
|
||||
struct wsfs_provider * provider,
|
||||
void * user_data);
|
||||
|
||||
extern WSFS_API void wsfs_provider_client_connect(
|
||||
struct wsfs_provider_client * client,
|
||||
char const * url);
|
||||
|
||||
extern WSFS_API void wsfs_provider_client_disconnect(
|
||||
struct wsfs_provider_client * client);
|
||||
|
||||
extern WSFS_API void wsfs_provider_client_settimeout(
|
||||
struct wsfs_provider_client * client,
|
||||
unsigned int timepoint);
|
||||
|
||||
extern WSFS_API void wsfs_provider_client_dispose(
|
||||
struct wsfs_provider_client * client);
|
||||
|
||||
extern WSFS_API void wsfs_provider_client_run(
|
||||
struct wsfs_provider_client * client);
|
||||
|
||||
extern WSFS_API void wsfs_provider_client_shutdown(
|
||||
struct wsfs_provider_client * client);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,32 @@
|
||||
#ifndef _WSFSP_CLIENT_PROTOCOL_H
|
||||
#define _WSFSP_CLIENT_PROTOCOL_H
|
||||
|
||||
#include "wsfs/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 WSFSÜ_API void wsfsp_client_protocol_dispose(
|
||||
struct wsfsp_client_protocol * protocol);
|
||||
|
||||
extern WSFSÜ_API void wsfsp_client_protocol_init_lws(
|
||||
struct wsfs_provider_client_protocol * protocol,
|
||||
struct lws_protocols * lws_protocol);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,114 @@
|
||||
#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>
|
||||
|
||||
|
||||
struct wsfsp_request;
|
||||
struct wsfs_dirbuffer;
|
||||
|
||||
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);
|
||||
|
||||
struct wsfsüp
|
||||
{
|
||||
wsfsp_connected_fn * connected;
|
||||
wsfsp_disconnected_fn * connected;
|
||||
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
|
||||
|
||||
extern void wsfsp_respond_error(
|
||||
struct wsfsp_request * request,
|
||||
int status);
|
||||
|
||||
extern void wsfsp_respond_lookup(
|
||||
struct wsfsp_request * request,
|
||||
struct wsfs_stat const * stat);
|
||||
|
||||
extern void wsfsp_respond_getattr(
|
||||
struct wsfsp_request * request,
|
||||
struct stat const * stat);
|
||||
|
||||
extern void wsfsp_respond_readdir(
|
||||
struct wsfsp_request * request,
|
||||
struct wsfsp_dirbuffer * dirbuffer);
|
||||
|
||||
extern void wsfsp_respond_open(
|
||||
struct wsfsp_request * request,
|
||||
uint32_t handle);
|
||||
|
||||
extern void wsfsp_respond_read(
|
||||
struct wsfsp_request * request,
|
||||
char const * data,
|
||||
size_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,2 @@
|
||||
#include "wsfsp/client.h"
|
||||
|
Loading…
Reference in new issue