2019-03-26 22:04:53 +00:00
|
|
|
#include "webfuse_adapter.h"
|
|
|
|
|
|
|
|
#include "webfuse/adapter/impl/server.h"
|
|
|
|
#include "webfuse/adapter/impl/server_protocol.h"
|
|
|
|
#include "webfuse/adapter/impl/server_config.h"
|
|
|
|
#include "webfuse/adapter/impl/credentials.h"
|
2020-02-15 14:11:35 +00:00
|
|
|
#include "webfuse/adapter/impl/mountpoint.h"
|
2019-03-26 22:04:53 +00:00
|
|
|
|
2020-03-07 14:27:04 +00:00
|
|
|
#include "webfuse/core/util.h"
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
// server
|
|
|
|
|
|
|
|
struct wf_server * wf_server_create(
|
|
|
|
struct wf_server_config * config)
|
|
|
|
{
|
|
|
|
return wf_impl_server_create(config);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_dispose(
|
|
|
|
struct wf_server * server)
|
|
|
|
{
|
|
|
|
wf_impl_server_dispose(server);
|
|
|
|
}
|
|
|
|
|
2019-04-26 18:51:24 +00:00
|
|
|
void wf_server_service(
|
2020-04-06 18:44:18 +00:00
|
|
|
struct wf_server * server)
|
2020-03-07 14:27:04 +00:00
|
|
|
{
|
|
|
|
wf_impl_server_service(server);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_interrupt(
|
|
|
|
struct wf_server * server)
|
2019-03-26 22:04:53 +00:00
|
|
|
{
|
2020-03-07 14:27:04 +00:00
|
|
|
wf_impl_server_interrupt(server);
|
2019-03-26 22:04:53 +00:00
|
|
|
}
|
|
|
|
|
2020-03-07 14:27:04 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
// server protocol
|
|
|
|
|
2020-03-21 08:18:04 +00:00
|
|
|
struct wf_server_protocol * wf_server_protocol_create(
|
2020-02-16 20:03:17 +00:00
|
|
|
wf_create_mountpoint_fn * create_mountpoint,
|
|
|
|
void * create_mountpoint_context)
|
|
|
|
{
|
2020-03-21 08:18:04 +00:00
|
|
|
return wf_impl_server_protocol_create(create_mountpoint, create_mountpoint_context);
|
2020-02-16 20:03:17 +00:00
|
|
|
}
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
void wf_server_protocol_dispose(
|
|
|
|
struct wf_server_protocol * protocol)
|
|
|
|
{
|
|
|
|
wf_impl_server_protocol_dispose(protocol);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_protocol_init_lws(
|
|
|
|
struct wf_server_protocol * protocol,
|
|
|
|
struct lws_protocols * lws_protocol)
|
|
|
|
{
|
|
|
|
wf_impl_server_protocol_init_lws(protocol, lws_protocol);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_protocol_add_authenticator(
|
|
|
|
struct wf_server_protocol * protocol,
|
|
|
|
char const * type,
|
|
|
|
wf_authenticate_fn * authenticate,
|
|
|
|
void * user_data)
|
|
|
|
{
|
|
|
|
wf_impl_server_protocol_add_authenticator(protocol, type, authenticate, user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
// server_config
|
|
|
|
|
|
|
|
struct wf_server_config * wf_server_config_create(void)
|
|
|
|
{
|
|
|
|
return wf_impl_server_config_create();
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_config_dispose(
|
|
|
|
struct wf_server_config * config)
|
|
|
|
{
|
|
|
|
wf_impl_server_config_dispose(config);
|
|
|
|
}
|
|
|
|
|
2020-02-16 20:03:17 +00:00
|
|
|
void wf_server_config_set_mountpoint_factory(
|
|
|
|
struct wf_server_config * config,
|
|
|
|
wf_create_mountpoint_fn * create_mountpoint,
|
|
|
|
void * user_data)
|
|
|
|
{
|
|
|
|
wf_impl_server_config_set_mountpoint_factory(
|
|
|
|
config, create_mountpoint, user_data);
|
|
|
|
}
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
void wf_server_config_set_documentroot(
|
|
|
|
struct wf_server_config * config,
|
|
|
|
char const * document_root)
|
|
|
|
{
|
|
|
|
wf_impl_server_config_set_documentroot(config, document_root);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_config_set_keypath(
|
|
|
|
struct wf_server_config * config,
|
|
|
|
char const * key_path)
|
|
|
|
{
|
|
|
|
wf_impl_server_config_set_keypath(config, key_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_config_set_certpath(
|
|
|
|
struct wf_server_config * config,
|
|
|
|
char const * cert_path)
|
|
|
|
{
|
|
|
|
wf_impl_server_config_set_certpath(config, cert_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_config_set_vhostname(
|
|
|
|
struct wf_server_config * config,
|
|
|
|
char const * vhost_name)
|
|
|
|
{
|
|
|
|
wf_impl_server_config_set_vhostname(config, vhost_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_config_set_port(
|
|
|
|
struct wf_server_config * config,
|
|
|
|
int port)
|
|
|
|
{
|
|
|
|
wf_impl_server_config_set_port(config, port);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_server_config_add_authenticator(
|
|
|
|
struct wf_server_config * config,
|
|
|
|
char const * type,
|
|
|
|
wf_authenticate_fn * authenticate,
|
|
|
|
void * user_data)
|
|
|
|
{
|
|
|
|
wf_impl_server_config_add_authenticator(config, type, authenticate, user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
// credentials
|
|
|
|
|
|
|
|
char const * wf_credentials_type(
|
|
|
|
struct wf_credentials const * credentials)
|
|
|
|
{
|
|
|
|
return wf_impl_credentials_type(credentials);
|
|
|
|
}
|
|
|
|
|
|
|
|
char const * wf_credentials_get(
|
|
|
|
struct wf_credentials const * credentials,
|
|
|
|
char const * key)
|
|
|
|
{
|
|
|
|
return wf_impl_credentials_get(credentials, key);
|
|
|
|
}
|
2020-02-15 14:11:35 +00:00
|
|
|
|
|
|
|
// mountpoint
|
|
|
|
|
|
|
|
struct wf_mountpoint *
|
|
|
|
wf_mountpoint_create(
|
|
|
|
char const * path)
|
|
|
|
{
|
|
|
|
return wf_impl_mountpoint_create(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_mountpoint_dispose(
|
|
|
|
struct wf_mountpoint * mountpoint)
|
|
|
|
{
|
|
|
|
wf_impl_mountpoint_dispose(mountpoint);
|
|
|
|
}
|
|
|
|
|
|
|
|
char const *
|
|
|
|
wf_mountpoint_get_path(
|
|
|
|
struct wf_mountpoint const * mountpoint)
|
|
|
|
{
|
|
|
|
return wf_impl_mountpoint_get_path(mountpoint);
|
|
|
|
}
|
2020-02-15 14:50:32 +00:00
|
|
|
|
|
|
|
void
|
2020-02-16 03:02:23 +00:00
|
|
|
wf_mountpoint_set_userdata(
|
2020-02-15 14:50:32 +00:00
|
|
|
struct wf_mountpoint * mountpoint,
|
2020-02-16 03:02:23 +00:00
|
|
|
void * user_data,
|
|
|
|
wf_mountpoint_userdata_dispose_fn * dispose)
|
2020-02-15 14:50:32 +00:00
|
|
|
{
|
2020-02-16 03:02:23 +00:00
|
|
|
wf_impl_mountpoint_set_userdata(mountpoint, user_data, dispose);
|
2020-02-15 14:50:32 +00:00
|
|
|
}
|
2020-06-09 20:41:38 +00:00
|
|
|
|
|
|
|
// client
|
|
|
|
|
|
|
|
struct wf_client *
|
|
|
|
wf_client_create(
|
|
|
|
wf_client_callback_fn * callback,
|
|
|
|
void * user_data)
|
|
|
|
{
|
|
|
|
(void) callback;
|
|
|
|
(void) user_data;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_client_dispose(
|
|
|
|
struct wf_client * client)
|
|
|
|
{
|
|
|
|
(void) client;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
|
|
|
wf_client_get_userdata(
|
|
|
|
struct wf_client * client)
|
|
|
|
{
|
|
|
|
(void) client;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_client_service(
|
|
|
|
struct wf_client * client)
|
|
|
|
{
|
|
|
|
(void) client;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_client_interrupt(
|
|
|
|
struct wf_client * client)
|
|
|
|
{
|
|
|
|
(void) client;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_client_connect(
|
|
|
|
struct wf_client * client,
|
|
|
|
char const * url)
|
|
|
|
{
|
|
|
|
(void) client;
|
|
|
|
(void) url;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_client_disconnect(
|
|
|
|
struct wf_client * client)
|
|
|
|
{
|
|
|
|
(void) client;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_client_authenticate(
|
|
|
|
struct wf_client * client)
|
|
|
|
{
|
|
|
|
(void) client;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_client_add_filesystem(
|
|
|
|
struct wf_client * client,
|
|
|
|
char const * local_path,
|
|
|
|
char const * name)
|
|
|
|
{
|
|
|
|
(void) client;
|
|
|
|
(void) local_path;
|
|
|
|
(void) name;
|
|
|
|
}
|
|
|
|
|
|
|
|
// client credentials
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_client_credentials_set_type(
|
|
|
|
struct wf_client_credentials * credentials,
|
|
|
|
char const * type)
|
|
|
|
{
|
|
|
|
(void) credentials;
|
|
|
|
(void) type;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_client_credentials_add(
|
|
|
|
struct wf_client_credentials * credentials,
|
|
|
|
char const * key,
|
|
|
|
char const * value)
|
|
|
|
{
|
|
|
|
(void) credentials;
|
|
|
|
(void) key;
|
|
|
|
(void) value;
|
|
|
|
}
|