commit
7934319d73
@ -0,0 +1,88 @@
|
|||||||
|
#ifndef WSFS_PROVIDER_CLIENT_CONFIG_H
|
||||||
|
#define WSFS_PROVIDER_CLIENT_CONFIG_H
|
||||||
|
|
||||||
|
#include <wsfs/provider/api.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>
|
||||||
|
|
||||||
|
struct wsfsp_client_config;
|
||||||
|
|
||||||
|
typedef void wsfsp_connected_fn(
|
||||||
|
void * user_data);
|
||||||
|
|
||||||
|
typedef void wsfsp_disconnected_fn(
|
||||||
|
void * user_data);
|
||||||
|
|
||||||
|
typedef void wsfsp_ontimer_fn(
|
||||||
|
void * user_data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern WSFSP_API struct wsfsp_client_config * wsfsp_client_config_create(void);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_dispose(
|
||||||
|
struct wsfsp_client_config * config);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_userdata(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
void * user_data);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_keypath(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
char const * key_path);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_certpath(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
char const * cert_path);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_onconnected(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_connected_fn * handler);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_ondisconnected(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_disconnected_fn * handler);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_ontimer(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_ontimer_fn * handler);
|
||||||
|
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_onlookup(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_lookup_fn * handler);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_ongetattr(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_getattr_fn * handler);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_onreaddir(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_readdir_fn * handler);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_onopen(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_open_fn * handler);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_onclose(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_close_fn * handler);
|
||||||
|
|
||||||
|
extern WSFSP_API void wsfsp_client_config_set_onread(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_read_fn * handler);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -1,34 +0,0 @@
|
|||||||
#ifndef WSFS_PROVIDER_PROVIDER_H
|
|
||||||
#define WSFS_PROVIDER_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
|
|
@ -0,0 +1,112 @@
|
|||||||
|
#include "wsfs/provider/client_config_intern.h"
|
||||||
|
#include "wsfs/provider/provider.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
struct wsfsp_client_config * wsfsp_client_config_create(void)
|
||||||
|
{
|
||||||
|
struct wsfsp_client_config * config = malloc(sizeof(struct wsfsp_client_config));
|
||||||
|
if (NULL != config)
|
||||||
|
{
|
||||||
|
wsfsp_provider_init(&config->provider);
|
||||||
|
config->user_data = NULL;
|
||||||
|
config->key_path = NULL;
|
||||||
|
config->cert_path = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_dispose(
|
||||||
|
struct wsfsp_client_config * config)
|
||||||
|
{
|
||||||
|
free(config->key_path);
|
||||||
|
free(config->cert_path);
|
||||||
|
free(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_userdata(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
void * user_data)
|
||||||
|
{
|
||||||
|
config->user_data = user_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_keypath(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
char const * key_path)
|
||||||
|
{
|
||||||
|
free(config->key_path);
|
||||||
|
config->key_path = strdup(key_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_certpath(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
char const * cert_path)
|
||||||
|
{
|
||||||
|
free(config->cert_path);
|
||||||
|
config->cert_path = strdup(cert_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_onconnected(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_connected_fn * handler)
|
||||||
|
{
|
||||||
|
config->provider.connected = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_ondisconnected(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_disconnected_fn * handler)
|
||||||
|
{
|
||||||
|
config->provider.disconnected = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_ontimer(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_ontimer_fn * handler)
|
||||||
|
{
|
||||||
|
config->provider.ontimer = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_onlookup(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_lookup_fn * handler)
|
||||||
|
{
|
||||||
|
config->provider.lookup = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_ongetattr(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_getattr_fn * handler)
|
||||||
|
{
|
||||||
|
config->provider.getattr = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_onreaddir(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_readdir_fn * handler)
|
||||||
|
{
|
||||||
|
config->provider.readdir = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_onopen(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_open_fn * handler)
|
||||||
|
{
|
||||||
|
config->provider.open = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_onclose(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_close_fn * handler)
|
||||||
|
{
|
||||||
|
config->provider.close = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wsfsp_client_config_set_onread(
|
||||||
|
struct wsfsp_client_config * config,
|
||||||
|
wsfsp_read_fn * handler)
|
||||||
|
{
|
||||||
|
config->provider.read = handler;
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef WSFS_PROVIDER_CLIENT_CONFIG_INTERN_H
|
||||||
|
#define WSFS_PROVIDER_CLIENT_CONFIG_INTERN_H
|
||||||
|
|
||||||
|
#include "wsfs/provider/client_config.h"
|
||||||
|
#include "wsfs/provider/provider.h"
|
||||||
|
|
||||||
|
struct wsfsp_client_config
|
||||||
|
{
|
||||||
|
struct wsfsp_provider provider;
|
||||||
|
void * user_data;
|
||||||
|
char * key_path;
|
||||||
|
char * cert_path;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,65 @@
|
|||||||
|
#ifndef WSFS_PROVIDER_PROVIDER_H
|
||||||
|
#define WSFS_PROVIDER_PROVIDER_H
|
||||||
|
|
||||||
|
#include "wsfs/provider/client_config.h"
|
||||||
|
#include "wsfs/provider/request.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>
|
||||||
|
|
||||||
|
#include <jansson.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wsfsp_invokation_context
|
||||||
|
{
|
||||||
|
struct wsfsp_provider * provider;
|
||||||
|
void * user_data;
|
||||||
|
struct wsfsp_request * request;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void wsfsp_provider_init(
|
||||||
|
struct wsfsp_provider * provider);
|
||||||
|
|
||||||
|
extern void wsfsp_provider_init_from_prototype(
|
||||||
|
struct wsfsp_provider * provider,
|
||||||
|
struct wsfsp_provider const * prototype);
|
||||||
|
|
||||||
|
|
||||||
|
extern void wsfsp_provider_invoke(
|
||||||
|
struct wsfsp_invokation_context * context,
|
||||||
|
json_t * request);
|
||||||
|
|
||||||
|
extern void wsfsp_connected_default(
|
||||||
|
void * user_data);
|
||||||
|
|
||||||
|
extern void wsfsp_disconnected_default(
|
||||||
|
void * user_data);
|
||||||
|
|
||||||
|
extern void wsfsp_ontimer_default(
|
||||||
|
void * user_data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -1,38 +0,0 @@
|
|||||||
#ifndef WSFS_PROVIDER_PROVIDER_INTERN_H
|
|
||||||
#define WSFS_PROVIDER_PROVIDER_INTERN_H
|
|
||||||
|
|
||||||
#include "wsfs/provider/provider.h"
|
|
||||||
#include "wsfs/provider/request.h"
|
|
||||||
|
|
||||||
#include <jansson.h>
|
|
||||||
|
|
||||||
struct wsfsp_invokation_context
|
|
||||||
{
|
|
||||||
struct wsfsp_provider * provider;
|
|
||||||
void * user_data;
|
|
||||||
struct wsfsp_request * request;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void wsfsp_provider_invoke(
|
|
||||||
struct wsfsp_invokation_context * context,
|
|
||||||
json_t * request);
|
|
||||||
|
|
||||||
extern void wsfsp_connected_default(
|
|
||||||
void * user_data);
|
|
||||||
|
|
||||||
extern void wsfsp_disconnected_default(
|
|
||||||
void * user_data);
|
|
||||||
|
|
||||||
extern void wsfsp_ontimer_default(
|
|
||||||
void * user_data);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||||||
#include "wsfs/adapter/status.h"
|
#include "wsfs/status_intern.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef WSFS_STATUS_INTERN_H
|
||||||
|
#define WSFS_STATUS_INTERN_H
|
||||||
|
|
||||||
|
#include "wsfs/status.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int wsfs_status_to_rc(wsfs_status status);
|
||||||
|
|
||||||
|
extern char const * wsfs_status_tostring(wsfs_status status);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in new issue