2019-03-26 14:35:33 +00:00
|
|
|
#include "wsfs/provider/impl/client_config.h"
|
|
|
|
#include "wsfs/provider/impl/provider.h"
|
2019-03-04 20:18:16 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
struct wsfsp_client_config * wsfsp_impl_client_config_create(void)
|
2019-03-04 20:18:16 +00:00
|
|
|
{
|
|
|
|
struct wsfsp_client_config * config = malloc(sizeof(struct wsfsp_client_config));
|
|
|
|
if (NULL != config)
|
|
|
|
{
|
2019-03-26 14:35:33 +00:00
|
|
|
wsfsp_impl_provider_init(&config->provider);
|
2019-03-04 20:18:16 +00:00
|
|
|
config->user_data = NULL;
|
|
|
|
config->key_path = NULL;
|
|
|
|
config->cert_path = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_dispose(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config)
|
|
|
|
{
|
|
|
|
free(config->key_path);
|
|
|
|
free(config->cert_path);
|
|
|
|
free(config);
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_userdata(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
void * user_data)
|
|
|
|
{
|
|
|
|
config->user_data = user_data;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_keypath(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
char const * key_path)
|
|
|
|
{
|
|
|
|
free(config->key_path);
|
|
|
|
config->key_path = strdup(key_path);
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_certpath(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
char const * cert_path)
|
|
|
|
{
|
|
|
|
free(config->cert_path);
|
|
|
|
config->cert_path = strdup(cert_path);
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_onconnected(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
wsfsp_connected_fn * handler)
|
|
|
|
{
|
|
|
|
config->provider.connected = handler;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_ondisconnected(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
wsfsp_disconnected_fn * handler)
|
|
|
|
{
|
|
|
|
config->provider.disconnected = handler;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_ontimer(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
wsfsp_ontimer_fn * handler)
|
|
|
|
{
|
|
|
|
config->provider.ontimer = handler;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_onlookup(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
wsfsp_lookup_fn * handler)
|
|
|
|
{
|
|
|
|
config->provider.lookup = handler;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_ongetattr(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
wsfsp_getattr_fn * handler)
|
|
|
|
{
|
|
|
|
config->provider.getattr = handler;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_onreaddir(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
wsfsp_readdir_fn * handler)
|
|
|
|
{
|
|
|
|
config->provider.readdir = handler;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_onopen(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
wsfsp_open_fn * handler)
|
|
|
|
{
|
|
|
|
config->provider.open = handler;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_onclose(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
wsfsp_close_fn * handler)
|
|
|
|
{
|
|
|
|
config->provider.close = handler;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:35:33 +00:00
|
|
|
void wsfsp_impl_client_config_set_onread(
|
2019-03-04 20:18:16 +00:00
|
|
|
struct wsfsp_client_config * config,
|
|
|
|
wsfsp_read_fn * handler)
|
|
|
|
{
|
|
|
|
config->provider.read = handler;
|
|
|
|
}
|